Changeset 29438 for branches/sc_branches/psps_testing/testers/fits/p2.py
- Timestamp:
- Oct 15, 2010, 2:51:13 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/sc_branches/psps_testing/testers/fits/p2.py
r29228 r29438 49 49 True 50 50 """ 51 PsPsLogger.info('Testing P2FitsTester object') 52 # 1. There is no image for the PrimaryHDU (at 0) 53 PsPsLogger.debug(' Testing P2FitsTester object: primary') 54 product = self.test_primary() 55 if not product.success: 56 return product 57 # 2. Look at the FrameMeta information 58 PsPsLogger.debug(' Testing P2FitsTester object: frameMeta') 59 product = self.test_frame_meta(be_tolerant_for_types) 60 # Fail if there is any failure and we are type-strict 61 if not product.success and not be_tolerant_for_types: 62 return product 63 # 3. There should be 'product.nOTA' sequences of [ImageMeta, 64 # Detection, SkinnyObject, ObjectCalColor] frames 65 frameID = product.frameID 66 nOTA = product.nOTA 67 if len(self.fits) != 4*nOTA + 2: 68 TestReport.ko('Invalid number of OTA: from FITS file: %d / from FrameMeta %d' 69 % (len(self.fits)-2/4, nOTA), 51 try: 52 PsPsLogger.info('Testing P2FitsTester object') 53 # 1. There is no image for the PrimaryHDU (at 0) 54 PsPsLogger.debug(' Testing P2FitsTester object: primary') 55 product = self.test_primary() 56 if not product.success: 57 return product 58 # 2. Look at the FrameMeta information 59 PsPsLogger.debug(' Testing P2FitsTester object: frameMeta') 60 product = self.test_frame_meta(be_tolerant_for_types) 61 # Fail if there is any failure and we are type-strict 62 if not product.success and not be_tolerant_for_types: 63 return product 64 # 3. There should be 'product.nOTA' sequences of [ImageMeta, 65 # Detection, SkinnyObject, ObjectCalColor] frames 66 frameID = product.frameID 67 nOTA = product.nOTA 68 if len(self.fits) != 4*nOTA + 2: 69 TestReport.ko('Invalid number of OTA: from FITS file: %d / from FrameMeta %d' 70 % (len(self.fits)-2/4, nOTA), 71 {'requirement': 'TBD'}) 72 return TestProduct() 73 for ota_index in range(nOTA): 74 PsPsLogger.debug(' Testing P2FitsTester object: OTA (%d/%d)' 75 % ((ota_index+1), nOTA)) 76 subproduct = self.test_detections_frames(frameID, ota_index, 77 be_tolerant_for_types) 78 if subproduct.success: 79 TestReport.ok(requirement) 80 product.success = product.success and subproduct.success 81 return product 82 except KeyError, e: 83 PsPsLogger.error(' Exception caught!') 84 TestReport.ko('Unexpected exception', 70 85 {'requirement': 'TBD'}) 86 TestReport.info(e) 71 87 return TestProduct() 72 for ota_index in range(nOTA): 73 PsPsLogger.debug(' Testing P2FitsTester object: OTA (%d/%d)' 74 % ((ota_index+1), nOTA)) 75 subproduct = self.test_detections_frames(frameID, ota_index, 76 be_tolerant_for_types) 77 if subproduct.success: 78 TestReport.ok(requirement) 79 product.success = product.success and subproduct.success 80 return product 88 81 89 82 90 ##################################################### … … 91 99 fits_index = 4*ota_index+2 92 100 product = TestProduct() 93 TestReport. title('Data frames tests')101 TestReport.addSection('Data frames tests') 94 102 if self.fits[fits_index].name != 'IMAGEMETA': 95 103 TestReport.ko(requirement, … … 115 123 query = 'SELECT * FROM ImageMeta WHERE imageID = %s' % str(imageID) 116 124 answer = self.psi_inquisitor.query(query) 117 TestReport. title('ImageMeta values tests (frame %d - %s)'118 % (ota_index, query))125 TestReport.addSection('ImageMeta values tests (frame %d - %s)' 126 % (ota_index, query)) 119 127 subproduct = match(self.fits[fits_index].data, answer, requirement, 120 128 tolerance = Configuration.TOLERANCE, … … 158 166 """ 159 167 Tests the contents of the FrameMeta table. 160 - 48 columns x 1 row161 - This table contains values that are useful, namely: frameID,162 nOTA (number of OTA).163 - The data can be found in PSI using the query:168 - 48 columns x 1 row 169 - This table contains values that are useful, namely: frameID, 170 nOTA (number of OTA). 171 - The data can be found in PSI using the query: 164 172 SELECT * FROM FrameMeta WHERE frameID = <frameID>; 165 173 """ 166 174 requirement = 'PSDC-940-006-01, 3.6.6.8: ' 167 175 product = TestProduct() 168 TestReport. title('MetaFrame tests')176 TestReport.addSection('MetaFrame tests') 169 177 if self.fits[1].header['NAXIS'] != 2: 170 178 TestReport.ko(requirement, 'NAXIS != 2') … … 196 204 Check that the primary header i.e. fits[0] has no dimension. 197 205 """ 198 TestReport. title('Primary frame tests')206 TestReport.addSection('Primary frame tests') 199 207 requirement = 'PSDC-940-006-01, 3.6.3, 1' 200 208 product = TestProduct()
Note:
See TracChangeset
for help on using the changeset viewer.
