def test_sfcm_reprocess(self): """Branch 13 - SF + CM with reprocessing""" # Add images & sources to DB first stages = { 'source finding': True, 'source association': False, 'catalog matching': False } opts = { 'save to database': True, 'quality checks': True, 'overwrite': False, 'reprocess': True, 'redo match': False, 'update match': False } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) # Re-do SF & add in CM stages = { 'source finding': True, 'source association': False, 'catalog matching': True } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) self.assertEqual(vdp.branch, 13)
def test_sapass_cmonly(self): """Branch 21 - SA already done, CM only""" # Run SF + SA first stages = { 'source finding': True, 'source association': True, 'catalog matching': False } opts = { 'save to database': True, 'quality checks': True, 'overwrite': False, 'reprocess': False, 'redo match': False, 'update match': False } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) # Now try to run SA + CM stages = { 'source finding': False, 'source association': True, 'catalog matching': True } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) self.assertEqual(vdp.branch, 21)
def test_cmonly_fail(self): """Branch 16 - CM only, but stage < 2""" # Add images & sources to database stages = { 'source finding': True, 'source association': False, 'catalog matching': False } opts = { 'save to database': True, 'quality checks': True, 'overwrite': False, 'reprocess': False, 'redo match': False, 'update match': False } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) # Now try to run CM only stages = { 'source finding': False, 'source association': False, 'catalog matching': True } opts['save to database'] = False # Should fail due to stage < 2 vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) self.assertEqual(vdp.branch, 16)
def test_sacm(self): """Branch 20 - SA + CM""" # Run SF first stages = { 'source finding': True, 'source association': False, 'catalog matching': False } opts = { 'save to database': True, 'quality checks': True, 'overwrite': False, 'reprocess': False, 'redo match': False, 'update match': False } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) # Now run SA + CM stages = { 'source finding': False, 'source association': True, 'catalog matching': True } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) self.assertEqual(vdp.branch, 20)
def test_cmredo(self): """Branch 17.2 - redo existing CM only""" # Run SF + SA + CM first stages = { 'source finding': True, 'source association': True, 'catalog matching': True } opts = { 'save to database': True, 'quality checks': True, 'overwrite': False, 'reprocess': False, 'redo match': False, 'update match': False } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) # Now redo CM stages = { 'source finding': False, 'source association': False, 'catalog matching': True } opts = { 'save to database': True, 'quality checks': True, 'overwrite': False, 'reprocess': False, 'redo match': True, 'update match': False } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) self.assertEqual(vdp.branch, 17.2)
def test_saonly_already_done(self): """Branch 18 - SA already done, so do nothing""" # Process through SA first stages = { 'source finding': True, 'source association': True, 'catalog matching': False } opts = { 'save to database': True, 'quality checks': True, 'overwrite': False, 'reprocess': True, 'redo match': False, 'update match': False } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) # Now try SA only stages = { 'source finding': False, 'source association': True, 'catalog matching': False } opts['save to database'] = False # Code should exit vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) self.assertEqual(vdp.branch, 18)
def test_saonly(self): """Branch 19 - SA only""" # Add sources to database stages = { 'source finding': True, 'source association': False, 'catalog matching': False } opts = { 'save to database': True, 'quality checks': True, 'overwrite': False, 'reprocess': False, 'redo match': False, 'update match': False } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) # Now do SA only stages = { 'source finding': False, 'source association': True, 'catalog matching': False } opts['save to database'] = False vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) self.assertEqual(vdp.branch, 19)
def test_no_sf_stage1(self): """Branch 7 - trying to sa/cm before sf, existing image""" # Add images to DB first stages = { 'source finding': False, 'source association': False, 'catalog matching': False } opts = { 'save to database': True, 'quality checks': True, 'overwrite': False, 'reprocess': False, 'redo match': False, 'update match': False } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) # Now try to sa/cm before sf stages = { 'source finding': False, 'source association': True, 'catalog matching': True } opts['save to database'] = False vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) self.assertEqual(vdp.branch, 7)
def test_all_new_image(self): """Branch 12 - SF + SA + CM on new image""" stages = { 'source finding': True, 'source association': True, 'catalog matching': True } opts = { 'save to database': True, 'quality checks': True, 'overwrite': False, 'reprocess': False, 'redo match': False, 'update match': False } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) self.assertEqual(vdp.branch, 12)
def test_no_stages_add_new_image(self): """Branch 2 - add new image to DB""" stages = { 'source finding': False, 'source association': False, 'catalog matching': False } opts = { 'save to database': True, 'quality checks': True, 'overwrite': False, 'reprocess': False, 'redo match': False, 'update match': False } # Pipeline should stop after adding image to DB vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) self.assertEqual(vdp.branch, 2)
def test_no_stages_no_reprocess(self): """Branch 3 - image already in DB, no reprocess""" # Need to add images to DB first stages = { 'source finding': False, 'source association': False, 'catalog matching': False } opts = { 'save to database': True, 'quality checks': True, 'overwrite': False, 'reprocess': False, 'redo match': False, 'update match': False } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) # Now try to add again; nothing should happen vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) self.assertEqual(vdp.branch, 3)
def test_cmupdate(self): """Branch 17.3 - add new catalog to existing CM results""" # Run SF + SA + CM with NVSS catalog only stages = { 'source finding': True, 'source association': True, 'catalog matching': True } opts = { 'save to database': True, 'quality checks': True, 'overwrite': False, 'reprocess': False, 'redo match': False, 'update match': False } vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) # Now run CM again adding the WENSS catalog stages = { 'source finding': False, 'source association': False, 'catalog matching': True } opts = { 'save to database': True, 'quality checks': True, 'overwrite': False, 'reprocess': False, 'redo match': False, 'update match': True } self.catalogs = ['WENSS'] vdp.process(self.conn, stages, opts, self.dirs, self.files, self.catalogs, self.sfparams, self.qaparams) self.assertEqual(vdp.branch, 17.3)