None, None, True, True).split()
    else:
        cmdargs = "python {} model {} {} {} {} {} {}".format(
            tmap_script, n_pars, path.join(CThome, 'data'),
            None, None, True, True).split()
    status = subp.call(cmdargs)
    newmap = TemperatureMap(fname=path.join(CThome, 'temporary.fits'))
    subp.call(["rm", path.join(CThome, 'temporary.fits')])
    data, meta = newmap.data, newmap.meta
    fitsmap = Map(np.log10(newmap.goodness_of_fit), newmap.meta.copy())
    #print fitsmap.max()
    newmap.data = data
    print '-------------MINMAX:-------------'#, newmap.min(), newmap.max(), newmap.shape, 
    #print newmap.data[newmap.data == 0].shape, '----------\n'
    print 'GoF', fitsmap.min(), fitsmap.mean(), fitsmap.max()
    print 'T_out', newmap.min(), newmap.mean(), newmap.max()

    #truetemp = np.array(list(temps)*n_widths).reshape((n_widths, n_temps)).T
    truetemp = np.array(list(temps)*n_heights).reshape((n_heights, n_temps)).T
    #print truetemp.shape, data.shape
    diff = Map((abs(truetemp - data) / truetemp) * 100, newmap.meta.copy())
    print 'T_diff', diff.min(), diff.mean(), diff.max()
    if n_pars == 3:
        wdata = Map(newmap.dem_width, newmap.meta.copy())
        truew = np.ones(shape=(n_temps, n_heights)) * wid
        #print 'truew', truew.min(), truew.mean(), truew.max()
        diffw = Map((abs(truew - wdata.data) / truew) * 100, newmap.meta.copy())
        print 'w_out', wdata.min(), wdata.mean(), wdata.max()
        print 'w_diff', diffw.min(), diffw.mean(), diffw.max()
    
    #print wid, newmap.xrange, newmap.yrange, newmap.scale