Commits

Brian Kent authored fb9b6d2a2a3
Updated pipeline regression test values

gcwrap/python/scripts/regressions/pipelineTest_regression.py

Modified
1 1 import os
2 2 import time
3 3 import datetime
4 4 import regression_utility as regutl
5 5 import sys, traceback
6 6 import numpy as np
7 7 import pipeline
8 8
9 -
10 -
11 -pathname=os.environ.get('CASAPATH').split()[0]
9 +pathname = os.environ.get('CASAPATH').split()[0]
12 10 rootdatapath = pathname+'/data/regression/pipeline/'
13 11
14 12
15 13 '''Initial VLA pipeline regression
16 14 B. Kent, May 2015
17 - Last update September 1, 2015
15 + Update September 1, 2015
16 + Update April 20, 2018
18 17 '''
19 18
20 19 THISHOME = "working/"
21 20 startTime=0.0
22 21 endTime=0.0
23 22 startProc=0.0
24 23 endProc=0.0
25 24 regstate = True
26 25 standard_file = rootdatapath + 'VLApipeline44-standard'
27 -#MIN_CASA_REVISION = 36095
26 +# MIN_CASA_REVISION = 36095
28 27
29 28
30 29
31 30 def load_context(filename):
32 31 with open(filename, 'rb') as picklefile:
33 32 return pipeline.infrastructure.utils.pickle_load(picklefile)
34 33
35 34 #
36 35 EPS = 1e-5 # Logical "zero"
37 36 #
38 37 #--------------------------------------------------------------
39 38 #
40 39 def pipeline_regression():
41 40 global regstate
42 - #global MIN_CASA_REVISION
41 + # global MIN_CASA_REVISION
43 42
44 43
45 44 #revision = int(casadef.subversion_revision)
46 45 #if MIN_CASA_REVISION > revision:
47 46 # msg = ('Minimum CASA revision for the pipeline is r%s, '
48 47 # 'got CASA %s (r%s).' % (MIN_CASA_REVISION,
49 48 # cu.version_info( ),
50 49 # casadef.subversion_revision))
51 50 # print msg
52 51 # regstate = False
53 52 # raise EnvironmentError(msg)
54 53
55 54
56 55
57 - #ASDM = "/export/home/icarus_2/awells/CASA_stable/data/regression/foo/vla_pipeline_data/rawdata/13A-537.sb24066356.eb24324502.56514.05971091435"
56 + # ASDM = "/export/home/icarus_2/awells/CASA_stable/data/regression/foo/vla_pipeline_data/rawdata/13A-537.sb24066356.eb24324502.56514.05971091435"
58 57 ASDM = rootdatapath + "13A-537.sb24066356.eb24324502.56514.05971091435"
59 58 try:
60 59 import pipeline.recipes.hifv as hifv
61 60 except ImportError, e:
62 61 print e
63 62
64 63
65 - #Check to see if the ASDM exists
64 + # Check to see if the ASDM exists
66 65 if not os.path.exists(ASDM):
67 66 print "Unable to open ASDM " + ASDM
68 67 regstate=False
69 68 raise IOError
70 69 else:
71 70 print "Using " + ASDM
72 71
73 - #Run the CASA VLA Pipeline standard recipe
72 + # Run the CASA VLA Pipeline standard recipe
74 73 try:
75 74 hifv.hifv([ASDM], importonly=False)
76 75 except Exception, e:
77 76 print e
78 77 regstage=False
79 78
80 79
81 80
82 81 def run():
83 82 '''Timing and running of main regression function
99 98 logfile=open(outfile,'w')
100 99
101 100 try:
102 101 import pipeline
103 102 except ImportError, e:
104 103 print e
105 104 print >>logfile, "Unable to import the CASA pipeline"
106 105 regstate=False
107 106
108 107 try:
109 - #Open context
108 + # Open context
110 109 context = pipeline.Pipeline(context='last').context
111 110 regstate=True
112 111 print >>logfile,"VLA pipeline context created."
113 112 print "VLA pipeline context created."
114 113 print >>logfile,"Context verification - VLA pipeline regression PASSED."
115 114 print "Context verification - VLA pipeline regression PASSED."
116 115
117 116 except Exception, e:
118 117 regstate=False
119 118 print >>logfile,"VLA pipeline context NOT created."
120 119 print "VLA pipeline context NOT created."
121 120 print >>logfile,"Context verification - VLA pipeline regression FAILED."
122 121 print "Context verification - VLA pipeline regression FAILED."
123 122 print >>logfile, e
124 123 print e
125 124
126 - #Test fluxscale values
127 - #Test that hifv_fluxboot stage was the 13th stage run (index 12)
125 + # Test fluxscale values
126 + # Test that hifv_fluxboot stage was the 13th stage run (index 12)
128 127 try:
129 - #Open context of regression pipeline run
128 + # Open context of regression pipeline run
130 129 context = pipeline.Pipeline(context='last').context
131 130 fluxlist = context.results[12].read()[0].flux_densities
132 - rtol=1.0e-5 #Relative Tolerance
133 - atol=1.0e-8 #Absolute Tolerance
134 -
135 - #Open context "standard" for comparison
136 - #Test commit
137 - #standard_context = pipeline.Pipeline(context=standard_file+'.context', path_overrides={'name':standard_file, 'output_dir':os.getcwd()}).context
138 - #standard_fluxlist = standard_context.results[12].read()[0].flux_densities
139 - #value_compare43 = 0.6934577681171487
140 - #value_compare = 0.716367318068 #CASA 4.5
141 - #value_compare = 0.717857716108 #CASA 4.6
142 - #value_compare = 0.716364780148 #CASA 4.6.144 r36095, pipeline r36209 (trunk)
143 - #value_compare = 0.718457023749 #CASA-test 5.0.11-DEV (r38177)
144 - #value_compare = 0.71857779577 #CASA-prerelease 5.0.0-187, pipeline r40156
145 - #value_compare = 0.718551806637 #CASA-prerelease 5.1.0-34, pipeline r40615
146 - value_compare = 0.718519030402 #CASA-prerelease 5.3.0-26, pipeline r40909
131 + rtol = 1.0e-5 #Relative Tolerance
132 + atol = 1.0e-8 #Absolute Tolerance
133 +
134 + # value_compare43 = 0.6934577681171487
135 + # value_compare = 0.716367318068 # CASA 4.5
136 + # value_compare = 0.717857716108 # CASA 4.6
137 + # value_compare = 0.716364780148 # CASA 4.6.144 r36095, pipeline r36209 (trunk)
138 + # value_compare = 0.718457023749 # CASA-test 5.0.11-DEV (r38177)
139 + # value_compare = 0.71857779577 # CASA-prerelease 5.0.0-187, pipeline r40156
140 + # value_compare = 0.718551806637 # CASA-prerelease 5.1.0-34, pipeline r40615
141 + # value_compare = 0.718519030402 # CASA-prerelease 5.3.0-26, pipeline r40909
142 + value_compare = 0.718358266974 # CASA-prerelease 5.3.0-109, pipeline r41386
147 143
148 -
149 - #result_bool = np.isclose(fluxlist[0][0], standard_fluxlist[0][0], rtol=rtol, atol=atol, equal_nan=False)
150 144 result_bool = np.isclose(fluxlist[0][0], value_compare, rtol=rtol, atol=atol, equal_nan=False)
151 145
152 146 print >>logfile, "Accepted test value is: ", value_compare, " from CASA-prerelease 5.3.0-26, pipeline r40909 (trunk)"
153 147 print "Accepted test value is: ", value_compare, " from CASA-prerelease 5.3.0-26, pipeline r40909 (trunk)"
154 148 print >>logfile, "Regression generated value is: ", fluxlist[0][0]
155 149 print "Regression generated value is: ", fluxlist[0][0]
156 150
157 151 if (result_bool):
158 152 regstate=True
159 153 print >>logfile,"hifv_fluxboot values match within relative tolerance of 1.0e-05 and absolute tolerance of 1.0e-08"
169 163
170 164 except Exception, e:
171 165 regstate=False
172 166 print >>logfile,"hifv_fluxboot values are not within tolerances."
173 167 print "hifv_fluxboot values are not within tolerances."
174 168 print >>logfile,"hifv_fluxboot test FAILED."
175 169 print "hifv_fluxboot test FAILED."
176 170 print >>logfile, e
177 171 print e
178 172
179 - '''
180 - #Test flagging values
181 - #Test flagging statistics from the final applycal stage
182 - try:
183 - #Open context of regression pipeline run
184 - context = pipeline.Pipeline(context='last').context
185 - flagsummary= context.results[14].read()[0].flagsummary
186 -
187 - #Open context "standard" for comparison
188 -
189 - standard_context = pipeline.Pipeline(context=standard_file+'.context', path_overrides={'name':standard_file, 'output_dir':os.getcwd()}).context
190 - standard_flagsummary = standard_context.results[14].read()[0].flagsummary
191 - try:
192 - assert cmp(flagsummary, standard_flagsummary) == 0
193 - regstate=True
194 - print >>logfile,"hifv_applycals flagsummary dictionaries match."
195 - print "hifv_applycals flagsummary dictionaries match."
196 - print >>logfile,"hifv_applycals test PASSED."
197 - print "hifv_applycals test PASSED."
198 - except Exception, e:
199 - regstate=False
200 - print >>logfile,"hifv_applycals flagsummary dictionaries do NOT match."
201 - print "hifv_applycals flagsummary dictionaries do NOT match."
202 - print >>logfile,"hifv_applycals test FAILED."
203 - print "hifv_applycals test FAILED."
204 - print >>logfile, e
205 - print e
206 -
207 -
208 - except Exception, e:
209 - regstate=False
210 - print >>logfile,"hifv_fluxboot values are not within tolerances."
211 - print "hifv_fluxboot values are not within tolerances."
212 - print >>logfile,"hifv_fluxboot test FAILED."
213 - print "hifv_fluxboot test FAILED."
214 - print >>logfile, e
215 - print e
216 - '''
217 -
218 173 logfile.close()
219 174
220 175 def main():
221 176 try:
222 177 run()
223 178 stats()
224 179 except KeyboardInterrupt:
225 180 print "Interrupt requested...exiting"
226 181 except Exception:
227 182 traceback.print_exc(file=sys.stdout)
228 - #sys.exit(0)
229 183
230 184 if __name__ == "__main__":
231 185 main()
232 186 print "Regstate:" , regstate
233 187 if regstate:
234 - print "Regression PASSED"
188 + print "Regression PASSED"
235 189 else:
236 - print "Regression FAILED"
190 + print "Regression FAILED"

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut