From 6dd41088a261e327618ddfc2f141d5c4d52ba218 Mon Sep 17 00:00:00 2001 From: Rob Knop Date: Thu, 17 Oct 2024 09:00:01 -0700 Subject: [PATCH] Apply suggestions from code review Typos Co-authored-by: whohensee <106775295+whohensee@users.noreply.github.com> --- improc/scamp.py | 2 +- models/calibratorfile.py | 4 ++-- models/instrument.py | 4 ++-- pipeline/acquire_decam_refs.py | 2 -- pipeline/coaddition.py | 1 - pipeline/ref_maker.py | 6 +++--- tests/pipeline/test_coaddition.py | 2 -- util/logger.py | 2 +- 8 files changed, 9 insertions(+), 14 deletions(-) diff --git a/improc/scamp.py b/improc/scamp.py index 5a9ee428..731a1bb3 100644 --- a/improc/scamp.py +++ b/improc/scamp.py @@ -122,7 +122,7 @@ def solve_wcs_scamp( sources, catalog, crossid_radius=2., t0 = time.perf_counter() # Don't catch the timeout exception; assume that if it times out first time around, - # it's not going to succeed with other paramters. This is maybe too strong of + # it's not going to succeed with other parameters. This is maybe too strong of # an assumption, but it will often be true, and when it is, catching the exception # and retrying turns this into a multi-minute timewaster. res = subprocess.run( command, capture_output=True, timeout=timeout ) diff --git a/models/calibratorfile.py b/models/calibratorfile.py index 0d2054b9..37a2cdad 100644 --- a/models/calibratorfile.py +++ b/models/calibratorfile.py @@ -327,11 +327,11 @@ def acquire_lock( cls, instrument, section, calibset, calibtype, flattype=None, # each time, but that had a race condition of its own. When launching a # bunch of processes with a multiprocessing pool, they'd all be synchronized # enough that multiple processes would get to a long sleep at the same time, - # and then all pool for the lock at clse enough to the same time that only + # and then all pool for the lock at close enough to the same time that only # one would get it. The rest would all wait a very long time (while, for # most of it, no lock was being held) before trying again. They'd only have # a few tries left, and ultimately several would fail. So, instead, wait a - # random amount of time, to prevent syncronization. + # random amount of time, to prevent synchronization. tsleep = sleepmin + math.fabs( random.normalvariate( mu=0., sigma=sleepsigma ) ) time.sleep( tsleep ) totsleep += tsleep diff --git a/models/instrument.py b/models/instrument.py index 7cbb9171..c6ce58d0 100644 --- a/models/instrument.py +++ b/models/instrument.py @@ -2180,7 +2180,7 @@ def exposure_coords( self, index ): ra, dec : float, float """ - raise NotImplementedError( f"{self.__class__.__name__} has't implemetned exposure_coords" ) + raise NotImplementedError( f"{self.__class__.__name__} hasn't implemented exposure_coords" ) def exposure_depth( self, index ): """Return a number in magnitudes that relates to depth of exposure. @@ -2190,7 +2190,7 @@ def exposure_depth( self, index ): Parameters ---------- index: int - Index into encapsulated expolsures + Index into encapsulated exposures Returns ------- diff --git a/pipeline/acquire_decam_refs.py b/pipeline/acquire_decam_refs.py index cf9b59df..0708b769 100644 --- a/pipeline/acquire_decam_refs.py +++ b/pipeline/acquire_decam_refs.py @@ -302,7 +302,6 @@ def extract_image_and_do_things( self, exposure, section_id ): 'calibset': 'externally_supplied', 'flattype': 'externally_supplied', 'steps_required': [ 'overscan', 'linearity', 'flat', 'fringe' ]} ) - import pdb; pdb.set_trace() pipeline.run( ds, no_provtag=True, ok_no_ref_provs=True ) ds.reraise() @@ -339,7 +338,6 @@ def download_and_extract( self, origexps, usefuldexen ): """Download identified exposures; load them and their images into the database.""" SCLogger.info( f"============ Downloading {len(usefuldexen)} reduced exposures." ) - # exposures = origexps.download_and_commit_exposures( list(usefuldexen) ) exposures = origexps.download_and_commit_exposures( list(usefuldexen), delete_downloads=False, existing_ok=True ) diff --git a/pipeline/coaddition.py b/pipeline/coaddition.py index d1d510e4..b302eb16 100644 --- a/pipeline/coaddition.py +++ b/pipeline/coaddition.py @@ -616,7 +616,6 @@ def _coadd_swarp( self, ] ) - # SCLogger.debug( f"Running swarp to coadd {len(sumimgs)} images" ) SCLogger.debug( f"Running swarp to coadd {len(sumimgs)} images; swarp command is {command}" ) t0 = time.perf_counter() res = subprocess.run( command, capture_output=True, timeout=self.pars.swarp_timeout ) diff --git a/pipeline/ref_maker.py b/pipeline/ref_maker.py index 341f060d..2689f85d 100644 --- a/pipeline/ref_maker.py +++ b/pipeline/ref_maker.py @@ -136,7 +136,7 @@ def __init__(self, **kwargs): 'preprocessing_prov', None, (str, None), - "Provenance ID of preprocessing provenacne to search for images for. Be careful using this! " + "Provenance ID of preprocessing provenance to search for images for. Be careful using this! " "Do not use this if you have more than one instrument. If you don't specify this, it will " "be determined automatically using config, which is usually what you want.", critical=True @@ -660,7 +660,7 @@ def run(self, *args, do_not_build=False, **kwargs ): """Look to see if there is an existing reference that matches the specs; if not, optionally build one. See parse_arguments for function call parameters. The remaining - policy for which images to picdk, and what provenacne to use to + policy for which images to pick, and what provenance to use to find references, is defined by the parameters object of self and self.pipeline. @@ -717,7 +717,7 @@ def run(self, *args, do_not_build=False, **kwargs ): return None elif ( not self.pars.min_only_center ) and any( c < self.pars.min_number for c in match_count ): SCLogger.info( f"RefMaker didn't find enough references at at least one point on the image; " - f"match_count={match_count}, min_number={self.mars.min_number}" ) + f"match_count={match_count}, min_number={self.pars.min_number}" ) return None # Sort the images and create data stores for all of them diff --git a/tests/pipeline/test_coaddition.py b/tests/pipeline/test_coaddition.py index 66fb38d6..91e4194b 100644 --- a/tests/pipeline/test_coaddition.py +++ b/tests/pipeline/test_coaddition.py @@ -607,5 +607,3 @@ def test_coadd_17_decam_images_swarp( decam_17_offset_refs, decam_four_refs_alig assert img.flags.shape == img.data.shape assert img.weight.shape == img.weight.shape - # import pdb; pdb.set_trace() - # pass diff --git a/util/logger.py b/util/logger.py index 15731ccb..0276fd99 100644 --- a/util/logger.py +++ b/util/logger.py @@ -68,7 +68,7 @@ def replace( cls, midformat=None, datefmt=None, level=None ): @classmethod def multiprocessing_replace( cls, datefmt=None, level=None ): - """Shorthand for replace with midformat parsed from the current muiltiprocessing process.""" + """Shorthand for replace with midformat parsed from the current multiprocessing process.""" me = multiprocessing.current_process() # Usually processes are named things like ForkPoolWorker-{number}, or something