From 9fc462b322d45913febc3c349acbef13ebbc6ad0 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 29 Aug 2023 13:03:54 -0700 Subject: [PATCH 01/14] initial rendering check-in --- .gitignore | 3 + .readthedocs.yml | 10 +- doc/Makefile | 14 +- doc/_static/desidatamodel.css | 4 + doc/api.rst | 3 + doc/changes.rst | 2 + doc/conf.py | 2 +- doc/index.rst | 1 + doc/rtd-requirements.txt | 1 + foo.rst | 463 ++++++++++++++++++ py/desidatamodel/check.py | 29 +- py/desidatamodel/data/column_descriptions.rst | 20 + py/desidatamodel/render.py | 46 ++ py/desidatamodel/stub.py | 8 +- py/desidatamodel/test/datamodeltestcase.py | 2 + py/desidatamodel/test/test_check.py | 105 ++-- py/desidatamodel/test/test_render.py | 15 + py/desidatamodel/test/test_scan.py | 20 +- py/desidatamodel/test/test_stub.py | 19 +- py/desidatamodel/test/test_unit.py | 10 - py/desidatamodel/test/test_update.py | 4 +- py/desidatamodel/update.py | 11 +- requirements.txt | 1 + setup.py | 5 +- 24 files changed, 703 insertions(+), 95 deletions(-) create mode 100644 foo.rst create mode 100644 py/desidatamodel/data/column_descriptions.rst create mode 100644 py/desidatamodel/render.py create mode 100644 py/desidatamodel/test/test_render.py diff --git a/.gitignore b/.gitignore index b1bf8746..ec36eaef 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,6 @@ MANIFEST # Mac OSX .DS_Store + +# Generated files +doc/column_descriptions.rst diff --git a/.readthedocs.yml b/.readthedocs.yml index 4374d5a5..89e2e82c 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -5,6 +5,14 @@ # Required version: 2 +build: + os: "ubuntu-22.04" + tools: + python: "3.10" + jobs: + post_install: + - python -m desidatamodel.render > doc/column_descriptions.rst + # Build documentation in the doc/ directory with Sphinx sphinx: configuration: doc/conf.py @@ -14,7 +22,7 @@ formats: all # Optionally set the version of Python and requirements required to build your docs python: - version: 3 + # version: 3 # system_packages: true install: - requirements: doc/rtd-requirements.txt diff --git a/doc/Makefile b/doc/Makefile index 17186b25..990bad2c 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -8,10 +8,16 @@ SPHINXBUILD = sphinx-build # SPHINXBUILD = sphinx-build-2.7 PAPER = BUILDDIR = _build +PYTHON = python + +# User-friendly check for Python +ifeq ($(shell which $(PYTHON) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(Python)' command was not found. Make sure you have Python installed.) +endif # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) -$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/.) endif # Internal variables. @@ -49,9 +55,13 @@ help: @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: + $(RM) column_descriptions.rst rm -rf $(BUILDDIR)/* -html: +column_descriptions.rst: + $(PYTHON) -m desidatamodel.render > column_descriptions.rst + +html: column_descriptions.rst $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." diff --git a/doc/_static/desidatamodel.css b/doc/_static/desidatamodel.css index a64cd741..90ca65f4 100644 --- a/doc/_static/desidatamodel.css +++ b/doc/_static/desidatamodel.css @@ -20,3 +20,7 @@ section details.summary-required-header-keywords-table div.wy-table-responsive t section details.summary-required-header-keywords-table div.wy-table-responsive table.keywords tbody tr.row-odd td { background-color: rgb(232, 232, 252); } section section div.wy-table-responsive table.columns tbody tr.row-even td { background-color: rgb(223, 246, 226); } section section div.wy-table-responsive table.columns tbody tr.row-odd td { background-color: rgb(232, 252, 232); } + +.wy-nav-content { + max-width: none; +} diff --git a/doc/api.rst b/doc/api.rst index 7b62daab..111d64c1 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -8,6 +8,9 @@ desidatamodel API .. automodule:: desidatamodel.check :members: +.. automodule:: desidatamodel.render + :members: + .. automodule:: desidatamodel.scan :members: diff --git a/doc/changes.rst b/doc/changes.rst index 6b1da387..94da7ab0 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -5,9 +5,11 @@ desidatamodel Change Log 23.6 (unreleased) ----------------- +* Add note about equivalent width values in ``fuji`` and ``guadalupe`` (PR `#181`_). * Add note about units in FITS files (PR `#178`_). .. _`#178`: https://github.com/desihub/desidatamodel/pull/178 +.. _`#181`: https://github.com/desihub/desidatamodel/pull/181 23.1 (2023-06-12) ----------------- diff --git a/doc/conf.py b/doc/conf.py index ea4b3b17..b37db22f 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -121,7 +121,7 @@ # some external dependencies are not met at build time and break the # building process. autodoc_mock_imports = [] -for missing in ('astropy', 'desiutil', 'numpy'): +for missing in ('astropy', 'desiutil', 'jinja2', 'numpy'): try: foo = import_module(missing) except ImportError: diff --git a/doc/index.rst b/doc/index.rst index 5b29f857..739f51cd 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -62,6 +62,7 @@ Bitmask definitions and environment variables used by the DESI data pipelines: :maxdepth: 1 bitmasks + column_descriptions Environment variables Units in data files diff --git a/doc/rtd-requirements.txt b/doc/rtd-requirements.txt index 99f2a583..9d8f4831 100644 --- a/doc/rtd-requirements.txt +++ b/doc/rtd-requirements.txt @@ -1 +1,2 @@ sphinx-toolbox +jinja2 diff --git a/foo.rst b/foo.rst new file mode 100644 index 00000000..40067728 --- /dev/null +++ b/foo.rst @@ -0,0 +1,463 @@ +============================ +Standard Column Descriptions +============================ + +This file is an auto-generated version of `column_descriptions.csv`_. + +.. _`column_descriptions.csv`: https://github.com/desihub/desidatamodel/blob/main/py/desidatamodel/data/column_descriptions.csv + +================================= =========== ================================= ===================================================================================================================================== +Name Type Units Description +================================= =========== ================================= ===================================================================================================================================== +ABSMAG_R float64 Absolute magnitude in the r-band after k-correction +AIRMASS float32 Average airmass during this exposure +AIRMASS_GFA float64 Average airmass during this exposure as measured by GFA +APFLUX_G float32 nanomaggy Total flux in nanomaggies extracted in a 0.75 arcsec radius in the g band at this location +APFLUX_IVAR_G float32 nanomaggy^-2 Inverse variance of APFLUX_G +APFLUX_IVAR_R float32 nanomaggy^-2 Inverse variance of APFLUX_R +APFLUX_IVAR_Z float32 nanomaggy^-2 Inverse variance of APFLUX_Z +APFLUX_R float32 nanomaggy Total flux in nanomaggies extracted in a 0.75 arcsec radius in the r band at this location +APFLUX_Z float32 nanomaggy Total flux in nanomaggies extracted in a 0.75 arcsec radius in the z band at this location +A_MGII float32 Fitted parameter A (amplitude) by MgII fitter +BGS_TARGET int64 BGS (Bright Galaxy Survey) target selection bitmask +BITWEIGHTS int64[2] A size of two 64 bit masks that encodes which of the alternative assignment histories that the target was assigned in +BLOBDIST float32 pix Maximum distance from a detected Legacy Surveys source +BRICKID int32 Brick ID from tractor input +BRICKNAME char[8] Brick name from tractor input +BRICK_OBJID int32 Imaging Surveys OBJID on that brick +B_MGII float32 Fitted parameter B (constant) by MgII fitter +CAMERA char[2] Camera identifier. Passband and SPECGRPH ([brz][0-9]). +CHECKER char[5] Initials of researcher who vetted the target +CHI2 float64 Best fit chi squared +CMX_TARGET int64 Target selection bitmask for commissioning +COADD_EXPTIME float32 s Summed exposure time for coadd +COADD_FIBERSTATUS int32 bitwise-AND of input FIBERSTATUS +COADD_NUMEXP int16 Number of exposures in coadd +COADD_NUMNIGHT int16 Number of nights in coadd +COADD_NUMTILE int16 Number of tiles in coadd +COEFF float64[10] Redrock template coefficients +COMP_TILE float64 Assignment completeness for all targets of this type with the same value for TILES +C_CIII float32 Confidence for CIII line +C_CIV float32 Confidence for CIV line +C_Halpha float32 Confidence for Halpha line +C_Hbeta float32 Confidence for Hbeta line +C_LYA float32 Confidence for LyA line, i.e. ~probability to be a QSO +C_MgII float32 Confidence for MgII line +DCHISQ float32[5] Difference in chi-squared between Tractor model fits +DEC float64 deg Barycentric declination in ICRS +DEC_IVAR float32 deg^-2 Inverse variance of DEC, excluding astrometric calibration errors +DELTACHI2 float64 chi2 difference between first- and second-best redrock template fits +DELTA_CHI2 float32 Difference of chi2 between redrock fit and MgII fitter over the lambda interval considered during the fit +DELTA_X float64 mm CS5 X requested minus actual position +DELTA_Y float64 mm CS5 Y requested minus actual position +DESI_TARGET int64 DESI (dark time program) target selection bitmask +DEVICE_LOC int32 Device location on focal plane [0-523] +DEVICE_TYPE char[3] Device type +EBV float32 mag Galactic extinction E(B-V) reddening from SFD98 +EFFTIME_ETC float64 s Effective exposure time for nominal conditions inferred from ETC data +EFFTIME_SPEC float64 s Effective exposure time for nominal conditions derived from the TSNR2 fits to the spectroscopy +EQ_ALL_0P0 float64 e-correction at redshift=0.0 +EQ_ALL_0P1 float64 e-correction at redshift=0.1 +EXPID int32 DESI Exposure ID number +EXPTIME float64 s Length of time shutter was open +FAFLAVOR char[*] Fiberassign flavor name +FAPRGRM char[*] Fiberassign program name +FA_TARGET int64 Targeting bit internally used by fiberassign (linked with FA_TYPE) +FA_TYPE binary Fiberassign internal target type (science, standard, sky, safe, suppsky) +FIBER int32 Fiber ID on the CCDs [0-4999] +FIBERASSIGN_X float32 mm Fiberassign expected CS5 X location on focal plane +FIBERASSIGN_Y float32 mm Fiberassign expected CS5 Y location on focal plane +FIBERFLUX_G float32 nanomaggy Predicted g-band flux within a fiber of diameter 1.5 arcsec from this object in 1 arcsec Gaussian seeing +FIBERFLUX_R float32 nanomaggy Predicted r-band flux within a fiber of diameter 1.5 arcsec from this object in 1 arcsec Gaussian seeing +FIBERFLUX_Z float32 nanomaggy Predicted z-band flux within a fiber of diameter 1.5 arcsec from this object in 1 arcsec Gaussian seeing +FIBERFLUX_IVAR_G float32 nanomaggy^-2 Inverse variance of ``FIBERFLUX_G`` +FIBERFLUX_IVAR_R float32 nanomaggy^-2 Inverse variance of ``FIBERFLUX_R`` +FIBERFLUX_IVAR_Z float32 nanomaggy^-2 Inverse variance of ``FIBERFLUX_Z`` +FIBERSTATUS int32 Fiber status mask. 0=good +FIBERTOTFLUX_G float32 nanomaggy Predicted g-band flux within a fiber of diameter 1.5 arcsec from all sources at this location in 1 arcsec Gaussian seeing +FIBERTOTFLUX_R float32 nanomaggy Predicted r-band flux within a fiber of diameter 1.5 arcsec from all sources at this location in 1 arcsec Gaussian seeing +FIBERTOTFLUX_W1 float32 nanomaggy Predicted WISE W1-band flux within a fiber of diameter 1.5 arcsec from all sources at this location in 1 arcsec Gaussian seeing +FIBERTOTFLUX_W2 float32 nanomaggy Predicted WISE W2-band flux within a fiber of diameter 1.5 arcsec from all sources at this location in 1 arcsec Gaussian seeing +FIBERTOTFLUX_Z float32 nanomaggy Predicted z-band flux within a fiber of diameter 1.5 arcsec from all sources at this location in 1 arcsec Gaussian seeing +FIBER_DEC float64 deg DEC of actual fiber position +FIBER_RA float64 deg RA of actual fiber position +FIBER_X float64 mm CS5 X location requested by PlateMaker +FIBER_Y float64 mm CS5 Y location requested by PlateMaker +FLUX_G float32 nanomaggy Flux in the Legacy Survey g-band (AB) +FLUX_G_DERED float32 nanomaggy Flux in the g-band after correcting for Galactic extinction (AB system) +FLUX_IVAR_G float32 nanomaggy^-2 Inverse variance of FLUX_G (AB) +FLUX_IVAR_R float32 nanomaggy^-2 Inverse variance of FLUX_R (AB) +FLUX_IVAR_W1 float32 nanomaggy^-2 Inverse variance of FLUX_W1 (AB) +FLUX_IVAR_W2 float32 nanomaggy^-2 Inverse variance of FLUX_W2 (AB) +FLUX_IVAR_Z float32 nanomaggy^-2 Inverse variance of FLUX_Z (AB) +FLUX_R float32 nanomaggy Flux in the Legacy Survey r-band (AB) +FLUX_R_DERED float32 nanomaggy Flux in the r-band after correcting for Galactic extinction (AB system) +FLUX_W1 float32 nanomaggy WISE flux in W1 (AB) +FLUX_W1_DERED float32 nanomaggy Flux in the WISE W1-band after correcting for Galactic extinction (AB system) +FLUX_W2 float32 nanomaggy WISE flux in W2 (AB) +FLUX_W2_DERED float32 nanomaggy Flux in the WISE W2-band after correcting for Galactic extinction (AB system) +FLUX_Z float32 nanomaggy Flux in the Legacy Survey z-band (AB) +FLUX_Z_DERED float32 nanomaggy Flux in the z-band after correcting for Galactic extinction (AB system) +FRACZ_TILELOCID float64 The fraction of targets of this type at this TILELOCID that received an observation (after forcing each target to a unique TILELOCID) +GAIA_ASTROMETRIC_EXCESS_NOISE float32 Gaia astrometric excess noise +GAIA_ASTROMETRIC_PARAMS_SOLVED int64 which astrometric parameters were estimated for a Gaia source +GAIA_ASTROMETRIC_SIGMA5D_MAX float32 mas Gaia longest semi-major axis of the 5-d error ellipsoid +GAIA_DEC float64 deg Gaia ICRS declination +GAIA_DUPLICATED_SOURCE bool Gaia duplicated source flag +GAIA_PHOT_BP_MEAN_FLUX_OVER_ERROR float32 Gaia BP band signal-to-noise +GAIA_PHOT_BP_MEAN_MAG float32 mag Gaia BP band magnitude +GAIA_PHOT_BP_N_OBS int32 Gaia BP band number of observations +GAIA_PHOT_BP_RP_EXCESS_FACTOR float32 Gaia BP/RP excess factor +GAIA_PHOT_G_MEAN_FLUX_OVER_ERROR float32 Gaia G band signal-to-noise +GAIA_PHOT_G_MEAN_MAG float32 mag Gaia G band magnitude +GAIA_PHOT_G_N_OBS int32 Gaia G band number of observations +GAIA_PHOT_RP_MEAN_FLUX_OVER_ERROR float32 Gaia RP band signal-to-noise +GAIA_PHOT_RP_MEAN_MAG float32 mag Gaia RP band magnitude +GAIA_PHOT_RP_N_OBS int32 Gaia RP band number of observations +GAIA_RA float64 deg Gaia ICRS right ascension +GALDEPTH_G float32 nanomaggy^-2 Galaxy model-based depth in LS g-band +GALDEPTH_R float32 nanomaggy^-2 Galaxy model-based depth in LS r-band +GALDEPTH_Z float32 nanomaggy^-2 Galaxy model-based depth in LS z-band +GOODHARDLOC bool True/False whether the fiber had good hardware +GOODPRI bool True/False whether the priority of what was assigned to the location was <= the base priority of the given target class +GOODTSNR bool True/False whether the TSNR_ value used was above the minimum threshold for the given target class +HALPHA_CHI2 float32 Reduced chi2 of the fit for the HALPHA line +HALPHA_CONT float32 10**-17 erg/(s cm2 Angstrom) Continuum used for the fitting (fixed value) for the HALPHA line +HALPHA_CONT_IVAR float32 10**+34 (s2 cm4 Angstrom2) / erg2 Inverse variance of the continuum for the HALPHA line +HALPHA_EW float32 Angstrom Fitted rest-frame equivalent width for the HALPHA line +HALPHA_EW_IVAR float32 Angstrom^-2 Inverse variance of the fitted rest-frame equivalent width for the HALPHA line +HALPHA_FLUX float32 10**-17 erg/(s cm2) Fitted flux for the HALPHA line +HALPHA_FLUX_IVAR float32 10**+34 (s2 cm4) / erg2 Inverse variance of the fitted flux for the HALPHA line +HALPHA_NDOF int32 Number of degrees of freedom of the fit for the HALPHA line +HALPHA_SHARE float32 NaN (SHARE not relevant for HALPHA line) +HALPHA_SHARE_IVAR float32 NaN (SHARE not relevant for HALPHA line) +HALPHA_SIGMA float32 Angstrom Fitted line width (in the observed frame) for the HALPHA line +HALPHA_SIGMA_IVAR float32 Angstrom^-2 Inverse variance of the fitted line width (in the observed frame) for the HALPHA line +HBETA_CHI2 float32 Reduced chi2 of the fit for the HBETA line +HBETA_CONT float32 10**-17 erg/(s cm2 Angstrom) Continuum used for the fitting (fixed value) for the HBETA line +HBETA_CONT_IVAR float32 10**+34 (s2 cm4 Angstrom2) / erg2 Inverse variance of the continuum for the HBETA line +HBETA_EW float32 Angstrom Fitted rest-frame equivalent width for the HBETA line +HBETA_EW_IVAR float32 Angstrom^-2 Inverse variance of the fitted rest-frame equivalent width for the HBETA line +HBETA_FLUX float32 10**-17 erg/(s cm2) Fitted flux for the HBETA line +HBETA_FLUX_IVAR float32 10**+34 (s2 cm4) / erg2 Inverse variance of the fitted flux for the HBETA line +HBETA_NDOF int32 Number of degrees of freedom of the fit for the HBETA line +HBETA_SHARE float32 NaN (SHARE not relevant for HBETA line) +HBETA_SHARE_IVAR float32 NaN (SHARE not relevant for HBETA line) +HBETA_SIGMA float32 Angstrom Fitted line width (in the observed frame) for the HBETA line +HBETA_SIGMA_IVAR float32 Angstrom^-2 Inverse variance of the fitted line width (in the observed frame) for the HBETA line +HDELTA_CHI2 float32 Reduced chi2 of the fit for the HDELTA line +HDELTA_CONT float32 10**-17 erg/(s cm2 Angstrom) Continuum used for the fitting (fixed value) for the HDELTA line +HDELTA_CONT_IVAR float32 10**+34 (s2 cm4 Angstrom2) / erg2 Inverse variance of the continuum for the HDELTA line +HDELTA_EW float32 Angstrom Fitted rest-frame equivalent width for the HDELTA line +HDELTA_EW_IVAR float32 Angstrom^-2 Inverse variance of the fitted rest-frame equivalent width for the HDELTA line +HDELTA_FLUX float32 10**-17 erg/(s cm2) Fitted flux for the HDELTA line +HDELTA_FLUX_IVAR float32 10**+34 (s2 cm4) / erg2 Inverse variance of the fitted flux for the HDELTA line +HDELTA_NDOF int32 Number of degrees of freedom of the fit for the HDELTA line +HDELTA_SHARE float32 NaN (SHARE not relevant for HDELTA line) +HDELTA_SHARE_IVAR float32 NaN (SHARE not relevant for HDELTA line) +HDELTA_SIGMA float32 Angstrom Fitted line width (in the observed frame) for the HDELTA line +HDELTA_SIGMA_IVAR float32 Angstrom^-2 Inverse variance of the fitted line width (in the observed frame) for the HDELTA line +HEALPIX int32 HEALPixel containing this location at NSIDE=64 in the NESTED scheme +HGAMMA_CHI2 float32 Reduced chi2 of the fit for the HGAMMA line +HGAMMA_CONT float32 10**-17 erg/(s cm2 Angstrom) Continuum used for the fitting (fixed value) for the HGAMMA line +HGAMMA_CONT_IVAR float32 10**+34 (s2 cm4 Angstrom2) / erg2 Inverse variance of the continuum for the HGAMMA line +HGAMMA_EW float32 Angstrom Fitted rest-frame equivalent width for the HGAMMA line +HGAMMA_EW_IVAR float32 Angstrom^-2 Inverse variance of the fitted rest-frame equivalent width for the HGAMMA line +HGAMMA_FLUX float32 10**-17 erg/(s cm2) Fitted flux for the HGAMMA line +HGAMMA_FLUX_IVAR float32 10**+34 (s2 cm4) / erg2 Inverse variance of the fitted flux for the HGAMMA line +HGAMMA_NDOF int32 Number of degrees of freedom of the fit for the HGAMMA line +HGAMMA_SHARE float32 NaN (SHARE not relevant for HGAMMA line) +HGAMMA_SHARE_IVAR float32 NaN (SHARE not relevant for HGAMMA line) +HGAMMA_SIGMA float32 Angstrom Fitted line width (in the observed frame) for the HGAMMA line +HGAMMA_SIGMA_IVAR float32 Angstrom^-2 Inverse variance of the fitted line width (in the observed frame) for the HGAMMA line +HPXPIXEL int64 HEALPixel containing this location at NSIDE=64 in the NESTED scheme +IN_DESI int16 Used by fiberassign to make a tile in the DESI footprint; always set to 1 +IN_RADIUS float32 arcsec Radius used to set the ``IN_BRIGHT_OBJECT`` bit in the ``DESI_TARGET`` bitmask. +IS_QSO_MGII bool Boolean: True if the object passes the MgII selection +IS_QSO_QN int16 Spectroscopic classification from QuasarNET (1 for a quasar) +KCORR_G0P0 float64 g-band k-correction at redshift=0.0 +KCORR_G0P1 float64 g-band k-correction at redshift=0.1 +KCORR_R0P0 float64 r-band k-correction at redshift=0.0 +KCORR_R0P1 float64 r-band k-correction at redshift=0.1 +LAMBDA_REF float32 Angstrom Requested wavelength at which targets should be centered on fibers +LASTNIGHT int32 Final night of observation included in a series of coadds +LC_FLUX_IVAR_W1 float32[15] nanomaggy^-2 Inverse variance of LC_FLUX_W1 (AB system; defaults to zero for unused entries) +LC_FLUX_IVAR_W2 float32[15] nanomaggy^-2 Inverse variance of LC_FLUX_W2 (AB system; defaults to zero for unused entries) +LC_FLUX_W1 float32[15] nanomaggy FLUX_W1 in each of up to fifteen unWISE coadd epochs (AB system; defaults to zero for unused entries) +LC_FLUX_W2 float32[15] nanomaggy FLUX_W2 in each of up to fifteen unWISE coadd epochs (AB system; defaults to zero for unused entries) +LC_MJD_W1 float64[15] MJD_W1 in each of up to fifteen unWISE coadd epochs (defaults to zero for unused entries) +LC_MJD_W2 float64[15] MJD_W2 in each of up to fifteen unWISE coadd epochs (defaults to zero for unused entries) +LC_NOBS_W1 int16[15] NOBS_W1 in each of up to fifteen unWISE coadd epochs +LC_NOBS_W2 int16[15] NOBS_W2 in each of up to fifteen unWISE coadd epochs +LOCATION int64 Location on the focal plane PETAL_LOC*1000 + DEVICE_LOC +LOCATION_ASSIGNED bool True/False for assigned/unassigned for the target in question +LRG_MASK binary Imaging mask bits relevant to LRG targets +MAIN_NSPEC int32 Number of coadded spectra for this TARGETID in Main survey +MAIN_PRIMARY bool Boolean flag (True/False) for the primary coadded spectrum in Main survey +MASKBITS int16 Bitwise mask from the imaging indicating potential issue or blending +MEAN_DELTA_X float32 mm Mean (over exposures) fiber difference requested - actual CS5 X location on focal plane +MEAN_DELTA_Y float32 mm Mean (over exposures) fiber difference requested - actual CS5 Y location on focal plane +MEAN_FIBER_DEC float64 deg Mean (over exposures) DEC of actual fiber position +MEAN_FIBER_RA float64 deg Mean (over exposures) RA of actual fiber position +MEAN_FIBER_X float32 mm Mean (over exposures) fiber CS5 X location on focal plane +MEAN_FIBER_Y float32 mm Mean (over exposures) fiber CS5 Y location on focal plane +MEAN_PSF_TO_FIBER_SPECFLUX float32 Mean of input exposures fraction of light from point-like source captured by 1.5 arcsec diameter fiber given atmospheric seeing +MEDIAN_CALIB_COUNT_B float64 Median of calibrated flux in B camera +MEDIAN_CALIB_COUNT_R float64 Median of calibrated flux in R camera +MEDIAN_CALIB_COUNT_Z float64 Median of calibrated flux in Z camera +MEDIAN_CALIB_SNR_B float64 Median(S/N) of calibrated flux in B camera +MEDIAN_CALIB_SNR_R float64 Median(S/N) of calibrated flux in R camera +MEDIAN_CALIB_SNR_Z float64 Median(S/N) of calibrated flux in Z camera +MEDIAN_FFLAT_COUNT_B float64 Median of fiber-flatfielded counts in B camera +MEDIAN_FFLAT_COUNT_R float64 Median of fiber-flatfielded counts in R camera +MEDIAN_FFLAT_COUNT_Z float64 Median of fiber-flatfielded counts in Z camera +MEDIAN_FFLAT_SNR_B float64 Median(S/N) of fiberflatfielded counts in B camera +MEDIAN_FFLAT_SNR_R float64 Median(S/N) of fiberflatfielded counts in R camera +MEDIAN_FFLAT_SNR_Z float64 Median(S/N) of fiberflatfielded counts in Z camera +MEDIAN_RAW_COUNT_B float64 Median of raw counts in B camera +MEDIAN_RAW_COUNT_R float64 Median of raw counts in R camera +MEDIAN_RAW_COUNT_Z float64 Median of raw counts in Z camera +MEDIAN_RAW_SNR_B float64 Median(raw signal/noise) in B camera +MEDIAN_RAW_SNR_R float64 Median(raw signal/noise) in R camera +MEDIAN_RAW_SNR_Z float64 Median(raw signal/noise) in Z camera +MEDIAN_SKYSUB_COUNT_B float64 Median of sky-subtracted counts in B camera +MEDIAN_SKYSUB_COUNT_R float64 Median of sky-subtracted counts in R camera +MEDIAN_SKYSUB_COUNT_Z float64 Median of sky-subtracted counts in Z camera +MEDIAN_SKYSUB_SNR_B float64 Median(S/N) of sky-subtracted counts in B camera +MEDIAN_SKYSUB_SNR_R float64 Median(S/N) of sky-subtracted counts in R camera +MEDIAN_SKYSUB_SNR_Z float64 Median(S/N) of sky-subtracted counts in Z camera +MJD float64 d Modified Julian Date when shutter was opened for this exposure +MJD_BEGIN float64 d Start of the allowed observing window for this target (Modified Julian Date) +MJD_END float64 d End of the allowed observing window for this target (Modified Julian Date) +MORPHTYPE char[4] Imaging Surveys morphological type from Tractor +MWS_TARGET int64 Milky Way Survey targeting bits +MW_TRANSMISSION_G float32 Milky Way dust transmission in LS g-band +MW_TRANSMISSION_R float32 Milky Way dust transmission in LS r-band +MW_TRANSMISSION_W1 float32 Milky Way dust transmission in WISE W1 +MW_TRANSMISSION_W2 float32 Milky Way dust transmission in WISE W2 +MW_TRANSMISSION_W3 float32 Milky Way dust transmission in WISE W3 +MW_TRANSMISSION_W4 float32 Milky Way dust transmission in WISE W4 +MW_TRANSMISSION_Z float32 Milky Way dust transmission in LS z-band +NCOEFF int64 Number of Redrock template coefficients +NEAR_RADIUS float32 arcsec Radius used to set the ``NEAR_BRIGHT_OBJECT`` bit in the ``DESI_TARGET`` bitmask. +NIGHT int32 Night of observation (YYYYMMDD) starting at local noon before observations start +NOBS_G int16 Number of images for central pixel in g-band +NOBS_R int16 Number of images for central pixel in r-band +NOBS_Z int16 Number of images for central pixel in z-band +NPIXELS int64 Number of unmasked pixels contributing to the Redrock fit +NTILE int64 Number of tiles target was available on +NUMOBS int64 Number of spectroscopic observations (on this specific, single tile) +NUMOBS_INIT int64 Initial number of observations for target calculated across target selection bitmasks and OBSCONDITIONS +NUMOBS_MORE int64 Number of additional observations needed +NUMTARGET int16 Total number of targets that this positioner covered +NUM_ITER int64 Number of positioner iterations +NZ float64 h^3 Mpc^-3 The comoving number density of the tracer at the given redshift, assuming complete sample +O2C float64 The criteria for assessing strength of OII emission for ELG observations +OBJID int32 Imaging Surveys OBJID on that brick (renamed BRICK_OBJID) +OBJTYPE char[3] Object type: TGT, SKY, NON, BAD +OBSCONDITIONS int32 Bitmask of allowed observing conditions +OCLAYER char[6] Either 'DARK' for dark-time or 'BRIGHT' to observe in either bright- or dark-time +OIII_CHI2 float32 Reduced chi2 of the fit for the [OIII] doublet +OIII_CONT float32 10**-17 erg/(s cm2 Angstrom) Continuum used for the fitting (fixed value) for the [OIII] doublet +OIII_CONT_IVAR float32 10**+34 (s2 cm4 Angstrom2) / erg2 Inverse variance of the continuum for the [OIII] doublet +OIII_EW float32 Angstrom Fitted rest-frame equivalent width for the [OIII] doublet +OIII_EW_IVAR float32 Angstrom^-2 Inverse variance of the fitted rest-frame equivalent width for the [OIII] doublet +OIII_FLUX float32 10**-17 erg/(s cm2) Fitted flux for the [OIII] doublet +OIII_FLUX_IVAR float32 10**+34 (s2 cm4) / erg2 Inverse variance of the fitted flux for the [OIII] doublet +OIII_NDOF int32 Number of degrees of freedom of the fit for the [OIII] doublet +OIII_SHARE float32 F1/(F0+F1) for the [OIII] doublet, where F0 and F1 are the individual line fluxes (SHARE value fixed during the fit) +OIII_SHARE_IVAR float32 Infinite value, as SHARE is fixed during the fit +OIII_SIGMA float32 Angstrom Fitted line width (in the observed frame) for the [OIII] doublet +OIII_SIGMA_IVAR float32 Angstrom^-2 Inverse variance of the fitted line width (in the observed frame) for the [OIII] doublet +OII_CHI2 float32 Reduced chi2 of the fit for the [OII] doublet +OII_CONT float32 10**-17 erg/(s cm2 Angstrom) Continuum used for the fitting (fixed value) for the [OII] doublet +OII_CONT_IVAR float32 10**+34 (s2 cm4 Angstrom2) / erg2 Inverse variance of the continuum for the [OII] doublet +OII_EW float32 Angstrom Fitted rest-frame equivalent width for the [OII] doublet +OII_EW_IVAR float32 Angstrom^-2 Inverse variance of the fitted rest-frame equivalent width for the [OII] doublet +OII_FLUX float32 10**-17 erg/(s cm2) Fitted flux for the [OII] doublet +OII_FLUX_IVAR float32 10**+34 (s2 cm4) / erg2 Inverse variance of the fitted flux for the [OII] doublet +OII_NDOF int32 Number of degrees of freedom of the fit for the [OII] doublet +OII_SHARE float32 Fitted F1/(F0+F1) for the [OII] doublet, where F0 and F1 are the individual line fluxes +OII_SHARE_IVAR float32 Inverse variance of the fitted F1/(F0+F1) for the [OII] doublet +OII_SIGMA float32 Angstrom Fitted line width (in the observed frame) for the [OII] doublet +OII_SIGMA_IVAR float32 Angstrom^-2 Inverse variance of the fitted line width (in the observed frame) for the [OII] doublet +PARALLAX float32 mas Reference catalog parallax +PARALLAX_IVAR float32 mas^-2 Inverse variance of PARALLAX +PETAL_LOC int16 Petal location [0-9] +PHOTSYS char[1] 'N' for the MzLS/BASS photometric system, 'S' for DECaLS +PLATE_DEC float64 deg Barycentric Declination in ICRS to be used by PlateMaker +PLATE_RA float64 deg Barycentric Right Ascension in ICRS to be used by PlateMaker +PLATE_REF_EPOCH float64 yr Copy of REF_EPOCH to be used by PlateMaker +PMDEC float32 mas yr^-1 Proper motion in the +Dec direction +PMDEC_IVAR float32 yr^2 mas^-2 Inverse variance of PMDEC +PMRA float32 mas yr^-1 proper motion in the +RA direction (already including cos(dec)) +PMRA_IVAR float32 yr^2 mas^-2 Inverse variance of PMRA +PRIORITY int32 Target current priority +PRIORITY_INIT int64 Target initial priority from target selection bitmasks and OBSCONDITIONS +PROBA_RF float32 Probability of being a quasar generated by the quasar Random Forest targeting algorithm. +PROB_OBS float64 The number alternative assignment histories that the target was assigned in divided by 128 +PROGRAM char[6] DESI program type - BRIGHT, DARK, BACKUP, OTHER +PSFDEPTH_G float32 nanomaggy^-2 PSF-based depth in g-band +PSFDEPTH_R float32 nanomaggy^-2 PSF-based depth in r-band +PSFDEPTH_W1 float32 nanomaggy^-2 PSF-based depth in WISE W1 +PSFDEPTH_W2 float32 nanomaggy^-2 PSF-based depth in WISE W2 +PSFDEPTH_Z float32 nanomaggy^-2 PSF-based depth in z-band +PSFSIZE_G float32 arcsec Median PSF size evaluated at the BRICK_PRIMARY objects in this brick in g-band +PSFSIZE_R float32 arcsec Median PSF size evaluated at the BRICK_PRIMARY objects in this brick in r-band +PSFSIZE_Z float32 arcsec Median PSF size evaluated at the BRICK_PRIMARY objects in this brick in z-band +PSF_TO_FIBER_SPECFLUX float64 fraction of light from point-like source captured by 1.5 arcsec diameter fiber given atmospheric seeing +RA float64 deg Barycentric Right Ascension in ICRS +RA_IVAR float32 deg^-2 Inverse variance of RA (no cosine term!), excluding astrometric calibration errors +REF_CAT char[2] Reference catalog source for star: 'T2' for Tycho-2, 'G2' for Gaia DR2, 'L2' for the SGA, empty otherwise +REF_EPOCH float32 yr Reference epoch for Gaia/Tycho astrometry. Typically 2015.5 for Gaia +REF_ID int64 Tyc1*1,000,000+Tyc2*10+Tyc3 for Tycho-2; ``sourceid`` for Gaia DR2 +REF_MAG float32 mag Magnitude used to calculate ``IN_RADIUS``; typically, in order of preference, G-band for Gaia or VT then HP then BT for Tycho. +RELEASE int16 Imaging surveys release ID +REST_GMR_0P0 float64 Rest-frame g-r colour at redshift=0.0 +REST_GMR_0P1 float64 Rest-frame g-r colour at redshift=0.1 +RMS_DELTA_X float32 mm RMS (over exposures) of the fiber difference between measured and requested CS5 X location on focal plane +RMS_DELTA_Y float32 mm RMS (over exposures) of the fiber difference between measured and requested CS5 Y location on focal plane +ROSETTE_NUMBER int32 Rosette number ID [0-19] +ROSETTE_R float64 deg Radius from the center of the rosette to the target +SCND_TARGET int64 Target selection bitmask for secondary programs +SCND_ORDER int32 Number of row for target entry in secondary file (placeholder; needed by fiberassign) +SEEING_ETC float64 arcsec Average FWHM atmospheric seeing during this exposure as measured by ETC +SEEING_GFA float64 arcsec Average FWHM atmospheric seeing during this exposure as measured by GFA +SERSIC float32 Power-law index for the Sersic profile model (MORPHTYPE='SER') +SERSIC_IVAR float32 Inverse variance of SERSIC +SHAPEDEV_E1 float32 deVaucouleurs shape fit elipticity parameter e1 +SHAPEDEV_E1_IVAR float32 Inverse variance of SHAPEDEV_E1 +SHAPEDEV_E2 float32 deVaucouleurs shape fit elipticity parameter e2 +SHAPEDEV_E2_IVAR float32 Inverse variance of SHAPEDEV_E2 +SHAPEDEV_R float32 arcsec deVaucouleurs shape half-light radius +SHAPEDEV_R_IVAR float32 arcsec^-2 Inverse variance of SHAPEDEV_R +SHAPEEXP_E1 float32 Imaging exponential shape fit elipticity parameter e1 +SHAPEEXP_E1_IVAR float32 Inverse variance of SHAPEEXP_E1 +SHAPEEXP_E2 float32 Imaging exponential shape fit elipticity parameter e2 +SHAPEEXP_E2_IVAR float32 Inverse variance of SHAPEEXP_E2 +SHAPEEXP_R float32 arcsec Imaging exponential shape half-light radius +SHAPEEXP_R_IVAR float32 arcsec^-2 Inverse variance of SHAPEEXP_R +SHAPE_E1 float32 Ellipticity component 1 of galaxy model for galaxy type MORPHTYPE +SHAPE_E1_IVAR float32 Inverse variance of SHAPE_E1 +SHAPE_E2 float32 Ellipticity component 2 of galaxy model for galaxy type MORPHTYPE +SHAPE_E2_IVAR float32 Inverse variance of SHAPE_E2 +SHAPE_R float32 arcsec Half-light radius of galaxy model (>0) +SHAPE_R_IVAR float32 arcsec^-2 Inverse variance of SHAPE_R +SIGMA_MGII float32 Angstrom Fitted parameter SIGMA (linewidth) by MgII fitter (in angstrom?) +SPECTRO int16 Spectrograph number [0-9] +SPECTROID int32 Hardware ID of spectrograph (not used) +SPECTYPE char[6] Spectral type of Redrock best fit template (e.g. GALAXY, QSO, STAR) +SPGRPVAL int32 Value by which spectra are grouped for a coadd (e.g. a YEARMMDD night) +STD_FIBER_DEC float32 arcsec Standard deviation (over exposures) of DEC of actual fiber position +STD_FIBER_RA float32 arcsec Standard deviation (over exposures) of RA of actual fiber position +SUBPRIORITY float64 Random subpriority [0-1) to break assignment ties +SUBTYPE char[20] Spectral subtype +SUM_CALIB_COUNT_B float64 Sum of calibrated flux in B camera +SUM_CALIB_COUNT_R float64 Sum of calibrated flux in R camera +SUM_CALIB_COUNT_Z float64 Sum of calibrated flux in Z camera +SUM_FFLAT_COUNT_B float64 Sum of fiber-flatfielded counts B camera +SUM_FFLAT_COUNT_R float64 Sum of fiber-flatfielded counts R camera +SUM_FFLAT_COUNT_Z float64 Sum of fiber-flatfielded counts Z camera +SUM_RAW_COUNT_B float64 Sum of raw counts in B camera +SUM_RAW_COUNT_R float64 Sum of raw counts in R camera +SUM_RAW_COUNT_Z float64 Sum of raw counts in Z camera +SUM_SKYSUB_COUNT_B float64 Sum of sky-subtracted counts in B camera +SUM_SKYSUB_COUNT_R float64 Sum of sky-subtracted counts in R camera +SUM_SKYSUB_COUNT_Z float64 Sum of sky-subtracted counts in Z camera +SURVEY char[7] Survey name +SV1_BGS_TARGET int64 BGS (bright time program) target selection bitmask for SV1 +SV1_DESI_TARGET int64 DESI (dark time program) target selection bitmask for SV1 +SV1_MWS_TARGET int64 MWS (bright time program) target selection bitmask for SV1 +SV1_SCND_TARGET int64 Secondary target selection bitmask for SV1 +SV2_BGS_TARGET int64 BGS (bright time program) target selection bitmask for SV2 +SV2_DESI_TARGET int64 DESI (dark time program) target selection bitmask for SV2 +SV2_MWS_TARGET int64 MWS (bright time program) target selection bitmask for SV2 +SV2_SCND_TARGET int64 Secondary target selection bitmask for SV2 +SV3_BGS_TARGET int64 BGS (bright time program) target selection bitmask for SV3 +SV3_DESI_TARGET int64 DESI (dark time program) target selection bitmask for SV3 +SV3_MWS_TARGET int64 MWS (bright time program) target selection bitmask for SV3 +SV3_SCND_TARGET int64 Secondary target selection bitmask for SV3 +SV_NSPEC int32 Number of coadded spectra for this TARGETID in SV (SV1+2+3) +SV_PRIMARY bool Boolean flag (True/False) for the primary coadded spectrum in SV (SV1+2+3) +TARGETID int64 Unique DESI target ID +TARGET_DEC float64 deg Barycentric declination in ICRS +TARGET_RA float64 deg Barycentric right ascension in ICRS +TARGET_STATE char[*] Combination of target class and its current observational state +TILEDEC float64 deg Barycentric declination of tile center in ICRS +TILEID int32 Unique DESI tile ID +TILELOCID int64 Is 10000*TILEID+LOCATION +TILELOCIDS char[*] TILELOCIDs that the target was available for, separated by '-' +TILELOCID_ASSIGNED int64 0/1 for unassigned/assigned for TILELOCID in question (it could have been assigned to a different target) +TILERA float64 deg Barycentric Right Ascension of tile center in ICRS +TILES char[*] TILEIDs of those tile, in string form separated by '-' +TIMESTAMP str s UTC/ISO time at which the target state was updated +TOOID int64 ID for this target assigned by the ``CHECKER`` +TOO_PRIO char[2] Either 'HI' for a very-high-priority target or 'LO' for a very-low-priority target +TOO_TYPE char[5] Either 'TILE' for a special tile or 'FIBER' for a fiber-override ToO +TSNR2_BGS float32 BGS template (S/N)^2 summed over B,R,Z +TSNR2_BGS_B float32 BGS B template (S/N)^2 +TSNR2_BGS_R float32 BGS R template (S/N)^2 +TSNR2_BGS_Z float32 BGS Z template (S/N)^2 +TSNR2_ELG float32 ELG template (S/N)^2 summed over B,R,Z +TSNR2_ELG_B float32 ELG B template (S/N)^2 +TSNR2_ELG_R float32 ELG R template (S/N)^2 +TSNR2_ELG_Z float32 ELG Z template (S/N)^2 +TSNR2_GPBBACKUP float64 template (S/N)^2 for backup targets in guider pass band +TSNR2_GPBBACKUP_B float64 template (S/N)^2 for backup targets in guider pass band on B +TSNR2_GPBBACKUP_R float64 template (S/N)^2 for backup targets in guider pass band on R +TSNR2_GPBBACKUP_Z float64 template (S/N)^2 for backup targets in guider pass band on Z +TSNR2_GPBBRIGHT float64 template (S/N)^2 for bright targets in guider pass band +TSNR2_GPBBRIGHT_B float64 template (S/N)^2 for bright targets in guider pass band on B +TSNR2_GPBBRIGHT_R float64 template (S/N)^2 for bright targets in guider pass band on R +TSNR2_GPBBRIGHT_Z float64 template (S/N)^2 for bright targets in guider pass band on Z +TSNR2_GPBDARK float64 template (S/N)^2 for dark targets in guider pass band +TSNR2_GPBDARK_B float64 template (S/N)^2 for dark targets in guider pass band on B +TSNR2_GPBDARK_R float64 template (S/N)^2 for dark targets in guider pass band on R +TSNR2_GPBDARK_Z float64 template (S/N)^2 for dark targets in guider pass band on Z +TSNR2_LRG float32 LRG template (S/N)^2 summed over B,R,Z +TSNR2_LRG_B float32 LRG B template (S/N)^2 +TSNR2_LRG_R float32 LRG R template (S/N)^2 +TSNR2_LRG_Z float32 LRG Z template (S/N)^2 +TSNR2_LYA float32 LYA template (S/N)^2 summed over B,R,Z +TSNR2_LYA_B float32 LYA B template (S/N)^2 +TSNR2_LYA_R float32 LYA R template (S/N)^2 +TSNR2_LYA_Z float32 LYA Z template (S/N)^2 +TSNR2_QSO float32 QSO template (S/N)^2 summed over B,R,Z +TSNR2_QSO_B float32 QSO B template (S/N)^2 +TSNR2_QSO_R float32 QSO R template (S/N)^2 +TSNR2_QSO_Z float32 QSO Z template (S/N)^2 +TYPE char[4] Morphological Model type from Tractor; renamed MORPHTYPE in most files +URAT_ID int64 ID in the URAT catalog for sources where URAT supplemented missing Gaia astrometric information +URAT_SEP float32 arcsec Separation between URAT and Gaia sources where URAT supplemented missing Gaia astrometric information +VAR_A_MGII float32 Variance of MgII fit amplitude parameter A +VAR_B_MGII float32 Variance of MgII fit offset parameter B +VAR_SIGMA_MGII float32 Variance of MgII fit width parameter sigma +VERSION char[14] Tag of desitarget used to create the target catalog +WEIGHT float64 The combination of all weights to use +WEIGHT_COMP float64 1/FRACZ_TILELOCID +WEIGHT_FKP float64 1/(1+NZ*P0), with P0 different for each tracer +WEIGHT_SYS float64 Correction for fluctuations in projected density with imaging conditions, from random forrest method +WEIGHT_SYSEB float64 Correction for fluctuations in projected density with imaging conditions, from linear regression method applied to eBOSS +WEIGHT_ZFAIL float64 Should be all 1 at this point for main survey +WISEMASK_W1 byte Bitwise mask for WISE W1 data +WISEMASK_W2 byte Bitwise mask for WISE W2 data +Z float64 Redshift measured by Redrock +ZCAT_NSPEC int32 Number of coadded spectra for this TARGETID in this zcatalog +ZCAT_PRIMARY bool Boolean flag (True/False) for the primary coadded spectrum in this zcatalog +ZERR float64 Redshift error from redrock +ZPOSSLOC bool True/False whether the location could have been assigned to the given target class +ZTILEID int32 ID of tile that most recently updated target's state +ZWARN int64 Redshift warning bitmask from Redrock +ZWARN_MTL int64 The ZWARN from the zmtl file (contains extra bits) +Z_CIII float64 Redshift estimated by QuasarNET with CIII line +Z_CIV float64 Redshift estimated by QuasarNET with CIV line +Z_Halpha float64 Redshift estimated by QuasarNET with Halpha line +Z_Hbeta float64 Redshift estimated by QuasarNET with Hbeta line +Z_HP float64 Redshift from Healpix coadd +Z_LYA float64 Redshift estimated by QuasarNET with LyA line +Z_MgII float64 Redshift estimated by QuasarNET with MgII line +Z_QN float64 Redshift measured by QuasarNET using line with highest confidence +Z_QN_CONF float64 Redshift confidence from QuasarNET +Z_RR float64 Redshift collected from redrock file +================================= =========== ================================= ===================================================================================================================================== + diff --git a/py/desidatamodel/check.py b/py/desidatamodel/check.py index d57c6bd6..2c2fc972 100644 --- a/py/desidatamodel/check.py +++ b/py/desidatamodel/check.py @@ -10,6 +10,7 @@ import os import re import itertools +from pathlib import Path from sys import argv from argparse import ArgumentParser @@ -25,10 +26,15 @@ class DataModel(DataModelUnit): Parameters ---------- - filename : :class:`str` + filename : :class:`str` or :class:`pathlib.Path` The full path of the data model file. - section : :class:`str` + section : :class:`str` or :class:`pathlib.Path` The full path to the section of the data model containing the file. + + Raises + ------ + ValueError + If `filename` or `section` have an unexpected type. """ # Marker for optional keywords and columns. _o = '[1]_' @@ -82,10 +88,23 @@ class DataModel(DataModelUnit): _expectedtypes = ('ascii', 'csv', 'ecsv', 'fits', 'json', 'yaml') def __init__(self, filename, section): - shortname = filename.replace(f'{section}/', '') + if isinstance(filename, str): + self.filename = filename + self.section = section + shortname = filename.replace(f'{section}/', '') + elif isinstance(filename, Path): + self.filename = str(filename) + self.section = str(section) + shortname = str(filename).replace(f'{section}/', '') + else: + raise ValueError('Unexpected type for filename!') + if isinstance(section, str): + self.section = section + elif isinstance(section, Path): + self.section = str(section) + else: + raise ValueError('Unexpected type for section!') log.debug('Creating DataModel for %s.', shortname) - self.filename = filename - self.section = section self.title = None self.ref = None self.regexp = None diff --git a/py/desidatamodel/data/column_descriptions.rst b/py/desidatamodel/data/column_descriptions.rst new file mode 100644 index 00000000..7c4d8da1 --- /dev/null +++ b/py/desidatamodel/data/column_descriptions.rst @@ -0,0 +1,20 @@ +============================ +Standard Column Descriptions +============================ + +This file is an auto-generated version of `column_descriptions.csv`_. + +.. _`column_descriptions.csv`: https://github.com/desihub/desidatamodel/blob/main/py/desidatamodel/data/column_descriptions.csv + +{% for row in reader %} +{% if loop.first %} +{{ separator }} +{% endif %} +{{ format_string.format(*row) }} +{% if loop.first %} +{{ separator }} +{% endif %} +{% if loop.last %} +{{ separator }} +{% endif %} +{% endfor %} diff --git a/py/desidatamodel/render.py b/py/desidatamodel/render.py new file mode 100644 index 00000000..8aeafb09 --- /dev/null +++ b/py/desidatamodel/render.py @@ -0,0 +1,46 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +# -*- coding: utf-8 -*- +""" +==================== +desidatamodel.render +==================== + +Render the column descriptions file. +""" +import csv +import importlib.resources as ir +import jinja2 + + +def main(): + """Entry point for command-line scripts. + + Returns + ------- + :class:`int` + An integer suitable for passing to :func:`sys.exit`. + """ + env = jinja2.Environment(loader=jinja2.PackageLoader('desidatamodel', package_path='data'), + trim_blocks=True) + template = env.get_template('column_descriptions.rst') + columns = ir.files('desidatamodel') / 'data' / 'column_descriptions.csv' + separator_data = list() + with open(columns, newline='') as cf: + reader = csv.reader(cf) + for row in reader: + for k, col in enumerate(row): + try: + if len(col) > separator_data[k]: + separator_data[k] = len(col) + except IndexError: + separator_data.append(len(col)) + cf.seek(0) + format_string = " ".join(["{{{0}:{1}}}".format(k, c) for k, c in enumerate(separator_data)]) + # print(format_string) + separator = ' '.join(['='*k for k in separator_data]) + print(template.render(reader=reader, format_string=format_string, separator=separator)) + return 0 + + +if __name__ == '__main__': + main() diff --git a/py/desidatamodel/stub.py b/py/desidatamodel/stub.py index 1270f657..95604488 100644 --- a/py/desidatamodel/stub.py +++ b/py/desidatamodel/stub.py @@ -10,7 +10,9 @@ import os import re from html import escape -from pkg_resources import resource_filename +from pathlib import Path +import importlib.resources as ir +# from pkg_resources import resource_filename from astropy.io import fits from astropy.io.fits.card import Undefined from astropy.table import Table @@ -102,6 +104,8 @@ def __init__(self, filename, description_file=None, error=False): self.headers.append(fx[k].header) if isinstance(filename, (str,)): self.filename = filename + elif isinstance(filename, (Path,)): + self.filename = str(filename) self._basef = None self._modelname = None self._filesize = None @@ -752,7 +756,7 @@ def main(): parser.add_argument("--column_descriptions", help="CSV file with column info Name,Type,Units,Description; " "default=%(default)s", - default=resource_filename('desidatamodel', 'data/column_descriptions.csv')) + default=(ir.files('desidatamodel') / 'data' / 'column_descriptions.csv')) options = parser.parse_args() if options.verbose: diff --git a/py/desidatamodel/test/datamodeltestcase.py b/py/desidatamodel/test/datamodeltestcase.py index 27389515..e06160f8 100644 --- a/py/desidatamodel/test/datamodeltestcase.py +++ b/py/desidatamodel/test/datamodeltestcase.py @@ -7,6 +7,7 @@ import unittest import logging import shutil +import importlib.resources as ir from packaging import version from astropy import __version__ as astropyVersion @@ -24,6 +25,7 @@ def setUpClass(cls): cls.astropyVersion = version.parse(astropyVersion) cls.maxDiff = None cls.data_dir = tempfile.mkdtemp() + cls.test_files = ir.files('desidatamodel.test') / 't' if DM in os.environ: cls.old_env = os.environ[DM] else: diff --git a/py/desidatamodel/test/test_check.py b/py/desidatamodel/test/test_check.py index 2a34786d..8ec926d5 100644 --- a/py/desidatamodel/test/test_check.py +++ b/py/desidatamodel/test/test_check.py @@ -7,7 +7,6 @@ from packaging import version import unittest from unittest.mock import patch -from pkg_resources import resource_filename from .datamodeltestcase import DataModelTestCase, DM @@ -18,6 +17,23 @@ class TestCheck(DataModelTestCase): + def test_DataModel_init(self): + """Test initialization of the DataModel object. + """ + modelfile = self.test_files / 'fits_file.rst' + model = DataModel(modelfile, self.test_files) + self.assertEqual(model.filename, str(modelfile)) + self.assertEqual(model.section, str(self.test_files)) + + def test_DataModel_init_bad_type(self): + """Test initialization of the DataModel object. + """ + modelfile = self.test_files / 'fits_file.rst' + with self.assertRaises(ValueError): + model = DataModel(None, self.test_files) + with self.assertRaises(ValueError): + model = DataModel(modelfile, None) + def test_scan_model(self): """Test identification of data model files. """ @@ -112,7 +128,7 @@ def test_files_to_regexp_with_bad_filetype(self): def test_get_regexp_filesize(self): """Test extraction of file size from data model documents. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' model = DataModel(modelfile, os.path.dirname(modelfile)) foo = model.get_regexp('/desi/spectro/data') self.assertEqual(model.filetype, 'fits') @@ -121,7 +137,7 @@ def test_get_regexp_filesize(self): def test_get_regexp_missing_filesize(self): """Test extraction of file size from data model documents, missing size. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file_no_size.rst') + modelfile = self.test_files / 'fits_file_no_size.rst' model = DataModel(modelfile, os.path.dirname(modelfile)) foo = model.get_regexp('/desi/spectro/data') self.assertEqual(model.filetype, 'fits') @@ -200,7 +216,7 @@ def test_extract_metadata(self): 'length of dimension 1'), ('NAXIS2', '3', 'int', 'length of dimension 2')]}} - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' model = DataModel(modelfile, os.path.dirname(modelfile)) meta = model.extract_metadata() self.assertEqual(self.title, 'fits_file') @@ -245,7 +261,7 @@ def test_extract_metadata(self): 'length of dimension 1'), ('NAXIS2', '3', 'int', 'length of dimension 2')]}} - modelfile = resource_filename('desidatamodel.test', 't/fits_file_collapse.rst') + modelfile = self.test_files / 'fits_file_collapse.rst' model = DataModel(modelfile, os.path.dirname(modelfile)) meta = model.extract_metadata() self.assertEqual(len(meta.keys()), len(ex_meta.keys())) @@ -265,7 +281,7 @@ def test_extract_metadata(self): def test_extract_metadata_missing_extname(self): """Test reading metadata with missing EXTNAME. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' model = DataModel(modelfile, os.path.dirname(modelfile)) meta = model.extract_metadata() lines = model._metafile_data.split('\n') @@ -283,7 +299,7 @@ def test_extract_metadata_bad_keyword_unit(self): """Test reading metadata with bad FITS BUNIT values. """ erg_msg = self.badUnitMessage('ergs') - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' model = DataModel(modelfile, os.path.dirname(modelfile)) meta = model.extract_metadata() lines = model._metafile_data.split('\n') @@ -301,7 +317,7 @@ def test_extract_metadata_bad_keyword_unit(self): def test_extract_metadata_missing_keyword_unit(self): """Test reading metadata with missing units for header keywords. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' model = DataModel(modelfile, os.path.dirname(modelfile)) meta = model.extract_metadata() lines = model._metafile_data.split('\n') @@ -320,7 +336,7 @@ def test_extract_metadata_bad_column_unit(self): """Test reading metadata with bad FITS column units. """ erg_msg = self.badUnitMessage('ergs') - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' model = DataModel(modelfile, os.path.dirname(modelfile)) meta = model.extract_metadata() lines = model._metafile_data.split('\n') @@ -337,7 +353,7 @@ def test_extract_metadata_bad_column_unit(self): def test_extract_metadata_missing_column_type(self): """Test reading metadata with missing FITS column types. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' model = DataModel(modelfile, os.path.dirname(modelfile)) meta = model.extract_metadata() lines = model._metafile_data.split('\n') @@ -354,7 +370,7 @@ def test_extract_metadata_missing_column_type(self): def test_extract_metadata_with_hdu_span(self): """Test reading metadata with a HDU span. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file_hduspan.rst') + modelfile = self.test_files / 'fits_file_hduspan.rst' model = DataModel(modelfile, os.path.dirname(modelfile)) meta = model.extract_metadata() self.assertEqual(meta['TWO']['number'], 2) @@ -362,7 +378,7 @@ def test_extract_metadata_with_hdu_span(self): def test_extract_metadata_with_hdu_span_no_spanext(self): """Test reading metadata with a HDU span, but with no reference HDU. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file_hduspan_no_spanext.rst') + modelfile = self.test_files / 'fits_file_hduspan_no_spanext.rst' model = DataModel(modelfile, os.path.dirname(modelfile)) with self.assertRaises(DataModelError) as e: meta = model.extract_metadata() @@ -372,7 +388,7 @@ def test_extract_metadata_with_hdu_span_no_spanext(self): def test_extract_metadata_with_hdu_span_bad_extname(self): """Test reading metadata with a HDU span, but with bad EXTNAME specification. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file_hduspan_bad_extname.rst') + modelfile = self.test_files / 'fits_file_hduspan_bad_extname.rst' model = DataModel(modelfile, os.path.dirname(modelfile)) meta = model.extract_metadata() self.assertLog(log, -1, "Range specification from HDU 2 to HDU 5 does not have a matching EXTNAME specification!") @@ -380,7 +396,7 @@ def test_extract_metadata_with_hdu_span_bad_extname(self): def test_extract_metadata_bad_format(self): """Test reading metadata with a bad HDU format specification. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file_bad_format.rst') + modelfile = self.test_files / 'fits_file_bad_format.rst' model = DataModel(modelfile, os.path.dirname(modelfile)) with self.assertRaises(DataModelError) as e: meta = model.extract_metadata() @@ -390,7 +406,7 @@ def test_extract_metadata_bad_format(self): def test_validate_prototypes(self): """Test the data model validation function. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -399,7 +415,7 @@ def test_validate_prototypes(self): def test_validate_prototype_no_prototype(self): """Test the data model validation method with no prototype. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -410,7 +426,7 @@ def test_validate_prototype_not_verifiable_prototype(self): """Test the data model validation method with prototypes that are not currently verifiable. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -421,7 +437,7 @@ def test_validate_prototype_not_verifiable_prototype(self): def test_validate_prototype_oserror(self): """Test the data model validation method with a file that throws an error. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -443,32 +459,32 @@ def test_validate_prototype_oserror(self): def test_validate_prototype_hdu_mismatch(self): """Test the data model validation method with wrong number of HDUs. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) foo = f.extract_metadata() f.hdumeta['foobar'] = 'baz' f.validate_prototype(error=True) - self.assertLog(log, -2, "{0} has the wrong number of sections (HDUs) according to {1}, skipping to next candidate.".format(modelfile.replace('.rst', '.fits'), modelfile)) + self.assertLog(log, -2, "{0} has the wrong number of sections (HDUs) according to {1}, skipping to next candidate.".format(str(modelfile).replace('.rst', '.fits'), modelfile)) self.assertLog(log, -1, "No useful prototype files found for {0}!".format(modelfile)) def test_validate_prototype_hdu_keyword_mismatch(self): """Test the data model validation method with wrong number of HDU keywords. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) f.validate_prototype() f._stub_meta[0]['keywords'].append(('BUNIT', 'erg', 'str', 'This is a test.')) f.validate_prototype(error=True) - self.assertLog(log, -1, "Prototype file {0} has these keywords in HDU0 missing from model: {{'BUNIT'}}".format(modelfile.replace('.rst', '.fits'))) + self.assertLog(log, -1, "Prototype file {0} has these keywords in HDU0 missing from model: {{'BUNIT'}}".format(str(modelfile).replace('.rst', '.fits'))) def test_validate_prototype_hdu_keyword_type_mismatch(self): """Test the data model validation method with a keyword type mismatch. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -480,51 +496,51 @@ def test_validate_prototype_hdu_keyword_type_mismatch(self): def test_validate_prototype_hdu_wrong_keyword(self): """Test the data model validation method with wrong HDU keyword names. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) f.validate_prototype() f._stub_meta[0]['keywords'][-1] = ('BUNIT', 'erg', 'str', 'This is a test.') f.validate_prototype(error=True) - self.assertLog(log, -2, "Prototype file {0} has these keywords in HDU0 missing from model: {{'BUNIT'}}".format(modelfile.replace('.rst', '.fits'))) + self.assertLog(log, -2, "Prototype file {0} has these keywords in HDU0 missing from model: {{'BUNIT'}}".format(str(modelfile).replace('.rst', '.fits'))) self.assertLog(log, -1, "Model file {0} has these keywords in HDU0 missing from data: {{'BZERO'}}".format(modelfile)) def test_validate_prototype_hdu_extension_type(self): """Test the data model validation method with wrong HDU extension type. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) f.validate_prototype() f._stub_meta[1]['extension'] = 'IMAGE' f.validate_prototype(error=True) - self.assertLog(log, -1, "Prototype file {0} has an extension type mismatch in HDU1 (IMAGE != BINTABLE) according to {1}.".format(modelfile.replace('.rst', '.fits'), modelfile)) + self.assertLog(log, -1, "Prototype file {0} has an extension type mismatch in HDU1 (IMAGE != BINTABLE) according to {1}.".format(str(modelfile).replace('.rst', '.fits'), modelfile)) # f._stub_meta[1]['extname'] = '' # f.validate_prototype(error=True) - # self.assertLog(log, -1, "Prototype file {0} has no EXTNAME in HDU1.".format(modelfile.replace('.rst', '.fits'))) + # self.assertLog(log, -1, "Prototype file {0} has no EXTNAME in HDU1.".format(str(modelfile).replace('.rst', '.fits'))) def test_validate_prototype_hdu_extension_name(self): """Test the data model validation method with wrong HDU extension name. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) f.validate_prototype() f._stub_meta[1]['extname'] = 'GALAXY' f.validate_prototype(error=True) - self.assertLog(log, -1, "Prototype file {0} has an EXTNAME mismatch in HDU1 (GALAXY != Galaxies) according to {1}.".format(modelfile.replace('.rst', '.fits'), modelfile)) + self.assertLog(log, -1, "Prototype file {0} has an EXTNAME mismatch in HDU1 (GALAXY != Galaxies) according to {1}.".format(str(modelfile).replace('.rst', '.fits'), modelfile)) f._stub_meta[1]['extname'] = '' f.validate_prototype(error=True) - self.assertLog(log, -2, "Prototype file {0} has no EXTNAME in HDU1.".format(modelfile.replace('.rst', '.fits'))) + self.assertLog(log, -2, "Prototype file {0} has no EXTNAME in HDU1.".format(str(modelfile).replace('.rst', '.fits'))) self.assertLog(log, -1, "Could not find EXTNAME = '' in {0}; trying by HDU number.".format(modelfile)) def test_validate_prototype_hdu_bad_format(self): """Test the data model validation method with a bad HDU format in the model. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -538,7 +554,7 @@ def test_validate_prototype_hdu_bad_format(self): def test_validate_prototype_hdu_alternate_format(self): """Test the data model validation method with an alternate HDU format in the model. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -552,7 +568,7 @@ def test_validate_prototype_hdu_alternate_format(self): def test_validate_prototype_hdu_bad_extension(self): """Test the data model validation method with a bad HDU extension in the model. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -566,7 +582,7 @@ def test_validate_prototype_hdu_bad_extension(self): def test_validate_prototype_hdu_missing_column(self): """Test the data model validation method with missing column in the model. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -578,7 +594,7 @@ def test_validate_prototype_hdu_missing_column(self): def test_validate_prototype_hdu_missing_data_column(self): """Test the data model validation method with missing column in the data. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -590,7 +606,7 @@ def test_validate_prototype_hdu_missing_data_column(self): def test_validate_prototype_hdu_bad_column_type(self): """Test the data model validation method with a bad column type. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -602,7 +618,7 @@ def test_validate_prototype_hdu_bad_column_type(self): def test_validate_prototype_hdu_bad_column_unit(self): """Test the data model validation method with a bad column unit. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -614,7 +630,7 @@ def test_validate_prototype_hdu_bad_column_unit(self): def test_validate_prototype_optional_keywords(self): """Test the data model validation method with optional keywords. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file_optional_columns.rst') + modelfile = self.test_files / 'fits_file_optional_columns.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -627,7 +643,7 @@ def test_validate_prototype_optional_keywords(self): def test_validate_prototype_optional_columns(self): """Test the data model validation method with optional columns. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file_optional_columns.rst') + modelfile = self.test_files / 'fits_file_optional_columns.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -639,7 +655,7 @@ def test_validate_prototype_optional_columns(self): def test_validate_prototype_variable_columns(self): """Test the data model validation method with variable-size columns. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file_variable_columns.rst') + modelfile = self.test_files / 'fits_file_variable_columns.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) f.get_regexp(os.path.dirname(modelfile)) collect_files(os.path.dirname(modelfile), [f]) @@ -651,7 +667,7 @@ def test_validate_prototype_variable_columns(self): def test_extract_columns(self): """Test extraction of columns from a row of data. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) foo = '======= ============= ==== ============' columns = list(map(len, foo.split())) @@ -663,12 +679,11 @@ def test_extract_columns(self): def test_cross_reference(self): """Test parsing of cross-references. """ - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + modelfile = self.test_files / 'fits_file.rst' f = DataModel(modelfile, os.path.dirname(modelfile)) line = "See :doc:`Other file `" ref = f._cross_reference(line) - self.assertEqual(ref, resource_filename('desidatamodel.test', - 't/fits_file.rst')) + self.assertEqual(ref, str(modelfile)) @patch('sys.argv', ['check_model', '--verbose', '--compare-files', 'DESI_SPECTRO_DATA', '/desi/spectro/data/desi-00000000.fits.fz']) def test_options(self): diff --git a/py/desidatamodel/test/test_render.py b/py/desidatamodel/test/test_render.py new file mode 100644 index 00000000..fa833b17 --- /dev/null +++ b/py/desidatamodel/test/test_render.py @@ -0,0 +1,15 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +# -*- coding: utf-8 -*- +"""Test desidatamodel.render functions +""" +import os +import sys +from packaging import version +import unittest +from unittest.mock import patch + + +class TestRender(unittest.TestCase): + + def test_render(self): + pass diff --git a/py/desidatamodel/test/test_scan.py b/py/desidatamodel/test/test_scan.py index 50c8431a..84a86ae0 100644 --- a/py/desidatamodel/test/test_scan.py +++ b/py/desidatamodel/test/test_scan.py @@ -23,7 +23,7 @@ def test_UnionStub(self): """Test initialization of UnionStub. """ - model = DataModel(resource_filename('desidatamodel.test', 't/fits_file_optional_columns.rst'), + model = DataModel(self.test_files / 'fits_file_optional_columns.rst', os.path.join(os.environ[DM], 'doc', 'examples')) foo = model.get_regexp('/desi/spectro/data') union = UnionStub(model, 10, error=False) @@ -36,7 +36,7 @@ def test_UnionStub(self): def test_UnionStub_mark_optional(self): """Test final output of UnionStub. """ - model = DataModel(resource_filename('desidatamodel.test', 't/fits_file_optional_columns.rst'), + model = DataModel(self.test_files / 'fits_file_optional_columns.rst', os.path.join(os.environ[DM], 'doc', 'examples')) foo = model.get_regexp('/desi/spectro/data') union = UnionStub(model, 10, error=False) @@ -60,9 +60,9 @@ def test_UnionStub_mark_optional(self): def test_UnionStub_update(self): """Test updates to the union model. """ - stubs = [Stub(resource_filename('desidatamodel.test', 't/fits_file.fits')), - Stub(resource_filename('desidatamodel.test', 't/fits_file.fits')), - Stub(resource_filename('desidatamodel.test', 't/fits_file.fits'))] + stubs = [Stub(self.test_files / 'fits_file.fits'), + Stub(self.test_files / 'fits_file.fits'), + Stub(self.test_files / 'fits_file.fits')] stubs[0].hdumeta[0]['keywords'][2] = ('BSCALE', '1', 'int', 'No scaling.') stubs[0].hdumeta[1]['format'].append(('OPT1', 'int32', '', 'Comment')) stubs[0].hdumeta[1]['format'].append(('OPT2', 'float64', 'yr', 'Comment')) @@ -71,7 +71,7 @@ def test_UnionStub_update(self): stubs[1].hdumeta[0]['keywords'][2] = ('BSCALE', '1', 'int', 'No scaling.') stubs[1].hdumeta[1]['format'].append(('OPT2', 'float64', 'yr', 'Comment')) stubs[2].hdumeta[0]['keywords'].append(('KEYTEST', 'example', 'str', 'Comment')) - model = DataModel(resource_filename('desidatamodel.test', 't/fits_file_optional_columns.rst'), + model = DataModel(self.test_files / 'fits_file_optional_columns.rst', os.path.join(os.environ[DM], 'doc', 'examples')) foo = model.get_regexp('/desi/spectro/data') modelmeta = model.extract_metadata() @@ -121,13 +121,13 @@ def test_collect_files(self): def test_union_metadata(self, mock_update, mock_mark): """Test collection of stub data. """ - stubs = [Stub(resource_filename('desidatamodel.test', 't/fits_file.fits')), - Stub(resource_filename('desidatamodel.test', 't/fits_file.fits')), - Stub(resource_filename('desidatamodel.test', 't/fits_file.fits'))] + stubs = [Stub(self.test_files / 'fits_file.fits'), + Stub(self.test_files / 'fits_file.fits'), + Stub(self.test_files / 'fits_file.fits')] stubs[0].hdumeta[0]['extname'] = 'primary' stubs[1].hdumeta[1]['extname'] = '' stubs[2].nhdr = 1 - model = DataModel(resource_filename('desidatamodel.test', 't/fits_file_optional_columns.rst'), + model = DataModel(self.test_files / 'fits_file_optional_columns.rst', os.path.join(os.environ[DM], 'doc', 'examples')) foo = model.get_regexp('/desi/spectro/data') union_metadata(model, stubs) diff --git a/py/desidatamodel/test/test_stub.py b/py/desidatamodel/test/test_stub.py index 937f56a5..10793a95 100644 --- a/py/desidatamodel/test/test_stub.py +++ b/py/desidatamodel/test/test_stub.py @@ -3,9 +3,9 @@ """Test desidatamodel.stub functions """ import os +import importlib.resources as ir import unittest from unittest.mock import patch, call -from pkg_resources import resource_filename from astropy.io import fits from astropy.io.fits.card import Undefined from collections import OrderedDict @@ -45,8 +45,7 @@ def test_Stub(self): # # Use a real file, and make sure no exceptions are raised. # - with fits.open(resource_filename('desidatamodel.test', - 't/fits_file.fits')) as hdulist: + with fits.open(self.test_files / 'fits_file.fits') as hdulist: stub = Stub(hdulist) self.assertEqual(stub.nhdr, 2) # @@ -626,8 +625,8 @@ def test_extract_keywords(self): def test_process_file(self): """Full test of parsing a FITS file. """ - filename = resource_filename('desidatamodel.test', 't/fits_file.fits') - modelfile = resource_filename('desidatamodel.test', 't/fits_file.rst') + filename = self.test_files / 'fits_file.fits' + modelfile = self.test_files / 'fits_file.rst' with open(modelfile) as m: modeldata = m.read() stub = Stub(filename) @@ -643,7 +642,7 @@ def test_read_column_descriptions(self): # this test mainly verifies that future edits of # data/column_descriptions.csv didn't break the format, # e.g. descriptions with spaces and commas are properly quoted - filename = resource_filename('desidatamodel', 'data/column_descriptions.csv') + filename = ir.files('desidatamodel') / 'data' / 'column_descriptions.csv' coldesc = read_column_descriptions(filename) colname = 'FLUX_R' self.assertIn(colname, coldesc.keys()) @@ -653,9 +652,9 @@ def test_read_column_descriptions(self): @patch('desidatamodel.stub.log') def test_Stub_with_descriptions(self, mock_log): - descfile = resource_filename('desidatamodel.test', 't/column_descriptions.csv') - filename = resource_filename('desidatamodel.test', 't/fits_file.fits') - filename_desc = resource_filename('desidatamodel.test', 't/fits_file_desc.fits') + descfile = self.test_files / 'column_descriptions.csv' + filename = self.test_files / 'fits_file.fits' + filename_desc = self.test_files / 'fits_file_desc.fits' # no descriptions stub = Stub(filename) @@ -682,7 +681,7 @@ def test_Stub_with_descriptions(self, mock_log): ]) # incorrect format column description file - baddescfile = resource_filename('desidatamodel.test', 't/bad_column_descriptions.csv') + baddescfile = self.test_files / 'bad_column_descriptions.csv' with self.assertRaises(ValueError): stub = Stub(filename, description_file=baddescfile) lines = str(stub) diff --git a/py/desidatamodel/test/test_unit.py b/py/desidatamodel/test/test_unit.py index a147fa93..5da52169 100644 --- a/py/desidatamodel/test/test_unit.py +++ b/py/desidatamodel/test/test_unit.py @@ -4,8 +4,6 @@ """ # import os import unittest -# from pkg_resources import resource_filename -# from .. import DataModelError from .datamodeltestcase import DataModelTestCase from ..unit import DataModelUnit, log @@ -30,11 +28,3 @@ def test_check_model(self): c = u.check_unit('ergs', error=True) self.assertEqual(str(e.exception), erg_msg) self.assertLog(log, -1, erg_msg) - - -def test_suite(): - """Allows testing of only this module with the command:: - - python setup.py test -m - """ - return unittest.defaultTestLoader.loadTestsFromName(__name__) diff --git a/py/desidatamodel/test/test_update.py b/py/desidatamodel/test/test_update.py index 0850061b..e14d961f 100644 --- a/py/desidatamodel/test/test_update.py +++ b/py/desidatamodel/test/test_update.py @@ -4,7 +4,7 @@ """ import unittest import csv -from pkg_resources import resource_filename +import importlib.resources as ir from ..update import update @@ -15,7 +15,7 @@ def test_column_descriptions(self): """Ensure that every column described in the CSV file at least has a non-empty type and description. """ - coldef_file = resource_filename('desidatamodel', 'data/column_descriptions.csv') + coldef_file = ir.files('desidatamodel') / 'data' / 'column_descriptions.csv' with open(coldef_file, newline='') as csv_columns: reader = csv.reader(csv_columns) # diff --git a/py/desidatamodel/update.py b/py/desidatamodel/update.py index 1b8ab76b..d2b7242a 100755 --- a/py/desidatamodel/update.py +++ b/py/desidatamodel/update.py @@ -9,13 +9,13 @@ """ import re -import sys +import importlib.resources as ir from html import escape -from pkg_resources import resource_filename +# from pkg_resources import resource_filename import argparse import numpy as np from astropy.table import Table -from astropy.io.ascii import RST +# from astropy.io.ascii import RST from desiutil.log import get_logger @@ -128,7 +128,8 @@ def update(lines, force=False): """ log = get_logger() - coldef_file = resource_filename('desidatamodel', 'data/column_descriptions.csv') + # coldef_file = resource_filename('desidatamodel', 'data/column_descriptions.csv') + coldef_file = ir.files('desidatamodel') / 'data' / 'column_descriptions.csv' coldefs = read_column_descriptions(coldef_file) output_lines = list() @@ -216,8 +217,6 @@ def main(): :class:`int` An integer suitable for passing to :func:`sys.exit`. """ - - import argparse parser = argparse.ArgumentParser() parser.add_argument('-i', '--infile', required=True, help='Input model filename') diff --git a/requirements.txt b/requirements.txt index c39194c9..ebe7d3bc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ astropy sphinx-toolbox +jinja2 git+https://github.com/desihub/desiutil.git@3.3.0#egg=desiutil diff --git a/setup.py b/setup.py index 1302561e..a686072b 100755 --- a/setup.py +++ b/setup.py @@ -64,7 +64,10 @@ # Autogenerate command-line scripts. # # setup_keywords['entry_points'] = {'console_scripts': ['check_model = desidatamodel.check:main', -# 'generate_model = desidatamodel.stub:main']} +# 'deep_scan_metadata = desidatamodel.scan:main', +# 'generate_model = desidatamodel.stub:main', +# 'update_bitmasks = desidatamodel.bitmasks:main', +# 'update_column_descriptions = desidatamodel.update:main']} # # Add internal data directories. # From 245d15e0e29c5ca6e32aca41a6152328100c2b4f Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 29 Aug 2023 13:14:50 -0700 Subject: [PATCH 02/14] update doc test --- .github/workflows/python-package.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index c7554f43..6adbff00 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -98,7 +98,10 @@ jobs: python -m pip install --upgrade pip wheel python -m pip install Sphinx sphinx-toolbox - name: Test the documentation + env: + PYTHONPATH: ${{ github.workspace }}/py run: | + python -m desidatamodel.render > doc/column_descriptions.rst sphinx-build -W --keep-going -b html doc doc/_build/html api: From 4e75eec7c16efd6b8ca0ff832f969d24697d5646 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 29 Aug 2023 13:29:33 -0700 Subject: [PATCH 03/14] set PYTHONPATH for RTD --- .readthedocs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 89e2e82c..42054b25 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -10,8 +10,8 @@ build: tools: python: "3.10" jobs: - post_install: - - python -m desidatamodel.render > doc/column_descriptions.rst + pre_build: + - env PYTHONPATH=${PWD}/py python -m desidatamodel.render > doc/column_descriptions.rst # Build documentation in the doc/ directory with Sphinx sphinx: From 73121c815affefdd763c74bfecf85e3cdd496980 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 29 Aug 2023 13:42:19 -0700 Subject: [PATCH 04/14] jinja2 requirement is redundant --- doc/Makefile | 7 +------ doc/_static/desidatamodel.css | 8 ++++---- doc/rtd-requirements.txt | 1 - 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 990bad2c..45a97940 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -10,11 +10,6 @@ PAPER = BUILDDIR = _build PYTHON = python -# User-friendly check for Python -ifeq ($(shell which $(PYTHON) >/dev/null 2>&1; echo $$?), 1) -$(error The '$(Python)' command was not found. Make sure you have Python installed.) -endif - # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/.) @@ -59,7 +54,7 @@ clean: rm -rf $(BUILDDIR)/* column_descriptions.rst: - $(PYTHON) -m desidatamodel.render > column_descriptions.rst + env PYTHONPATH=$(abspath ../py) $(PYTHON) -m desidatamodel.render > column_descriptions.rst html: column_descriptions.rst $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html diff --git a/doc/_static/desidatamodel.css b/doc/_static/desidatamodel.css index 90ca65f4..15010745 100644 --- a/doc/_static/desidatamodel.css +++ b/doc/_static/desidatamodel.css @@ -20,7 +20,7 @@ section details.summary-required-header-keywords-table div.wy-table-responsive t section details.summary-required-header-keywords-table div.wy-table-responsive table.keywords tbody tr.row-odd td { background-color: rgb(232, 232, 252); } section section div.wy-table-responsive table.columns tbody tr.row-even td { background-color: rgb(223, 246, 226); } section section div.wy-table-responsive table.columns tbody tr.row-odd td { background-color: rgb(232, 252, 232); } - -.wy-nav-content { - max-width: none; -} +/* + * Experimental: use a wide "viewport". This makes tables look better. + */ +.wy-nav-content { max-width: none; } diff --git a/doc/rtd-requirements.txt b/doc/rtd-requirements.txt index 9d8f4831..99f2a583 100644 --- a/doc/rtd-requirements.txt +++ b/doc/rtd-requirements.txt @@ -1,2 +1 @@ sphinx-toolbox -jinja2 From 3a07ca0bfb3a3432bd5c69392d89397a5857d7b3 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 29 Aug 2023 13:47:19 -0700 Subject: [PATCH 05/14] upgrade jinja2 --- doc/rtd-requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/rtd-requirements.txt b/doc/rtd-requirements.txt index 99f2a583..3a628c80 100644 --- a/doc/rtd-requirements.txt +++ b/doc/rtd-requirements.txt @@ -1 +1,2 @@ +jinja2>3.1 sphinx-toolbox From 6846def859f5d5adc987d5df824b721262245046 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 29 Aug 2023 14:03:40 -0700 Subject: [PATCH 06/14] clean up tests --- py/desidatamodel/render.py | 43 +++++++++++++++++-------- py/desidatamodel/test/test_check.py | 8 ----- py/desidatamodel/test/test_model.py | 8 ----- py/desidatamodel/test/test_render.py | 17 ++++++---- py/desidatamodel/test/test_scan.py | 8 ----- py/desidatamodel/test/test_stub.py | 8 ----- py/desidatamodel/test/test_top_level.py | 8 ----- 7 files changed, 41 insertions(+), 59 deletions(-) diff --git a/py/desidatamodel/render.py b/py/desidatamodel/render.py index 8aeafb09..3399da27 100644 --- a/py/desidatamodel/render.py +++ b/py/desidatamodel/render.py @@ -8,10 +8,37 @@ Render the column descriptions file. """ import csv +import sys import importlib.resources as ir import jinja2 +def format_columns(rows): + """Does something. + + Parameters + ---------- + rows : iterable + An iterable containing rows with any number of columns. + + Returns + ------- + :class:`tuple` + A tuple containing a format string, and an RST-style table separator. + """ + lengths = list() + for row in rows: + for k, col in enumerate(row): + try: + if len(col) > lengths[k]: + lengths[k] = len(col) + except IndexError: + lengths.append(len(col)) + format_string = " ".join(["{{{0}:{1}}}".format(k, c) for k, c in enumerate(lengths)]) + separator = ' '.join(['='*k for k in lengths]) + return (format_string, separator) + + def main(): """Entry point for command-line scripts. @@ -24,23 +51,13 @@ def main(): trim_blocks=True) template = env.get_template('column_descriptions.rst') columns = ir.files('desidatamodel') / 'data' / 'column_descriptions.csv' - separator_data = list() with open(columns, newline='') as cf: reader = csv.reader(cf) - for row in reader: - for k, col in enumerate(row): - try: - if len(col) > separator_data[k]: - separator_data[k] = len(col) - except IndexError: - separator_data.append(len(col)) + format_string, separator = format_columns(reader) cf.seek(0) - format_string = " ".join(["{{{0}:{1}}}".format(k, c) for k, c in enumerate(separator_data)]) - # print(format_string) - separator = ' '.join(['='*k for k in separator_data]) print(template.render(reader=reader, format_string=format_string, separator=separator)) return 0 -if __name__ == '__main__': - main() +if __name__ == '__main__': # pragma: no cover + sys.exit(main()) diff --git a/py/desidatamodel/test/test_check.py b/py/desidatamodel/test/test_check.py index 8ec926d5..8a614e47 100644 --- a/py/desidatamodel/test/test_check.py +++ b/py/desidatamodel/test/test_check.py @@ -694,11 +694,3 @@ def test_options(self): self.assertTrue(options.files) self.assertEqual(options.section, 'DESI_SPECTRO_DATA') self.assertEqual(options.directory, '/desi/spectro/data/desi-00000000.fits.fz') - - -def test_suite(): - """Allows testing of only this module with the command:: - - python setup.py test -m - """ - return unittest.defaultTestLoader.loadTestsFromName(__name__) diff --git a/py/desidatamodel/test/test_model.py b/py/desidatamodel/test/test_model.py index 49996755..18e14874 100644 --- a/py/desidatamodel/test/test_model.py +++ b/py/desidatamodel/test/test_model.py @@ -30,11 +30,3 @@ def test_model(self): error=True) for f in files: meta = f.extract_metadata(error=True) - - -def test_suite(): - """Allows testing of only this module with the command:: - - python setup.py test -m - """ - return unittest.defaultTestLoader.loadTestsFromName(__name__) diff --git a/py/desidatamodel/test/test_render.py b/py/desidatamodel/test/test_render.py index fa833b17..14ab0b6f 100644 --- a/py/desidatamodel/test/test_render.py +++ b/py/desidatamodel/test/test_render.py @@ -2,14 +2,19 @@ # -*- coding: utf-8 -*- """Test desidatamodel.render functions """ -import os -import sys -from packaging import version import unittest -from unittest.mock import patch +from ..render import format_columns class TestRender(unittest.TestCase): - def test_render(self): - pass + def test_format_columns(self): + """Test + """ + data = [('one', 'two', 'three'), + ('four', 'five', 'six'), + ('seven', 'eight', 'nine'), + ('ten', 'eleven', 'twelve')] + format_string, separator = format_columns(data) + self.assertEqual(format_string, "{0:5} {1:6} {2:6}") + self.assertEqual(separator, '===== ====== ======') diff --git a/py/desidatamodel/test/test_scan.py b/py/desidatamodel/test/test_scan.py index 84a86ae0..0a7f8b2a 100644 --- a/py/desidatamodel/test/test_scan.py +++ b/py/desidatamodel/test/test_scan.py @@ -149,11 +149,3 @@ def test_options(self): self.assertEqual(options.number, 1000) self.assertEqual(options.model, 'DESI_SPECTRO_DATA/NIGHT/EXPID/desi-EXPID.rst') self.assertListEqual(options.directory, ['/desi/spectro/data']) - - -def test_suite(): - """Allows testing of only this module with the command:: - - python setup.py test -m - """ - return unittest.defaultTestLoader.loadTestsFromName(__name__) diff --git a/py/desidatamodel/test/test_stub.py b/py/desidatamodel/test/test_stub.py index 10793a95..aedab83c 100644 --- a/py/desidatamodel/test/test_stub.py +++ b/py/desidatamodel/test/test_stub.py @@ -685,11 +685,3 @@ def test_Stub_with_descriptions(self, mock_log): with self.assertRaises(ValueError): stub = Stub(filename, description_file=baddescfile) lines = str(stub) - - -def test_suite(): - """Allows testing of only this module with the command:: - - python setup.py test -m - """ - return unittest.defaultTestLoader.loadTestsFromName(__name__) diff --git a/py/desidatamodel/test/test_top_level.py b/py/desidatamodel/test/test_top_level.py index d073fcf5..da195864 100644 --- a/py/desidatamodel/test/test_top_level.py +++ b/py/desidatamodel/test/test_top_level.py @@ -22,11 +22,3 @@ def test_version(self): """Ensure the version conforms to PEP386/PEP440. """ self.assertRegex(theVersion, self.versionre) - - -def test_suite(): - """Allows testing of only this module with the command:: - - python setup.py test -m - """ - return unittest.defaultTestLoader.loadTestsFromName(__name__) From cc919755a146d409f226907922839befa13eba23 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 29 Aug 2023 14:10:27 -0700 Subject: [PATCH 07/14] install jinja2 for tests --- .github/workflows/python-package.yml | 2 +- py/desidatamodel/check.py | 6 +++--- py/desidatamodel/test/test_check.py | 4 ++-- py/desidatamodel/test/test_render.py | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 6adbff00..49b0f2ae 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -33,7 +33,7 @@ jobs: - name: Install Python dependencies run: | python -m pip install --upgrade pip wheel - python -m pip install pytest + python -m pip install pytest jinja2 python -m pip install numpy\<1.23 python -m pip install "git+https://github.com/desihub/desiutil.git@${{ matrix.desiutil-version }}#egg=desiutil" python -m pip install "astropy${{ matrix.astropy-version }}" diff --git a/py/desidatamodel/check.py b/py/desidatamodel/check.py index 2c2fc972..946349d3 100644 --- a/py/desidatamodel/check.py +++ b/py/desidatamodel/check.py @@ -33,7 +33,7 @@ class DataModel(DataModelUnit): Raises ------ - ValueError + TypeError If `filename` or `section` have an unexpected type. """ # Marker for optional keywords and columns. @@ -97,13 +97,13 @@ def __init__(self, filename, section): self.section = str(section) shortname = str(filename).replace(f'{section}/', '') else: - raise ValueError('Unexpected type for filename!') + raise TypeError('Unexpected type for filename!') if isinstance(section, str): self.section = section elif isinstance(section, Path): self.section = str(section) else: - raise ValueError('Unexpected type for section!') + raise TypeError('Unexpected type for section!') log.debug('Creating DataModel for %s.', shortname) self.title = None self.ref = None diff --git a/py/desidatamodel/test/test_check.py b/py/desidatamodel/test/test_check.py index 8a614e47..08396150 100644 --- a/py/desidatamodel/test/test_check.py +++ b/py/desidatamodel/test/test_check.py @@ -29,9 +29,9 @@ def test_DataModel_init_bad_type(self): """Test initialization of the DataModel object. """ modelfile = self.test_files / 'fits_file.rst' - with self.assertRaises(ValueError): + with self.assertRaises(TypeError): model = DataModel(None, self.test_files) - with self.assertRaises(ValueError): + with self.assertRaises(TypeError): model = DataModel(modelfile, None) def test_scan_model(self): diff --git a/py/desidatamodel/test/test_render.py b/py/desidatamodel/test/test_render.py index 14ab0b6f..2dac25d5 100644 --- a/py/desidatamodel/test/test_render.py +++ b/py/desidatamodel/test/test_render.py @@ -6,10 +6,11 @@ from ..render import format_columns + class TestRender(unittest.TestCase): def test_format_columns(self): - """Test + """Test column formatting operations. """ data = [('one', 'two', 'three'), ('four', 'five', 'six'), From ea2df24b364dc0f5f9d1cceab6d70b540e4cdd18 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 29 Aug 2023 14:13:52 -0700 Subject: [PATCH 08/14] pin rtd theme --- doc/rtd-requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/rtd-requirements.txt b/doc/rtd-requirements.txt index 3a628c80..15ab89dd 100644 --- a/doc/rtd-requirements.txt +++ b/doc/rtd-requirements.txt @@ -1,2 +1,3 @@ jinja2>3.1 sphinx-toolbox +sphinx-rtd-theme>=1.3 From 13e2750cf90b054209dc899a1c16a896f3a6f037 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 29 Aug 2023 14:24:39 -0700 Subject: [PATCH 09/14] remove extraneous file --- doc/rtd-requirements.txt | 2 +- foo.rst | 463 --------------------------------------- 2 files changed, 1 insertion(+), 464 deletions(-) delete mode 100644 foo.rst diff --git a/doc/rtd-requirements.txt b/doc/rtd-requirements.txt index 15ab89dd..abd4c674 100644 --- a/doc/rtd-requirements.txt +++ b/doc/rtd-requirements.txt @@ -1,3 +1,3 @@ jinja2>3.1 sphinx-toolbox -sphinx-rtd-theme>=1.3 +sphinx-rtd-theme>1.2 diff --git a/foo.rst b/foo.rst deleted file mode 100644 index 40067728..00000000 --- a/foo.rst +++ /dev/null @@ -1,463 +0,0 @@ -============================ -Standard Column Descriptions -============================ - -This file is an auto-generated version of `column_descriptions.csv`_. - -.. _`column_descriptions.csv`: https://github.com/desihub/desidatamodel/blob/main/py/desidatamodel/data/column_descriptions.csv - -================================= =========== ================================= ===================================================================================================================================== -Name Type Units Description -================================= =========== ================================= ===================================================================================================================================== -ABSMAG_R float64 Absolute magnitude in the r-band after k-correction -AIRMASS float32 Average airmass during this exposure -AIRMASS_GFA float64 Average airmass during this exposure as measured by GFA -APFLUX_G float32 nanomaggy Total flux in nanomaggies extracted in a 0.75 arcsec radius in the g band at this location -APFLUX_IVAR_G float32 nanomaggy^-2 Inverse variance of APFLUX_G -APFLUX_IVAR_R float32 nanomaggy^-2 Inverse variance of APFLUX_R -APFLUX_IVAR_Z float32 nanomaggy^-2 Inverse variance of APFLUX_Z -APFLUX_R float32 nanomaggy Total flux in nanomaggies extracted in a 0.75 arcsec radius in the r band at this location -APFLUX_Z float32 nanomaggy Total flux in nanomaggies extracted in a 0.75 arcsec radius in the z band at this location -A_MGII float32 Fitted parameter A (amplitude) by MgII fitter -BGS_TARGET int64 BGS (Bright Galaxy Survey) target selection bitmask -BITWEIGHTS int64[2] A size of two 64 bit masks that encodes which of the alternative assignment histories that the target was assigned in -BLOBDIST float32 pix Maximum distance from a detected Legacy Surveys source -BRICKID int32 Brick ID from tractor input -BRICKNAME char[8] Brick name from tractor input -BRICK_OBJID int32 Imaging Surveys OBJID on that brick -B_MGII float32 Fitted parameter B (constant) by MgII fitter -CAMERA char[2] Camera identifier. Passband and SPECGRPH ([brz][0-9]). -CHECKER char[5] Initials of researcher who vetted the target -CHI2 float64 Best fit chi squared -CMX_TARGET int64 Target selection bitmask for commissioning -COADD_EXPTIME float32 s Summed exposure time for coadd -COADD_FIBERSTATUS int32 bitwise-AND of input FIBERSTATUS -COADD_NUMEXP int16 Number of exposures in coadd -COADD_NUMNIGHT int16 Number of nights in coadd -COADD_NUMTILE int16 Number of tiles in coadd -COEFF float64[10] Redrock template coefficients -COMP_TILE float64 Assignment completeness for all targets of this type with the same value for TILES -C_CIII float32 Confidence for CIII line -C_CIV float32 Confidence for CIV line -C_Halpha float32 Confidence for Halpha line -C_Hbeta float32 Confidence for Hbeta line -C_LYA float32 Confidence for LyA line, i.e. ~probability to be a QSO -C_MgII float32 Confidence for MgII line -DCHISQ float32[5] Difference in chi-squared between Tractor model fits -DEC float64 deg Barycentric declination in ICRS -DEC_IVAR float32 deg^-2 Inverse variance of DEC, excluding astrometric calibration errors -DELTACHI2 float64 chi2 difference between first- and second-best redrock template fits -DELTA_CHI2 float32 Difference of chi2 between redrock fit and MgII fitter over the lambda interval considered during the fit -DELTA_X float64 mm CS5 X requested minus actual position -DELTA_Y float64 mm CS5 Y requested minus actual position -DESI_TARGET int64 DESI (dark time program) target selection bitmask -DEVICE_LOC int32 Device location on focal plane [0-523] -DEVICE_TYPE char[3] Device type -EBV float32 mag Galactic extinction E(B-V) reddening from SFD98 -EFFTIME_ETC float64 s Effective exposure time for nominal conditions inferred from ETC data -EFFTIME_SPEC float64 s Effective exposure time for nominal conditions derived from the TSNR2 fits to the spectroscopy -EQ_ALL_0P0 float64 e-correction at redshift=0.0 -EQ_ALL_0P1 float64 e-correction at redshift=0.1 -EXPID int32 DESI Exposure ID number -EXPTIME float64 s Length of time shutter was open -FAFLAVOR char[*] Fiberassign flavor name -FAPRGRM char[*] Fiberassign program name -FA_TARGET int64 Targeting bit internally used by fiberassign (linked with FA_TYPE) -FA_TYPE binary Fiberassign internal target type (science, standard, sky, safe, suppsky) -FIBER int32 Fiber ID on the CCDs [0-4999] -FIBERASSIGN_X float32 mm Fiberassign expected CS5 X location on focal plane -FIBERASSIGN_Y float32 mm Fiberassign expected CS5 Y location on focal plane -FIBERFLUX_G float32 nanomaggy Predicted g-band flux within a fiber of diameter 1.5 arcsec from this object in 1 arcsec Gaussian seeing -FIBERFLUX_R float32 nanomaggy Predicted r-band flux within a fiber of diameter 1.5 arcsec from this object in 1 arcsec Gaussian seeing -FIBERFLUX_Z float32 nanomaggy Predicted z-band flux within a fiber of diameter 1.5 arcsec from this object in 1 arcsec Gaussian seeing -FIBERFLUX_IVAR_G float32 nanomaggy^-2 Inverse variance of ``FIBERFLUX_G`` -FIBERFLUX_IVAR_R float32 nanomaggy^-2 Inverse variance of ``FIBERFLUX_R`` -FIBERFLUX_IVAR_Z float32 nanomaggy^-2 Inverse variance of ``FIBERFLUX_Z`` -FIBERSTATUS int32 Fiber status mask. 0=good -FIBERTOTFLUX_G float32 nanomaggy Predicted g-band flux within a fiber of diameter 1.5 arcsec from all sources at this location in 1 arcsec Gaussian seeing -FIBERTOTFLUX_R float32 nanomaggy Predicted r-band flux within a fiber of diameter 1.5 arcsec from all sources at this location in 1 arcsec Gaussian seeing -FIBERTOTFLUX_W1 float32 nanomaggy Predicted WISE W1-band flux within a fiber of diameter 1.5 arcsec from all sources at this location in 1 arcsec Gaussian seeing -FIBERTOTFLUX_W2 float32 nanomaggy Predicted WISE W2-band flux within a fiber of diameter 1.5 arcsec from all sources at this location in 1 arcsec Gaussian seeing -FIBERTOTFLUX_Z float32 nanomaggy Predicted z-band flux within a fiber of diameter 1.5 arcsec from all sources at this location in 1 arcsec Gaussian seeing -FIBER_DEC float64 deg DEC of actual fiber position -FIBER_RA float64 deg RA of actual fiber position -FIBER_X float64 mm CS5 X location requested by PlateMaker -FIBER_Y float64 mm CS5 Y location requested by PlateMaker -FLUX_G float32 nanomaggy Flux in the Legacy Survey g-band (AB) -FLUX_G_DERED float32 nanomaggy Flux in the g-band after correcting for Galactic extinction (AB system) -FLUX_IVAR_G float32 nanomaggy^-2 Inverse variance of FLUX_G (AB) -FLUX_IVAR_R float32 nanomaggy^-2 Inverse variance of FLUX_R (AB) -FLUX_IVAR_W1 float32 nanomaggy^-2 Inverse variance of FLUX_W1 (AB) -FLUX_IVAR_W2 float32 nanomaggy^-2 Inverse variance of FLUX_W2 (AB) -FLUX_IVAR_Z float32 nanomaggy^-2 Inverse variance of FLUX_Z (AB) -FLUX_R float32 nanomaggy Flux in the Legacy Survey r-band (AB) -FLUX_R_DERED float32 nanomaggy Flux in the r-band after correcting for Galactic extinction (AB system) -FLUX_W1 float32 nanomaggy WISE flux in W1 (AB) -FLUX_W1_DERED float32 nanomaggy Flux in the WISE W1-band after correcting for Galactic extinction (AB system) -FLUX_W2 float32 nanomaggy WISE flux in W2 (AB) -FLUX_W2_DERED float32 nanomaggy Flux in the WISE W2-band after correcting for Galactic extinction (AB system) -FLUX_Z float32 nanomaggy Flux in the Legacy Survey z-band (AB) -FLUX_Z_DERED float32 nanomaggy Flux in the z-band after correcting for Galactic extinction (AB system) -FRACZ_TILELOCID float64 The fraction of targets of this type at this TILELOCID that received an observation (after forcing each target to a unique TILELOCID) -GAIA_ASTROMETRIC_EXCESS_NOISE float32 Gaia astrometric excess noise -GAIA_ASTROMETRIC_PARAMS_SOLVED int64 which astrometric parameters were estimated for a Gaia source -GAIA_ASTROMETRIC_SIGMA5D_MAX float32 mas Gaia longest semi-major axis of the 5-d error ellipsoid -GAIA_DEC float64 deg Gaia ICRS declination -GAIA_DUPLICATED_SOURCE bool Gaia duplicated source flag -GAIA_PHOT_BP_MEAN_FLUX_OVER_ERROR float32 Gaia BP band signal-to-noise -GAIA_PHOT_BP_MEAN_MAG float32 mag Gaia BP band magnitude -GAIA_PHOT_BP_N_OBS int32 Gaia BP band number of observations -GAIA_PHOT_BP_RP_EXCESS_FACTOR float32 Gaia BP/RP excess factor -GAIA_PHOT_G_MEAN_FLUX_OVER_ERROR float32 Gaia G band signal-to-noise -GAIA_PHOT_G_MEAN_MAG float32 mag Gaia G band magnitude -GAIA_PHOT_G_N_OBS int32 Gaia G band number of observations -GAIA_PHOT_RP_MEAN_FLUX_OVER_ERROR float32 Gaia RP band signal-to-noise -GAIA_PHOT_RP_MEAN_MAG float32 mag Gaia RP band magnitude -GAIA_PHOT_RP_N_OBS int32 Gaia RP band number of observations -GAIA_RA float64 deg Gaia ICRS right ascension -GALDEPTH_G float32 nanomaggy^-2 Galaxy model-based depth in LS g-band -GALDEPTH_R float32 nanomaggy^-2 Galaxy model-based depth in LS r-band -GALDEPTH_Z float32 nanomaggy^-2 Galaxy model-based depth in LS z-band -GOODHARDLOC bool True/False whether the fiber had good hardware -GOODPRI bool True/False whether the priority of what was assigned to the location was <= the base priority of the given target class -GOODTSNR bool True/False whether the TSNR_ value used was above the minimum threshold for the given target class -HALPHA_CHI2 float32 Reduced chi2 of the fit for the HALPHA line -HALPHA_CONT float32 10**-17 erg/(s cm2 Angstrom) Continuum used for the fitting (fixed value) for the HALPHA line -HALPHA_CONT_IVAR float32 10**+34 (s2 cm4 Angstrom2) / erg2 Inverse variance of the continuum for the HALPHA line -HALPHA_EW float32 Angstrom Fitted rest-frame equivalent width for the HALPHA line -HALPHA_EW_IVAR float32 Angstrom^-2 Inverse variance of the fitted rest-frame equivalent width for the HALPHA line -HALPHA_FLUX float32 10**-17 erg/(s cm2) Fitted flux for the HALPHA line -HALPHA_FLUX_IVAR float32 10**+34 (s2 cm4) / erg2 Inverse variance of the fitted flux for the HALPHA line -HALPHA_NDOF int32 Number of degrees of freedom of the fit for the HALPHA line -HALPHA_SHARE float32 NaN (SHARE not relevant for HALPHA line) -HALPHA_SHARE_IVAR float32 NaN (SHARE not relevant for HALPHA line) -HALPHA_SIGMA float32 Angstrom Fitted line width (in the observed frame) for the HALPHA line -HALPHA_SIGMA_IVAR float32 Angstrom^-2 Inverse variance of the fitted line width (in the observed frame) for the HALPHA line -HBETA_CHI2 float32 Reduced chi2 of the fit for the HBETA line -HBETA_CONT float32 10**-17 erg/(s cm2 Angstrom) Continuum used for the fitting (fixed value) for the HBETA line -HBETA_CONT_IVAR float32 10**+34 (s2 cm4 Angstrom2) / erg2 Inverse variance of the continuum for the HBETA line -HBETA_EW float32 Angstrom Fitted rest-frame equivalent width for the HBETA line -HBETA_EW_IVAR float32 Angstrom^-2 Inverse variance of the fitted rest-frame equivalent width for the HBETA line -HBETA_FLUX float32 10**-17 erg/(s cm2) Fitted flux for the HBETA line -HBETA_FLUX_IVAR float32 10**+34 (s2 cm4) / erg2 Inverse variance of the fitted flux for the HBETA line -HBETA_NDOF int32 Number of degrees of freedom of the fit for the HBETA line -HBETA_SHARE float32 NaN (SHARE not relevant for HBETA line) -HBETA_SHARE_IVAR float32 NaN (SHARE not relevant for HBETA line) -HBETA_SIGMA float32 Angstrom Fitted line width (in the observed frame) for the HBETA line -HBETA_SIGMA_IVAR float32 Angstrom^-2 Inverse variance of the fitted line width (in the observed frame) for the HBETA line -HDELTA_CHI2 float32 Reduced chi2 of the fit for the HDELTA line -HDELTA_CONT float32 10**-17 erg/(s cm2 Angstrom) Continuum used for the fitting (fixed value) for the HDELTA line -HDELTA_CONT_IVAR float32 10**+34 (s2 cm4 Angstrom2) / erg2 Inverse variance of the continuum for the HDELTA line -HDELTA_EW float32 Angstrom Fitted rest-frame equivalent width for the HDELTA line -HDELTA_EW_IVAR float32 Angstrom^-2 Inverse variance of the fitted rest-frame equivalent width for the HDELTA line -HDELTA_FLUX float32 10**-17 erg/(s cm2) Fitted flux for the HDELTA line -HDELTA_FLUX_IVAR float32 10**+34 (s2 cm4) / erg2 Inverse variance of the fitted flux for the HDELTA line -HDELTA_NDOF int32 Number of degrees of freedom of the fit for the HDELTA line -HDELTA_SHARE float32 NaN (SHARE not relevant for HDELTA line) -HDELTA_SHARE_IVAR float32 NaN (SHARE not relevant for HDELTA line) -HDELTA_SIGMA float32 Angstrom Fitted line width (in the observed frame) for the HDELTA line -HDELTA_SIGMA_IVAR float32 Angstrom^-2 Inverse variance of the fitted line width (in the observed frame) for the HDELTA line -HEALPIX int32 HEALPixel containing this location at NSIDE=64 in the NESTED scheme -HGAMMA_CHI2 float32 Reduced chi2 of the fit for the HGAMMA line -HGAMMA_CONT float32 10**-17 erg/(s cm2 Angstrom) Continuum used for the fitting (fixed value) for the HGAMMA line -HGAMMA_CONT_IVAR float32 10**+34 (s2 cm4 Angstrom2) / erg2 Inverse variance of the continuum for the HGAMMA line -HGAMMA_EW float32 Angstrom Fitted rest-frame equivalent width for the HGAMMA line -HGAMMA_EW_IVAR float32 Angstrom^-2 Inverse variance of the fitted rest-frame equivalent width for the HGAMMA line -HGAMMA_FLUX float32 10**-17 erg/(s cm2) Fitted flux for the HGAMMA line -HGAMMA_FLUX_IVAR float32 10**+34 (s2 cm4) / erg2 Inverse variance of the fitted flux for the HGAMMA line -HGAMMA_NDOF int32 Number of degrees of freedom of the fit for the HGAMMA line -HGAMMA_SHARE float32 NaN (SHARE not relevant for HGAMMA line) -HGAMMA_SHARE_IVAR float32 NaN (SHARE not relevant for HGAMMA line) -HGAMMA_SIGMA float32 Angstrom Fitted line width (in the observed frame) for the HGAMMA line -HGAMMA_SIGMA_IVAR float32 Angstrom^-2 Inverse variance of the fitted line width (in the observed frame) for the HGAMMA line -HPXPIXEL int64 HEALPixel containing this location at NSIDE=64 in the NESTED scheme -IN_DESI int16 Used by fiberassign to make a tile in the DESI footprint; always set to 1 -IN_RADIUS float32 arcsec Radius used to set the ``IN_BRIGHT_OBJECT`` bit in the ``DESI_TARGET`` bitmask. -IS_QSO_MGII bool Boolean: True if the object passes the MgII selection -IS_QSO_QN int16 Spectroscopic classification from QuasarNET (1 for a quasar) -KCORR_G0P0 float64 g-band k-correction at redshift=0.0 -KCORR_G0P1 float64 g-band k-correction at redshift=0.1 -KCORR_R0P0 float64 r-band k-correction at redshift=0.0 -KCORR_R0P1 float64 r-band k-correction at redshift=0.1 -LAMBDA_REF float32 Angstrom Requested wavelength at which targets should be centered on fibers -LASTNIGHT int32 Final night of observation included in a series of coadds -LC_FLUX_IVAR_W1 float32[15] nanomaggy^-2 Inverse variance of LC_FLUX_W1 (AB system; defaults to zero for unused entries) -LC_FLUX_IVAR_W2 float32[15] nanomaggy^-2 Inverse variance of LC_FLUX_W2 (AB system; defaults to zero for unused entries) -LC_FLUX_W1 float32[15] nanomaggy FLUX_W1 in each of up to fifteen unWISE coadd epochs (AB system; defaults to zero for unused entries) -LC_FLUX_W2 float32[15] nanomaggy FLUX_W2 in each of up to fifteen unWISE coadd epochs (AB system; defaults to zero for unused entries) -LC_MJD_W1 float64[15] MJD_W1 in each of up to fifteen unWISE coadd epochs (defaults to zero for unused entries) -LC_MJD_W2 float64[15] MJD_W2 in each of up to fifteen unWISE coadd epochs (defaults to zero for unused entries) -LC_NOBS_W1 int16[15] NOBS_W1 in each of up to fifteen unWISE coadd epochs -LC_NOBS_W2 int16[15] NOBS_W2 in each of up to fifteen unWISE coadd epochs -LOCATION int64 Location on the focal plane PETAL_LOC*1000 + DEVICE_LOC -LOCATION_ASSIGNED bool True/False for assigned/unassigned for the target in question -LRG_MASK binary Imaging mask bits relevant to LRG targets -MAIN_NSPEC int32 Number of coadded spectra for this TARGETID in Main survey -MAIN_PRIMARY bool Boolean flag (True/False) for the primary coadded spectrum in Main survey -MASKBITS int16 Bitwise mask from the imaging indicating potential issue or blending -MEAN_DELTA_X float32 mm Mean (over exposures) fiber difference requested - actual CS5 X location on focal plane -MEAN_DELTA_Y float32 mm Mean (over exposures) fiber difference requested - actual CS5 Y location on focal plane -MEAN_FIBER_DEC float64 deg Mean (over exposures) DEC of actual fiber position -MEAN_FIBER_RA float64 deg Mean (over exposures) RA of actual fiber position -MEAN_FIBER_X float32 mm Mean (over exposures) fiber CS5 X location on focal plane -MEAN_FIBER_Y float32 mm Mean (over exposures) fiber CS5 Y location on focal plane -MEAN_PSF_TO_FIBER_SPECFLUX float32 Mean of input exposures fraction of light from point-like source captured by 1.5 arcsec diameter fiber given atmospheric seeing -MEDIAN_CALIB_COUNT_B float64 Median of calibrated flux in B camera -MEDIAN_CALIB_COUNT_R float64 Median of calibrated flux in R camera -MEDIAN_CALIB_COUNT_Z float64 Median of calibrated flux in Z camera -MEDIAN_CALIB_SNR_B float64 Median(S/N) of calibrated flux in B camera -MEDIAN_CALIB_SNR_R float64 Median(S/N) of calibrated flux in R camera -MEDIAN_CALIB_SNR_Z float64 Median(S/N) of calibrated flux in Z camera -MEDIAN_FFLAT_COUNT_B float64 Median of fiber-flatfielded counts in B camera -MEDIAN_FFLAT_COUNT_R float64 Median of fiber-flatfielded counts in R camera -MEDIAN_FFLAT_COUNT_Z float64 Median of fiber-flatfielded counts in Z camera -MEDIAN_FFLAT_SNR_B float64 Median(S/N) of fiberflatfielded counts in B camera -MEDIAN_FFLAT_SNR_R float64 Median(S/N) of fiberflatfielded counts in R camera -MEDIAN_FFLAT_SNR_Z float64 Median(S/N) of fiberflatfielded counts in Z camera -MEDIAN_RAW_COUNT_B float64 Median of raw counts in B camera -MEDIAN_RAW_COUNT_R float64 Median of raw counts in R camera -MEDIAN_RAW_COUNT_Z float64 Median of raw counts in Z camera -MEDIAN_RAW_SNR_B float64 Median(raw signal/noise) in B camera -MEDIAN_RAW_SNR_R float64 Median(raw signal/noise) in R camera -MEDIAN_RAW_SNR_Z float64 Median(raw signal/noise) in Z camera -MEDIAN_SKYSUB_COUNT_B float64 Median of sky-subtracted counts in B camera -MEDIAN_SKYSUB_COUNT_R float64 Median of sky-subtracted counts in R camera -MEDIAN_SKYSUB_COUNT_Z float64 Median of sky-subtracted counts in Z camera -MEDIAN_SKYSUB_SNR_B float64 Median(S/N) of sky-subtracted counts in B camera -MEDIAN_SKYSUB_SNR_R float64 Median(S/N) of sky-subtracted counts in R camera -MEDIAN_SKYSUB_SNR_Z float64 Median(S/N) of sky-subtracted counts in Z camera -MJD float64 d Modified Julian Date when shutter was opened for this exposure -MJD_BEGIN float64 d Start of the allowed observing window for this target (Modified Julian Date) -MJD_END float64 d End of the allowed observing window for this target (Modified Julian Date) -MORPHTYPE char[4] Imaging Surveys morphological type from Tractor -MWS_TARGET int64 Milky Way Survey targeting bits -MW_TRANSMISSION_G float32 Milky Way dust transmission in LS g-band -MW_TRANSMISSION_R float32 Milky Way dust transmission in LS r-band -MW_TRANSMISSION_W1 float32 Milky Way dust transmission in WISE W1 -MW_TRANSMISSION_W2 float32 Milky Way dust transmission in WISE W2 -MW_TRANSMISSION_W3 float32 Milky Way dust transmission in WISE W3 -MW_TRANSMISSION_W4 float32 Milky Way dust transmission in WISE W4 -MW_TRANSMISSION_Z float32 Milky Way dust transmission in LS z-band -NCOEFF int64 Number of Redrock template coefficients -NEAR_RADIUS float32 arcsec Radius used to set the ``NEAR_BRIGHT_OBJECT`` bit in the ``DESI_TARGET`` bitmask. -NIGHT int32 Night of observation (YYYYMMDD) starting at local noon before observations start -NOBS_G int16 Number of images for central pixel in g-band -NOBS_R int16 Number of images for central pixel in r-band -NOBS_Z int16 Number of images for central pixel in z-band -NPIXELS int64 Number of unmasked pixels contributing to the Redrock fit -NTILE int64 Number of tiles target was available on -NUMOBS int64 Number of spectroscopic observations (on this specific, single tile) -NUMOBS_INIT int64 Initial number of observations for target calculated across target selection bitmasks and OBSCONDITIONS -NUMOBS_MORE int64 Number of additional observations needed -NUMTARGET int16 Total number of targets that this positioner covered -NUM_ITER int64 Number of positioner iterations -NZ float64 h^3 Mpc^-3 The comoving number density of the tracer at the given redshift, assuming complete sample -O2C float64 The criteria for assessing strength of OII emission for ELG observations -OBJID int32 Imaging Surveys OBJID on that brick (renamed BRICK_OBJID) -OBJTYPE char[3] Object type: TGT, SKY, NON, BAD -OBSCONDITIONS int32 Bitmask of allowed observing conditions -OCLAYER char[6] Either 'DARK' for dark-time or 'BRIGHT' to observe in either bright- or dark-time -OIII_CHI2 float32 Reduced chi2 of the fit for the [OIII] doublet -OIII_CONT float32 10**-17 erg/(s cm2 Angstrom) Continuum used for the fitting (fixed value) for the [OIII] doublet -OIII_CONT_IVAR float32 10**+34 (s2 cm4 Angstrom2) / erg2 Inverse variance of the continuum for the [OIII] doublet -OIII_EW float32 Angstrom Fitted rest-frame equivalent width for the [OIII] doublet -OIII_EW_IVAR float32 Angstrom^-2 Inverse variance of the fitted rest-frame equivalent width for the [OIII] doublet -OIII_FLUX float32 10**-17 erg/(s cm2) Fitted flux for the [OIII] doublet -OIII_FLUX_IVAR float32 10**+34 (s2 cm4) / erg2 Inverse variance of the fitted flux for the [OIII] doublet -OIII_NDOF int32 Number of degrees of freedom of the fit for the [OIII] doublet -OIII_SHARE float32 F1/(F0+F1) for the [OIII] doublet, where F0 and F1 are the individual line fluxes (SHARE value fixed during the fit) -OIII_SHARE_IVAR float32 Infinite value, as SHARE is fixed during the fit -OIII_SIGMA float32 Angstrom Fitted line width (in the observed frame) for the [OIII] doublet -OIII_SIGMA_IVAR float32 Angstrom^-2 Inverse variance of the fitted line width (in the observed frame) for the [OIII] doublet -OII_CHI2 float32 Reduced chi2 of the fit for the [OII] doublet -OII_CONT float32 10**-17 erg/(s cm2 Angstrom) Continuum used for the fitting (fixed value) for the [OII] doublet -OII_CONT_IVAR float32 10**+34 (s2 cm4 Angstrom2) / erg2 Inverse variance of the continuum for the [OII] doublet -OII_EW float32 Angstrom Fitted rest-frame equivalent width for the [OII] doublet -OII_EW_IVAR float32 Angstrom^-2 Inverse variance of the fitted rest-frame equivalent width for the [OII] doublet -OII_FLUX float32 10**-17 erg/(s cm2) Fitted flux for the [OII] doublet -OII_FLUX_IVAR float32 10**+34 (s2 cm4) / erg2 Inverse variance of the fitted flux for the [OII] doublet -OII_NDOF int32 Number of degrees of freedom of the fit for the [OII] doublet -OII_SHARE float32 Fitted F1/(F0+F1) for the [OII] doublet, where F0 and F1 are the individual line fluxes -OII_SHARE_IVAR float32 Inverse variance of the fitted F1/(F0+F1) for the [OII] doublet -OII_SIGMA float32 Angstrom Fitted line width (in the observed frame) for the [OII] doublet -OII_SIGMA_IVAR float32 Angstrom^-2 Inverse variance of the fitted line width (in the observed frame) for the [OII] doublet -PARALLAX float32 mas Reference catalog parallax -PARALLAX_IVAR float32 mas^-2 Inverse variance of PARALLAX -PETAL_LOC int16 Petal location [0-9] -PHOTSYS char[1] 'N' for the MzLS/BASS photometric system, 'S' for DECaLS -PLATE_DEC float64 deg Barycentric Declination in ICRS to be used by PlateMaker -PLATE_RA float64 deg Barycentric Right Ascension in ICRS to be used by PlateMaker -PLATE_REF_EPOCH float64 yr Copy of REF_EPOCH to be used by PlateMaker -PMDEC float32 mas yr^-1 Proper motion in the +Dec direction -PMDEC_IVAR float32 yr^2 mas^-2 Inverse variance of PMDEC -PMRA float32 mas yr^-1 proper motion in the +RA direction (already including cos(dec)) -PMRA_IVAR float32 yr^2 mas^-2 Inverse variance of PMRA -PRIORITY int32 Target current priority -PRIORITY_INIT int64 Target initial priority from target selection bitmasks and OBSCONDITIONS -PROBA_RF float32 Probability of being a quasar generated by the quasar Random Forest targeting algorithm. -PROB_OBS float64 The number alternative assignment histories that the target was assigned in divided by 128 -PROGRAM char[6] DESI program type - BRIGHT, DARK, BACKUP, OTHER -PSFDEPTH_G float32 nanomaggy^-2 PSF-based depth in g-band -PSFDEPTH_R float32 nanomaggy^-2 PSF-based depth in r-band -PSFDEPTH_W1 float32 nanomaggy^-2 PSF-based depth in WISE W1 -PSFDEPTH_W2 float32 nanomaggy^-2 PSF-based depth in WISE W2 -PSFDEPTH_Z float32 nanomaggy^-2 PSF-based depth in z-band -PSFSIZE_G float32 arcsec Median PSF size evaluated at the BRICK_PRIMARY objects in this brick in g-band -PSFSIZE_R float32 arcsec Median PSF size evaluated at the BRICK_PRIMARY objects in this brick in r-band -PSFSIZE_Z float32 arcsec Median PSF size evaluated at the BRICK_PRIMARY objects in this brick in z-band -PSF_TO_FIBER_SPECFLUX float64 fraction of light from point-like source captured by 1.5 arcsec diameter fiber given atmospheric seeing -RA float64 deg Barycentric Right Ascension in ICRS -RA_IVAR float32 deg^-2 Inverse variance of RA (no cosine term!), excluding astrometric calibration errors -REF_CAT char[2] Reference catalog source for star: 'T2' for Tycho-2, 'G2' for Gaia DR2, 'L2' for the SGA, empty otherwise -REF_EPOCH float32 yr Reference epoch for Gaia/Tycho astrometry. Typically 2015.5 for Gaia -REF_ID int64 Tyc1*1,000,000+Tyc2*10+Tyc3 for Tycho-2; ``sourceid`` for Gaia DR2 -REF_MAG float32 mag Magnitude used to calculate ``IN_RADIUS``; typically, in order of preference, G-band for Gaia or VT then HP then BT for Tycho. -RELEASE int16 Imaging surveys release ID -REST_GMR_0P0 float64 Rest-frame g-r colour at redshift=0.0 -REST_GMR_0P1 float64 Rest-frame g-r colour at redshift=0.1 -RMS_DELTA_X float32 mm RMS (over exposures) of the fiber difference between measured and requested CS5 X location on focal plane -RMS_DELTA_Y float32 mm RMS (over exposures) of the fiber difference between measured and requested CS5 Y location on focal plane -ROSETTE_NUMBER int32 Rosette number ID [0-19] -ROSETTE_R float64 deg Radius from the center of the rosette to the target -SCND_TARGET int64 Target selection bitmask for secondary programs -SCND_ORDER int32 Number of row for target entry in secondary file (placeholder; needed by fiberassign) -SEEING_ETC float64 arcsec Average FWHM atmospheric seeing during this exposure as measured by ETC -SEEING_GFA float64 arcsec Average FWHM atmospheric seeing during this exposure as measured by GFA -SERSIC float32 Power-law index for the Sersic profile model (MORPHTYPE='SER') -SERSIC_IVAR float32 Inverse variance of SERSIC -SHAPEDEV_E1 float32 deVaucouleurs shape fit elipticity parameter e1 -SHAPEDEV_E1_IVAR float32 Inverse variance of SHAPEDEV_E1 -SHAPEDEV_E2 float32 deVaucouleurs shape fit elipticity parameter e2 -SHAPEDEV_E2_IVAR float32 Inverse variance of SHAPEDEV_E2 -SHAPEDEV_R float32 arcsec deVaucouleurs shape half-light radius -SHAPEDEV_R_IVAR float32 arcsec^-2 Inverse variance of SHAPEDEV_R -SHAPEEXP_E1 float32 Imaging exponential shape fit elipticity parameter e1 -SHAPEEXP_E1_IVAR float32 Inverse variance of SHAPEEXP_E1 -SHAPEEXP_E2 float32 Imaging exponential shape fit elipticity parameter e2 -SHAPEEXP_E2_IVAR float32 Inverse variance of SHAPEEXP_E2 -SHAPEEXP_R float32 arcsec Imaging exponential shape half-light radius -SHAPEEXP_R_IVAR float32 arcsec^-2 Inverse variance of SHAPEEXP_R -SHAPE_E1 float32 Ellipticity component 1 of galaxy model for galaxy type MORPHTYPE -SHAPE_E1_IVAR float32 Inverse variance of SHAPE_E1 -SHAPE_E2 float32 Ellipticity component 2 of galaxy model for galaxy type MORPHTYPE -SHAPE_E2_IVAR float32 Inverse variance of SHAPE_E2 -SHAPE_R float32 arcsec Half-light radius of galaxy model (>0) -SHAPE_R_IVAR float32 arcsec^-2 Inverse variance of SHAPE_R -SIGMA_MGII float32 Angstrom Fitted parameter SIGMA (linewidth) by MgII fitter (in angstrom?) -SPECTRO int16 Spectrograph number [0-9] -SPECTROID int32 Hardware ID of spectrograph (not used) -SPECTYPE char[6] Spectral type of Redrock best fit template (e.g. GALAXY, QSO, STAR) -SPGRPVAL int32 Value by which spectra are grouped for a coadd (e.g. a YEARMMDD night) -STD_FIBER_DEC float32 arcsec Standard deviation (over exposures) of DEC of actual fiber position -STD_FIBER_RA float32 arcsec Standard deviation (over exposures) of RA of actual fiber position -SUBPRIORITY float64 Random subpriority [0-1) to break assignment ties -SUBTYPE char[20] Spectral subtype -SUM_CALIB_COUNT_B float64 Sum of calibrated flux in B camera -SUM_CALIB_COUNT_R float64 Sum of calibrated flux in R camera -SUM_CALIB_COUNT_Z float64 Sum of calibrated flux in Z camera -SUM_FFLAT_COUNT_B float64 Sum of fiber-flatfielded counts B camera -SUM_FFLAT_COUNT_R float64 Sum of fiber-flatfielded counts R camera -SUM_FFLAT_COUNT_Z float64 Sum of fiber-flatfielded counts Z camera -SUM_RAW_COUNT_B float64 Sum of raw counts in B camera -SUM_RAW_COUNT_R float64 Sum of raw counts in R camera -SUM_RAW_COUNT_Z float64 Sum of raw counts in Z camera -SUM_SKYSUB_COUNT_B float64 Sum of sky-subtracted counts in B camera -SUM_SKYSUB_COUNT_R float64 Sum of sky-subtracted counts in R camera -SUM_SKYSUB_COUNT_Z float64 Sum of sky-subtracted counts in Z camera -SURVEY char[7] Survey name -SV1_BGS_TARGET int64 BGS (bright time program) target selection bitmask for SV1 -SV1_DESI_TARGET int64 DESI (dark time program) target selection bitmask for SV1 -SV1_MWS_TARGET int64 MWS (bright time program) target selection bitmask for SV1 -SV1_SCND_TARGET int64 Secondary target selection bitmask for SV1 -SV2_BGS_TARGET int64 BGS (bright time program) target selection bitmask for SV2 -SV2_DESI_TARGET int64 DESI (dark time program) target selection bitmask for SV2 -SV2_MWS_TARGET int64 MWS (bright time program) target selection bitmask for SV2 -SV2_SCND_TARGET int64 Secondary target selection bitmask for SV2 -SV3_BGS_TARGET int64 BGS (bright time program) target selection bitmask for SV3 -SV3_DESI_TARGET int64 DESI (dark time program) target selection bitmask for SV3 -SV3_MWS_TARGET int64 MWS (bright time program) target selection bitmask for SV3 -SV3_SCND_TARGET int64 Secondary target selection bitmask for SV3 -SV_NSPEC int32 Number of coadded spectra for this TARGETID in SV (SV1+2+3) -SV_PRIMARY bool Boolean flag (True/False) for the primary coadded spectrum in SV (SV1+2+3) -TARGETID int64 Unique DESI target ID -TARGET_DEC float64 deg Barycentric declination in ICRS -TARGET_RA float64 deg Barycentric right ascension in ICRS -TARGET_STATE char[*] Combination of target class and its current observational state -TILEDEC float64 deg Barycentric declination of tile center in ICRS -TILEID int32 Unique DESI tile ID -TILELOCID int64 Is 10000*TILEID+LOCATION -TILELOCIDS char[*] TILELOCIDs that the target was available for, separated by '-' -TILELOCID_ASSIGNED int64 0/1 for unassigned/assigned for TILELOCID in question (it could have been assigned to a different target) -TILERA float64 deg Barycentric Right Ascension of tile center in ICRS -TILES char[*] TILEIDs of those tile, in string form separated by '-' -TIMESTAMP str s UTC/ISO time at which the target state was updated -TOOID int64 ID for this target assigned by the ``CHECKER`` -TOO_PRIO char[2] Either 'HI' for a very-high-priority target or 'LO' for a very-low-priority target -TOO_TYPE char[5] Either 'TILE' for a special tile or 'FIBER' for a fiber-override ToO -TSNR2_BGS float32 BGS template (S/N)^2 summed over B,R,Z -TSNR2_BGS_B float32 BGS B template (S/N)^2 -TSNR2_BGS_R float32 BGS R template (S/N)^2 -TSNR2_BGS_Z float32 BGS Z template (S/N)^2 -TSNR2_ELG float32 ELG template (S/N)^2 summed over B,R,Z -TSNR2_ELG_B float32 ELG B template (S/N)^2 -TSNR2_ELG_R float32 ELG R template (S/N)^2 -TSNR2_ELG_Z float32 ELG Z template (S/N)^2 -TSNR2_GPBBACKUP float64 template (S/N)^2 for backup targets in guider pass band -TSNR2_GPBBACKUP_B float64 template (S/N)^2 for backup targets in guider pass band on B -TSNR2_GPBBACKUP_R float64 template (S/N)^2 for backup targets in guider pass band on R -TSNR2_GPBBACKUP_Z float64 template (S/N)^2 for backup targets in guider pass band on Z -TSNR2_GPBBRIGHT float64 template (S/N)^2 for bright targets in guider pass band -TSNR2_GPBBRIGHT_B float64 template (S/N)^2 for bright targets in guider pass band on B -TSNR2_GPBBRIGHT_R float64 template (S/N)^2 for bright targets in guider pass band on R -TSNR2_GPBBRIGHT_Z float64 template (S/N)^2 for bright targets in guider pass band on Z -TSNR2_GPBDARK float64 template (S/N)^2 for dark targets in guider pass band -TSNR2_GPBDARK_B float64 template (S/N)^2 for dark targets in guider pass band on B -TSNR2_GPBDARK_R float64 template (S/N)^2 for dark targets in guider pass band on R -TSNR2_GPBDARK_Z float64 template (S/N)^2 for dark targets in guider pass band on Z -TSNR2_LRG float32 LRG template (S/N)^2 summed over B,R,Z -TSNR2_LRG_B float32 LRG B template (S/N)^2 -TSNR2_LRG_R float32 LRG R template (S/N)^2 -TSNR2_LRG_Z float32 LRG Z template (S/N)^2 -TSNR2_LYA float32 LYA template (S/N)^2 summed over B,R,Z -TSNR2_LYA_B float32 LYA B template (S/N)^2 -TSNR2_LYA_R float32 LYA R template (S/N)^2 -TSNR2_LYA_Z float32 LYA Z template (S/N)^2 -TSNR2_QSO float32 QSO template (S/N)^2 summed over B,R,Z -TSNR2_QSO_B float32 QSO B template (S/N)^2 -TSNR2_QSO_R float32 QSO R template (S/N)^2 -TSNR2_QSO_Z float32 QSO Z template (S/N)^2 -TYPE char[4] Morphological Model type from Tractor; renamed MORPHTYPE in most files -URAT_ID int64 ID in the URAT catalog for sources where URAT supplemented missing Gaia astrometric information -URAT_SEP float32 arcsec Separation between URAT and Gaia sources where URAT supplemented missing Gaia astrometric information -VAR_A_MGII float32 Variance of MgII fit amplitude parameter A -VAR_B_MGII float32 Variance of MgII fit offset parameter B -VAR_SIGMA_MGII float32 Variance of MgII fit width parameter sigma -VERSION char[14] Tag of desitarget used to create the target catalog -WEIGHT float64 The combination of all weights to use -WEIGHT_COMP float64 1/FRACZ_TILELOCID -WEIGHT_FKP float64 1/(1+NZ*P0), with P0 different for each tracer -WEIGHT_SYS float64 Correction for fluctuations in projected density with imaging conditions, from random forrest method -WEIGHT_SYSEB float64 Correction for fluctuations in projected density with imaging conditions, from linear regression method applied to eBOSS -WEIGHT_ZFAIL float64 Should be all 1 at this point for main survey -WISEMASK_W1 byte Bitwise mask for WISE W1 data -WISEMASK_W2 byte Bitwise mask for WISE W2 data -Z float64 Redshift measured by Redrock -ZCAT_NSPEC int32 Number of coadded spectra for this TARGETID in this zcatalog -ZCAT_PRIMARY bool Boolean flag (True/False) for the primary coadded spectrum in this zcatalog -ZERR float64 Redshift error from redrock -ZPOSSLOC bool True/False whether the location could have been assigned to the given target class -ZTILEID int32 ID of tile that most recently updated target's state -ZWARN int64 Redshift warning bitmask from Redrock -ZWARN_MTL int64 The ZWARN from the zmtl file (contains extra bits) -Z_CIII float64 Redshift estimated by QuasarNET with CIII line -Z_CIV float64 Redshift estimated by QuasarNET with CIV line -Z_Halpha float64 Redshift estimated by QuasarNET with Halpha line -Z_Hbeta float64 Redshift estimated by QuasarNET with Hbeta line -Z_HP float64 Redshift from Healpix coadd -Z_LYA float64 Redshift estimated by QuasarNET with LyA line -Z_MgII float64 Redshift estimated by QuasarNET with MgII line -Z_QN float64 Redshift measured by QuasarNET using line with highest confidence -Z_QN_CONF float64 Redshift confidence from QuasarNET -Z_RR float64 Redshift collected from redrock file -================================= =========== ================================= ===================================================================================================================================== - From cd5fe9c4e6e76220885f991cbd26092fb3a3e08c Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 29 Aug 2023 14:40:55 -0700 Subject: [PATCH 10/14] only build html format --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 42054b25..c80bb3de 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -18,7 +18,7 @@ sphinx: configuration: doc/conf.py # Optionally build your docs in additional formats such as PDF and ePub -formats: all +# formats: all # Optionally set the version of Python and requirements required to build your docs python: From 0428d02284316bf9827d9497efeefe4650aadcb0 Mon Sep 17 00:00:00 2001 From: Stephen Bailey Date: Tue, 29 Aug 2023 16:05:58 -0700 Subject: [PATCH 11/14] explain what column_descriptions.csv is --- py/desidatamodel/data/column_descriptions.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/py/desidatamodel/data/column_descriptions.rst b/py/desidatamodel/data/column_descriptions.rst index 7c4d8da1..46565cef 100644 --- a/py/desidatamodel/data/column_descriptions.rst +++ b/py/desidatamodel/data/column_descriptions.rst @@ -2,7 +2,9 @@ Standard Column Descriptions ============================ -This file is an auto-generated version of `column_descriptions.csv`_. +This file is an auto-generated version of `column_descriptions.csv`_, +which contains the descriptions of table column names regardless of +what file(s) they appear in. .. _`column_descriptions.csv`: https://github.com/desihub/desidatamodel/blob/main/py/desidatamodel/data/column_descriptions.csv From 4a9fc5dfb1c9ac88213955841cab580b05388943 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Thu, 31 Aug 2023 11:28:48 -0700 Subject: [PATCH 12/14] rename render.py --- doc/Makefile | 2 +- doc/api.rst | 2 +- py/desidatamodel/{render.py => columns.py} | 8 ++++---- py/desidatamodel/test/{test_render.py => test_columns.py} | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) rename py/desidatamodel/{render.py => columns.py} (93%) rename py/desidatamodel/test/{test_render.py => test_columns.py} (82%) diff --git a/doc/Makefile b/doc/Makefile index 45a97940..0bd6714b 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -54,7 +54,7 @@ clean: rm -rf $(BUILDDIR)/* column_descriptions.rst: - env PYTHONPATH=$(abspath ../py) $(PYTHON) -m desidatamodel.render > column_descriptions.rst + env PYTHONPATH=$(abspath ../py) $(PYTHON) -m desidatamodel.columns > column_descriptions.rst html: column_descriptions.rst $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html diff --git a/doc/api.rst b/doc/api.rst index 111d64c1..16cad9a6 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -8,7 +8,7 @@ desidatamodel API .. automodule:: desidatamodel.check :members: -.. automodule:: desidatamodel.render +.. automodule:: desidatamodel.columns :members: .. automodule:: desidatamodel.scan diff --git a/py/desidatamodel/render.py b/py/desidatamodel/columns.py similarity index 93% rename from py/desidatamodel/render.py rename to py/desidatamodel/columns.py index 3399da27..56e9e2d3 100644 --- a/py/desidatamodel/render.py +++ b/py/desidatamodel/columns.py @@ -1,11 +1,11 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- """ -==================== -desidatamodel.render -==================== +===================== +desidatamodel.columns +===================== -Render the column descriptions file. +Render the standard column descriptions file. """ import csv import sys diff --git a/py/desidatamodel/test/test_render.py b/py/desidatamodel/test/test_columns.py similarity index 82% rename from py/desidatamodel/test/test_render.py rename to py/desidatamodel/test/test_columns.py index 2dac25d5..b691fb70 100644 --- a/py/desidatamodel/test/test_render.py +++ b/py/desidatamodel/test/test_columns.py @@ -1,13 +1,13 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- -"""Test desidatamodel.render functions +"""Test desidatamodel.columns functions """ import unittest -from ..render import format_columns +from ..columns import format_columns -class TestRender(unittest.TestCase): +class TestColumns(unittest.TestCase): def test_format_columns(self): """Test column formatting operations. From 87bc6bbb1258e55fd1f739255bee850296b885c3 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Thu, 31 Aug 2023 11:31:07 -0700 Subject: [PATCH 13/14] rename module in actions --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 49b0f2ae..956a33d7 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -101,7 +101,7 @@ jobs: env: PYTHONPATH: ${{ github.workspace }}/py run: | - python -m desidatamodel.render > doc/column_descriptions.rst + python -m desidatamodel.columns > doc/column_descriptions.rst sphinx-build -W --keep-going -b html doc doc/_build/html api: From 65dda8b5c6d4b1144dc0dfbe930b497494d2c364 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Thu, 31 Aug 2023 11:33:31 -0700 Subject: [PATCH 14/14] rename in rtd config --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index c80bb3de..f8a86a28 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -11,7 +11,7 @@ build: python: "3.10" jobs: pre_build: - - env PYTHONPATH=${PWD}/py python -m desidatamodel.render > doc/column_descriptions.rst + - env PYTHONPATH=${PWD}/py python -m desidatamodel.columns > doc/column_descriptions.rst # Build documentation in the doc/ directory with Sphinx sphinx: