From a195c06f3d8ea74f0bd62b640bd3afeef6f53741 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 17 Sep 2024 12:10:42 -0700 Subject: [PATCH] add notes on daily loading --- doc/dynamic.rst | 12 ++++++++++++ py/specprodDB/load.py | 26 +++++++++++++------------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/doc/dynamic.rst b/doc/dynamic.rst index 5e5efaf..ce3ebd6 100644 --- a/doc/dynamic.rst +++ b/doc/dynamic.rst @@ -27,6 +27,9 @@ Daily Database Loading Requirements Possible Load Scenario ---------------------- +For individual tiles +~~~~~~~~~~~~~~~~~~~~ + 1. Read ``tiles-daily``, find changes. Update ``daily.tile``. 2. Find corresponding exposures. Update ``daily.exposure``, ``daily.frame``. 3. Find any *new* fiberassign files and obtain the list of new potentials (because potentials include observed targets). @@ -35,6 +38,15 @@ Possible Load Scenario 6. Update ``daily.fiberassign``, ``daily.potential``. 7. Read corresponding ``tiles/cumulative`` redshift files. Update ``daily.ztile``. +For initial load +~~~~~~~~~~~~~~~~ + +1. Load the exposures and tiles files. +2. Compute "monolithic" redshift catalogs. These are needed as input to photometry. +3. Create "monolithic" photometry and target catalogs. +4. The load procedure then resembles loading a static specprod, just without healpix redshifts. +5. Update the "primary" columns and any q3c indexes. + Automated Extraction of Targeting and Photometry ------------------------------------------------ diff --git a/py/specprodDB/load.py b/py/specprodDB/load.py index 17c08f3..9a5ee11 100644 --- a/py/specprodDB/load.py +++ b/py/specprodDB/load.py @@ -1971,19 +1971,7 @@ def main(): 'chunksize': chunksize, 'maxrows': maxrows }], - 'redshift': [{'filepaths': zpix_file, - 'tcls': Zpix, - 'hdu': 'ZCATALOG', - 'preload': _survey_program, - 'expand': {'COEFF': ('coeff_0', 'coeff_1', 'coeff_2', 'coeff_3', 'coeff_4', - 'coeff_5', 'coeff_6', 'coeff_7', 'coeff_8', 'coeff_9',)}, - 'convert': {'id': lambda x: x[0] << 64 | x[1]}, - # 'rowfilter': lambda x: (x['TARGETID'] > 0) & ((x['TARGETID'] & 2**59) == 0), - 'rowfilter': no_sky, - 'chunksize': chunksize, - 'maxrows': maxrows - }, - {'filepaths': ztile_file, + 'redshift': [{'filepaths': ztile_file, 'tcls': Ztile, 'hdu': 'ZCATALOG', 'preload': _survey_program, @@ -2017,6 +2005,18 @@ def main(): 'chunksize': chunksize, 'maxrows': maxrows }]} + if specprod != 'daily': + loaders['redshift'].append({'filepaths': zpix_file, + 'tcls': Zpix, + 'hdu': 'ZCATALOG', + 'preload': _survey_program, + 'expand': {'COEFF': ('coeff_0', 'coeff_1', 'coeff_2', 'coeff_3', 'coeff_4', + 'coeff_5', 'coeff_6', 'coeff_7', 'coeff_8', 'coeff_9',)}, + 'convert': {'id': lambda x: x[0] << 64 | x[1]}, + # 'rowfilter': lambda x: (x['TARGETID'] > 0) & ((x['TARGETID'] & 2**59) == 0), + 'rowfilter': no_sky, + 'chunksize': chunksize, + 'maxrows': maxrows}) try: loader = loaders[options.load] except KeyError: