def get_netd(self,filtres_netd,fpos=10): netd_seq = [x for x in self.seq if os.path.isdir(x) and "Temperature.txt" in os.listdir(x) and size(glob.glob("%s/*.raw"% x))%fpos==0] netd_flight = [] netd_time = [] for k,a in enumerate(netd_seq): sequence=FirrSequence(a,fpos,"zou") print sequence.date0 netd_time+=[sequence.date0] sequence.get_netd(filtres_netd,showplot=False) netd_flight+= [sequence.netd] self.netd_flight = array(netd_flight) self.netd_time = netd_time
def get_radiance(self,filtres_bt,npos=10,method="next",save=False): good_seq=[s for s in self.sequences if "Temperature.txt" in os.listdir(s) and size(glob.glob("%s/*.raw"%s))%npos==0] bt=[] radiance=[] time=[] if save: f=open("QuickLookData/brightness_temperature_%s.txt"%self.date,"w") f.write("Date {0} \n".format(" ".join([fil for fil in filtres_order]))) g=open("QuickLookData/Radiance_%s.txt"%self.date,"w") g.write("Date {0} \n".format(" ".join([fil for fil in filtres_order]))) for rr,a in enumerate(good_seq): if method == "next": if rr==len(good_seq)-1: next_seq = a else: next_seq = good_seq[rr+1] else: next_seq = a seq = FirrSequence(a,npos,next_seq) print "Sequence time",seq.date0 nview=seq.npos-2 seq.get_radiance(filtres_bt,method="next",spav="all") # print seq.real_timestamp[2:] # raw_input() time+=seq.real_timestamp[2:] bt+=[seq.all_bt[:,nv] for nv in range(nview)] radiance+=[seq.all_radiance[:,nv] for nv in range(nview)] # rad+=[seq.rad[:,nv] for nv in range(nview)] if save: for nv in range(nview): f.write("%s %s \n"%(datetime.strftime(seq.real_timestamp[nv+2],"%Y-%m-%d_%H-%M-%S")," ".join([str(a) for a in seq.bt[:,nv]]))) g.write("%s %s \n"%(datetime.strftime(seq.real_timestamp[nv+2],"%Y-%m-%d_%H-%M-%S")," ".join([str(a) for a in seq.rad[:,nv]]))) if save: f.close() g.close() self.bt_series = array(bt) self.radiance_series = array(radiance) self.time_series = array(time)
npos = 10 print "Date of measurements:",date_series abb = [] hbb = [] abb_non_ill = [] hbb_non_ill = [] time = [] diff = [] diff_non_ill = [] for seq in data.sequences[80:120]: print seq seq=FirrSequence(seq,npos,seq) time+=[seq.date0] seq.organized(spav="fast",non_ill=0) abb+=[seq.all_mean[:,0,0]] hbb+=[seq.all_mean[:,1,0]] diff+=[seq.all_mean[:,0,0]-seq.all_mean[:,1,0]] seq.organized(spav="fast",non_ill=1) abb_non_ill+=[seq.all_mean[:,0,0]] hbb_non_ill+=[seq.all_mean[:,1,0]] diff_non_ill+=[seq.all_mean[:,0,0]-seq.all_mean[:,1,0]] abb = array(abb) hbb = array(hbb) abb_non_ill = array(abb_non_ill) hbb_non_ill = array(hbb_non_ill) diff = array(diff)
"""Display the 2D image of detector counts and std for each of raw files in files""" from pylab import * from FirrSequence import FirrSequence labs=["open","10-12$\mu$m","12-14$\mu$m","17-18.5$\mu$m","22.5-27.5$\mu$m","7.9-9.5$\mu$m","20.5-22.5$\mu$m","18.5-20.5$\mu$m","17.25-19.75$\mu$m","30-50$\mu$m","blank"] directory = "/media/quentin/LACIE SHARE/FIRR_measurements/LR-TECH/SET1/2015-07-30_13-26-44.0834" # 26°C directory = "/media/quentin/LACIE SHARE/FIRR_measurements/LR-TECH/SET1/2015-07-30_16-29-09.0957" # 35°C #directory = "/media/quentin/LACIE SHARE/FIRR_measurements/LR-TECH/SET1/2015-07-30_19-01-57.0327" # 55°C #directory = "/media/quentin/LACIE SHARE/FIRR_measurements/LR-TECH/SET2/2015-07-30_21-11-28.0353" # 55°C directory = "/media/quentin/LACIE SHARE/FIRR_measurements/LR-TECH/SET2/2015-07-31_00-22-52.0748" directory = "/media/quentin/LACIE SHARE/FIRR_measurements/LR-TECH/SET2/2015-07-31_00-16-56.0710" sequence = FirrSequence(directory,10,directory) sequence.organized(spav="None") counts = sequence.all_mean stds = sequence.all_std std_nad = stds[:,2,:] ambient = counts[:,0,:] hot = counts[:,1,:] nadir = counts[:,2,:] zenith = counts[:,3,:] for j in range(9,11): # imshow(reshape(hot[j,:]-zenith[j,:],(60,80)),vmin=-2,vmax=2) # imsh
rc('xtick',labelsize=22) rc('ytick',labelsize=22) #-------------------------------------- """LR Tech BB emissivity""" em = loadtxt("../Params/emissivity.dat") emiss_wls = em[:,0] emiss = em[:,1] illuminated = list(loadtxt("../Params/illuminated_pixels.txt")) non_illuminated = list(loadtxt("../Params/non_illuminated_pixels.txt")) seq = "/media/quentin/LACIE SHARE/FIRR_measurements/LR-TECH/SET2/2015-07-30_21-47-25.0678" npos = 10 sequence = FirrSequence(seq,npos,seq) filters = ["F0008"] k = 1 sequence.organized(spav="None",non_ill=0) all_tms = sequence.all_tms all_mean = sequence.all_mean i_abb1 = searchsorted(sequence.temp_tms,all_tms[k,0]) Tamb1 = sequence.temp_abb[i_abb1] # exact ABB temperature at measurement i_hbb = searchsorted(sequence.temp_tms,all_tms[k,1]) Thot = sequence.temp_hbb[i_hbb] # exact HBB temperature at measurement Tpma1 = sequence.temp_pm[i_abb1] # pointing mirror temperature at ABB measurement Tpmh = sequence.temp_pm[i_hbb] # pointing mirror temperature at HBB measurement tamb1 = all_tms[k,0]
all_filters = ['open','F0008','F0009','F0034','F0011','F0007','F0036','F0035','F0010','F0014','blank'] labs=["open","10-12~$\mu$m","12-14~$\mu$m","17-18.5~$\mu$m","22.5-27.5~$\mu$m","7.9-9.5~$\mu$m","20.5-22.5~$\mu$m","18.5-20.5~$\mu$m","17.25-19.75~$\mu$m","30-50~$\mu$m","blank"] colors=["grey","DarkOrange","Red","Chartreuse","cyan","Gold","LightBlue","green","black","blue","pink"] wls=array([0,11,13,17.75,25,8.7,21.5,19.5,18.5,40,0]) series = "/media/quentin/LACIE SHARE/FIRR_measurements/LR-TECH/SET2" data = FirrSeries(series) npos = 10 all_sitf0= zeros([10,11]) for s,seq in enumerate(data.sequences[10:20]): print seq sequence = FirrSequence(seq,npos,seq,illuminated_pixels=193,nframes=120) sequence.get_netd(ordered_filters,spav='fast',non_ill=1) all_sitf0[s,:] = sequence.sitf_rad all_sitf = mean(all_sitf0,axis=0) fig = figure(12,figsize=(12,7)) fig.subplots_adjust(bottom=0.12) for fil in ordered_filters: k = all_filters.index(fil) plot(wls[k],all_sitf[k],marker="o",linestyle="",markersize=8,mew=1.,mfc=colors[k],mec="k",color=colors[k]) xlabel(r"Wavelength ($\mu$m)",size=20) ylabel(r"SiTF (counts W$^{-1}$~m$^{2}$~sr$^{1}$)",size=20) #ylim(0,1.6) xlim(0,50)
#seq = "/media/quentin/LACIE SHARE/FIRR_measurements/LR-TECH/SET2/2015-07-30_21-59-17.0755" #seqs = glob("/media/quentin/LACIE SHARE/FIRR_measurements/LR-TECH/SET2/2015-07-30_22*") #seq = "/media/quentin/LACIE SHARE/FIRR_measurements/LR-TECH/SET2/2015-07-31_05-26-02.0030" npos = 10 npix=[1,9,25,45,69,109,145,193,249,305] all_sigma = zeros([len(npix),11]) for m,np in enumerate(npix): print np if np==1: all_std0 = zeros([10,11]) for s,seq in enumerate(data.sequences[10:20]): print seq sequence = FirrSequence(seq,npos,seq,nframes=120) sequence.organized(spav="None",non_ill=1) all_std = sequence.all_std for fil in ordered_filters: k = all_filters.index(fil) all_std0[s,k] = all_std[k,0,3492] for fil in ordered_filters: k = all_filters.index(fil) print mean(all_std0[:,k]) all_sigma[m,k] = mean(all_std0[:,k]) else: all_std0 = zeros([10,11]) for s,seq in enumerate(data.sequences[10:20]): sequence = FirrSequence(seq,npos,seq,illuminated_pixels=np,nframes=120) sequence.organized(spav="fast",non_ill=1)
rc('text', usetex=True) #-------------------------------------- rc('xtick',labelsize=22) rc('ytick',labelsize=22) """read a whole sequence and display radiance and brightness temperatures""" filters = ['F0008','F0009','F0034','F0011','F0007','F0036','F0035','F0010','F0014'] filters_positions = ['open','F0008','F0009','F0034','F0011','F0007','F0036','F0035','F0010','F0014','blank'] list_filters = [filters_positions.index(f) for f in filters] wls = array([0,11,13,17.75,25,8.7,21.5,19.5,18.5,40,0]) colors = ["gold","red","blue","black","orange","yellow","cyan","green","Chartreuse","LightBlue"] sequence = "Data/2015-07-30_14-23-46.0230" # Slow sequence AHNZ seq_data = FirrSequence(sequence,10,sequence) seq_data.get_radiance(filters,method="next",spav="all") radiances = seq_data.all_radiance[:,0] bt = seq_data.all_bt[:,0] """Figure""" fig,(ax1,ax2) = subplots(1,2,figsize=(18,8)) fig.subplots_adjust(bottom=0.15) for k in list_filters: ax1.plot(wls[k],radiances[k],"o",color=colors[k]) ax2.plot(wls[k],bt[k]-273.15,"o",color=colors[k]) ax1.set_xlim(0,50) ax1.grid()
mean_rad = [] std_counts = [] temp_counts = [] temp_rad = [] last_rad = zeros([11]) last_ind = 0 start = 0 nvalues = [] t_nad = [] valid_temp = [] # different NBB temperatures temp_error = [] mean_error = [] std_error = [] for k,s in enumerate(sequences[:nf]): seq = FirrSequence(s,10,s,illuminated_pixels = 69) tms0 = seq.date0 ind = searchsorted(dates,tms0) ind_firr = searchsorted(temp_firr_time,tms0) print "%s/%s %s"%(k,nf,tms0) dates_firr+=[tms0] t_nad+=[t_nadir[ind]] if selection[ind]==1: # in NBB stable conditions print "-----------------------New data---------------------" # 1-Calculate theoretical radiances rad_nad[:,k] = array([Toolbox.radiance(t_nadir[ind]+273.15,all_filters[j],emiss_wls,emiss,firr_pm[ind_firr]+273.15) for j in list_filters]) rad_hbb[:,k] = array([Toolbox.radiance(firr_hbb[ind_firr]+273.15,all_filters[j],emiss_wls,emiss,firr_pm[ind_firr]+273.15) for j in list_filters]) rad_abb[:,k] = array([Toolbox.radiance(firr_abb[ind_firr]+273.15,all_filters[j],emiss_wls,emiss,firr_pm[ind_firr]+273.15) for j in list_filters]) rad_zbb[:,k] = array([Toolbox.radiance(t_zenith[ind]+273.15,all_filters[j],emiss_wls,emiss,firr_pm[ind_firr]+273.15) for j in list_filters])