Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 import time
00015 import os
00016
00017 os.system('rm -rf IRC+10216_rawACSmod IRC+10216_rawACSmod_cal IRC+10216_rawACSmod_cal_sm IRC+10216_rawACSmod_cal_sm_bs irc_hc3n_reducedSCAN0_CYCLE0_BEAM0_IF0.txt irc_hc3n_reduced.eps irc_cs_fit.txt')
00018
00019
00020 doplot = False
00021
00022 casapath=os.environ['CASAPATH'].split()[0]
00023 datapath=casapath+'/data/regression/ATST5/IRC+10216/IRC+10216_rawACSmod'
00024 copystring='cp -r '+datapath+' .'
00025 os.system(copystring)
00026
00027 startTime=time.time()
00028 startProc=time.clock()
00029
00030
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 asap_init()
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(sdreduce)
00085 infile='IRC+10216_rawACSmod'
00086 fluxunit='K'
00087 calmode='nod'
00088 scanlist=[236,237,238,239,248,249,250,251]
00089 iflist=[17]
00090 average=True
00091 scanaverage=False
00092 timeaverage=True
00093 tweight='tintsys'
00094 polaverage=True
00095 pweight='tsys'
00096 tau=0.09
00097
00098 kernel='boxcar'
00099 kwidth=5
00100
00101
00102 maskmode='auto'
00103 thresh=5
00104 avg_limit=4
00105 blfunc='poly'
00106 order=2
00107 overwrite=True
00108 plotlevel=localplotlevel
00109 sdreduce()
00110 localoutfile=infile+'_cal'
00111
00112
00113
00114 if doplot:
00115 default(sdplot)
00116 infile=localoutfile
00117 specunit='GHz'
00118 outfile='irc_hc3n_reduced.eps'
00119
00120
00121 sdplot()
00122 else:
00123 print "Plotting the result is skipped."
00124
00125
00126 default(sdstat)
00127
00128 infile=localoutfile
00129 masklist=[200,1500]
00130 xstat=sdstat()
00131 rms=xstat['rms']
00132
00133
00134
00135 masklist=[1800,2400]
00136 xstat=sdstat()
00137 xstat
00138 max=xstat['max']
00139 sum=xstat['sum']
00140 median=xstat['median']
00141 mean=xstat['mean']
00142
00143
00144
00145 default(sdsave)
00146 infile=localoutfile
00147 outfile='irc_hc3n_reduced'
00148 outform='ASCII'
00149 overwrite=True
00150 sdsave()
00151
00152
00153
00154
00155
00156 endProc = time.clock()
00157 endTime = time.time()
00158
00159
00160
00161
00162
00163
00164
00165 irc_max=1.827
00166 irc_rms=0.02213
00167 irc_sum=474.1
00168 diff_max = abs((irc_max-max)/irc_max)
00169 diff_rms = abs((irc_rms-rms)/irc_rms)
00170 diff_sum = abs((irc_sum-sum)/irc_sum)
00171
00172 import datetime
00173 datestring=datetime.datetime.isoformat(datetime.datetime.today())
00174 outfile='irc.hc3n.task'+datestring+'.log'
00175 logfile=open(outfile,'w')
00176
00177 print >>logfile,''
00178 print >>logfile,'********** Regression ***********'
00179 print >>logfile,'* *'
00180 if (diff_max < 0.05): print >>logfile,'* Passed spectrum max test '
00181 print >>logfile,'* Spectrum max '+str(max)
00182 if (diff_rms < 0.05): print >>logfile,'* Passed spectrum rms test '
00183 print >>logfile,'* Spectrum rms '+str(rms)
00184 if (diff_sum < 0.05): print >>logfile,'* Passed spectrum (line) sum test'
00185 print >>logfile,'* Line integral '+str(sum)
00186 if ((diff_max<0.05) & (diff_rms<0.05) & (diff_sum<0.05)):
00187 regstate=True
00188 print ''
00189 print 'Regression PASSED'
00190 print ''
00191 print >>logfile,'---'
00192 print >>logfile,'Passed Regression test for IRC-HC3N'
00193 print >>logfile,'---'
00194 else:
00195 regstate=False
00196 print ''
00197 print 'Regression FAILED'
00198 print ''
00199 print >>logfile,'----FAILED Regression test for IRC-HC3N'
00200 print >>logfile,'*********************************'
00201
00202 print >>logfile,''
00203 print >>logfile,''
00204 print >>logfile,'********* Benchmarking *****************'
00205 print >>logfile,'* *'
00206 print >>logfile,'Total wall clock time was: '+str(endTime - startTime)
00207 print >>logfile,'Total CPU time was: '+str(endProc - startProc)
00208
00209
00210 logfile.close()