From b4349d61dfe4bdbbdecd764ef8f5fb4e04e1f0f0 Mon Sep 17 00:00:00 2001 From: Rob Knop Date: Fri, 11 Oct 2024 13:19:18 -0700 Subject: [PATCH] cleanup --- pipeline/ref_maker.py | 75 ------------------------------- tests/fixtures/decam.py | 2 +- tests/pipeline/test_coaddition.py | 12 ++--- 3 files changed, 7 insertions(+), 82 deletions(-) diff --git a/pipeline/ref_maker.py b/pipeline/ref_maker.py index acef3a7d..341f060d 100644 --- a/pipeline/ref_maker.py +++ b/pipeline/ref_maker.py @@ -386,81 +386,6 @@ def setup_provenances(self, session=None): self.ref_prov.insert_if_needed() - # ====================================================================== - - # def parse_arguments(self, *args, **kwargs): - # """Figure out if the input parameters are given as coordinates or as target + section ID pairs. - - # Possible combinations: - # - float + float + string: interpreted as RA/Dec in degrees - # - str + str: try to interpret as sexagesimal (RA as hours, Dec as degrees) - # if it fails, will interpret as target + section ID - # # TODO: can we identify a reference with only a target/field ID without a section ID? Issue #320 - # In addition to the first two arguments, can also supply a filter name as a string - # and can provide a session object as an argument (in any position) to be used and kept open - # for the entire run. If not given a session, will open a new one and close it when done using it internally. - - # Alternatively, can provide named arguments with the same combinations for either - # (ra, dec) or (target, section_id) and filter. - - # Returns - # ------- - # session: sqlalchemy.orm.session.Session object or None - # The session object, if it was passed in as a positional argument. - # If not given, the ref maker will just open and close sessions internally - # when needed. - # """ - # self.ra = None - # self.dec = None - # self.target = None - # self.section_id = None - # self.filter = None - - # args, kwargs, session = parse_session(*args, **kwargs) # first pick out any sessions - - # if len(args) == 3: - # if not isinstance(args[2], str): - # raise ValueError('Third argument must be a string, the filter name!') - # self.filter = args[2] - # args = args[:2] # remove the last one - - # if len(args) == 2: - # if isinstance(args[0], (float, int, np.number)) and isinstance(args[1], (float, int, np.number)): - # self.ra = float(args[0]) - # self.dec = float(args[1]) - # if isinstance(args[0], str) and isinstance(args[1], str): - # try: - # self.ra = parse_sexigesimal_degrees(args[0], hours=True) - # self.dec = parse_sexigesimal_degrees(args[1], hours=False) - # except ValueError: - # self.target, self.section_id = args[0], args[1] - # elif len(args) == 0: # parse kwargs instead! - # if 'ra' in kwargs and 'dec' in kwargs: - # self.ra = kwargs.pop('ra') - # if isinstance(self.ra, str): - # self.ra = parse_sexigesimal_degrees(self.ra, hours=True) - - # self.dec = kwargs.pop('dec') - # if isinstance(self.dec, str): - # self.dec = parse_sexigesimal_degrees(self.dec, hours=False) - - # elif 'target' in kwargs and 'section_id' in kwargs: - # self.target = kwargs.pop('target') - # self.section_id = kwargs.pop('section_id') - # else: - # raise ValueError('Cannot find ra/dec or target/section_id in any of the inputs! ') - - # if 'filter' in kwargs: - # self.filter = kwargs.pop('filter') - - # else: - # raise ValueError('Invalid number of arguments given to RefMaker.parse_arguments()') - - # if self.filter is None: - # raise ValueError('No filter given to RefMaker.parse_arguments()!') - - # return session - # ====================================================================== def _append_provenance_to_refset_if_appropriate( self, existing, session ): diff --git a/tests/fixtures/decam.py b/tests/fixtures/decam.py index 86c122a2..b6b8daa7 100644 --- a/tests/fixtures/decam.py +++ b/tests/fixtures/decam.py @@ -367,7 +367,7 @@ def decam_datastore( decam_exposure, 'S3', cache_dir=decam_cache_dir, - cache_base_name='007/c4d_20230702_080904_S3_r_Sci_PN4G4I', + cache_base_name='007/c4d_20230702_080904_S3_r_Sci_IDDLGQ', overrides={ 'subtraction': { 'refset': 'test_refset_decam' } }, save_original_image=True, provtag='decam_datastore' diff --git a/tests/pipeline/test_coaddition.py b/tests/pipeline/test_coaddition.py index 37fd1070..f6d30f66 100644 --- a/tests/pipeline/test_coaddition.py +++ b/tests/pipeline/test_coaddition.py @@ -558,18 +558,18 @@ def test_coadd_partial_overlap_swarp( decam_four_offset_refs, decam_four_refs_al # (I manually looked at the image and picked out a few spots) # Check that the weight is higher in a region where two images actually overlapped - assert img.weight[ 550:640, 975:1140 ].mean() == pytest.approx( 0.0199, abs=0.0005 ) - assert img.weight[ 690:770, 930:1050 ].mean() == pytest.approx( 0.0131, abs=0.0005 ) + assert img.weight[ 550:640, 975:1140 ].mean() == pytest.approx( 0.020, abs=0.001 ) + assert img.weight[ 690:770, 930:1050 ].mean() == pytest.approx( 0.013, abs=0.001 ) # Look at a spot with a star, and a nearby sky, in a place where there was only # one image in the coadd - assert img.data[ 3217:3231, 479:491 ].sum() == pytest.approx( 82530., abs=25. ) - assert img.data[ 3217:3231, 509:521 ].sum() == pytest.approx( 231., abs=25. ) + assert img.data[ 3217:3231, 479:491 ].sum() == pytest.approx( 84485., abs=25. ) + assert img.data[ 3217:3231, 509:521 ].sum() == pytest.approx( 210., abs=25. ) # Look at a spot with a galaxy and a nearby sky, in a place where there were # two images in the sum - assert img.data[ 237:266, 978:988 ].sum() == pytest.approx( 7918., abs=10. ) - assert img.data[ 237:266, 1008:1018 ].sum() == pytest.approx( 44., abs=10. ) + assert img.data[ 237:266, 978:988 ].sum() == pytest.approx( 8088., abs=10. ) + assert img.data[ 237:266, 1008:1018 ].sum() == pytest.approx( 53., abs=10. ) # This test is very slow, and also perhaps a bit much given that it downloads # and swarps together 17 images. As such, put in two conditions to skip it;