Exemplo n.º 1
0
def lightcone_xfrac(rsd=''):
    filenames = ["" for x in range(len(redshifts))]
    if rsd!='':
        vel_files=["" for x in range(len(redshifts)/2)]#]'/research/prace/sph_smooth_cubepm_130329_10_4000_244Mpc_ext2_test/global/so/nc250'+'%.3fv_all.dat'%z for z in redshifts]
        dens_files=["" for x in range(len(redshifts)/2)]#]'/research/prace/sph_smooth_cubepm_130329_10_4000_244Mpc_ext2_test/global/so/nc250'+'%.3fv_all.dat'%z for z in redshifts]
#    filenames[0] = len(redshifts)
    mini = -457
    maxi=83
    for i in range(len(filenames)):
        #filenames[i] = setup_dirs.path() + 'lightcone_temp/Temper3D_'+str('%.3f' % redshifts[i]) + '.bin'
        filenames[i] = filename = setup_dirs.path()+'xfrac3d_'+str('%.3f' % redshifts[i]) + '.bin'
        if i%2==0 and rsd!='':
            vel_files[i/2]='/research/prace/sph_smooth_cubepm_130329_10_4000_244Mpc_ext2_test/global/so/nc250/'+str('%.3f' % redshifts[i])+'v_all.dat'
            dens_files[i/2]='/research/prace/sph_smooth_cubepm_130329_10_4000_244Mpc_ext2_test/global/so/nc250/%.3fn_all.dat'%redshifts[i]
    noreds=10
#    redshifts_many = np.zeros(len(redshifts)*noreds)
#    for i in range(len(redshifts)-1):
#        for j in range(noreds):
#            redshifts_many[i+j]=redshifts[i]-(redshifts[i+1]-redshifts[i])*j/noreds
    print filenames
    im,z=c2t.make_lightcone(filenames)#,interpolation='step_cell')
    if rsd!='':
        vel_lightcone, z = c2t.make_velocity_lightcone(vel_files, dens_files)#,redshifts[0], redshifts[len(redshifts)-1])
        rsd_xfrac = c2t.get_distorted_dt(im, vel_lightcone, z, \
                              num_particles=30, los_axis=2, velocity_axis=0, \
                              periodic=False)
        im=np.asarray(rsd_xfrac)
        plot_lightcone(im[125,:,::-1],i,"Ionised Fraction","lightcone_rsd_xfrac",mini,maxi,z,cmap='Blues_r')
    else:
        im=np.asarray(im)
        plot_lightcone(im[125,:,::-1],i,"Ionised Fraction","lightconexfrac",mini,maxi,z,cmap='Blues_r')
Exemplo n.º 2
0
def dbt_lightcone(ht=""):
    filenames = ["" for x in range(len(redshifts))]
    for i in range(0, len(redshifts)):
        filenames[i] = setup_dirs.resultsdir() + "dbt" + ht + "/map_dbt_" + ht + str("%.3f" % redshifts[i]) + ".bin"
    output = setup_dirs.resultsdir() + "dbt_lightcone" + ht + ".bin"
    output2 = setup_dirs.resultsdir() + "dbt_lightcone_redshifts.bin"
    lightcone, z = c2t.make_lightcone(filenames, redshifts[len(redshifts) - 1], redshifts[0], interpolation="linear")
    lightcone2 = np.asarray(lightcone)
    z2 = np.asarray(z)
    IO.writebin(lightcone2, output)
    IO.writebin(z2, output2)
    print "written lightcone to " + output
Exemplo n.º 3
0
def lightcone():
    filenames = ["" for x in range(len(redshifts))]
#    filenames[0] = len(redshifts)
    mini = -457
    maxi=83 
    for i in range(len(filenames)):
        #filenames[i] = setup_dirs.path() + 'lightcone_temp/Temper3D_'+str('%.3f' % redshifts[i]) + '.bin'
        filenames[i] = '../generate_data/'+setup_dirs.resultsdir()+'dbt/map_dbt_'+str('%.3f' % redshifts[i]) + '.bin'
  
    noreds=10
    redshifts_many = np.zeros(len(redshifts)*noreds)
    for i in range(len(redshifts)-1):
        for j in range(noreds):
            redshifts_many[i+j]=redshifts[i]-(redshifts[i+1]-redshifts[i])*j/noreds
    print redshifts_many
    im,z=c2t.make_lightcone(filenames,redshifts[len(redshifts)-1],redshifts[0],interpolation='step_cell') 
    im=np.asarray(im)
    print(im[125,:,::-1])
    print(im[1,1,1])
    plot_lightcone(im[125,:,::-1],i,"$\delta$ T [mK]","lightcone_dbt",mini,maxi,z,cmap='Blues_r')
