Public Member Functions | |
def | setUp |
def | tearDown |
def | test_bad_imagename |
Incorrect inputs to parameters. | |
def | test_bad_linefile |
def | test_bad_contfile |
def | test_bad_fitorder |
def | test_bad_region |
def | test_bad_chans |
def | test_bad_box |
def | test_bad_stokes |
def | test_fitorder |
Continuum subtraction correctness test. | |
def | cmp_images |
def | test_box_and_chans |
Definition at line 129 of file test_imcontsub.py.
def tests.test_imcontsub.imcontsub_test.cmp_images | ( | self, | |
newimg, | |||
oldimg, | |||
errmsg, | |||
retval, | |||
tol = 1.0e-8 |
|||
) |
Check that newimg matches oldimg to within tol. errmsg is a descriptive label in case there is an error. retval is updated with the results and returned.
Definition at line 454 of file test_imcontsub.py.
References irc_cs_task_regression.max.
Referenced by tests.test_imcontsub.imcontsub_test.test_box_and_chans(), and tests.test_imcontsub.imcontsub_test.test_fitorder().
def tests.test_imcontsub.imcontsub_test.setUp | ( | self | ) |
Definition at line 131 of file test_imcontsub.py.
def tests.test_imcontsub.imcontsub_test.tearDown | ( | self | ) |
Definition at line 141 of file test_imcontsub.py.
def tests.test_imcontsub.imcontsub_test.test_bad_box | ( | self | ) |
Test bad box parameter causes failure
Definition at line 245 of file test_imcontsub.py.
Test bad chans parameter causes failure
Definition at line 226 of file test_imcontsub.py.
Test bad continuum file name fails
Definition at line 188 of file test_imcontsub.py.
Test bad fitorder fails
Definition at line 199 of file test_imcontsub.py.
Incorrect inputs to parameters.
The parameters are: imagename linefile contfile fitorder region box chans stokes
Returns True if successful, and False if it has failed.
Test bad image name throws exception
Definition at line 166 of file test_imcontsub.py.
Test bad line file name fails
Definition at line 177 of file test_imcontsub.py.
Test bad region parameter fails
Definition at line 208 of file test_imcontsub.py.
Test bad stokes parameter causes failure
Definition at line 272 of file test_imcontsub.py.
Imcontsub: Testing box and chans
Definition at line 479 of file test_imcontsub.py.
References tests.test_imcontsub.imcontsub_test.cmp_images().
def test_continuum(self): '''Imcontsub: Testing continuum sub correctness''' retValue = {'success': True, 'msgs': "", 'error_msgs': '' } casalog.post( "Starting imcontsub CONTINUUM SUB CORRECTNESS tests.", 'NORMAL2' ) try: results=imcontsub( 'g192_a2.image', fitorder=0, contfile='cont_test_cont1', linefile='cont_test_line1' ) except Exception, err: retValue['success']=False retValue['error_msgs']=retValue['error_msgs']\ +"\nError: Unable to subtract continuum with a fit order of 0 "\ +"\n\t REULTS: "+str(results) else: if ( not os.path.exists( 'cont_test_cont1' ) or not os.path.exists( 'cont_test_line1' ) or not results ): retValue['success']=False retValue['error_msgs']=retValue['error_msgs']\ +"\nError: continuum 3 output files were NOT created." else:
for count in range(0,50): x = random.randint(0,511) y = random.randint(0,511) box=str(x)+','+str(y)+','+str(x)+','+str(y) chan = str(random.randint(0,39)) line_prev_value={} line_cur_value={'empty':''} try: line_prev_value = imval( 'g192_a2.contfree', box=box, chans=chan, stokes='I' ) line_cur_value = imval( 'cont_test_line1', box=box, chans=chan, stokes='I' ) except: retValue['success']=False retValue['error_msgs']=retValue['error_msgs']\ +"\nError: Unable to compare spectral line files." else:
casalog.post( "*** line_prev_value " + str(line_prev_value), 'WARN') casalog.post( "*** line_cur_value " + str(line_cur_value), 'WARN') if ( (line_prev_value['data'] != line_cur_value['data']).any() ): retValue['success'] = False retValue['error_msgs'] = ': spectral line value differs with '\
if ( (cont_prev_value['data'] != cont_cur_value['data']).any() ): retValue['success'] = False retValue['error_msgs'] = ': continuum value differs with '\
self.assertTrue(retValue['success'],retValue['error_msgs']) Region selection correction test.
This test selects a region for continuum subtraction. Checks are done to make sure only the data in the selected region changes.
Returns True if successful, and False if it has failed. Fitorder tests correctness test.
This test subtacts the continuum from the g192 data file for fitorder =1 and fitorder=2, note that fitorder=0 is tested in the continuum test and valid/invalid inputs to the fitorder paramter are tested in the input test.
The results, image file contents, are compared with previously created image files.
Returns True if successful, and False if it has failed.
Imcontsub: testing fitorder correctness
Definition at line 405 of file test_imcontsub.py.
References tests.test_imcontsub.imcontsub_test.cmp_images().