# #hifidemo_FitHifiFringe_apr2010.py: instructions to run FitHifiFringe # Task. # # v0.0 ACAB 02/Dec/2009: created for Caltech group demo # v0.1 ACAB 07/Dec/2009: adapted for Madrid DPWS Dec 2009 # v0.2 ACAB 07/Mar/2010: adapted to HIPE 3.0, with a different example # v0.3 ACAB 03/Apr/2010: adapted to HIPE 2.6 for ESTEC DPWS Apr 2010 # #load band 4B SScan LChop observation #from ~/.hcss/lstore/ #It has a short-period standing wave in some scans, #and a long-period one in others. obs=getObservation("1342180554",poolName="pool_1342180554") storage= ProductStorage(poolname) query=herschel.ia.pal.query.AttribQuery(herschel.ia.obs.ObservationContext,"p","1") result = storage.select(query) obs = storage.load(result[0].urn).product #run fitHifiFringe using the GUI.... #This will process all SpectrumDataSets. It generates 2 plots #per scan, so don't forget to set plot=0 if the observation #contains many scans....! #note that if one runs the GUI, the input ObservationContext is overwritten, #so for this demo, read it again obs = storage.load(result[0].urn).product #Or work on DataSet level. #Select a level 2 spectrumdataset sds_lev2=obs.refs["level2"].product.refs["WBS-H-USB"].product.refs["60"].product["dataset"] #Run fitHifiFringe using the GUI.... #Drag sds_lev2 to the sds1 button. #or on the command line, using default settings fhf = FitHifiFringe() sds_lev2_out = fhf(sds1=sds_lev2,nfringes=1,plot=1,start_period=20,end_period=3000.,typical_period=150.,averscan=False,doglue=True) #Notes on previous fit: # # -the mask (orange line) 'detects' lines that do not seem to be present # This is not seriously affecting the fit, as the masked regions are small. # # -the baseline (blue line) may not be reasonable, as long-period standing waves # might be present. Baseline curvatures can be controlled with the 'typical_period' # parameter. Higher values mean less curvature. In the following example, # midcycle was increased to 650 MHz, and as one can see the SW baseline is # much smoother and any deviations from that will be fitted with sine waves fhf = FitHifiFringe() sds_lev2_out = fhf(sds1=sds_lev2,nfringes=1,plot=1,start_period=50,end_period=3000.,typical_period=650.,averscan=False,doglue=True) #In case the period vs. Chi^2 plot shows multiple peaks, increase #the number of standing waves to fit accordingly. fhf = FitHifiFringe() sds_lev2_out = fhf(sds1=sds_lev2,nfringes=2,plot=1,start_period=50,end_period=3000.,typical_period=650.,averscan=False,doglue=True) #if a line was not fully masked, add mask by hand #note that not the entire region is masked--> solved in HIPE 3 fhf = FitHifiFringe() sds_lev2_out = fhf(sds1=sds_lev2,nfringes=2,plot=1,start_period=50,end_period=3000.,typical_period=650.,averscan=False,doglue=True,usermask=[(1113.,1114.)]) #If you know pretty well the period, narrow the search range #(speeds up processing) fhf = FitHifiFringe() sds_lev2_out = fhf(sds1=sds_lev2,nfringes=2,plot=1,start_period=80,end_period=110.,typical_period=650.,averscan=False,doglue=True) #If you like to work on WBS sub-bands. #Useful if there are strong WBS sub-band jumps, or getting better #solutions for narrow lines. sds_lev2_out = fhf(sds1=sds_lev2,nfringes=2,plot=1,start_period=80,end_period=110.,typical_period=650.,averscan=False,doglue=False)