Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 import time
00017 import os
00018
00019 os.system('rm -rf IRC+10216_rawACSmod IRC+10216_rawACSmod_cal IRC+10216_rawACSmod_cal_sm IRC+10216_rawACSmod_cal_sm_bs irc_cs_reducedSCAN0_CYCLE0_BEAM0_IF0.txt irc_cs_reduced.eps irc_cs_fit.txt')
00020
00021
00022 doplot = False
00023
00024 casapath=os.environ['CASAPATH'].split()[0]
00025 datapath=casapath+'/data/regression/ATST5/IRC+10216/IRC+10216_rawACSmod'
00026 copystring='cp -r '+datapath+' .'
00027 os.system(copystring)
00028
00029 startTime=time.time()
00030 startProc=time.clock()
00031
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
00063
00064
00065
00066
00067
00068 asap_init()
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 if doplot:
00080 localplotlevel = 1
00081 else:
00082 localplotlevel = 0
00083
00084
00085
00086 default(sdcal)
00087 infile='IRC+10216_rawACSmod'
00088 fluxunit='K'
00089 calmode='nod'
00090 scanlist=[229,230]
00091 iflist=[3]
00092 scanaverage=False
00093 timeaverage=True
00094 tweight='tintsys'
00095 polaverage=True
00096 pweight='tsys'
00097 tau=0.09
00098 overwrite=True
00099 plotlevel=localplotlevel
00100 sdcal()
00101
00102 localoutfile=infile+'_cal'
00103
00104
00105
00106 default(sdsmooth)
00107 infile = localoutfile
00108 kernel='boxcar'
00109 kwidth=5
00110 overwrite=True
00111 plotlevel=localplotlevel
00112 sdsmooth()
00113 localoutfile=infile+'_sm'
00114
00115
00116
00117
00118
00119 default(sdbaseline)
00120 infile=localoutfile
00121 maskmode='auto'
00122
00123 thresh=5
00124 avg_limit=4
00125
00126
00127 blfunc='cspline'
00128 npiece=2
00129 clipthresh=3.0
00130 clipniter=1
00131 overwrite=True
00132 plotlevel=localplotlevel
00133 sdbaseline()
00134 localoutfile=infile+'_bs'
00135
00136
00137
00138 if doplot:
00139 default(sdplot)
00140 infile=localoutfile
00141 specunit='GHz'
00142 outfile='irc_cs_reduced.eps'
00143
00144
00145 sdplot()
00146 else:
00147 print "Plotting the result is skipped."
00148
00149
00150 default(sdstat)
00151
00152 infile=localoutfile
00153 masklist=[800,1500]
00154 xstat=sdstat()
00155 rms=xstat['rms']
00156
00157
00158
00159 masklist=[1850,2300]
00160 xstat=sdstat()
00161 xstat
00162 max=xstat['max']
00163 sum=xstat['sum']
00164 median=xstat['median']
00165 mean=xstat['mean']
00166
00167
00168
00169 default(sdsave)
00170 infile=localoutfile
00171 outfile='irc_cs_reduced'
00172 outform='ASCII'
00173 overwrite=True
00174 sdsave()
00175
00176
00177
00178
00179
00180 endProc = time.clock()
00181 endTime = time.time()
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196 irc_max=3.3270
00197 irc_rms=0.1472
00198 irc_sum=630.75
00199
00200 diff_max = abs((irc_max-max)/irc_max)
00201 diff_rms = abs((irc_rms-rms)/irc_rms)
00202 diff_sum = abs((irc_sum-sum)/irc_sum)
00203
00204 import datetime
00205 datestring=datetime.datetime.isoformat(datetime.datetime.today())
00206 outfile='irc.cs.task'+datestring+'.log'
00207 logfile=open(outfile,'w')
00208
00209 print >>logfile,''
00210 print >>logfile,'********** Regression ***********'
00211 print >>logfile,'* *'
00212 if (diff_max < 0.05): print >>logfile,'* Passed spectrum max test '
00213 print >>logfile,'* Spectrum max '+str(max)
00214 if (diff_rms < 0.05): print >>logfile,'* Passed spectrum rms test '
00215 print >>logfile,'* Spectrum rms '+str(rms)
00216 if (diff_sum < 0.05): print >>logfile,'* Passed spectrum (line) sum test'
00217 print >>logfile,'* Line integral '+str(sum)
00218 if ((diff_max<0.05) & (diff_rms<0.05) & (diff_sum<0.05)):
00219 regstate=True
00220 print ''
00221 print 'Regression PASSED'
00222 print ''
00223 print >>logfile,'---'
00224 print >>logfile,'Passed Regression test for IRC-CS'
00225 print >>logfile,'---'
00226 else:
00227 regstate=False
00228 print ''
00229 print 'Regression FAILED'
00230 print ''
00231 print >>logfile,'----FAILED Regression test for IRC-CS'
00232 print >>logfile,'*********************************'
00233
00234 print >>logfile,''
00235 print >>logfile,''
00236 print >>logfile,'********* Benchmarking *****************'
00237 print >>logfile,'* *'
00238 print >>logfile,'Total wall clock time was: '+str(endTime - startTime)
00239 print >>logfile,'Total CPU time was: '+str(endProc - startProc)
00240
00241
00242 logfile.close()