Coverage for tests/testSSM_Diasources.py : 68%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# Observation metadata modules # To access opsim sqlite database # photometric parameters (exptime lives here for dmag calculation) # SSM catalog modules # For camera.
# Build sso instance class 'skyVelocity', 'dist', 'dmagTrailing', 'dmagDetection', 'sedFilename', 'magFilter', 'magSNR', 'visibility', 'seeing', 'bandpass', 'visitExpTime', 'm5']
'velRa': np.degrees, 'velDec': np.degrees}
'velRa': np.degrees, 'velDec': np.degrees}
######
def tearDownClass(cls):
# Fake opsim data.
limit=3, boundLength=2.2)
for obsMeta in obsMetaDataResults: # But moving objects databases are not currently complete for all years. # Push forward to night=747. # (note that we need the phosim dictionary as well)
newMJD = 59590.2 # this MJD is artificially chosen to be in the # time span of the new baseline simulated survey
obs = ObservationMetaData(mjd=newMJD, pointingRA=obsMeta.pointingRA, pointingDec=obsMeta.pointingDec, bandpassName=obsMeta.bandpass, rotSkyPos=obsMeta.rotSkyPos, m5=obsMeta.m5[obsMeta.bandpass], seeing=obsMeta.seeing[obsMeta.bandpass], boundLength=obsMeta.boundLength, boundType=obsMeta.boundType)
obs._OpsimMetaData = {'visitExpTime': 30}
mySsmDb = ssmCatCamera(ssmObj, obs_metadata = obs) photParams = PhotometricParameters(exptime = obs.OpsimMetaData['visitExpTime'], nexp=1, bandpass=obs.bandpass) mySsmDb.photParams = photParams
try: with lsst.utils.tests.getTempFilePath('.txt') as output_cat: mySsmDb.write_catalog(output_cat, write_header=write_header, write_mode=write_mode)
# verify that we did not write an empty catalog with open(output_cat, 'r') as input_file: lines = input_file.readlines() msg = 'MJD is %.3f' % obs.mjd.TAI self.assertGreater(len(lines), 1, msg=msg) except: # This is because the solar system object 'tables' # don't actually connect to tables on fatboy; they just # call methods stored on fatboy. Therefore, the connection # failure will not be noticed until this part of the test msg = sys.exc_info()[1].args[0] if 'DB-Lib error' in msg: reassure() continue else: raise
write_mode = 'a' write_header = False
dt, t = dtime(t) print('To query solar system objects: %f seconds (obs MJD time %f)' % (dt, obs.mjd.TAI))
# if the exception was because of a failed connection # to fatboy, ignore it.
else: raise
lsst.utils.tests.init() unittest.main() |