Exemplo n.º 4
0
            return newlist[0]
        return newlist
    if os.path.isfile(files_list):
        return files_list
    else:
        return glob.glob(files_list)
    
    
def _is_nonstring_list(l):
    return hasattr(l, '__iter__') and (not isinstance(l, basestring))


def make_redshifts_filename(output_filename):
    basefilename = os.path.splitext(output_filename)[0]
    return basefilename + '_z.dat'

    
if __name__ == '__main__':
    if len(sys.argv) <= 1:
        print 'No arguments given. Use -h to print help.'
        sys.exit(2)
    args = parse_options()
    c2t.set_sim_constants(args.boxsize)
    c2t.set_verbose(True)
    lightcone, redshifts = c2t.make_lightcone(args.files, z_low=args.min_z, z_high=args.max_z)
    c2t.save_cbin(args.output, lightcone)
    np.savetxt(make_redshifts_filename(args.output), redshifts)
    
    
    
    
#Redshift limits for the light cone
z_low = 7.5
z_high = 12. 

#List all the redhifts for which we have data files
density_redshifts = c2t.get_dens_redshifts(density_dir, z_low, z_high, bracket=True)
xfrac_redshifts = c2t.get_xfrac_redshifts(xfrac_dir, z_low, z_high, bracket=True)

#List all the data files
dens_files = [density_dir + '%.3fn_all.dat' % z for z in density_redshifts]
vel_files = [velocity_dir + '%.3fv_all.dat' % z for z in density_redshifts]
xfrac_files = [xfrac_dir + 'xfrac3d_%.3f.bin' % z for z in xfrac_redshifts]

#Make the ionization fraction lightcone
xfrac_lightcone, z = c2t.make_lightcone(xfrac_files, z_low, z_high)

#Make the density lightcone
dens_lightcone, z = c2t.make_lightcone(dens_files, z_low, z_high)

#Combine ionization fraction and density to make a dT lightcone
dT_lightcone = c2t.calc_dt_lightcone(xfrac_lightcone, dens_lightcone, \
                                     lowest_z=z.min())

#Make a velocity lightcone
vel_lightcone, z = c2t.make_velocity_lightcone(vel_files, dens_files, \
                                               z_low, z_high)

#Apply redshift space distortions. This is done in the same way as for
#coeval data volumes. Just be sure to set periodic to False and 
#to specify the the velocity_axis argument (see the documentation
Exemplo n.º 6
0
def compare_dbt_lightcones():
    length=min(len(redshifts1),len(redshifts2))
    filenames1 = ["" for x in range(length)]
    filenames2 = ["" for x in range(length)]
