From a8a13fb45b6166632838e7e818d9abc17a7d02b5 Mon Sep 17 00:00:00 2001 From: alphasentaurii Date: Thu, 4 Apr 2024 15:35:53 -0400 Subject: [PATCH] added xtimer decorator --- spacekit/analyzer/track.py | 6 ++---- spacekit/preprocessor/ingest.py | 6 ++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spacekit/analyzer/track.py b/spacekit/analyzer/track.py index 9357256..3535032 100644 --- a/spacekit/analyzer/track.py +++ b/spacekit/analyzer/track.py @@ -4,7 +4,7 @@ import os import glob import time -from spacekit.logger.log import Logger +from spacekit.logger.log import Logger, SPACEKIT_LOG class Stopwatch: @@ -31,7 +31,6 @@ def wrap(*args, **kwargs): result = self.func(*args, **kwargs) self.stop() return result - return wrap def start(self): @@ -186,7 +185,6 @@ def wrap(*args, **kwargs): stopwatch(ps, t0=start, t1=end) print(end - start) return result - return wrap @@ -209,6 +207,6 @@ def inner(*args, **kwargs): to_execute = fn(*args, **kwargs) end_time = time.perf_counter() execution_time = end_time - start_time - print('{0} took {1:.8f}s to execute'.format(fn.__name__, execution_time)) + SPACEKIT_LOG.info('{0} took {1:.8f}s to execute'.format(fn.__name__, execution_time)) return to_execute return inner diff --git a/spacekit/preprocessor/ingest.py b/spacekit/preprocessor/ingest.py index 9c37f69..c7996ee 100644 --- a/spacekit/preprocessor/ingest.py +++ b/spacekit/preprocessor/ingest.py @@ -10,7 +10,7 @@ from spacekit.preprocessor.scrub import HstSvmScrubber, JwstCalScrubber from spacekit.generator.draw import DrawMosaics from spacekit.skopes.jwst.cal.config import KEYPAIR_DATA, KEYPAIR_DATA_V2, L3_TYPES -from spacekit.analyzer.track import timer, record_metrics +from spacekit.analyzer.track import timer, record_metrics, xtimer class SvmAlignmentIngest: @@ -285,6 +285,7 @@ def set_outpath(self, value=None): self.rempath = self.outpath + "/rem-{}.csv" self.rawpath = self.outpath + "/raw-{}.csv" + @xtimer def run_ingest(self, save_l1=True): self.ingest_data() if len(self.files) == 0: @@ -495,10 +496,11 @@ def drop_mosaics(self): self.df.drop('mosaic', axis=1, inplace=True) def scrub_exposures(self): + KEYPAIR_DATA.update(KEYPAIR_DATA_V2) # TEMP self.scrb = JwstCalScrubber( self.input_path, data=self.df.loc[self.df[self.dag].isin(self.l1_dags)], - encoding_pairs=KEYPAIR_DATA.update(KEYPAIR_DATA_V2), + encoding_pairs=KEYPAIR_DATA, mode='df' ) for exp_type in self.exp_types: