Skip to content

Commit

Permalink
Move checking for excluded MJDs earlier in the process
Browse files Browse the repository at this point in the history
  • Loading branch information
ndrory committed Nov 7, 2024
1 parent ebadfde commit be46ba3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions python/lvmdrp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1504,14 +1504,6 @@ def science_reduction(expnum: int, use_longterm_cals: bool = False,

log.info(f"Reducing MJD {sci_mjd}, exposure {expnum}, tile_id {sci_tileid} ... ")

# skip this reduction if the MJD is in a list of excluded (bad, engineering...) MJDs
exclude_file = os.getenv('LVMCORE_DIR') + '/etc/exclude_mjds.txt'
with open(exclude_file) as exclude_mjd_file:
exclude = [tuple(map(int, line.split(','))) for line in exclude_mjd_file]
if any([m[0] <= sci_mjd <= m[1] for m in exclude]):
log.info(f"MJD {sci_mjd} falls within excluded period in {exclude_file}, skipping ...")
return

cals_mjd = get_master_mjd(sci_mjd) if use_longterm_cals else sci_mjd
log.info(f"target master MJD: {cals_mjd}")

Expand Down Expand Up @@ -1740,6 +1732,14 @@ def run_drp(mjd: Union[int, str, list], expnum: Union[int, str, list] = None,
log.warning(f'{mjd = } is not valid raw data directory.')
return

# skip this reduction if the MJD is in a list of excluded (bad, engineering...) MJDs
exclude_file = os.getenv('LVMCORE_DIR') + '/etc/exclude_mjds.txt'
with open(exclude_file) as exclude_mjd_file:
exclude = [tuple(map(int, line.split(','))) for line in exclude_mjd_file]
if any([m[0] <= mjd <= m[1] for m in exclude]):
log.info(f"MJD {mjd} falls within excluded period in {exclude_file}, skipping ...")
return

# generate the MJD metadata
frames = get_frames_metadata(mjd=mjd)
sub = frames.copy()
Expand Down

0 comments on commit be46ba3

Please sign in to comment.