#    filenames[0] = len(redshifts)
    mini = -457
    maxi=83
    for i in range(length):
        #filenames[i] = setup_dirs.path() + 'lightcone_temp/Temper3D_'+str('%.3f' % redshifts[i]) + '.bin'
        filenames1[i-20] = '../generate_data/data_'+flag1+'/dbt/map_dbt_'+str('%.3f' % redshifts1[i]) + '.bin'
        filenames2[i-20] = '../generate_data/data_'+flag2+'/dbt/map_dbt_'+str('%.3f' % redshifts2[i]) + '.bin'
    Im1,z=c2t.make_lightcone(filenames1,redshifts1[len(redshifts1)-1],redshifts1[0])
    Im2,z=c2t.make_lightcone(filenames2,redshifts1[len(redshifts1)-1],redshifts1[0])
    Im1=np.asarray(Im1)
    Im2=np.asarray(Im2)
    dataslice1=Im1[125,:,::-1]
    dataslice2=Im2[125,:,::-1]

    cmapdbt = {'red':   ((0.0, 0.0, 0.0),
                        (0.846, 0.0, 1.0),
                        (1.0, 1.0, 1.0)),
                'green': ((0.0, 0.0, 0.0),
                        (0.846,0.0, 0.0),
                        (1.0, 1.0, 1.0)),
                'blue':  ((0.0, 0.0, 0.0),
                        (0.846, 1.0, 0.0),
                        (1.0, 1.0, 1.0))
              }
    plt.register_cmap(name='dbtmap',data=cmapdbt)
    cmap = plt.get_cmap('dbtmap')

    fig,axes =plt.subplots(2,1,figsize=(28,8))
    im1 = axes[1].imshow(dataslice1,cmap=cmap,vmin=mini,vmax=maxi,origin='lower')
    im1 = axes[0].imshow(dataslice2,cmap=cmap,vmin=mini,vmax=maxi,origin='lower')
    axes[1].text(20,200,label1,fontsize=fontsize+1,color="white")
    axes[0].text(20,200,label2,fontsize=fontsize+1,color="white")

    font = FontProperties()
    #font.set_weight('bold')

    cnv=250.0/244.0
    ytick_locs=[0,50*cnv,100*cnv,150*cnv,200*cnv,250*cnv]
    ytick_lbls=[0,50,100,150,200,250]

    axes[0].tick_params(axis='y', which='major', labelsize=numberfontsize, width = tickwidth, length = 11, direction='out',pad=14.0,top='off',right='off',bottom='off')
    axes[1].tick_params(axis='both', which='major', labelsize=numberfontsize, width = tickwidth, length = 11, direction='out',pad=14.0,top='off',right='off')
    axes[0].tick_params(axis='both', which='minor', width = tickwidth, length = 5.5,direction='out',top='off',right='off',bottom='off')
    axes[1].tick_params(axis='both', which='minor', width = tickwidth, length = 5.5,direction='out',top='off',right='off')
    m0=MultipleLocator(200)
    axes[1].xaxis.set_major_locator(m0)

    m0 = MultipleLocator(50)
    axes[1].yaxis.set_major_locator(m0)
    m0 = MultipleLocator(10)
    axes[1].yaxis.set_minor_locator(m0)

    m0 = MultipleLocator(50)
    axes[0].yaxis.set_major_locator(m0)
    m0 = MultipleLocator(10)
    axes[0].yaxis.set_minor_locator(m0)

    m0 = MultipleLocator(100)
    axes[1].xaxis.set_major_locator(m0)
    m0 = MultipleLocator(10)
    axes[1].xaxis.set_minor_locator(m0)


#    m0=MultipleLocator(100)
#    axes[0].xaxis.set_minor_locator(m0)
#    axes[1].xaxis.set_minor_locator(m0)

    print len(dataslice1[1,:])
    labels = [str('%.2f'%z[i])]#.np.chararray(len(dataslice1[1,:])/100+2)
    print len(z)
    for i in range(1,len(dataslice1[1,:])):
        if (i+1)%200==0:
            if i/200<len(labels) and i<len(z):
                print "in if " + str(i)
                #labels[i/100] = str('%.2f'%z[i])
                labels.append(str('%.2f'%z[i]))
        elif (i+1)%100==0:
            if i/200<len(labels) and i<len(z):
                labels.append(" ")
#    labels[len(labels)-2]=str('%.2f'%z[len(z)-2])
    labels.append(" ")
    labels.append(str('%.2f'%z[len(z)-2]))
    
    print labels
    axes[1].set_xticklabels(labels[::-1])
    axes[0].set_xticklabels([])
    plt.xlabel("Redshift",size=fontsize)
    #plt.ylabel("Distance (Mpc)",size=fontsize)
    fig.text(0.08,0.65,"Distance (Mpc)\n",ha='center',fontsize=fontsize,rotation='vertical')
    plt.tight_layout()
    fig.subplots_adjust(right=0.95)
    cbar_ax = fig.add_axes([0.87, 0.25, 0.02, 0.5])
    cbar = fig.colorbar(im1, cax=cbar_ax,ticks=[-400,-300,-200,-100,0,100,200,300])
    cbar.ax.set_yticklabels
    cbar.set_label("$\delta T_b \ (mK)$",size=fontsize)

