Skip to content

Commit

Permalink
added xtimer decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
alphasentaurii committed Apr 4, 2024
1 parent 1817871 commit a8a13fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 2 additions & 4 deletions spacekit/analyzer/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -31,7 +31,6 @@ def wrap(*args, **kwargs):
result = self.func(*args, **kwargs)
self.stop()
return result

return wrap

def start(self):
Expand Down Expand Up @@ -186,7 +185,6 @@ def wrap(*args, **kwargs):
stopwatch(ps, t0=start, t1=end)
print(end - start)
return result

return wrap


Expand All @@ -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
6 changes: 4 additions & 2 deletions spacekit/preprocessor/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a8a13fb

Please sign in to comment.