Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 import time
00018 import os
00019
00020 os.system('rm -rf OrionS_rawACSmod orions_hc3n_reducedSCAN0_CYCLE0_BEAM0_IF0.txt orions_hc3n_reduced.eps orions_hc3n_fit.txt')
00021
00022
00023 doplot = False
00024
00025 casapath=os.environ['CASAPATH']
00026 datapath=casapath.split()[0]+'/data/regression/ATST5/OrionS/OrionS_rawACSmod'
00027 copystring='cp -r '+datapath+' .'
00028 os.system(copystring)
00029
00030 startTime=time.time()
00031 startProc=time.clock()
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 asap_init()
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 if doplot:
00078 localplotlevel = 1
00079 else:
00080 localplotlevel = 0
00081
00082
00083
00084 default(sdcal)
00085 infile='OrionS_rawACSmod'
00086 fluxunit='K'
00087 calmode='ps'
00088 scanlist=[20,21,22,23]
00089 iflist=[0]
00090 scanaverage=False
00091 timeaverage=True
00092 tweight='tintsys'
00093 polaverage=True
00094 pweight='tsys'
00095 tau=0.09
00096 overwrite=True
00097 plotlevel=localplotlevel
00098 sdcal()
00099
00100 localoutfile=infile+'_cal'
00101
00102
00103
00104 default(sdsmooth)
00105 infile = localoutfile
00106 kernel='boxcar'
00107 kwidth=5
00108 overwrite=True
00109 plotlevel=localplotlevel
00110 sdsmooth()
00111 localoutfile=infile+'_sm'
00112
00113
00114
00115
00116 default(sdbaseline)
00117 infile=localoutfile
00118 maskmode='auto'
00119 edge=[50]
00120 thresh=5
00121 avg_limit=4
00122 blfunc='poly'
00123 order=2
00124 overwrite=True
00125 plotlevel=localplotlevel
00126 sdbaseline()
00127 localoutfile=infile+'_bs'
00128
00129
00130
00131
00132 if doplot:
00133 default(sdplot)
00134 infile=localoutfile
00135 specunit='GHz'
00136 outfile='orions_hc3n_reduced.eps'
00137
00138
00139 sdplot()
00140 else:
00141 print "Plotting the result is skipped."
00142
00143
00144 default(sdstat)
00145
00146 infile=localoutfile
00147 masklist=[5000,7000]
00148 xstat=sdstat()
00149 rms=xstat['rms']
00150
00151
00152
00153
00154 masklist=[3900,4200]
00155 xstat=sdstat()
00156 xstat
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176 max=xstat['max']
00177 sum=xstat['sum']
00178
00179 default(sdfit)
00180 infile=localoutfile
00181
00182 fitmode='list'
00183 maskline=[3928,4255]
00184 nfit=1
00185 plotlevel=localplotlevel
00186 outfile='orions_hc3n_fit.txt'
00187 xstat=sdfit()
00188 xstat
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203 default(sdsave)
00204 infile=localoutfile
00205 outfile='orions_hc3n_reduced'
00206 outform='ASCII'
00207 overwrite=True
00208 sdsave()
00209 outfile='orions_hc3n_reduced.ms'
00210 outform='MS2'
00211
00212 endProc = time.clock()
00213 endTime = time.time()
00214
00215
00216
00217
00218
00219
00220
00221
00222 hc3n_max=0.9186
00223 hc3n_rms=0.04912
00224 hc3n_sum=65.09
00225 diff_max = abs((hc3n_max-max)/hc3n_max)
00226 diff_rms = abs((hc3n_rms-rms)/hc3n_rms)
00227 diff_sum = abs((hc3n_sum-sum)/hc3n_sum)
00228
00229 import datetime
00230 datestring=datetime.datetime.isoformat(datetime.datetime.today())
00231 outfile='ori.hc3n.task.'+datestring+'.log'
00232 logfile=open(outfile,'w')
00233 print >>logfile,''
00234 print >>logfile,'********** Regression ***********'
00235 print >>logfile,'* *'
00236 if (diff_max < 0.05): print >>logfile,'* Passed spectrum max test '
00237 print >>logfile,'* Spectrum max '+str(max)
00238 if (diff_rms < 0.05): print >>logfile,'* Passed spectrum rms test '
00239 print >>logfile,'* Spectrum rms '+str(rms)
00240 if (diff_sum < 0.05): print >>logfile,'* Passed spectrum (line) sum test'
00241 print >>logfile,'* Line integral '+str(sum)
00242 if ((diff_max<0.05) & (diff_rms<0.05) & (diff_sum<0.05)):
00243 regstate=True
00244 print >>logfile,'---'
00245 print >>logfile,'Passed Regression test for OrionS-HC3N'
00246 print >>logfile,'---'
00247 print ''
00248 print 'Regression PASSED'
00249 print ''
00250 else:
00251 regstate=False
00252 print >>logfile,'----FAILED Regression test for OrionS-HC3N'
00253 print ''
00254 print 'Regression FAILED'
00255 print ''
00256
00257 print >>logfile,'*********************************'
00258
00259 print >>logfile,''
00260 print >>logfile,''
00261 print >>logfile,'********* Benchmarking *****************'
00262 print >>logfile,'* *'
00263 print >>logfile,'Total wall clock time was: '+str(endTime - startTime)
00264 print >>logfile,'Total CPU time was: '+str(endProc - startProc)
00265
00266
00267 logfile.close()