#    plt.tight_layout()
    #plt.gcf().subplots_adjust(bottom=0.15,left=0.15)
    print "saving as..." +"compare_"+flag2+"_"+flag1+"/lightcones.png"
    plt.savefig("compare_"+flag1+"_"+flag2+"/lightcones.png")
    plt.savefig("paperplots/plot4.png")
    plt.close()
Exemplo n.º 7
0
c2t.set_verbose(True)

#We are using the 114/h Mpc simulation box, so set all the proper conversion factors
#Always set this before loading data!
c2t.set_sim_constants(boxsize_cMpc = 114.)

#We will make one density light cone, one for ionized
#fraction and one for brightness temperature.

#First we need lists of all the available ionization fraction and density files.
#Here, we use python's built-in glob command, which makes a list of all such files:
xfrac_files = glob.glob(xfrac_dir + '/xfrac3d_*.bin')
density_files = glob.glob(density_dir + '/*n_all.dat')

#Make the ionization fraction lightcone
xfrac_lightcone, z = c2t.make_lightcone(xfrac_files, z_low = 7.059, z_high = 7.3)

#Make the density lightcone
density_lightcone, z = c2t.make_lightcone(density_files, z_low = 7.059, z_high = 7.3)

#The dT lightcone is made by combining density and ionization fraction.
#If you already have a bunch of dT files, you can make a lightcone directly
#using the make_lightcone method
dt_lightcone = c2t.calc_dt_lightcone(xfrac_lightcone, density_lightcone, lowest_z = z.min())
print dt_lightcone.shape

#Calculate the mean dT along the line-of-sight of the lightcone
dT_mean = c2t.apply_func_along_los(dt_lightcone, func=np.mean, los_axis=2)

#Plot the dT volume
pl.subplot(121)
file_z = './lc_boxes/out0_z.dat'
file1_z = './lc_boxes/out1_z.dat'
file2_z = './lc_boxes/out2_z.dat'

c2t.set_verbose(True)
c2t.set_sim_constants(boxsize_cMpc = 244.)
z_low = 6.0
z_high = 22.

# Read in dT boxes, get filenames, and make lightcones
dT_files = glob.glob(dT_path+'dT_*.cbin')
dens_files = glob.glob(density_path+'*n_all.dat')
vel_files = glob.glob(density_path+'*v_all.dat')

vel_lightcone, z = c2t.make_velocity_lightcone(vel_files, dens_files, z_low, z_high, los_axis=0)
dT_lightcone,out_z = c2t.make_lightcone(dT_files, z_low , z_high, cbin_bits=64, cbin_order='F', los_axis=0)
rsd_dT = c2t.get_distorted_dt(dT_lightcone, vel_lightcone, z, num_particles=40, los_axis=2, velocity_axis=0, periodic=False)

c2t.save_cbin(out_box, dT_lightcone)
c2t.save_cbin(out_pv_box, rsd_dT)
np.savetxt(file_z,out_z,fmt="%f")

vel_lightcone, z = c2t.make_velocity_lightcone(vel_files, dens_files, z_low, z_high, los_axis=1)
dT_lightcone,out_z = c2t.make_lightcone(dT_files, z_low , z_high, cbin_bits=64, cbin_order='F', los_axis=1)
rsd_dT = c2t.get_distorted_dt(dT_lightcone, vel_lightcone, z, num_particles=40, los_axis=2, velocity_axis=1, periodic=False)

c2t.save_cbin(out1_box, dT_lightcone)
c2t.save_cbin(out1_pv_box, rsd_dT)
np.savetxt(file1_z,out_z,fmt="%f")

vel_lightcone, z = c2t.make_velocity_lightcone(vel_files, dens_files, z_low, z_high, los_axis=2)
Exemplo n.º 9
0
def compare_xfrac_lightcones(id=''):
    length=min(len(redshifts1),len(redshifts2))
    filenames1 = ["" for x in range(length)]
    filenames2 = ["" for x in range(length)]
#    filenames[0] = len(redshifts)
    mini = 1e-8#1e-4 
    maxi=1
    for i in range(length):
        #filenames[i] = setup_dirs.path() + 'lightcone_temp/Temper3D_'+str('%.3f' % redshifts[i]) + '.bin'
        filenames1[i] = '/lustre/scratch/astro/hr203/RESULTS/244Mpc_f2_8.2S_H250_'+flag1+'/xfrac3d'+id+'_'+str('%.3f' % redshifts1[i]) + '.bin'
        filenames2[i] ='/lustre/scratch/astro/hr203/RESULTS/244Mpc_f2_8.2S_H250_'+flag2+'/xfrac3d'+id+'_'+str('%.3f' % redshifts2[i]) + '.bin'
    print "Filenames:"
    print filenames1
    print filenames2
    Im1,z=c2t.make_lightcone(filenames1,redshifts1[len(redshifts1)-1],redshifts1[0],interpolation='sigmoid')
    Im2,z=c2t.make_lightcone(filenames2,redshifts1[len(redshifts1)-1],redshifts1[0],interpolation='sigmoid')

    Im1=np.asarray(Im1)
    Im2=np.asarray(Im2)
    dataslice1=Im1[90,:,::-1]
    dataslice2=Im2[90,:,::-1]

    cmap = 'Blues_r'
    fig,axes =plt.subplots(2,1,figsize=(15,8))
    im1 = axes[1].imshow(dataslice1,cmap=cmap,norm=LogNorm(),vmin=mini,vmax=maxi,origin='lower',interpolation='nearest')
    im1 = axes[0].imshow(dataslice2,cmap=cmap,norm=LogNorm(),vmin=mini,vmax=maxi,origin='lower',interpolation='nearest')
    axes[1].text(20,200,label1,fontsize=fontsize+1,color="Red")
    axes[0].text(20,200,label2,fontsize=fontsize+1,color="Red")

    font = FontProperties()
    #font.set_weight('bold')

    cnv=250.0/244.0
    ytick_locs=[0,50*cnv,100*cnv,150*cnv,200*cnv,250*cnv]
    ytick_lbls=[0,50,100,150,200,250]

    axes[0].tick_params(axis='y', which='major', labelsize=numberfontsize, width = tickwidth, length = 11, direction='out',pad=14.0,top='off',right='off',bottom='off')
    axes[1].tick_params(axis='both', which='major', labelsize=numberfontsize, width = tickwidth, length = 11, direction='out',pad=14.0,top='off',right='off')
    axes[0].tick_params(axis='both', which='minor', width = tickwidth, length = 5.5,direction='out',top='off',right='off',bottom='off')
    axes[1].tick_params(axis='both', which='minor', width = tickwidth, length = 5.5,direction='out',top='off',right='off')
    #m0=MultipleLocator(200)
    #axes[1].xaxis.set_major_locator(m0)
    m0 = MultipleLocator(50)
    axes[1].yaxis.set_major_locator(m0)
    m0 = MultipleLocator(10)
    axes[1].yaxis.set_minor_locator(m0)

    m0 = MultipleLocator(50)
    axes[0].yaxis.set_major_locator(m0)
    m0 = MultipleLocator(10)
    axes[0].yaxis.set_minor_locator(m0)

    #m0 = MultipleLocator(100)
    #axes[1].xaxis.set_major_locator(m0)
    #m0 = MultipleLocator(10)
    #axes[1].xaxis.set_minor_locator(m0)


#    m0=MultipleLocator(100)
#    axes[0].xaxis.set_minor_locator(m0)
#    axes[1].xaxis.set_minor_locator(m0)

    print len(dataslice1[1,:])
    labels = ["" for x in range(11)]#[str('%.2f'%z[i])]#.np.chararray(len(dataslice1[1,:])/100+2)
    lticks = np.zeros(11)#[str('%.2f'%z[i])]#.np.chararray(len(dataslice1[1,:])/100+2)
    print "Length of z: "+ str(len(z))
    print "Lenght of z axis:  1688"
    zcount=0
    for i in range(len(z)):
        zlab=str('%.0f'%z[i])
        zred=str(z[i])
        if zred[2:4]=='.0': #or zlab[2:4]=='.0':
          zred_last='aa'
          if i!=0:
              zred_last=str(z[i-1])
          if zred[0:2]!=zred_last[0:2]:
             if zcount<len(labels):# or str('%.2f'%z[i])==22.00 or str('%.2f'%z[i])==22.00 :#(i+1)%200==0:
#                 zlab2=list(zlab)
#                 zlab2[4]='0'
                 labels[zcount]=''.join(zlab)
                 lticks[zcount]=(len(z)-i)*(float(len(dataslice1[1,:]))/float(len(z)))
                 zcount=zcount+1
        #     zcount=zcount+1
#            #if i/200<len(labels) and i<len(z):
#            #    print "in if " + str(i)
#                #labels[i/100] = str('%.2f'%z[i])
#                labels.append(str('%.2f'%z[i]))
#        elif (i+1)%100==0:
#            if i/200<len(labels) and i<len(z):
#                labels.append(" ")
#    labels[len(labels)-2]=str('%.2f'%z[len(z)-2])
#    labels.append(" ")
#    labels.append(str('%.2f'%z[len(z)-2]))
    print lticks[::-1]
    print labels
    axes[1].set_xticks(lticks) 
    axes[1].set_xticklabels(labels)
#    axes[0].set_xticks(lticks)
    axes[0].set_xticklabels([])
    plt.xlabel("Redshift",size=fontsize)
    #plt.ylabel("Distance (Mpc)",size=fontsize)
    fig.text(0.08,0.65,"Position [Mpc/h]\n",ha='center',fontsize=fontsize,rotation='vertical')
    plt.tight_layout()
    fig.subplots_adjust(right=0.95)
    cbar_ax = fig.add_axes([0.87, 0.25, 0.02, 0.5])
    cbar = fig.colorbar(im1, cax=cbar_ax,ticks=[1e-10,1e-8,1e-6,1e-4,1e-2,1e0])
    cbar.ax.set_yticklabels
    cbar.set_label("$\mathrm{log(x_v)}$",size=fontsize)

#    plt.tight_layout()
    #plt.gcf().subplots_adjust(bottom=0.15,left=0.15)
    print "saving as..." +"compare_"+flag1+"_"+flag2+"/lightcone_xfrac"+id+".png"
    plt.savefig("compare_"+flag1+"_"+flag2+"/lightcone_xfrac"+id+".png")
#    plt.savefig("paperplots/xfrac"+id"_lightcone.png")
    plt.close()
Exemplo n.º 10
0
def compare_dbt_lightcones():
    length=min(len(redshifts1),len(redshifts2))
    filenames1 = ["" for x in range(length)]
    filenames2 = ["" for x in range(length)]
#    filenames[0] = len(redshifts)
    mini = -457
    maxi=83
    for i in range(length):
        #filenames[i] = setup_dirs.path() + 'lightcone_temp/Temper3D_'+str('%.3f' % redshifts[i]) + '.bin'
        filenames1[i] = '../generate_data/data_'+flag1+'/dbt/map_dbt_'+str('%.3f' % redshifts1[i]) + '.bin'
        filenames2[i] = '../generate_data/data_'+flag2+'/dbt/map_dbt_'+str('%.3f' % redshifts2[i]) + '.bin'
    print "Filenames:"
    print filenames1
    print filenames2
    Im1,z=c2t.make_lightcone(filenames1,redshifts1[len(redshifts1)-1],redshifts1[0],interpolation='sigmoid')
    Im2,z=c2t.make_lightcone(filenames2,redshifts1[len(redshifts1)-1],redshifts1[0], interpolation='sigmoid')
    Im1=np.asarray(Im1)
    Im2=np.asarray(Im2)
    dataslice1=Im1[90,:,::-1]
    dataslice2=Im2[90,:,::-1]

    cmapdbt = {'red':   ((0.0, 0.0, 0.0),
                        (0.846, 0.0, 1.0),
                        (1.0, 1.0, 1.0)),
                'green': ((0.0, 0.0, 0.0),
                        (0.846,0.0, 0.0),
                        (1.0, 1.0, 1.0)),
                'blue':  ((0.0, 0.0, 0.0),
                        (0.846, 1.0, 0.0),
                        (1.0, 1.0, 1.0))
              }
    plt.register_cmap(name='dbtmap',data=cmapdbt)
    cmap = plt.get_cmap('dbtmap')

    fig,axes =plt.subplots(2,1,figsize=(15,8))
    im1 = axes[1].imshow(dataslice1,cmap=cmap,vmin=mini,vmax=maxi,origin='lower',interpolation='nearest')
    im1 = axes[0].imshow(dataslice2,cmap=cmap,vmin=mini,vmax=maxi,origin='lower',interpolation='nearest')
    axes[1].text(20,200,label1,fontsize=fontsize+1,color="white")
    axes[0].text(20,200,label2,fontsize=fontsize+1,color="white")

    font = FontProperties()
    font.set_weight('bold')

    cnv=250.0/244.0
    ytick_locs=[0,50*cnv,100*cnv,150*cnv,200*cnv,250*cnv]
    ytick_lbls=[0,50,100,150,200,250]

    axes[0].tick_params(axis='y', which='major', labelsize=numberfontsize, width = tickwidth, length = 11, direction='out',pad=14.0,top='off',right='off',bottom='off')
    axes[1].tick_params(axis='both', which='major', labelsize=numberfontsize, width = tickwidth, length = 11, direction='out',pad=14.0,top='off',right='off')
    axes[0].tick_params(axis='both', which='minor', width = tickwidth, length = 5.5,direction='out',top='off',right='off',bottom='off')
    axes[1].tick_params(axis='both', which='minor', width = tickwidth, length = 5.5,direction='out',top='off',right='off')

    m0 = MultipleLocator(50)
    axes[1].yaxis.set_major_locator(m0)
    m0 = MultipleLocator(10)
    axes[1].yaxis.set_minor_locator(m0)

    m0 = MultipleLocator(50)
    axes[0].yaxis.set_major_locator(m0)
    m0 = MultipleLocator(10)
    axes[0].yaxis.set_minor_locator(m0)

    print len(dataslice1[1,:])
    labels = ["" for x in range(11)]#[str('%.2f'%z[i])]#.np.chararray(len(dataslice1[1,:])/100+2)
    lticks = np.zeros(11)#[str('%.2f'%z[i])]#.np.chararray(len(dataslice1[1,:])/100+2)
    print "Length of z: "+ str(len(z))
    print "Lenght of z axis:  1688"
    zcount=0
    for i in range(len(z)):
#        zlab=str('%.2f'%z[i])
        zlab2=str('%.0f'%z[i])
        zred=str(z[i])
        if zred[2:4]=='.0': #or zlab[2:4]=='.0':
          zred_last='aa'
          if i!=0:
              zred_last=str(z[i-1])
          if zred[0:2]!=zred_last[0:2]:
             if zcount<len(labels):# or str('%.2f'%z[i])==22.00 or str('%.2f'%z[i])==22.00 :#(i+1)%200==0:
#                 zlab3=list(zlab)
#                 zlab3[4]='0'
                 labels[zcount]=''.join(zlab2)
                 lticks[zcount]=(len(z)-i)*float(len(dataslice1[1,:]))/float(len(z))
                 zcount=zcount+1
    print lticks[::-1]
    print labels
    axes[1].set_xticks(lticks)
    axes[1].set_xticklabels(labels)
    axes[0].set_xticklabels([])
    plt.xlabel("Redshift",size=fontsize)
    fig.text(0.08,0.65,"Position [Mpc\h]\n",ha='center',fontsize=fontsize,rotation='vertical',color='black')
    plt.tight_layout()
    fig.subplots_adjust(right=0.95)
    cbar_ax = fig.add_axes([0.87, 0.25, 0.02, 0.5])
    cbar = fig.colorbar(im1, cax=cbar_ax,ticks=[-400,-300,-200,-100,0,100,200,300])
    cbar.ax.set_yticklabels
    cbar.set_label("$\mathrm{\delta T_b \ [mK]}$",size=fontsize)
#    plt.tight_layout()
#    plt.gcf().subplots_adjust(left=0.15)
    print "saving as..." +"compare_"+flag1+"_"+flag2+"/lightcone_dbt.png"
    plt.savefig("compare_"+flag1+"_"+flag2+"/lightcone_dbt.png")
    #plt.savefig("paperplots/plot4.png")
    plt.close()