From 27fa6d3438ef7fc5c0ca9e538cae8c7b84a79ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Thu, 8 Aug 2024 12:37:56 -0700 Subject: [PATCH 01/30] Add missing columns to the SDSS_ID_To_Catalog models --- CHANGELOG.rst | 2 ++ python/sdssdb/peewee/sdss5db/catalogdb.py | 30 +++++++++++++++++++ python/sdssdb/sqlalchemy/sdss5db/catalogdb.py | 21 +++++++++++++ 3 files changed, 53 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3528f057..6133ceb2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,8 @@ Changelog This document records the main changes to the ``sdssdb`` code. +* Add missing columns to the ``SDSS_ID_To_Catalog`` models (the columns were being completed via reflection). + * :release:`0.12.4 <2024-08-07>` * Fix ``catalogid`` and ``version_id`` fields in ``SDSS_ID_To_Catalog`` model. diff --git a/python/sdssdb/peewee/sdss5db/catalogdb.py b/python/sdssdb/peewee/sdss5db/catalogdb.py index 23b3605a..ab4af8bb 100644 --- a/python/sdssdb/peewee/sdss5db/catalogdb.py +++ b/python/sdssdb/peewee/sdss5db/catalogdb.py @@ -3272,6 +3272,7 @@ class SDSS_ID_To_Catalog(CatalogdbModel): sdss_id = BigIntegerField() catalogid = BigIntegerField() version_id = IntegerField() + lead = TextField() allstar_dr17_synspec_rev1__apstar_id = TextField() allwise__cntr = BigIntegerField() bhm_rm_v0__pk = BigIntegerField() @@ -3284,9 +3285,14 @@ class SDSS_ID_To_Catalog(CatalogdbModel): guvcat__objid = BigIntegerField() legacy_survey_dr10__ls_id = BigIntegerField() legacy_survey_dr8__ls_id = BigIntegerField() + mangatarget__mangaid = TextField() + marvels_dr11_star__starname = TextField() + marvels_dr12_star__pk = BigIntegerField() + mastar_goodstars__mangaid = TextField() panstarrs1__catid_objid = BigIntegerField() ps1_g18__objid = BigIntegerField() sdss_dr13_photoobj__objid = BigIntegerField() + sdss_dr17_specobj__specobjid = TextField() skymapper_dr1_1__object_id = BigIntegerField() skymapper_dr2__object_id = BigIntegerField() supercosmos__objid = BigIntegerField() @@ -3343,6 +3349,26 @@ class SDSS_ID_To_Catalog(CatalogdbModel): Legacy_Survey_DR8, column_name='legacy_survey_dr8__ls_id', backref='+') + mangatarget = ForeignKeyField( + Mangatarget, + column_name='mangatarget__mangaid', + backref='+' + ) + marvels_dr11_star = ForeignKeyField( + Marvels_dr11_star, + column_name='marvels_dr11_star__starname', + backref='+' + ) + marvels_dr12_star = ForeignKeyField( + Marvels_dr12_star, + column_name='marvels_dr12_star__pk', + backref='+' + ) + mastar_goodstars = ForeignKeyField( + Mastar_goodstars, + column_name='mastar_goodstars__mangaid', + backref='+' + ) panstarrs1 = ForeignKeyField( Panstarrs1, column_name='panstarrs1__catid_objid', @@ -3355,6 +3381,10 @@ class SDSS_ID_To_Catalog(CatalogdbModel): SDSS_DR13_PhotoObj, column_name='sdss_dr13_photoobj__objid', backref='+') + sdss_dr17_specobj = ForeignKeyField( + SDSS_DR17_SpecObj, + column_name='sdss_dr17_specobj__specobjid', + backref='+') skymapper_dr1_1 = ForeignKeyField( SkyMapper_DR1_1, column_name='skymapper_dr1_1__object_id', diff --git a/python/sdssdb/sqlalchemy/sdss5db/catalogdb.py b/python/sdssdb/sqlalchemy/sdss5db/catalogdb.py index bb5358d1..1e4d8913 100644 --- a/python/sdssdb/sqlalchemy/sdss5db/catalogdb.py +++ b/python/sdssdb/sqlalchemy/sdss5db/catalogdb.py @@ -10211,6 +10211,7 @@ class SDSS_ID_To_Catalog(Base): sdss_id = Column(Float) catalogid = Column(Float) version_id = Column(Integer) + lead = Column(String(20)) allstar_dr17_synspec_rev1__apstar_id = Column(String(20)) allwise__cntr = Column(Float) bhm_rm_v0__pk = Column(Float) @@ -10223,9 +10224,14 @@ class SDSS_ID_To_Catalog(Base): guvcat__objid = Column(Float) legacy_survey_dr10__ls_id = Column(Float) legacy_survey_dr8__ls_id = Column(Float) + mangatarget__mangaid = Column(String(20)) + marvels_dr11_star__starname = Column(String(20)) + marvels_dr12_star__pk = Column(Integer) + mastar_goodstars__mangaid = Column(String(20)) panstarrs1__catid_objid = Column(Float) ps1_g18__objid = Column(Float) sdss_dr13_photoobj__objid = Column(Float) + sdss_dr17_specobj__specobjid = Column(String(20)) skymapper_dr1_1__object_id = Column(Float) skymapper_dr2__object_id = Column(Float) supercosmos__objid = Column(Float) @@ -10270,6 +10276,18 @@ class SDSS_ID_To_Catalog(Base): legacy_survey_dr8__ls_id = Column( ForeignKey('catalogdb.legacy_survey_dr8.ls_id'), index=True) + mangatarget__mangaid = Column( + ForeignKey('catalogdb.mangatarget.mangaid'), + index=True) + marvels_dr11_star__starname = Column( + ForeignKey('catalogdb.marvels_dr11_star.starname'), + index=True) + marvels_dr12_star__pk = Column( + ForeignKey('catalogdb.marvels_dr12_star.pk'), + index=True) + mastar_goodstars__mangaid = Column( + ForeignKey('catalogdb.mastar_goodstars.mangaid'), + index=True) panstarrs1__catid_objid = Column( ForeignKey('catalogdb.panstarrs1.catid_objid'), index=True) @@ -10279,6 +10297,9 @@ class SDSS_ID_To_Catalog(Base): sdss_dr13_photoobj__objid = Column( ForeignKey('catalogdb.sdss_dr13_photoobj.objid'), index=True) + sdss_dr17_specobj__specobjid = Column( + ForeignKey('sdss_dr17_specobj.specobjid'), + index=True) skymapper_dr1_1__object_id = Column( ForeignKey('catalogdb.skymapper_dr1_1.object_id'), index=True) From 4ecd3c6fb2f793eadd4a2df2c777758d7245fc0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Thu, 8 Aug 2024 12:59:20 -0700 Subject: [PATCH 02/30] reflect = False -> use_reflection = False --- CHANGELOG.rst | 1 + python/sdssdb/peewee/sdss5db/catalogdb.py | 101 +++++++++++----------- 2 files changed, 52 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6133ceb2..b5a0ddc9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,7 @@ Changelog This document records the main changes to the ``sdssdb`` code. * Add missing columns to the ``SDSS_ID_To_Catalog`` models (the columns were being completed via reflection). +* Change ``reflection=False`` to ``use_reflection=False`` in many ``catalogdb`` models. The previous setting was incorrect and was causing the models to be reflected. * :release:`0.12.4 <2024-08-07>` * Fix ``catalogid`` and ``version_id`` fields in ``SDSS_ID_To_Catalog`` model. diff --git a/python/sdssdb/peewee/sdss5db/catalogdb.py b/python/sdssdb/peewee/sdss5db/catalogdb.py index ab4af8bb..e0d4aae7 100644 --- a/python/sdssdb/peewee/sdss5db/catalogdb.py +++ b/python/sdssdb/peewee/sdss5db/catalogdb.py @@ -6,6 +6,7 @@ # @Filename: catalogdb.py # @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) +from typing import Text from peewee import ( AutoField, BigAutoField, @@ -2328,7 +2329,7 @@ class ToO_Target(CatalogdbModel): class Meta: table_name = "too_target" - reflect = False + use_reflection = False class ToO_Metadata(CatalogdbModel): @@ -2359,7 +2360,7 @@ class ToO_Metadata(CatalogdbModel): class Meta: table_name = "too_metadata" - reflect = False + use_reflection = False _Gaia_DR2_TwoMass_Deferred.set_model(Gaia_DR2_TwoMass_Best_Neighbour) @@ -2386,7 +2387,7 @@ class Meta: # in "catalog_to_X" tables table_name = "catalog_from_sdss_dr19p_speclite" primary_key = False - reflect = False + use_reflection = False class CatalogToAllStar_DR17_synspec_rev1(CatalogdbModel): @@ -2405,7 +2406,7 @@ class CatalogToAllStar_DR17_synspec_rev1(CatalogdbModel): class Meta: table_name = "catalog_to_allstar_dr17_synspec_rev1" primary_key = False - reflect = False + use_reflection = False class CatalogToAllWise(CatalogdbModel): @@ -2424,7 +2425,7 @@ class CatalogToAllWise(CatalogdbModel): class Meta: table_name = "catalog_to_allwise" primary_key = False - reflect = False + use_reflection = False class CatalogToBHM_CSC(CatalogdbModel): @@ -2443,7 +2444,7 @@ class CatalogToBHM_CSC(CatalogdbModel): class Meta: table_name = "catalog_to_bhm_csc" primary_key = False - reflect = False + use_reflection = False class CatalogToBHM_RM_v0(CatalogdbModel): @@ -2462,7 +2463,7 @@ class CatalogToBHM_RM_v0(CatalogdbModel): class Meta: table_name = "catalog_to_bhm_rm_v0" primary_key = False - reflect = False + use_reflection = False class CatalogToBHM_RM_v0_2(CatalogdbModel): @@ -2481,7 +2482,7 @@ class CatalogToBHM_RM_v0_2(CatalogdbModel): class Meta: table_name = "catalog_to_bhm_rm_v0" primary_key = False - reflect = False + use_reflection = False class CatalogToBHM_eFEDS_Veto(CatalogdbModel): @@ -2500,7 +2501,7 @@ class CatalogToBHM_eFEDS_Veto(CatalogdbModel): class Meta: table_name = "catalog_to_bhm_efeds_veto" primary_key = False - reflect = False + use_reflection = False class CatalogToCatWISE(CatalogdbModel): @@ -2519,7 +2520,7 @@ class CatalogToCatWISE(CatalogdbModel): class Meta: table_name = "catalog_to_catwise" primary_key = False - reflect = False + use_reflection = False class CatalogToCatWISE2020(CatalogdbModel): @@ -2538,7 +2539,7 @@ class CatalogToCatWISE2020(CatalogdbModel): class Meta: table_name = "catalog_to_catwise2020" primary_key = False - reflect = False + use_reflection = False class CatalogToGLIMPSE(CatalogdbModel): @@ -2557,7 +2558,7 @@ class CatalogToGLIMPSE(CatalogdbModel): class Meta: table_name = "catalog_to_glimpse" primary_key = False - reflect = False + use_reflection = False class CatalogToGLIMPSE360(CatalogdbModel): @@ -2576,7 +2577,7 @@ class CatalogToGLIMPSE360(CatalogdbModel): class Meta: table_name = "catalog_to_glimpse360" primary_key = False - reflect = False + use_reflection = False class CatalogToGUVCat(CatalogdbModel): @@ -2595,7 +2596,7 @@ class CatalogToGUVCat(CatalogdbModel): class Meta: table_name = "catalog_to_guvcat" primary_key = False - reflect = False + use_reflection = False class CatalogToGaiaQSO(CatalogdbModel): @@ -2614,7 +2615,7 @@ class CatalogToGaiaQSO(CatalogdbModel): class Meta: table_name = "catalog_to_gaia_qso" primary_key = False - reflect = False + use_reflection = False class CatalogToGaia_DR2(CatalogdbModel): @@ -2633,7 +2634,7 @@ class CatalogToGaia_DR2(CatalogdbModel): class Meta: table_name = "catalog_to_gaia_dr2_source" primary_key = False - reflect = False + use_reflection = False class CatalogToGaia_DR2_WD_SDSS(CatalogdbModel): @@ -2652,7 +2653,7 @@ class CatalogToGaia_DR2_WD_SDSS(CatalogdbModel): class Meta: table_name = "catalog_to_gaia_dr2_wd_sdss" primary_key = False - reflect = False + use_reflection = False class CatalogToGaia_DR3(CatalogdbModel): @@ -2671,7 +2672,7 @@ class CatalogToGaia_DR3(CatalogdbModel): class Meta: table_name = "catalog_to_gaia_dr3_source" primary_key = False - reflect = False + use_reflection = False class CatalogToGaia_unWISE_AGN(CatalogdbModel): @@ -2690,7 +2691,7 @@ class CatalogToGaia_unWISE_AGN(CatalogdbModel): class Meta: table_name = "catalog_to_gaia_unwise_agn" primary_key = False - reflect = False + use_reflection = False class CatalogToKeplerInput_DR10(CatalogdbModel): @@ -2709,7 +2710,7 @@ class CatalogToKeplerInput_DR10(CatalogdbModel): class Meta: table_name = "catalog_to_kepler_input_10" primary_key = False - reflect = False + use_reflection = False class CatalogToLegacy_Survey_DR10(CatalogdbModel): @@ -2728,7 +2729,7 @@ class CatalogToLegacy_Survey_DR10(CatalogdbModel): class Meta: table_name = "catalog_to_legacy_survey_dr10" primary_key = False - reflect = False + use_reflection = False class CatalogToLegacy_Survey_DR10a(CatalogdbModel): @@ -2747,7 +2748,7 @@ class CatalogToLegacy_Survey_DR10a(CatalogdbModel): class Meta: table_name = "catalog_to_legacy_survey_dr10a" primary_key = False - reflect = False + use_reflection = False class CatalogToLegacy_Survey_DR8(CatalogdbModel): @@ -2766,7 +2767,7 @@ class CatalogToLegacy_Survey_DR8(CatalogdbModel): class Meta: table_name = "catalog_to_legacy_survey_dr8" primary_key = False - reflect = False + use_reflection = False class CatalogToMILLIQUAS_7_7(CatalogdbModel): @@ -2785,7 +2786,7 @@ class CatalogToMILLIQUAS_7_7(CatalogdbModel): class Meta: table_name = "catalog_to_milliquas_7_7" primary_key = False - reflect = False + use_reflection = False class CatalogToPS1_g18(CatalogdbModel): @@ -2804,7 +2805,7 @@ class CatalogToPS1_g18(CatalogdbModel): class Meta: table_name = "catalog_to_ps1_g18" primary_key = False - reflect = False + use_reflection = False class CatalogToPanstarrs1(CatalogdbModel): @@ -2823,7 +2824,7 @@ class CatalogToPanstarrs1(CatalogdbModel): class Meta: table_name = "catalog_to_panstarrs1" primary_key = False - reflect = False + use_reflection = False class CatalogToSDSS_DR13_PhotoObj(CatalogdbModel): @@ -2842,7 +2843,7 @@ class CatalogToSDSS_DR13_PhotoObj(CatalogdbModel): class Meta: table_name = "catalog_to_sdss_dr13_photoobj" primary_key = False - reflect = False + use_reflection = False class CatalogToSDSS_DR13_PhotoObj_Primary(CatalogdbModel): @@ -2865,7 +2866,7 @@ class CatalogToSDSS_DR13_PhotoObj_Primary(CatalogdbModel): class Meta: table_name = "catalog_to_sdss_dr13_photoobj_primary" primary_key = False - reflect = False + use_reflection = False class CatalogToSDSS_DR16_APOGEE_Star(CatalogdbModel): @@ -2884,7 +2885,7 @@ class CatalogToSDSS_DR16_APOGEE_Star(CatalogdbModel): class Meta: table_name = "catalog_to_sdss_dr16_apogeestar" primary_key = False - reflect = False + use_reflection = False class CatalogToSDSS_DR16_SpecObj(CatalogdbModel): @@ -2903,7 +2904,7 @@ class CatalogToSDSS_DR16_SpecObj(CatalogdbModel): class Meta: table_name = "catalog_to_sdss_dr16_specobj" primary_key = False - reflect = False + use_reflection = False class CatalogToSDSS_DR19p_Speclite(CatalogdbModel): @@ -2922,7 +2923,7 @@ class CatalogToSDSS_DR19p_Speclite(CatalogdbModel): class Meta: table_name = "catalog_to_sdss_dr19p_speclite" primary_key = False - reflect = False + use_reflection = False class CatalogToSkies_v1(CatalogdbModel): @@ -2941,7 +2942,7 @@ class CatalogToSkies_v1(CatalogdbModel): class Meta: table_name = "catalog_to_skies_v1" primary_key = False - reflect = False + use_reflection = False class CatalogToSkies_v2(CatalogdbModel): @@ -2960,7 +2961,7 @@ class CatalogToSkies_v2(CatalogdbModel): class Meta: table_name = "catalog_to_skies_v2" primary_key = False - reflect = False + use_reflection = False class CatalogToSkyMapper_DR1_1(CatalogdbModel): @@ -2979,7 +2980,7 @@ class CatalogToSkyMapper_DR1_1(CatalogdbModel): class Meta: table_name = "catalog_to_skymapper_dr1_1" primary_key = False - reflect = False + use_reflection = False class CatalogToSkyMapper_DR2(CatalogdbModel): @@ -2998,7 +2999,7 @@ class CatalogToSkyMapper_DR2(CatalogdbModel): class Meta: table_name = "catalog_to_skymapper_dr2" primary_key = False - reflect = False + use_reflection = False class CatalogToSuperCosmos(CatalogdbModel): @@ -3017,7 +3018,7 @@ class CatalogToSuperCosmos(CatalogdbModel): class Meta: table_name = "catalog_to_supercosmos" primary_key = False - reflect = False + use_reflection = False class CatalogToTIC_v8(CatalogdbModel): @@ -3036,7 +3037,7 @@ class CatalogToTIC_v8(CatalogdbModel): class Meta: table_name = "catalog_to_tic_v8" primary_key = False - reflect = False + use_reflection = False class CatalogToTIC_v8_Extended(CatalogdbModel): @@ -3055,7 +3056,7 @@ class CatalogToTIC_v8_Extended(CatalogdbModel): class Meta: table_name = "catalog_to_tic_v8_extended" primary_key = False - reflect = False + use_reflection = False class CatalogToTwoMassPSC(CatalogdbModel): @@ -3074,7 +3075,7 @@ class CatalogToTwoMassPSC(CatalogdbModel): class Meta: table_name = "catalog_to_twomass_psc" primary_key = False - reflect = False + use_reflection = False class CatalogToTwoqz_sixqz(CatalogdbModel): @@ -3093,7 +3094,7 @@ class CatalogToTwoqz_sixqz(CatalogdbModel): class Meta: table_name = "catalog_to_twoqz_sixqz" primary_key = False - reflect = False + use_reflection = False class CatalogToTycho2(CatalogdbModel): @@ -3112,7 +3113,7 @@ class CatalogToTycho2(CatalogdbModel): class Meta: table_name = "catalog_to_tycho2" primary_key = False - reflect = False + use_reflection = False class CatalogToUVOT_SSC_1(CatalogdbModel): @@ -3131,7 +3132,7 @@ class CatalogToUVOT_SSC_1(CatalogdbModel): class Meta: table_name = "catalog_to_uvotssc1" primary_key = False - reflect = False + use_reflection = False class CatalogToXMM_OM_SUSS_4_1(CatalogdbModel): @@ -3150,7 +3151,7 @@ class CatalogToXMM_OM_SUSS_4_1(CatalogdbModel): class Meta: table_name = "catalog_to_xmm_om_suss_4_1" primary_key = False - reflect = False + use_reflection = False class CatalogToXMM_OM_SUSS_5_0(CatalogdbModel): @@ -3169,7 +3170,7 @@ class CatalogToXMM_OM_SUSS_5_0(CatalogdbModel): class Meta: table_name = "catalog_to_xmm_om_suss_5_0" primary_key = False - reflect = False + use_reflection = False class CatalogTounWISE(CatalogdbModel): @@ -3188,7 +3189,7 @@ class CatalogTounWISE(CatalogdbModel): class Meta: table_name = "catalog_to_unwise" primary_key = False - reflect = False + use_reflection = False class CatalogToMarvels_dr11_star(CatalogdbModel): @@ -3207,7 +3208,7 @@ class CatalogToMarvels_dr11_star(CatalogdbModel): class Meta: table_name = "catalog_to_marvels_dr11_star" primary_key = False - reflect = False + use_reflection = False class CatalogToMarvels_dr12_star(CatalogdbModel): @@ -3226,7 +3227,7 @@ class CatalogToMarvels_dr12_star(CatalogdbModel): class Meta: table_name = "catalog_to_marvels_dr12_star" primary_key = False - reflect = False + use_reflection = False class CatalogToSDSS_DR17_SpecObj(CatalogdbModel): @@ -3245,7 +3246,7 @@ class CatalogToSDSS_DR17_SpecObj(CatalogdbModel): class Meta: table_name = "catalog_to_sdss_dr17_specobj" primary_key = False - reflect = False + use_reflection = False class CatalogToToO_Target(CatalogdbModel): @@ -3264,7 +3265,7 @@ class CatalogToToO_Target(CatalogdbModel): class Meta: table_name = "catalog_to_too_target" primary_key = False - reflect = False + use_reflection = False class SDSS_ID_To_Catalog(CatalogdbModel): @@ -3417,4 +3418,4 @@ class SDSS_ID_To_Catalog(CatalogdbModel): class Meta: table_name = "sdss_id_to_catalog" primary_key = False - reflect = False + use_reflection = False From bf3b0819693a0e54f5991c3f70676783feae0f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Thu, 8 Aug 2024 13:02:53 -0700 Subject: [PATCH 03/30] Remove unused import --- python/sdssdb/peewee/sdss5db/catalogdb.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python/sdssdb/peewee/sdss5db/catalogdb.py b/python/sdssdb/peewee/sdss5db/catalogdb.py index e0d4aae7..da3be67d 100644 --- a/python/sdssdb/peewee/sdss5db/catalogdb.py +++ b/python/sdssdb/peewee/sdss5db/catalogdb.py @@ -6,7 +6,6 @@ # @Filename: catalogdb.py # @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) -from typing import Text from peewee import ( AutoField, BigAutoField, From bb8d616f83778d3f66ea6d50f8b0a45f251e7265 Mon Sep 17 00:00:00 2001 From: Sean Morrison <41479278+Sean-Morrison@users.noreply.github.com> Date: Fri, 9 Aug 2024 07:24:00 -0500 Subject: [PATCH 04/30] Boss drp metadata (#229) * add boss_drp metadata * Update boss_drp.json * Update boss_drp.json --- .DS_Store | Bin 0 -> 6148 bytes schema/.DS_Store | Bin 0 -> 6148 bytes schema/sdss5db/.DS_Store | Bin 0 -> 6148 bytes schema/sdss5db/metadata/boss_drp.json | 1908 +++++++++++++++++++++++++ 4 files changed, 1908 insertions(+) create mode 100644 .DS_Store create mode 100644 schema/.DS_Store create mode 100644 schema/sdss5db/.DS_Store create mode 100644 schema/sdss5db/metadata/boss_drp.json diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..cc2f43c4ce1e46c2ab2cace335f7b33e4a0747f9 GIT binary patch literal 6148 zcmeHK%}T>S5Z<-5KNKMcg&r5Y7OYXQ#Y>3w1&ruHr6xAmV45vWY7V84v%Zi|;`2DO zyEz04-bCyS?0&QJvzz%K`@n8g@tK||!IY!EbWbnTd6M6TwTF+a%Dc@WEB z!$g14gx}s^DSKj57P9L1e+2V5O0$0dlke2(yNxDDr}^MbW$tBuwoF}rafhR8DdV8j z{op1F^RcymA(PCHl5n9CqDcrL_qS0pk-00E$s|>|o_4fB##VQ=vQN%>!X6CPJ+T_v z{hl}-+Us?@b#Qoeel>oHXNi2%L~`I<$)3Ry-a)C<^y)2=SSHV4FLTORLSldzAO?tm z?PI{41+C8Zl};5C1H`}&4B-ACpdmU23yo^)fDW(E=&vK9fR1koL}Ab|SZD+f2-m5A zI+dFz2G{9e7beazSZLJgjH{Jl9Ue z@~bH{A_jkGzo!MVYhpTX}fa3TTheP%y4Q1qAfUB>)Dvk93t&`vvL{=NK$B U;w)%a>40<*P=ruN4EzEEU&KC40RR91 literal 0 HcmV?d00001 diff --git a/schema/.DS_Store b/schema/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..daf7aff02292263d74c96ed711bc385f2909df6d GIT binary patch literal 6148 zcmeHK%}T>S5Z-O8Z7D(y3Oz1(Em)&siQq7q|?0h9%Sxiel|~Ce|C+n3n}BE z)cxQxn&e|^`&1^GA0?BSN{GS{hv9J%0d%_+JmOZf; z+Wnq59NNoeyS1~scXB>{jGq$uqN(J-x{@t}CA@<2WmV7KEQw`u51ulsj3y)ohyh}N z7+5a`%sJ5Ntk<$>wZs51@B;>Le-Ka*9fO5NwRJ#+*Jt!M5K%zKw*;av=olU74{$k2}&xqQ5EH9FXZ3TNEWNHsA)46HIx*G&u0|1|P=`3j XV4)FvLAy!^q>F$egeqd-7Z~^e#AHkD literal 0 HcmV?d00001 diff --git a/schema/sdss5db/.DS_Store b/schema/sdss5db/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ab1b5dd533ed9dce4edab0c79be809166e1f1ee0 GIT binary patch literal 6148 zcmeHK%}T>S5Z-O8O({YT3Oz1(Em)&qi7J zu^ig{o;V%at5wT7I6OMP8o$KTM80Vdli_CQsli^U8QaVt^PR z28e;}VZfXLR(pF&rb>wcV&I1i;Qk<>Avy*NjcV(F4_=?q-#|nG9p4g&!k}ZY& 0", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_spectrum_line", + "column_name":"linenpixright", + "display_name":"Npixels right of line center", + "sql_type":"integer", + "description":"Npixels from line center to +3 sigma with INVVAR > 0", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_spectrum_line", + "column_name":"linedof", + "display_name":"DOF in Line Fit", + "sql_type":"real", + "description":"DOF in fit", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_spectrum_line", + "column_name":"linechi2", + "display_name":"Chi2 of Line Fit", + "sql_type":"real", + "description":"chi2 for all points within +/- 3 sigma of line center", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_spectrum_line", + "column_name":"created", + "display_name":"created", + "sql_type":"timestamp", + "description":"Time row was created", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_spectrum_line", + "column_name":"modified", + "display_name":"modified", + "sql_type":"timestamp", + "description":"Time row was last updated", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"id", + "display_name":"id", + "sql_type":"SERIAL", + "description":"id of row", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"boss_version_id", + "display_name":"BOSS Version ID", + "sql_type":"int", + "description":"ID of BOSS Pipeline version", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"field", + "display_name":"Field", + "sql_type":"integer", + "description":"SDSS FieldID (plateID for plate era data)", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"designs", + "display_name":"Designs", + "sql_type":"VARCHAR", + "description":"List of Included Designs", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"configs", + "display_name":"Configurations", + "sql_type":"VARCHAR", + "description":"List of Included Configurations", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"mjd", + "display_name":"MJD", + "sql_type":"integer", + "description":"Modified Julian date of completed combined Spectra", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"observatory", + "display_name":"Observatory", + "sql_type":"VARCHAR", + "description":"Observatory of Observation", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"run2d", + "display_name":"BOSS Run2d", + "sql_type":"VARCHAR", + "description":"Spectro-2D reduction name", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"run1d", + "display_name":"BOSS Run1d", + "sql_type":"VARCHAR", + "description":"Spectro-1D reduction name", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"racen", + "display_name":"Telescope RA", + "sql_type":"real", + "description":"RA of the telescope pointing", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"deccen", + "display_name":"Telescope Dec", + "sql_type":"real", + "description":"DEC of the telescope pointing", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"epoch", + "display_name":"Coordinate Epoch", + "sql_type":"real", + "description":"Epoch of the RACEN/DECCEN", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"cartid", + "display_name":"Cartridge", + "sql_type":"VARCHAR", + "description":"The currently loaded cartridge/instrument", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"tai", + "display_name":"Tai of integration", + "sql_type":"double precision", + "description":"Mean MJD(TAI) seconds of integration", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"tai_beg", + "display_name":"Tai at start of integration", + "sql_type":"double precision", + "description":"MJD(TAI) seconds at start of integration", + "unit":"s"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"tai_end", + "display_name":"Tai at end of integration", + "sql_type":"double precision", + "description":"MJD(TAI) seconds at end of integration", + "unit":"s"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"airmass", + "display_name":"Airmass", + "sql_type":"real", + "description":"Mean Airmass", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"exptime", + "display_name":"Exposure Time", + "sql_type":"real", + "description":"Total Exposure time", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"mapname", + "display_name":"Plugmap Name", + "sql_type":"VARCHAR", + "description":"ID of plate mapping file", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"tileid", + "display_name":"Tile ID", + "sql_type":"integer", + "description":"Tile ID for SDSS BOSS plates (-1 for SDSS)", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"designid", + "display_name":"Design ID", + "sql_type":"integer", + "description":"Plate Design ID", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"survey", + "display_name":"Survey", + "sql_type":"VARCHAR", + "description":"Survey that field is part of", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"programname", + "display_name":"Program Name", + "sql_type":"VARCHAR", + "description":"Program name within a given survey", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"fieldquality", + "display_name":"Field Quality", + "sql_type":"VARCHAR", + "description":"", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"fieldsn2", + "display_name":"Field SN2", + "sql_type":"real", + "description":"Overall (S/N)^2 for field; min of cameras", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"deredsn2", + "display_name":"Dereddened Field SN2", + "sql_type":"real", + "description":"Overall Dereddened (S/N)^2 for field; min of cameras", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"qsurvey", + "display_name":"Survey Quality", + "sql_type":"integer", + "description":"1 for an survey quality plate, 0 otherwise", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"mjdlist", + "display_name":"List of MJDs", + "sql_type":"VARCHAR", + "description":"List of MJD of each included exposures", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"nexp", + "display_name":"Number of exposures", + "sql_type":"integer", + "description":"Number of Included Exposures", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"nexp_b1", + "display_name":"SP1 blue number of exposures", + "sql_type":"integer", + "description":"Number of Included Exposures from b1", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"nexp_r1", + "display_name":"SP1 red number of exposures", + "sql_type":"integer", + "description":"Number of Included Exposures from r1", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"nexp_b2", + "display_name":"SP2 blue number of exposures", + "sql_type":"integer", + "description":"Number of Included Exposures from b2", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"nexp_r2", + "display_name":"SP2 red number of exposures", + "sql_type":"integer", + "description":"Number of Included Exposures from r2", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"expt_b1", + "display_name":"SP1 blue Exposure Time", + "sql_type":"real", + "description":"Total Exposure Time of b1", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"SP1 red Exposure Time", + "display_name":"EXPT_R1", + "sql_type":"real", + "description":"Total Exposure Time of r1", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"expt_b2", + "display_name":"SP2 blue Exposure Time", + "sql_type":"real", + "description":"Total Exposure Time of b2", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"expt_r2", + "display_name":"SP2 red Exposure Time", + "sql_type":"real", + "description":"Total Exposure Time of r2", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"sn2_g1", + "display_name":"SP1 g-band SN2", + "sql_type":"real", + "description":"Fit (S/N)^2 at g=20.20 for spectrograph #1", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"sn2_r1", + "display_name":"SP1 r-band SN2", + "sql_type":"real", + "description":"Fit (S/N)^2 at r=20.25 for spectrograph #1", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"sn2_i1", + "display_name":"SP1 i-band SN2", + "sql_type":"real", + "description":"Fit (S/N)^2 at i=19.90 for spectrograph #1", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"sn2_g2", + "display_name":"SP2 g-band SN2", + "sql_type":"real", + "description":"Fit (S/N)^2 at g=20.20 for spectrograph #2", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"sn2_r2", + "display_name":"SP2 r-band SN2", + "sql_type":"real", + "description":"Fit (S/N)^2 at r=20.25 for spectrograph #2", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"sn2_i2", + "display_name":"SP2 i-band SN2", + "sql_type":"real", + "description":"Fit (S/N)^2 at i=19.90 for spectrograph #2", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"goffstd", + "display_name":"Standards mag-g offset difference", + "sql_type":"real", + "description":"Mean g-band mag difference (spectro-photo) for standards", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"grmsstd", + "display_name":"Standards mag-g RMS difference", + "sql_type":"real", + "description":"Stddev g-band mag difference (spectro-photo) for standards", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"roffstd", + "display_name":"Standards mag-r Offset difference", + "sql_type":"real", + "description":"Mean r-band mag difference (spectro-photo) for standards", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"rrmsstd", + "display_name":"Standards mag-r RMS difference", + "sql_type":"real", + "description":"Stddev r-band mag difference (spectro-photo) for standards", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"ioffstd", + "display_name":"Standards mag-i Offset difference", + "sql_type":"real", + "description":"Mean i-band mag difference (spectro-photo) for standards", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"irmsstd", + "display_name":"Standards mag-i RMS difference", + "sql_type":"real", + "description":"Stddev i-band mag difference (spectro-photo) for standards", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"groffstd", + "display_name":"Standards Spectrophoto Offset for G-R", + "sql_type":"real", + "description":"Spectrophoto offset for G-R in standards", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"grrmsstd", + "display_name":"Standards Spectrophoto RMS for G-R", + "sql_type":"real", + "description":"Spectrophoto RMS for G-R in standards", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"rioffstd", + "display_name":"Standards Spectrophoto Offset for R-I", + "sql_type":"real", + "description":"Spectrophoto offset for R-I in standards", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"rirmsstd", + "display_name":"Standards Spectrophoto RMS for R-I", + "sql_type":"real", + "description":"Spectrophoto RMS for R-I in standards", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"goffgal", + "display_name":"Galaxy mag-g offset difference", + "sql_type":"real", + "description":"Mean g-band mag difference (spectro-photo) for galaxies", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"grmsgal", + "display_name":"Galaxy mag-g STD difference", + "sql_type":"real", + "description":"Stddev g-band mag difference (spectro-photo) for galaxies", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"roffgal", + "display_name":"Galaxy mag-r offset difference", + "sql_type":"real", + "description":"Mean r-band mag difference (spectro-photo) for galaxies", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"rrmsgal", + "display_name":"Galaxy mag-r RMS difference", + "sql_type":"real", + "description":"Stddev r-band mag difference (spectro-photo) for galaxies", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"ioffgal", + "display_name":"Galaxy mag-i offset difference", + "sql_type":"real", + "description":"Mean i-band mag difference (spectro-photo) for galaxies", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"irmsgal", + "display_name":"Galaxy mag-i RMS difference", + "sql_type":"real", + "description":"Stddev i-band mag difference (spectro-photo) for galaxies", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"groffgal", + "display_name":"Galaxy Spectrophoto Offset for G-R", + "sql_type":"real", + "description":"Spectrophoto offset for G-R in galaxies", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"grrmsgal", + "display_name":"Galaxy Spectrophoto RMS for G-R", + "sql_type":"real", + "description":"Spectrophoto RMS for G-R in galaxies", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"rioffgal", + "display_name":"Galaxy Spectrophoto Offset for R-I", + "sql_type":"real", + "description":"Spectrophoto offset for R-I in galaxies", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"rirmsgal", + "display_name":"Galaxy Spectrophoto RMS for R-I", + "sql_type":"real", + "description":"Spectrophoto RMS for R-I in galaxies", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"nguide", + "display_name":"Number of Guide Frames", + "sql_type":"integer", + "description":"Number of guider camera frames taken during the exposures", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"seeing20", + "display_name":"20% Seeing", + "sql_type":"real", + "description":"Mean 20% seeing during exposures", + "unit":"arcse"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"seeing50", + "display_name":"50% Seeing", + "sql_type":"real", + "description":"Mean 50% seeing during exposures", + "unit":"arcse"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"seeing80", + "display_name":"80% Seeing", + "sql_type":"real", + "description":"Mean 80% seeing during exposures", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"rmsoff20", + "display_name":"20% RMS offset of guider", + "sql_type":"real", + "description":"20% of RMS offset of guide fibers", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"rmsoff50", + "display_name":"50% RMS offset of guider", + "sql_type":"real", + "description":"50% of RMS offset of guide fibers", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"rmsoff80", + "display_name":"80% RMS offset of guider", + "sql_type":"real", + "description":"80% of RMS offset of guide fibers", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"airtemp", + "display_name":"Air Temperature", + "sql_type":"real", + "description":"Air temperature in the dome", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"xsigma", + "display_name":"Width of Extraction Profile", + "sql_type":"real", + "description":"Mean of median width of trace extraction profile", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"xsigmin", + "display_name":"Min Width of Extraction Profile", + "sql_type":"real", + "description":"Minimum of median width of trace extraction profile", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"xsigmax", + "display_name":"Max Width of Extraction Profile", + "sql_type":"real", + "description":"Maximum of median width of trace extraction profile", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"wsigma", + "display_name":"Width of Arc Lines", + "sql_type":"real", + "description":"Mean of median wavelength (Y) width of Arc Lines", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"wsigmin", + "display_name":"Min width of Arc Lines", + "sql_type":"real", + "description":"Minimum of median wavelength (Y) width of Arc Lines", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"wsigmax", + "display_name":"Max width of Arc Lines", + "sql_type":"real", + "description":"Maximum of median wavelength (Y) width of Arc Lines", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"xchi2", + "display_name":"reduced chi^2", + "sql_type":"real", + "description":"Mean of XCHI2 (reduced chi^2 of row-by-row extraction)", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"xchi2min", + "display_name":"Min reduced chi^2", + "sql_type":"real", + "description":"Minimum of XCHI2 (reduced chi^2 of row-by-row extraction)", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"xchi2max", + "display_name":"Max reduced chi^2", + "sql_type":"real", + "description":"Maximum of XCHI2 (reduced chi^2 of row-by-row extraction)", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"skychi2", + "display_name":"Sky Subtraction Chi2", + "sql_type":"real", + "description":"Average chi-squared from sky subtraction from all exposures", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"schi2min", + "display_name":"Min Sky Chi2", + "sql_type":"real", + "description":"Minimum skyChi2 over all exposures", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"schi2max", + "display_name":"Max Sky Chi2", + "sql_type":"real", + "description":"Maximum skyChi2 over all exposures", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"fbadpix", + "display_name":"Fraction of bad pixels", + "sql_type":"real", + "description":"Fraction of bad pixels", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"fbadpix1", + "display_name":"Fraction of bad pixels in SP1", + "sql_type":"real", + "description":"Fraction of bad pixels from spectrograph #1", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"fbadpix2", + "display_name":"Fraction of bad pixels in SP2", + "sql_type":"real", + "description":"Fraction of bad pixels from spectrograph #2", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"n_total", + "display_name":"Number of Sources", + "sql_type":"integer", + "description":"Number of Sources", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"n_galaxy", + "display_name":"Number of Galaxies", + "sql_type":"integer", + "description":"Number of Galaxies", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"n_qso", + "display_name":"Number of QSOs", + "sql_type":"integer", + "description":"Number of QSOs", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"n_star", + "display_name":"Number of Stars", + "sql_type":"integer", + "description":"Number of Stars", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"n_unknown", + "display_name":"Number of Unknown Sources", + "sql_type":"integer", + "description":"Number of Unknown Sources", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"n_sky", + "display_name":"Number of Skys", + "sql_type":"integer", + "description":"Number of Skys", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"n_std", + "display_name":"Number of Standard", + "sql_type":"integer", + "description":"Number of Standards", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"n_target_qso", + "display_name":"QSOs Targeted", + "sql_type":"integer", + "description":"Number of QSO Targeted", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"n_target_main", + "display_name":"Main Galaxies Targeted", + "sql_type":"integer", + "description":"Number of Main Galaxy targeted", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"n_target_lrg1", + "display_name":"LRG1s Targeted", + "sql_type":"integer", + "description":"Number of LRG1 targeted", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"n_target_lrg2", + "display_name":"LRG2s Targeted", + "sql_type":"integer", + "description":"Number of LRG2 targeted", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"n_target_elg", + "display_name":"ELGs Targeted", + "sql_type":"integer", + "description":"Number of ELG targted", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"success_main", + "display_name":"Main Galaxy Success Rate", + "sql_type":"real", + "description":"Success rate of Main Galaxy targets", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"success_lrg1", + "display_name":"LRG1 Success Rate", + "sql_type":"real", + "description":"Success rate of LRG1s", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"success_lrg2", + "display_name":"LRG2 Success Rate", + "sql_type":"real", + "description":"Success rate of LRG2s", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"success_elg", + "display_name":"ELG Success Rate", + "sql_type":"real", + "description":"Success rate of ELGs", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"success_qso", + "display_name":"QSO Success Rate", + "sql_type":"real", + "description":"Success rate of QSOs", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"status2d", + "display_name":"Status of 2D", + "sql_type":"VARCHAR", + "description":"Status of 2d extraction", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"statuscombine", + "display_name":"Status of Combine", + "sql_type":"VARCHAR", + "description":"Status of 1d combine", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"status1d", + "display_name":"Status of 1D", + "sql_type":"VARCHAR", + "description":"Status of 1d analysis", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"field_cadence", + "display_name":"Field Cadence", + "sql_type":"VARCHAR", + "description":"Planned Cadence of Observations", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"public", + "display_name":"Public", + "sql_type":"VARCHAR", + "description":"Is this Plate Public", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"qualcomments", + "display_name":"Quality Comments", + "sql_type":"VARCHAR", + "description":"Comments of Field Quality", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"moon_frac", + "display_name":"Moon Phase", + "sql_type":"real", + "description":"Mean Moon phase of the Coadded Spectra", + "unit":"None"} + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"created", + "display_name":"created", + "sql_type":"timestamp", + "description":"Time row was created", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_field", + "column_name":"modified", + "display_name":"modified", + "sql_type":"timestamp", + "description":"Time row was last updated", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_version", + "column_name":"id", + "display_name":"BOSS Version ID", + "sql_type":"SERIAL", + "description":"Identifier of Pipeline Version", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_version", + "column_name":"ipl", + "display_name":"ipl", + "sql_type":"INT2", + "description":"Associated IPL", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_version", + "column_name":"run2d", + "display_name":"BOSS run2d", + "sql_type":"VARCHAR", + "description":"Spectro-2D reduction name", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_version", + "column_name":"run1d", + "display_name":"BOSS run1d", + "sql_type":"VARCHAR", + "description":"Spectro-1D reduction name", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_version", + "column_name":"is_default", + "display_name":"Is Current Default?", + "sql_type":"BOOLEAN", + "description":"Is this the current default version", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_version", + "column_name":"is_epoch", + "display_name":"Is Epoch?", + "sql_type":"BOOLEAN", + "description":"Is this version associated with the field-epoch Coadds", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_version", + "column_name":"is_custom", + "display_name":"Is Custom?", + "sql_type":"BOOLEAN", + "description":"Is this version associated with a custom Coadd Schema", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_version", + "column_name":"custom_name", + "display_name":"Name of Custom", + "sql_type":"VARCHAR", + "description":"Name of Custom Coadd Schema", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_version", + "column_name":"created", + "display_name":"created", + "sql_type":"timestamp", + "description":"Time row was created", + "unit":"None"}, + {"schema":"boss_drp", + "table_name":"boss_version", + "column_name":"modified", + "display_name":"modified", + "sql_type":"timestamp", + "description":"Time row was last updated", + "unit":"None"} +] +} From 7c6f64d43b38d128747c57d9873ad3930f116cb0 Mon Sep 17 00:00:00 2001 From: Brian Cherinka Date: Fri, 9 Aug 2024 08:24:59 -0400 Subject: [PATCH 05/30] Delete .DS_Store --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index cc2f43c4ce1e46c2ab2cace335f7b33e4a0747f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5Z<-5KNKMcg&r5Y7OYXQ#Y>3w1&ruHr6xAmV45vWY7V84v%Zi|;`2DO zyEz04-bCyS?0&QJvzz%K`@n8g@tK||!IY!EbWbnTd6M6TwTF+a%Dc@WEB z!$g14gx}s^DSKj57P9L1e+2V5O0$0dlke2(yNxDDr}^MbW$tBuwoF}rafhR8DdV8j z{op1F^RcymA(PCHl5n9CqDcrL_qS0pk-00E$s|>|o_4fB##VQ=vQN%>!X6CPJ+T_v z{hl}-+Us?@b#Qoeel>oHXNi2%L~`I<$)3Ry-a)C<^y)2=SSHV4FLTORLSldzAO?tm z?PI{41+C8Zl};5C1H`}&4B-ACpdmU23yo^)fDW(E=&vK9fR1koL}Ab|SZD+f2-m5A zI+dFz2G{9e7beazSZLJgjH{Jl9Ue z@~bH{A_jkGzo!MVYhpTX}fa3TTheP%y4Q1qAfUB>)Dvk93t&`vvL{=NK$B U;w)%a>40<*P=ruN4EzEEU&KC40RR91 From 1750797af1129c81403935c734264cf6ddffa60c Mon Sep 17 00:00:00 2001 From: Brian Cherinka Date: Fri, 9 Aug 2024 08:25:29 -0400 Subject: [PATCH 06/30] Delete schema/.DS_Store --- schema/.DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 schema/.DS_Store diff --git a/schema/.DS_Store b/schema/.DS_Store deleted file mode 100644 index daf7aff02292263d74c96ed711bc385f2909df6d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5Z-O8Z7D(y3Oz1(Em)&siQq7q|?0h9%Sxiel|~Ce|C+n3n}BE z)cxQxn&e|^`&1^GA0?BSN{GS{hv9J%0d%_+JmOZf; z+Wnq59NNoeyS1~scXB>{jGq$uqN(J-x{@t}CA@<2WmV7KEQw`u51ulsj3y)ohyh}N z7+5a`%sJ5Ntk<$>wZs51@B;>Le-Ka*9fO5NwRJ#+*Jt!M5K%zKw*;av=olU74{$k2}&xqQ5EH9FXZ3TNEWNHsA)46HIx*G&u0|1|P=`3j XV4)FvLAy!^q>F$egeqd-7Z~^e#AHkD From 5019ee92758055743ddc4eb0f7564bdabf366c79 Mon Sep 17 00:00:00 2001 From: havok2063 Date: Fri, 9 Aug 2024 09:05:42 -0400 Subject: [PATCH 07/30] removing .DS_Store --- schema/sdss5db/.DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 schema/sdss5db/.DS_Store diff --git a/schema/sdss5db/.DS_Store b/schema/sdss5db/.DS_Store deleted file mode 100644 index ab1b5dd533ed9dce4edab0c79be809166e1f1ee0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5Z-O8O({YT3Oz1(Em)&qi7J zu^ig{o;V%at5wT7I6OMP8o$KTM80Vdli_CQsli^U8QaVt^PR z28e;}VZfXLR(pF&rb>wcV&I1i;Qk<>Avy*NjcV(F4_=?q-#|nG9p4g&!k}ZY& Date: Fri, 9 Aug 2024 09:07:47 -0400 Subject: [PATCH 08/30] updating gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 1fe8881b..edc25169 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ wheels/ *.egg-info/ .installed.cfg *.egg +*.DS_Store # PyInstaller # Usually these files are written by a python script from a template From 12fdadc4c07821fb41f97c6c8e93c5434ba07fae Mon Sep 17 00:00:00 2001 From: havok2063 Date: Fri, 9 Aug 2024 09:54:40 -0400 Subject: [PATCH 09/30] cleaning boss_drp metadata; updating loading script --- schema/sdss5db/metadata/boss_drp.json | 4358 ++++++++++++---------- schema/sdss5db/metadata/load_metadata.py | 13 + 2 files changed, 2464 insertions(+), 1907 deletions(-) diff --git a/schema/sdss5db/metadata/boss_drp.json b/schema/sdss5db/metadata/boss_drp.json index fc33d680..3012f09b 100644 --- a/schema/sdss5db/metadata/boss_drp.json +++ b/schema/sdss5db/metadata/boss_drp.json @@ -1,1908 +1,2452 @@ { - "metadata": - [{"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"id", - "display_name":"id", - "sql_type":"SERIAL", - "description":"id of row", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"boss_version_id", - "display_name":"boss_version_id", - "sql_type":"int", - "description":"ID of BOSS Pipeline version", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"field", - "display_name":"FIELD", - "sql_type":"integer", - "description":"SDSS FieldID (plateID for plate era data)", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"mjd", - "display_name":"MJD", - "sql_type":"integer", - "description":"Modified Julian date of completed combined Spectra", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"mjd_final", - "display_name":"Weighted MJD of Coadd", - "sql_type":"real", - "description":"Mean MJD of the Coadded Spectra", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"obs", - "display_name":"Observatory", - "sql_type":"VARCHAR", - "description":"Observatory of Observation", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"run2d", - "display_name":"BOSS RUN2D", - "sql_type":"VARCHAR", - "description":"Spectro-2D reduction name", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"run1d", - "display_name":"BOSS RUN1D", - "sql_type":"VARCHAR", - "description":"Spectro-1D reduction name", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"nexp", - "display_name":"Number of Exposures", - "sql_type":"smallint", - "description":"Number of Included Exposures", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"exptime", - "display_name":"Exposure Time", - "sql_type":"real", - "description":"Total Exposure time of Coadded Spectra", - "unit":"s"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"target_index", - "display_name":"Index of target in Field", - "sql_type":"integer", - "description":"Index of target on combined spField", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"spec_file", - "display_name":"Spec File name", - "sql_type":"VARCHAR", - "description":"Name of spec file (in SAS)", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"programname", - "display_name":"Program Name", - "sql_type":"VARCHAR", - "description":"Program name within a given survey", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"survey", - "display_name":"Survey", - "sql_type":"VARCHAR", - "description":"Survey that field is part of", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"cadence", - "display_name":"Target Cadence", - "sql_type":"VARCHAR", - "description":"Requested Target Cadence", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"firstcarton", - "display_name":"First Carton", - "sql_type":"VARCHAR", - "description":"Primary SDSS Carton for target", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"objtype", - "display_name":"Object Type", - "sql_type":"VARCHAR", - "description":"Why this object was targetted. QSO=SCIENCE", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"catalogid", - "display_name":"CatalogID", - "sql_type":"bigint", - "description":"SDSS-V CatalogID used in naming", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"CatalogID from V0", - "display_name":"CATALOGID_V0", - "sql_type":"bigint", - "description":"SDSS-V CatalogID from Catalog v0", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"CatalogID from V0.5", - "display_name":"CATALOGID_V0P5", - "sql_type":"bigint", - "description":"SDSS-V CatalogID from Catalog v0.5", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"sdss_id", - "display_name":"SDSS ID", - "sql_type":"bigint", - "description":"Unified SDSS Target Indentifier", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"specobjid", - "display_name":"SpecObjID", - "sql_type":"bigint", - "description":"Unique ID based on Field, MJD, FIBERID, RUN2D", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"calibflux", - "display_name":"CalibFlux", - "sql_type":"real[]", - "description":"Broad-band flux in SDSS-{ugriz} from PSFmag", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"calibflux_ivar", - "display_name":"CalibFlux IVAR", - "sql_type":"real[]", - "description":"Inverse var flux SDSS-{ugriz} from PSFmag", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"optical_prov", - "display_name":"Optical Magnitude Provenance", - "sql_type":"VARCHAR", - "description":"The source of the optical magnitudes", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"mag", - "display_name":"UGRIZ Magnitude", - "sql_type":"real[]", - "description":"[u, g, r, i, z] optical magnitudes", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"psfmag", - "display_name":"UGRIZ PSF Magnitude", - "sql_type":"real[]", - "description":"[u, g, r, i, z] optical PSF magnitudes", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"fiber2mag", - "display_name":"UGRIZ Fiber2 Magnitude", - "sql_type":"real[]", - "description":"[u, g, r, i, z] optical Fiber2 magnitudes", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"catdb_mag", - "display_name":"UGRIZ TargetDB Magnitude", - "sql_type":"real[]", - "description":"[u, g, r, i, z] Raw TargetDB magnitudes (paired with OPTICAL_PROV)", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"gri_gaia_transform", - "display_name":"GRI_GAIA_TRANSFORM", - "sql_type":"bigint", - "description":"provenance of ugriz photometry used in SDSS-V plate design process", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"gaia_g_mag", - "display_name":"Gaia G Magnitude", - "sql_type":"real", - "description":"Gaia G magnitude", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"bp_mag", - "display_name":"Gaia BP Magnitude", - "sql_type":"real", - "description":"Gaia BP magnitude", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"rp_mag", - "display_name":"Gaia RP magnitude", - "sql_type":"real", - "description":"Gaia RP magnitude", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"gaia_id", - "display_name":"Gaia SourceID", - "sql_type":"bigint", - "description":"Gaia SourceID", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"wise_mag", - "display_name":"WISE band magnitudes", - "sql_type":"real[]", - "description":"WISE [W1, W2, W3, W4] band magnitudes", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"twomass_mag", - "display_name":"TWOMASS band magnitudes", - "sql_type":"real[]", - "description":"2MASS [J, H, Ks] band magnitudes", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"guvcat_mag", - "display_name":"GALEX band magnitudes", - "sql_type":"real[]", - "description":"GALEX [FUV, NUV] band magnitudes", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"ebv", - "display_name":"EBV", - "sql_type":"real", - "description":"dust extinction", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"ebv_type", - "display_name":"EBV Type", - "sql_type":"VARCHAR", - "description":"Source of dust extinction", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"fiber_ra", - "display_name":"Fiber RA", - "sql_type":"double precision", - "description":"Fiber RA (first exposure) [J2000 for plate; at exposure for FPS]", - "unit":"deg"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"fiber_dec", - "display_name":"Fiber Dec", - "sql_type":"double precision", - "description":"Fiber DEC (first exposure) [J2000 for plate; at exposure for FPS]", - "unit":"deg"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"plug_ra", - "display_name":"Plug RA", - "sql_type":"double precision", - "description":"Object RA (drilled fiber position) [J2000]", - "unit":"deg"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"plug_dec", - "display_name":"Plug DEC", - "sql_type":"double precision", - "description":"Object DEC (drilled fiber position) [J2000]", - "unit":"deg"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"racat", - "display_name":"Catalog RA", - "sql_type":"double precision", - "description":"RA in ICRS coordinates at 'coord_epoch' for the target assigned", - "unit":"deg"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"Catalog DEC", - "display_name":"DECCAT", - "sql_type":"double precision", - "description":"Dec in ICRS coordinates at 'coord_epoch' for the target assigned", - "unit":"deg"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"coord_epoch", - "display_name":"Epoch of Catalog RA/DEC", - "sql_type":"real", - "description":"Epoch of the catalogue coordinates.", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"pmra", - "display_name":"RA Proper Motion", - "sql_type":"real", - "description":"Proper motion in RA (pmra is a true angle)", - "unit":"mas"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"pmdec", - "display_name":"DEC Proper Motion", - "sql_type":"real", - "description":"Proper motion in Dec", - "unit":"mas"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"parallax", - "display_name":"Parallax", - "sql_type":"real", - "description":"Parallax", - "unit":"mas"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"delta_ra", - "display_name":"RA Offset", - "sql_type":"double precision", - "description":"The maximum fiber offset in any exposure", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"delta_dec", - "display_name":"Dec Offset", - "sql_type":"double precision", - "description":"The maximum fiber offset in any exposure", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"fiber_offset", - "display_name":"Offset Fiber", - "sql_type":"integer", - "description":"Flag identifying the fiber was offset by design", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"lambda_eff", - "display_name":"Lambda_eff", - "sql_type":"real", - "description":"Wavelength to optimize hole location for", - "unit":"AA"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"healpix", - "display_name":"Healpix", - "sql_type":"integer", - "description":"healpix pixel number nside=128", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"healpixgrp", - "display_name":"Healpix Group", - "sql_type":"smallint", - "description":"Rounded-down integer value of healpix / 1000", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"fieldquality", - "display_name":"Field Quality", - "sql_type":"VARCHAR", - "description":"Characterization of field quality", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"exp_disp_med", - "display_name":"Exposure Dispersion", - "sql_type":"double precision", - "description":"Dispersion of Median Exposure Flux", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"fieldsn2", - "display_name":"Field SN2", - "sql_type":"real", - "description":"Overall (S/N)^2 for field; min of cameras", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"spec1_g", - "display_name":"g-band SN2 of SP1", - "sql_type":"real", - "description":"Fit (S/N)^2 at g=20.20 for spectrograph 1", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"spec1_r", - "display_name":"r-band SN2 of SP1", - "sql_type":"real", - "description":"Fit (S/N)^2 at r=20.25 for spectrograph 1", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"spec1_i", - "display_name":"i-band SN2 of SP1", - "sql_type":"real", - "description":"Fit (S/N)^2 at i=19.90 for spectrograph 1", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"spec2_g", - "display_name":"g-band SN2 of SP2", - "sql_type":"real", - "description":"Fit (S/N)^2 at g=20.20 for spectrograph 2", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"spec2_r", - "display_name":"r-band SN2 of SP2", - "sql_type":"real", - "description":"Fit (S/N)^2 at r=20.25 for spectrograph 2", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"spec2_i", - "display_name":"i-band SN2 of SP2", - "sql_type":"real", - "description":"Fit (S/N)^2 at i=19.90 for spectrograph 2", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"sn_median", - "display_name":"UGRIZ Median S/N", - "sql_type":"real[]", - "description":"Median S/N for all good pixels in SDSS-{ugriz}", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"sn_median_all", - "display_name":"Median S/N", - "sql_type":"real", - "description":"Median S/N for all good pixels in all filters", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"airmass", - "display_name":"Airmass", - "sql_type":"real", - "description":"Airmass at time of observation", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"seeing20", - "display_name":"Seeing 20 Percentile", - "sql_type":"real", - "description":"Mean 20% seeing during exposures (arcsec)", - "unit":"arcsec"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"seeing50", - "display_name":"Seeing 50 Percentile", - "sql_type":"real", - "description":"Mean 50% seeing during exposures (arcsec)", - "unit":"arcsec"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"seeing80", - "display_name":"Seeing 80 Percentile", - "sql_type":"real", - "description":"Mean 80% seeing during exposures (arcsec)", - "unit":"arcsec"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"moon_dist", - "display_name":"Mean Moon Separation", - "sql_type":"real", - "description":"Mean Moon-target separation of Coadded Spectra", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"moon_phase", - "display_name":"Mean Moon Phase", - "sql_type":"real", - "description":"Mean Moon phase of the Coadded Spectra", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"assigned", - "display_name":"ASSIGNED", - "sql_type":"BOOLEAN", - "description":"Fiber Assigned", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"on_target", - "display_name":"Fiber On Target", - "sql_type":"BOOLEAN", - "description":"Whether this fiber is on target", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"valid", - "display_name":"Valid Fiber Position", - "sql_type":"BOOLEAN", - "description":"Whether the alpha and beta angles are valid. Do not use with valid=0", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"decollided", - "display_name":"Fiber Decollided", - "sql_type":"BOOLEAN", - "description":"Whether this positioner had to be moved to decollide it.", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"anyandmask", - "display_name":"ANDMASK for any Pixel", - "sql_type":"integer", - "description":"For each bit, any pixel has bit set in ANDMASK", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"anyormask", - "display_name":"ORMASK for any Pixel", - "sql_type":"integer", - "description":"For each bit, any pixel has bit set in ORMASK", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"specprimary", - "display_name":"Primary Spectra", - "sql_type":"smallint", - "description":"Best version of spectrum at this location", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"specboss", - "display_name":"Primary BOSS Spectra", - "sql_type":"smallint", - "description":"Best version of spectrum at this location", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"boss_specobj_id", - "display_name":"BOSS_SPECOBJ_ID", - "sql_type":"integer", - "description":"ID of spectrum location on sky", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"nspecobs", - "display_name":"Number of Spectra at RA-DEC", - "sql_type":"smallint", - "description":"Number of spectral observations", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"spectroflux", - "display_name":"Flux in URGRIZ", - "sql_type":"real[]", - "description":"Spectrum projected onto SDSS-{ugriz} filter", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"spectroflux_ivar", - "display_name":"ivar of Flux in UGRIZ", - "sql_type":"real[]", - "description":"Inverse variance of SPECTROFLUX", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"spectrosynflux", - "display_name":"Flux of Template in UGRIZ", - "sql_type":"real[]", - "description":"Best-fit template projected onto SDSS-{ugriz}", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"ivar of Flux of Template in UGRIZ", - "display_name":"SPECTROSYNFLUX_IVAR", - "sql_type":"real[]", - "description":"Inverse variance of SPECTROSYNFLUX", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"Flux of Sky in UGRIZ", - "display_name":"SPECTROSKYFLUX", - "sql_type":"real[]", - "description":"Sky spectrum projected onto SDSS-{ugriz} filter", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"wavemin", - "display_name":"Min Wavelength", - "sql_type":"real", - "description":"Minimum observed (vacuum) wavelength for target", - "unit":"AA"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"wavemax", - "display_name":"Max Wavelength", - "sql_type":"real", - "description":"Maximum observed (vacuum) wavelength for target", - "unit":"AA"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"wcoverage", - "display_name":"Wavelength Coverage", - "sql_type":"real", - "description":"Amount of wavelength coverage in log-10(Angs)", - "unit":"log10(AA)"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"class", - "display_name":"Classification", - "sql_type":"VARCHAR", - "description":"Spectro classification: GALAXY, QSO, STAR", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"subclass", - "display_name":"Sub-Classification", - "sql_type":"VARCHAR", - "description":"Spectro sub-classification", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"z", - "display_name":"redshift", - "sql_type":"real", - "description":"Redshift; incorrect for nonzero ZWARNING flag", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"z_err", - "display_name":"redshift error", - "sql_type":"real", - "description":"z error from chi^2 min; negative is invalid fit", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"zwarning", - "display_name":"redshift Flag", - "sql_type":"integer", - "description":"A flag for bad z fits in place of CLASS=UNKNOWN", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"rchi2", - "display_name":"Reduced fit Chi^2", - "sql_type":"real", - "description":"Reduced chi^2 for best fit", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"dof", - "display_name":"Degrees of freedom for fit", - "sql_type":"integer", - "description":"Degrees of freedom for best fit", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"rchi2diff", - "display_name":"reduced fit chi^2 Difference", - "sql_type":"real", - "description":"Diff in reduced chi^2 of 2 best solutions", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"tfile", - "display_name":"Template File", - "sql_type":"VARCHAR", - "description":"Template file in $IDLSPEC2D_DIR/templates", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"vdisp", - "display_name":"Velocity dispersion", - "sql_type":"real", - "description":"Velocity dispersion, only computed for galaxies", - "unit":"km/s"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"vdisp_err", - "display_name":"Error in Velocity dispersion", - "sql_type":"real", - "description":"Error in VDISP; negative for invalid fit", - "unit":"km/s"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"vdispz", - "display_name":"Redshift of velocity dispersion", - "sql_type":"real", - "description":"Redshift for best-fit velocity dispersion", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"vdispz_err", - "display_name":"velocity dispersion redshift error", - "sql_type":"real", - "description":"Error in Redshift of velocity dispersion", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"vdispchi2", - "display_name":"velocity dispersion Chi2", - "sql_type":"real", - "description":"Chi^2 for best-fit velocity dispersion", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"vdispnpix", - "display_name":"velocity dispersion Pixels Fit", - "sql_type":"real", - "description":"Num of pixels overlapping VDISP fit templates", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"vdispdof", - "display_name":"velocity dispersion DOF", - "sql_type":"integer", - "description":"DOF for best-fit velocity dispersion", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"chi68p", - "display_name":"68% of abs(chi) of Fit Spectrum", - "sql_type":"real", - "description":"68% of abs(chi) of synthetic to actual spectrum", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"z_noqso", - "display_name":"non-QSO Redshift", - "sql_type":"real", - "description":"Redshift of the best-fit non-QSO model", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"z_err_noqso", - "display_name":"non-QSO Redshift Error", - "sql_type":"real", - "description":"Formal one-sigma error on Z_NOQSO", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"znum_noqso", - "display_name":"non-QSO Redshift Model index", - "sql_type":"integer", - "description":"Best fit z/class index excluding QSO; 1-indexed", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"zwarning_noqso", - "display_name":"non-QSO Redshift Warning", - "sql_type":"integer", - "description":"Redshift warning flag for Z_NOQSO", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"class_noqso", - "display_name":"non-QSO Classification", - "sql_type":"VARCHAR", - "description":"Spectro class of best-fit non-QSO model", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"subclass_noqso", - "display_name":"non-QSO Sub-Classification", - "sql_type":"VARCHAR", - "description":"Spectro sub-class of best-fit non-QSO model", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"rchi2diff_noqso", - "display_name":"non-QSO reduced fit chi^2 Difference", - "sql_type":"real", - "description":"Reduced chi^2 diff to next-best non-QSO model", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"xcsao_rv", - "display_name":"XCSAO RV", - "sql_type":"real", - "description":"Radial velocity measured with pyXCSAO", - "unit":"km/s"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"xcsao_erv", - "display_name":"XCSAO RV Error", - "sql_type":"real", - "description":"Uncertainty in Radial velocity", - "unit":"km/s"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"xcsao_rxc", - "display_name":"XCSAO Cross correlation strength", - "sql_type":"real", - "description":"Cross correlation strength from pyXCSAO", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"xcsao_teff", - "display_name":"XCSAO Temperature", - "sql_type":"real", - "description":"Interpolated temperature from pyXCSAO", - "unit":"K"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"xcsao_eteff", - "display_name":"XCSAO temperature Error", - "sql_type":"real", - "description":"Uncertainty in Interpolated temperature", - "unit":"K"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"xcsao_logg", - "display_name":"XCSAO surface gravity", - "sql_type":"real", - "description":"Interpolated surface gravity from pyXCSAO", - "unit":"cm/s/s"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"xcsao_elogg", - "display_name":"XCSAO surface gravity Error", - "sql_type":"real", - "description":"Uncertainty in Interpolated surface gravity", - "unit":"cm/s/s"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"xcsao_feh", - "display_name":"XCSAO metallicity", - "sql_type":"real", - "description":"Interpolated metallicity from pyXCSAO", - "unit":"Sun"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"xcsao_efeh", - "display_name":"XCSAO metallicity Error", - "sql_type":"real", - "description":"Uncertainty in interpolated metallicity", - "unit":"Sun"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"created", - "display_name":"created", - "sql_type":"timestamp", - "description":"Time row was created", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum", - "column_name":"modified", - "display_name":"modified", - "sql_type":"timestamp", - "description":"Time row was last updated", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"id", - "display_name":"id", - "sql_type":"SERIAL", - "description":"id of row", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"boss_version_id", - "display_name":"BOSS Version ID", - "sql_type":"int", - "description":"ID of BOSS Pipeline version", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"field", - "display_name":"Field", - "sql_type":"integer", - "description":"FieldID", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"mjd", - "display_name":"MJD", - "sql_type":"integer", - "description":"Modified Julian date of observation", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"target_index", - "display_name":"Target Index", - "sql_type":"integer", - "description":"Target Index (1 to number of targets)", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"catalogid", - "display_name":"Catalog ID", - "sql_type":"bigint", - "description":"SDSS-V CatalogID used in naming", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"sdss_id", - "display_name":"SDSS_ID", - "sql_type":"bigint", - "description":"Unified SDSS Target Indentifier", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"linename", - "display_name":"Line Name", - "sql_type":"VARCHAR", - "description":"Line name", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"linewave", - "display_name":"Line Wavelength", - "sql_type":"double precision", - "description":"Catalog wavelength for this line in vacuum Angstroms", - "unit":"AA"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"linez", - "display_name":"Line Redshift", - "sql_type":"real", - "description":"Redshift", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"linez_err", - "display_name":"Line Redshift error", - "sql_type":"real", - "description":"Line Redshift error (negative for invalid fit)", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"linesigma", - "display_name":"Line Gaussian Width", - "sql_type":"real", - "description":"Gaussian width in km/sec", - "unit":"km/s"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"linesigma_err", - "display_name":"Line Gaussian Width Error", - "sql_type":"real", - "description":"Line Gaussian Width Error (negative for invalid fit)", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"linearea", - "display_name":"Line Error", - "sql_type":"real", - "description":"Area in gaussian fit where units are (flux-units) * Ang", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"linearea_err", - "display_name":"Line Area Error", - "sql_type":"real", - "description":"Flux error (negative for invalid fit)", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"lineew", - "display_name":"Line Equivalent width", - "sql_type":"real", - "description":"quivalent width", - "unit":"AA"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"lineew_err", - "display_name":"Line Equivalent width error ", - "sql_type":"real", - "description":"Equivalent width error (negative for invalid fit)", - "unit":"AA"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"linecontlevel", - "display_name":"Line Continuum Level", - "sql_type":"real", - "description":"Continuum level at line center", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"linecontlevel_err", - "display_name":"Line Continuum Level Error", - "sql_type":"real", - "description":"Error in continuum level at line center", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"linenpixleft", - "display_name":"Npixels left of line center", - "sql_type":"integer", - "description":"Npixels from line center to -3 sigma with INVVAR > 0", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"linenpixright", - "display_name":"Npixels right of line center", - "sql_type":"integer", - "description":"Npixels from line center to +3 sigma with INVVAR > 0", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"linedof", - "display_name":"DOF in Line Fit", - "sql_type":"real", - "description":"DOF in fit", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"linechi2", - "display_name":"Chi2 of Line Fit", - "sql_type":"real", - "description":"chi2 for all points within +/- 3 sigma of line center", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"created", - "display_name":"created", - "sql_type":"timestamp", - "description":"Time row was created", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_spectrum_line", - "column_name":"modified", - "display_name":"modified", - "sql_type":"timestamp", - "description":"Time row was last updated", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"id", - "display_name":"id", - "sql_type":"SERIAL", - "description":"id of row", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"boss_version_id", - "display_name":"BOSS Version ID", - "sql_type":"int", - "description":"ID of BOSS Pipeline version", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"field", - "display_name":"Field", - "sql_type":"integer", - "description":"SDSS FieldID (plateID for plate era data)", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"designs", - "display_name":"Designs", - "sql_type":"VARCHAR", - "description":"List of Included Designs", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"configs", - "display_name":"Configurations", - "sql_type":"VARCHAR", - "description":"List of Included Configurations", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"mjd", - "display_name":"MJD", - "sql_type":"integer", - "description":"Modified Julian date of completed combined Spectra", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"observatory", - "display_name":"Observatory", - "sql_type":"VARCHAR", - "description":"Observatory of Observation", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"run2d", - "display_name":"BOSS Run2d", - "sql_type":"VARCHAR", - "description":"Spectro-2D reduction name", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"run1d", - "display_name":"BOSS Run1d", - "sql_type":"VARCHAR", - "description":"Spectro-1D reduction name", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"racen", - "display_name":"Telescope RA", - "sql_type":"real", - "description":"RA of the telescope pointing", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"deccen", - "display_name":"Telescope Dec", - "sql_type":"real", - "description":"DEC of the telescope pointing", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"epoch", - "display_name":"Coordinate Epoch", - "sql_type":"real", - "description":"Epoch of the RACEN/DECCEN", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"cartid", - "display_name":"Cartridge", - "sql_type":"VARCHAR", - "description":"The currently loaded cartridge/instrument", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"tai", - "display_name":"Tai of integration", - "sql_type":"double precision", - "description":"Mean MJD(TAI) seconds of integration", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"tai_beg", - "display_name":"Tai at start of integration", - "sql_type":"double precision", - "description":"MJD(TAI) seconds at start of integration", - "unit":"s"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"tai_end", - "display_name":"Tai at end of integration", - "sql_type":"double precision", - "description":"MJD(TAI) seconds at end of integration", - "unit":"s"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"airmass", - "display_name":"Airmass", - "sql_type":"real", - "description":"Mean Airmass", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"exptime", - "display_name":"Exposure Time", - "sql_type":"real", - "description":"Total Exposure time", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"mapname", - "display_name":"Plugmap Name", - "sql_type":"VARCHAR", - "description":"ID of plate mapping file", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"tileid", - "display_name":"Tile ID", - "sql_type":"integer", - "description":"Tile ID for SDSS BOSS plates (-1 for SDSS)", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"designid", - "display_name":"Design ID", - "sql_type":"integer", - "description":"Plate Design ID", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"survey", - "display_name":"Survey", - "sql_type":"VARCHAR", - "description":"Survey that field is part of", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"programname", - "display_name":"Program Name", - "sql_type":"VARCHAR", - "description":"Program name within a given survey", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"fieldquality", - "display_name":"Field Quality", - "sql_type":"VARCHAR", - "description":"", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"fieldsn2", - "display_name":"Field SN2", - "sql_type":"real", - "description":"Overall (S/N)^2 for field; min of cameras", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"deredsn2", - "display_name":"Dereddened Field SN2", - "sql_type":"real", - "description":"Overall Dereddened (S/N)^2 for field; min of cameras", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"qsurvey", - "display_name":"Survey Quality", - "sql_type":"integer", - "description":"1 for an survey quality plate, 0 otherwise", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"mjdlist", - "display_name":"List of MJDs", - "sql_type":"VARCHAR", - "description":"List of MJD of each included exposures", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"nexp", - "display_name":"Number of exposures", - "sql_type":"integer", - "description":"Number of Included Exposures", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"nexp_b1", - "display_name":"SP1 blue number of exposures", - "sql_type":"integer", - "description":"Number of Included Exposures from b1", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"nexp_r1", - "display_name":"SP1 red number of exposures", - "sql_type":"integer", - "description":"Number of Included Exposures from r1", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"nexp_b2", - "display_name":"SP2 blue number of exposures", - "sql_type":"integer", - "description":"Number of Included Exposures from b2", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"nexp_r2", - "display_name":"SP2 red number of exposures", - "sql_type":"integer", - "description":"Number of Included Exposures from r2", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"expt_b1", - "display_name":"SP1 blue Exposure Time", - "sql_type":"real", - "description":"Total Exposure Time of b1", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"SP1 red Exposure Time", - "display_name":"EXPT_R1", - "sql_type":"real", - "description":"Total Exposure Time of r1", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"expt_b2", - "display_name":"SP2 blue Exposure Time", - "sql_type":"real", - "description":"Total Exposure Time of b2", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"expt_r2", - "display_name":"SP2 red Exposure Time", - "sql_type":"real", - "description":"Total Exposure Time of r2", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"sn2_g1", - "display_name":"SP1 g-band SN2", - "sql_type":"real", - "description":"Fit (S/N)^2 at g=20.20 for spectrograph #1", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"sn2_r1", - "display_name":"SP1 r-band SN2", - "sql_type":"real", - "description":"Fit (S/N)^2 at r=20.25 for spectrograph #1", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"sn2_i1", - "display_name":"SP1 i-band SN2", - "sql_type":"real", - "description":"Fit (S/N)^2 at i=19.90 for spectrograph #1", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"sn2_g2", - "display_name":"SP2 g-band SN2", - "sql_type":"real", - "description":"Fit (S/N)^2 at g=20.20 for spectrograph #2", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"sn2_r2", - "display_name":"SP2 r-band SN2", - "sql_type":"real", - "description":"Fit (S/N)^2 at r=20.25 for spectrograph #2", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"sn2_i2", - "display_name":"SP2 i-band SN2", - "sql_type":"real", - "description":"Fit (S/N)^2 at i=19.90 for spectrograph #2", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"goffstd", - "display_name":"Standards mag-g offset difference", - "sql_type":"real", - "description":"Mean g-band mag difference (spectro-photo) for standards", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"grmsstd", - "display_name":"Standards mag-g RMS difference", - "sql_type":"real", - "description":"Stddev g-band mag difference (spectro-photo) for standards", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"roffstd", - "display_name":"Standards mag-r Offset difference", - "sql_type":"real", - "description":"Mean r-band mag difference (spectro-photo) for standards", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"rrmsstd", - "display_name":"Standards mag-r RMS difference", - "sql_type":"real", - "description":"Stddev r-band mag difference (spectro-photo) for standards", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"ioffstd", - "display_name":"Standards mag-i Offset difference", - "sql_type":"real", - "description":"Mean i-band mag difference (spectro-photo) for standards", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"irmsstd", - "display_name":"Standards mag-i RMS difference", - "sql_type":"real", - "description":"Stddev i-band mag difference (spectro-photo) for standards", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"groffstd", - "display_name":"Standards Spectrophoto Offset for G-R", - "sql_type":"real", - "description":"Spectrophoto offset for G-R in standards", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"grrmsstd", - "display_name":"Standards Spectrophoto RMS for G-R", - "sql_type":"real", - "description":"Spectrophoto RMS for G-R in standards", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"rioffstd", - "display_name":"Standards Spectrophoto Offset for R-I", - "sql_type":"real", - "description":"Spectrophoto offset for R-I in standards", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"rirmsstd", - "display_name":"Standards Spectrophoto RMS for R-I", - "sql_type":"real", - "description":"Spectrophoto RMS for R-I in standards", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"goffgal", - "display_name":"Galaxy mag-g offset difference", - "sql_type":"real", - "description":"Mean g-band mag difference (spectro-photo) for galaxies", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"grmsgal", - "display_name":"Galaxy mag-g STD difference", - "sql_type":"real", - "description":"Stddev g-band mag difference (spectro-photo) for galaxies", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"roffgal", - "display_name":"Galaxy mag-r offset difference", - "sql_type":"real", - "description":"Mean r-band mag difference (spectro-photo) for galaxies", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"rrmsgal", - "display_name":"Galaxy mag-r RMS difference", - "sql_type":"real", - "description":"Stddev r-band mag difference (spectro-photo) for galaxies", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"ioffgal", - "display_name":"Galaxy mag-i offset difference", - "sql_type":"real", - "description":"Mean i-band mag difference (spectro-photo) for galaxies", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"irmsgal", - "display_name":"Galaxy mag-i RMS difference", - "sql_type":"real", - "description":"Stddev i-band mag difference (spectro-photo) for galaxies", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"groffgal", - "display_name":"Galaxy Spectrophoto Offset for G-R", - "sql_type":"real", - "description":"Spectrophoto offset for G-R in galaxies", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"grrmsgal", - "display_name":"Galaxy Spectrophoto RMS for G-R", - "sql_type":"real", - "description":"Spectrophoto RMS for G-R in galaxies", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"rioffgal", - "display_name":"Galaxy Spectrophoto Offset for R-I", - "sql_type":"real", - "description":"Spectrophoto offset for R-I in galaxies", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"rirmsgal", - "display_name":"Galaxy Spectrophoto RMS for R-I", - "sql_type":"real", - "description":"Spectrophoto RMS for R-I in galaxies", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"nguide", - "display_name":"Number of Guide Frames", - "sql_type":"integer", - "description":"Number of guider camera frames taken during the exposures", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"seeing20", - "display_name":"20% Seeing", - "sql_type":"real", - "description":"Mean 20% seeing during exposures", - "unit":"arcse"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"seeing50", - "display_name":"50% Seeing", - "sql_type":"real", - "description":"Mean 50% seeing during exposures", - "unit":"arcse"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"seeing80", - "display_name":"80% Seeing", - "sql_type":"real", - "description":"Mean 80% seeing during exposures", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"rmsoff20", - "display_name":"20% RMS offset of guider", - "sql_type":"real", - "description":"20% of RMS offset of guide fibers", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"rmsoff50", - "display_name":"50% RMS offset of guider", - "sql_type":"real", - "description":"50% of RMS offset of guide fibers", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"rmsoff80", - "display_name":"80% RMS offset of guider", - "sql_type":"real", - "description":"80% of RMS offset of guide fibers", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"airtemp", - "display_name":"Air Temperature", - "sql_type":"real", - "description":"Air temperature in the dome", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"xsigma", - "display_name":"Width of Extraction Profile", - "sql_type":"real", - "description":"Mean of median width of trace extraction profile", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"xsigmin", - "display_name":"Min Width of Extraction Profile", - "sql_type":"real", - "description":"Minimum of median width of trace extraction profile", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"xsigmax", - "display_name":"Max Width of Extraction Profile", - "sql_type":"real", - "description":"Maximum of median width of trace extraction profile", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"wsigma", - "display_name":"Width of Arc Lines", - "sql_type":"real", - "description":"Mean of median wavelength (Y) width of Arc Lines", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"wsigmin", - "display_name":"Min width of Arc Lines", - "sql_type":"real", - "description":"Minimum of median wavelength (Y) width of Arc Lines", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"wsigmax", - "display_name":"Max width of Arc Lines", - "sql_type":"real", - "description":"Maximum of median wavelength (Y) width of Arc Lines", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"xchi2", - "display_name":"reduced chi^2", - "sql_type":"real", - "description":"Mean of XCHI2 (reduced chi^2 of row-by-row extraction)", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"xchi2min", - "display_name":"Min reduced chi^2", - "sql_type":"real", - "description":"Minimum of XCHI2 (reduced chi^2 of row-by-row extraction)", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"xchi2max", - "display_name":"Max reduced chi^2", - "sql_type":"real", - "description":"Maximum of XCHI2 (reduced chi^2 of row-by-row extraction)", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"skychi2", - "display_name":"Sky Subtraction Chi2", - "sql_type":"real", - "description":"Average chi-squared from sky subtraction from all exposures", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"schi2min", - "display_name":"Min Sky Chi2", - "sql_type":"real", - "description":"Minimum skyChi2 over all exposures", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"schi2max", - "display_name":"Max Sky Chi2", - "sql_type":"real", - "description":"Maximum skyChi2 over all exposures", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"fbadpix", - "display_name":"Fraction of bad pixels", - "sql_type":"real", - "description":"Fraction of bad pixels", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"fbadpix1", - "display_name":"Fraction of bad pixels in SP1", - "sql_type":"real", - "description":"Fraction of bad pixels from spectrograph #1", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"fbadpix2", - "display_name":"Fraction of bad pixels in SP2", - "sql_type":"real", - "description":"Fraction of bad pixels from spectrograph #2", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"n_total", - "display_name":"Number of Sources", - "sql_type":"integer", - "description":"Number of Sources", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"n_galaxy", - "display_name":"Number of Galaxies", - "sql_type":"integer", - "description":"Number of Galaxies", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"n_qso", - "display_name":"Number of QSOs", - "sql_type":"integer", - "description":"Number of QSOs", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"n_star", - "display_name":"Number of Stars", - "sql_type":"integer", - "description":"Number of Stars", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"n_unknown", - "display_name":"Number of Unknown Sources", - "sql_type":"integer", - "description":"Number of Unknown Sources", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"n_sky", - "display_name":"Number of Skys", - "sql_type":"integer", - "description":"Number of Skys", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"n_std", - "display_name":"Number of Standard", - "sql_type":"integer", - "description":"Number of Standards", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"n_target_qso", - "display_name":"QSOs Targeted", - "sql_type":"integer", - "description":"Number of QSO Targeted", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"n_target_main", - "display_name":"Main Galaxies Targeted", - "sql_type":"integer", - "description":"Number of Main Galaxy targeted", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"n_target_lrg1", - "display_name":"LRG1s Targeted", - "sql_type":"integer", - "description":"Number of LRG1 targeted", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"n_target_lrg2", - "display_name":"LRG2s Targeted", - "sql_type":"integer", - "description":"Number of LRG2 targeted", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"n_target_elg", - "display_name":"ELGs Targeted", - "sql_type":"integer", - "description":"Number of ELG targted", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"success_main", - "display_name":"Main Galaxy Success Rate", - "sql_type":"real", - "description":"Success rate of Main Galaxy targets", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"success_lrg1", - "display_name":"LRG1 Success Rate", - "sql_type":"real", - "description":"Success rate of LRG1s", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"success_lrg2", - "display_name":"LRG2 Success Rate", - "sql_type":"real", - "description":"Success rate of LRG2s", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"success_elg", - "display_name":"ELG Success Rate", - "sql_type":"real", - "description":"Success rate of ELGs", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"success_qso", - "display_name":"QSO Success Rate", - "sql_type":"real", - "description":"Success rate of QSOs", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"status2d", - "display_name":"Status of 2D", - "sql_type":"VARCHAR", - "description":"Status of 2d extraction", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"statuscombine", - "display_name":"Status of Combine", - "sql_type":"VARCHAR", - "description":"Status of 1d combine", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"status1d", - "display_name":"Status of 1D", - "sql_type":"VARCHAR", - "description":"Status of 1d analysis", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"field_cadence", - "display_name":"Field Cadence", - "sql_type":"VARCHAR", - "description":"Planned Cadence of Observations", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"public", - "display_name":"Public", - "sql_type":"VARCHAR", - "description":"Is this Plate Public", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"qualcomments", - "display_name":"Quality Comments", - "sql_type":"VARCHAR", - "description":"Comments of Field Quality", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"moon_frac", - "display_name":"Moon Phase", - "sql_type":"real", - "description":"Mean Moon phase of the Coadded Spectra", - "unit":"None"} - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"created", - "display_name":"created", - "sql_type":"timestamp", - "description":"Time row was created", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_field", - "column_name":"modified", - "display_name":"modified", - "sql_type":"timestamp", - "description":"Time row was last updated", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_version", - "column_name":"id", - "display_name":"BOSS Version ID", - "sql_type":"SERIAL", - "description":"Identifier of Pipeline Version", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_version", - "column_name":"ipl", - "display_name":"ipl", - "sql_type":"INT2", - "description":"Associated IPL", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_version", - "column_name":"run2d", - "display_name":"BOSS run2d", - "sql_type":"VARCHAR", - "description":"Spectro-2D reduction name", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_version", - "column_name":"run1d", - "display_name":"BOSS run1d", - "sql_type":"VARCHAR", - "description":"Spectro-1D reduction name", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_version", - "column_name":"is_default", - "display_name":"Is Current Default?", - "sql_type":"BOOLEAN", - "description":"Is this the current default version", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_version", - "column_name":"is_epoch", - "display_name":"Is Epoch?", - "sql_type":"BOOLEAN", - "description":"Is this version associated with the field-epoch Coadds", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_version", - "column_name":"is_custom", - "display_name":"Is Custom?", - "sql_type":"BOOLEAN", - "description":"Is this version associated with a custom Coadd Schema", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_version", - "column_name":"custom_name", - "display_name":"Name of Custom", - "sql_type":"VARCHAR", - "description":"Name of Custom Coadd Schema", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_version", - "column_name":"created", - "display_name":"created", - "sql_type":"timestamp", - "description":"Time row was created", - "unit":"None"}, - {"schema":"boss_drp", - "table_name":"boss_version", - "column_name":"modified", - "display_name":"modified", - "sql_type":"timestamp", - "description":"Time row was last updated", - "unit":"None"} -] -} + "metadata": [ + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "id", + "display_name": "id", + "sql_type": "SERIAL", + "description": "id of row", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "boss_version_id", + "display_name": "boss_version_id", + "sql_type": "int", + "description": "ID of BOSS Pipeline version", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "field", + "display_name": "FIELD", + "sql_type": "integer", + "description": "SDSS FieldID (plateID for plate era data)", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "mjd", + "display_name": "MJD", + "sql_type": "integer", + "description": "Modified Julian date of completed combined Spectra", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "mjd_final", + "display_name": "Weighted MJD of Coadd", + "sql_type": "real", + "description": "Mean MJD of the Coadded Spectra", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "obs", + "display_name": "Observatory", + "sql_type": "VARCHAR", + "description": "Observatory of Observation", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "run2d", + "display_name": "BOSS RUN2D", + "sql_type": "VARCHAR", + "description": "Spectro-2D reduction name", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "run1d", + "display_name": "BOSS RUN1D", + "sql_type": "VARCHAR", + "description": "Spectro-1D reduction name", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "nexp", + "display_name": "Number of Exposures", + "sql_type": "smallint", + "description": "Number of Included Exposures", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "exptime", + "display_name": "Exposure Time", + "sql_type": "real", + "description": "Total Exposure time of Coadded Spectra", + "unit": "s" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "target_index", + "display_name": "Index of target in Field", + "sql_type": "integer", + "description": "Index of target on combined spField", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "spec_file", + "display_name": "Spec File name", + "sql_type": "VARCHAR", + "description": "Name of spec file (in SAS)", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "programname", + "display_name": "Program Name", + "sql_type": "VARCHAR", + "description": "Program name within a given survey", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "survey", + "display_name": "Survey", + "sql_type": "VARCHAR", + "description": "Survey that field is part of", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "cadence", + "display_name": "Target Cadence", + "sql_type": "VARCHAR", + "description": "Requested Target Cadence", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "firstcarton", + "display_name": "First Carton", + "sql_type": "VARCHAR", + "description": "Primary SDSS Carton for target", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "objtype", + "display_name": "Object Type", + "sql_type": "VARCHAR", + "description": "Why this object was targetted. QSO=SCIENCE", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "catalogid", + "display_name": "CatalogID", + "sql_type": "bigint", + "description": "SDSS-V CatalogID used in naming", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "CatalogID from V0", + "display_name": "CATALOGID_V0", + "sql_type": "bigint", + "description": "SDSS-V CatalogID from Catalog v0", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "CatalogID from V0.5", + "display_name": "CATALOGID_V0P5", + "sql_type": "bigint", + "description": "SDSS-V CatalogID from Catalog v0.5", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "sdss_id", + "display_name": "SDSS ID", + "sql_type": "bigint", + "description": "Unified SDSS Target Indentifier", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "specobjid", + "display_name": "SpecObjID", + "sql_type": "bigint", + "description": "Unique ID based on Field, MJD, FIBERID, RUN2D", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "calibflux", + "display_name": "CalibFlux", + "sql_type": "real[]", + "description": "Broad-band flux in SDSS-{ugriz} from PSFmag", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "calibflux_ivar", + "display_name": "CalibFlux IVAR", + "sql_type": "real[]", + "description": "Inverse var flux SDSS-{ugriz} from PSFmag", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "optical_prov", + "display_name": "Optical Magnitude Provenance", + "sql_type": "VARCHAR", + "description": "The source of the optical magnitudes", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "mag", + "display_name": "UGRIZ Magnitude", + "sql_type": "real[]", + "description": "[u, g, r, i, z] optical magnitudes", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "psfmag", + "display_name": "UGRIZ PSF Magnitude", + "sql_type": "real[]", + "description": "[u, g, r, i, z] optical PSF magnitudes", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "fiber2mag", + "display_name": "UGRIZ Fiber2 Magnitude", + "sql_type": "real[]", + "description": "[u, g, r, i, z] optical Fiber2 magnitudes", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "catdb_mag", + "display_name": "UGRIZ TargetDB Magnitude", + "sql_type": "real[]", + "description": "[u, g, r, i, z] Raw TargetDB magnitudes (paired with OPTICAL_PROV)", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "gri_gaia_transform", + "display_name": "GRI_GAIA_TRANSFORM", + "sql_type": "bigint", + "description": "provenance of ugriz photometry used in SDSS-V plate design process", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "gaia_g_mag", + "display_name": "Gaia G Magnitude", + "sql_type": "real", + "description": "Gaia G magnitude", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "bp_mag", + "display_name": "Gaia BP Magnitude", + "sql_type": "real", + "description": "Gaia BP magnitude", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "rp_mag", + "display_name": "Gaia RP magnitude", + "sql_type": "real", + "description": "Gaia RP magnitude", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "gaia_id", + "display_name": "Gaia SourceID", + "sql_type": "bigint", + "description": "Gaia SourceID", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "wise_mag", + "display_name": "WISE band magnitudes", + "sql_type": "real[]", + "description": "WISE [W1, W2, W3, W4] band magnitudes", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "twomass_mag", + "display_name": "TWOMASS band magnitudes", + "sql_type": "real[]", + "description": "2MASS [J, H, Ks] band magnitudes", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "guvcat_mag", + "display_name": "GALEX band magnitudes", + "sql_type": "real[]", + "description": "GALEX [FUV, NUV] band magnitudes", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "ebv", + "display_name": "EBV", + "sql_type": "real", + "description": "dust extinction", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "ebv_type", + "display_name": "EBV Type", + "sql_type": "VARCHAR", + "description": "Source of dust extinction", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "fiber_ra", + "display_name": "Fiber RA", + "sql_type": "double precision", + "description": "Fiber RA (first exposure) [J2000 for plate; at exposure for FPS]", + "unit": "deg" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "fiber_dec", + "display_name": "Fiber Dec", + "sql_type": "double precision", + "description": "Fiber DEC (first exposure) [J2000 for plate; at exposure for FPS]", + "unit": "deg" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "plug_ra", + "display_name": "Plug RA", + "sql_type": "double precision", + "description": "Object RA (drilled fiber position) [J2000]", + "unit": "deg" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "plug_dec", + "display_name": "Plug DEC", + "sql_type": "double precision", + "description": "Object DEC (drilled fiber position) [J2000]", + "unit": "deg" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "racat", + "display_name": "Catalog RA", + "sql_type": "double precision", + "description": "RA in ICRS coordinates at 'coord_epoch' for the target assigned", + "unit": "deg" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "Catalog DEC", + "display_name": "DECCAT", + "sql_type": "double precision", + "description": "Dec in ICRS coordinates at 'coord_epoch' for the target assigned", + "unit": "deg" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "coord_epoch", + "display_name": "Epoch of Catalog RA/DEC", + "sql_type": "real", + "description": "Epoch of the catalogue coordinates.", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "pmra", + "display_name": "RA Proper Motion", + "sql_type": "real", + "description": "Proper motion in RA (pmra is a true angle)", + "unit": "mas" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "pmdec", + "display_name": "DEC Proper Motion", + "sql_type": "real", + "description": "Proper motion in Dec", + "unit": "mas" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "parallax", + "display_name": "Parallax", + "sql_type": "real", + "description": "Parallax", + "unit": "mas" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "delta_ra", + "display_name": "RA Offset", + "sql_type": "double precision", + "description": "The maximum fiber offset in any exposure", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "delta_dec", + "display_name": "Dec Offset", + "sql_type": "double precision", + "description": "The maximum fiber offset in any exposure", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "fiber_offset", + "display_name": "Offset Fiber", + "sql_type": "integer", + "description": "Flag identifying the fiber was offset by design", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "lambda_eff", + "display_name": "Lambda_eff", + "sql_type": "real", + "description": "Wavelength to optimize hole location for", + "unit": "AA" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "healpix", + "display_name": "Healpix", + "sql_type": "integer", + "description": "healpix pixel number nside=128", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "healpixgrp", + "display_name": "Healpix Group", + "sql_type": "smallint", + "description": "Rounded-down integer value of healpix / 1000", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "fieldquality", + "display_name": "Field Quality", + "sql_type": "VARCHAR", + "description": "Characterization of field quality", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "exp_disp_med", + "display_name": "Exposure Dispersion", + "sql_type": "double precision", + "description": "Dispersion of Median Exposure Flux", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "fieldsn2", + "display_name": "Field SN2", + "sql_type": "real", + "description": "Overall (S/N)^2 for field; min of cameras", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "spec1_g", + "display_name": "g-band SN2 of SP1", + "sql_type": "real", + "description": "Fit (S/N)^2 at g=20.20 for spectrograph 1", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "spec1_r", + "display_name": "r-band SN2 of SP1", + "sql_type": "real", + "description": "Fit (S/N)^2 at r=20.25 for spectrograph 1", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "spec1_i", + "display_name": "i-band SN2 of SP1", + "sql_type": "real", + "description": "Fit (S/N)^2 at i=19.90 for spectrograph 1", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "spec2_g", + "display_name": "g-band SN2 of SP2", + "sql_type": "real", + "description": "Fit (S/N)^2 at g=20.20 for spectrograph 2", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "spec2_r", + "display_name": "r-band SN2 of SP2", + "sql_type": "real", + "description": "Fit (S/N)^2 at r=20.25 for spectrograph 2", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "spec2_i", + "display_name": "i-band SN2 of SP2", + "sql_type": "real", + "description": "Fit (S/N)^2 at i=19.90 for spectrograph 2", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "sn_median", + "display_name": "UGRIZ Median S/N", + "sql_type": "real[]", + "description": "Median S/N for all good pixels in SDSS-{ugriz}", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "sn_median_all", + "display_name": "Median S/N", + "sql_type": "real", + "description": "Median S/N for all good pixels in all filters", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "airmass", + "display_name": "Airmass", + "sql_type": "real", + "description": "Airmass at time of observation", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "seeing20", + "display_name": "Seeing 20 Percentile", + "sql_type": "real", + "description": "Mean 20% seeing during exposures (arcsec)", + "unit": "arcsec" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "seeing50", + "display_name": "Seeing 50 Percentile", + "sql_type": "real", + "description": "Mean 50% seeing during exposures (arcsec)", + "unit": "arcsec" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "seeing80", + "display_name": "Seeing 80 Percentile", + "sql_type": "real", + "description": "Mean 80% seeing during exposures (arcsec)", + "unit": "arcsec" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "moon_dist", + "display_name": "Mean Moon Separation", + "sql_type": "real", + "description": "Mean Moon-target separation of Coadded Spectra", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "moon_phase", + "display_name": "Mean Moon Phase", + "sql_type": "real", + "description": "Mean Moon phase of the Coadded Spectra", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "assigned", + "display_name": "ASSIGNED", + "sql_type": "BOOLEAN", + "description": "Fiber Assigned", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "on_target", + "display_name": "Fiber On Target", + "sql_type": "BOOLEAN", + "description": "Whether this fiber is on target", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "valid", + "display_name": "Valid Fiber Position", + "sql_type": "BOOLEAN", + "description": "Whether the alpha and beta angles are valid. Do not use with valid=0", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "decollided", + "display_name": "Fiber Decollided", + "sql_type": "BOOLEAN", + "description": "Whether this positioner had to be moved to decollide it.", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "anyandmask", + "display_name": "ANDMASK for any Pixel", + "sql_type": "integer", + "description": "For each bit, any pixel has bit set in ANDMASK", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "anyormask", + "display_name": "ORMASK for any Pixel", + "sql_type": "integer", + "description": "For each bit, any pixel has bit set in ORMASK", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "specprimary", + "display_name": "Primary Spectra", + "sql_type": "smallint", + "description": "Best version of spectrum at this location", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "specboss", + "display_name": "Primary BOSS Spectra", + "sql_type": "smallint", + "description": "Best version of spectrum at this location", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "boss_specobj_id", + "display_name": "BOSS_SPECOBJ_ID", + "sql_type": "integer", + "description": "ID of spectrum location on sky", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "nspecobs", + "display_name": "Number of Spectra at RA-DEC", + "sql_type": "smallint", + "description": "Number of spectral observations", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "spectroflux", + "display_name": "Flux in URGRIZ", + "sql_type": "real[]", + "description": "Spectrum projected onto SDSS-{ugriz} filter", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "spectroflux_ivar", + "display_name": "ivar of Flux in UGRIZ", + "sql_type": "real[]", + "description": "Inverse variance of SPECTROFLUX", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "spectrosynflux", + "display_name": "Flux of Template in UGRIZ", + "sql_type": "real[]", + "description": "Best-fit template projected onto SDSS-{ugriz}", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "ivar of Flux of Template in UGRIZ", + "display_name": "SPECTROSYNFLUX_IVAR", + "sql_type": "real[]", + "description": "Inverse variance of SPECTROSYNFLUX", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "Flux of Sky in UGRIZ", + "display_name": "SPECTROSKYFLUX", + "sql_type": "real[]", + "description": "Sky spectrum projected onto SDSS-{ugriz} filter", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "wavemin", + "display_name": "Min Wavelength", + "sql_type": "real", + "description": "Minimum observed (vacuum) wavelength for target", + "unit": "AA" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "wavemax", + "display_name": "Max Wavelength", + "sql_type": "real", + "description": "Maximum observed (vacuum) wavelength for target", + "unit": "AA" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "wcoverage", + "display_name": "Wavelength Coverage", + "sql_type": "real", + "description": "Amount of wavelength coverage in log-10(Angs)", + "unit": "log10(AA)" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "class", + "display_name": "Classification", + "sql_type": "VARCHAR", + "description": "Spectro classification: GALAXY, QSO, STAR", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "subclass", + "display_name": "Sub-Classification", + "sql_type": "VARCHAR", + "description": "Spectro sub-classification", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "z", + "display_name": "redshift", + "sql_type": "real", + "description": "Redshift; incorrect for nonzero ZWARNING flag", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "z_err", + "display_name": "redshift error", + "sql_type": "real", + "description": "z error from chi^2 min; negative is invalid fit", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "zwarning", + "display_name": "redshift Flag", + "sql_type": "integer", + "description": "A flag for bad z fits in place of CLASS=UNKNOWN", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "rchi2", + "display_name": "Reduced fit Chi^2", + "sql_type": "real", + "description": "Reduced chi^2 for best fit", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "dof", + "display_name": "Degrees of freedom for fit", + "sql_type": "integer", + "description": "Degrees of freedom for best fit", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "rchi2diff", + "display_name": "reduced fit chi^2 Difference", + "sql_type": "real", + "description": "Diff in reduced chi^2 of 2 best solutions", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "tfile", + "display_name": "Template File", + "sql_type": "VARCHAR", + "description": "Template file in $IDLSPEC2D_DIR/templates", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "vdisp", + "display_name": "Velocity dispersion", + "sql_type": "real", + "description": "Velocity dispersion, only computed for galaxies", + "unit": "km/s" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "vdisp_err", + "display_name": "Error in Velocity dispersion", + "sql_type": "real", + "description": "Error in VDISP; negative for invalid fit", + "unit": "km/s" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "vdispz", + "display_name": "Redshift of velocity dispersion", + "sql_type": "real", + "description": "Redshift for best-fit velocity dispersion", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "vdispz_err", + "display_name": "velocity dispersion redshift error", + "sql_type": "real", + "description": "Error in Redshift of velocity dispersion", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "vdispchi2", + "display_name": "velocity dispersion Chi2", + "sql_type": "real", + "description": "Chi^2 for best-fit velocity dispersion", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "vdispnpix", + "display_name": "velocity dispersion Pixels Fit", + "sql_type": "real", + "description": "Num of pixels overlapping VDISP fit templates", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "vdispdof", + "display_name": "velocity dispersion DOF", + "sql_type": "integer", + "description": "DOF for best-fit velocity dispersion", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "chi68p", + "display_name": "68% of abs(chi) of Fit Spectrum", + "sql_type": "real", + "description": "68% of abs(chi) of synthetic to actual spectrum", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "z_noqso", + "display_name": "non-QSO Redshift", + "sql_type": "real", + "description": "Redshift of the best-fit non-QSO model", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "z_err_noqso", + "display_name": "non-QSO Redshift Error", + "sql_type": "real", + "description": "Formal one-sigma error on Z_NOQSO", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "znum_noqso", + "display_name": "non-QSO Redshift Model index", + "sql_type": "integer", + "description": "Best fit z/class index excluding QSO; 1-indexed", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "zwarning_noqso", + "display_name": "non-QSO Redshift Warning", + "sql_type": "integer", + "description": "Redshift warning flag for Z_NOQSO", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "class_noqso", + "display_name": "non-QSO Classification", + "sql_type": "VARCHAR", + "description": "Spectro class of best-fit non-QSO model", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "subclass_noqso", + "display_name": "non-QSO Sub-Classification", + "sql_type": "VARCHAR", + "description": "Spectro sub-class of best-fit non-QSO model", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "rchi2diff_noqso", + "display_name": "non-QSO reduced fit chi^2 Difference", + "sql_type": "real", + "description": "Reduced chi^2 diff to next-best non-QSO model", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "xcsao_rv", + "display_name": "XCSAO RV", + "sql_type": "real", + "description": "Radial velocity measured with pyXCSAO", + "unit": "km/s" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "xcsao_erv", + "display_name": "XCSAO RV Error", + "sql_type": "real", + "description": "Uncertainty in Radial velocity", + "unit": "km/s" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "xcsao_rxc", + "display_name": "XCSAO Cross correlation strength", + "sql_type": "real", + "description": "Cross correlation strength from pyXCSAO", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "xcsao_teff", + "display_name": "XCSAO Temperature", + "sql_type": "real", + "description": "Interpolated temperature from pyXCSAO", + "unit": "K" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "xcsao_eteff", + "display_name": "XCSAO temperature Error", + "sql_type": "real", + "description": "Uncertainty in Interpolated temperature", + "unit": "K" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "xcsao_logg", + "display_name": "XCSAO surface gravity", + "sql_type": "real", + "description": "Interpolated surface gravity from pyXCSAO", + "unit": "cm/s/s" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "xcsao_elogg", + "display_name": "XCSAO surface gravity Error", + "sql_type": "real", + "description": "Uncertainty in Interpolated surface gravity", + "unit": "cm/s/s" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "xcsao_feh", + "display_name": "XCSAO metallicity", + "sql_type": "real", + "description": "Interpolated metallicity from pyXCSAO", + "unit": "Sun" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "xcsao_efeh", + "display_name": "XCSAO metallicity Error", + "sql_type": "real", + "description": "Uncertainty in interpolated metallicity", + "unit": "Sun" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "created", + "display_name": "created", + "sql_type": "timestamp", + "description": "Time row was created", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum", + "column_name": "modified", + "display_name": "modified", + "sql_type": "timestamp", + "description": "Time row was last updated", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "id", + "display_name": "id", + "sql_type": "SERIAL", + "description": "id of row", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "boss_version_id", + "display_name": "BOSS Version ID", + "sql_type": "int", + "description": "ID of BOSS Pipeline version", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "field", + "display_name": "Field", + "sql_type": "integer", + "description": "FieldID", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "mjd", + "display_name": "MJD", + "sql_type": "integer", + "description": "Modified Julian date of observation", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "target_index", + "display_name": "Target Index", + "sql_type": "integer", + "description": "Target Index (1 to number of targets)", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "catalogid", + "display_name": "Catalog ID", + "sql_type": "bigint", + "description": "SDSS-V CatalogID used in naming", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "sdss_id", + "display_name": "SDSS_ID", + "sql_type": "bigint", + "description": "Unified SDSS Target Indentifier", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "linename", + "display_name": "Line Name", + "sql_type": "VARCHAR", + "description": "Line name", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "linewave", + "display_name": "Line Wavelength", + "sql_type": "double precision", + "description": "Catalog wavelength for this line in vacuum Angstroms", + "unit": "AA" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "linez", + "display_name": "Line Redshift", + "sql_type": "real", + "description": "Redshift", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "linez_err", + "display_name": "Line Redshift error", + "sql_type": "real", + "description": "Line Redshift error (negative for invalid fit)", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "linesigma", + "display_name": "Line Gaussian Width", + "sql_type": "real", + "description": "Gaussian width in km/sec", + "unit": "km/s" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "linesigma_err", + "display_name": "Line Gaussian Width Error", + "sql_type": "real", + "description": "Line Gaussian Width Error (negative for invalid fit)", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "linearea", + "display_name": "Line Error", + "sql_type": "real", + "description": "Area in gaussian fit where units are (flux-units) * Ang", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "linearea_err", + "display_name": "Line Area Error", + "sql_type": "real", + "description": "Flux error (negative for invalid fit)", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "lineew", + "display_name": "Line Equivalent width", + "sql_type": "real", + "description": "quivalent width", + "unit": "AA" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "lineew_err", + "display_name": "Line Equivalent width error ", + "sql_type": "real", + "description": "Equivalent width error (negative for invalid fit)", + "unit": "AA" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "linecontlevel", + "display_name": "Line Continuum Level", + "sql_type": "real", + "description": "Continuum level at line center", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "linecontlevel_err", + "display_name": "Line Continuum Level Error", + "sql_type": "real", + "description": "Error in continuum level at line center", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "linenpixleft", + "display_name": "Npixels left of line center", + "sql_type": "integer", + "description": "Npixels from line center to -3 sigma with INVVAR > 0", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "linenpixright", + "display_name": "Npixels right of line center", + "sql_type": "integer", + "description": "Npixels from line center to +3 sigma with INVVAR > 0", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "linedof", + "display_name": "DOF in Line Fit", + "sql_type": "real", + "description": "DOF in fit", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "linechi2", + "display_name": "Chi2 of Line Fit", + "sql_type": "real", + "description": "chi2 for all points within +/- 3 sigma of line center", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "created", + "display_name": "created", + "sql_type": "timestamp", + "description": "Time row was created", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_spectrum_line", + "column_name": "modified", + "display_name": "modified", + "sql_type": "timestamp", + "description": "Time row was last updated", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "id", + "display_name": "id", + "sql_type": "SERIAL", + "description": "id of row", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "boss_version_id", + "display_name": "BOSS Version ID", + "sql_type": "int", + "description": "ID of BOSS Pipeline version", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "field", + "display_name": "Field", + "sql_type": "integer", + "description": "SDSS FieldID (plateID for plate era data)", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "designs", + "display_name": "Designs", + "sql_type": "VARCHAR", + "description": "List of Included Designs", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "configs", + "display_name": "Configurations", + "sql_type": "VARCHAR", + "description": "List of Included Configurations", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "mjd", + "display_name": "MJD", + "sql_type": "integer", + "description": "Modified Julian date of completed combined Spectra", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "observatory", + "display_name": "Observatory", + "sql_type": "VARCHAR", + "description": "Observatory of Observation", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "run2d", + "display_name": "BOSS Run2d", + "sql_type": "VARCHAR", + "description": "Spectro-2D reduction name", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "run1d", + "display_name": "BOSS Run1d", + "sql_type": "VARCHAR", + "description": "Spectro-1D reduction name", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "racen", + "display_name": "Telescope RA", + "sql_type": "real", + "description": "RA of the telescope pointing", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "deccen", + "display_name": "Telescope Dec", + "sql_type": "real", + "description": "DEC of the telescope pointing", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "epoch", + "display_name": "Coordinate Epoch", + "sql_type": "real", + "description": "Epoch of the RACEN/DECCEN", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "cartid", + "display_name": "Cartridge", + "sql_type": "VARCHAR", + "description": "The currently loaded cartridge/instrument", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "tai", + "display_name": "Tai of integration", + "sql_type": "double precision", + "description": "Mean MJD(TAI) seconds of integration", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "tai_beg", + "display_name": "Tai at start of integration", + "sql_type": "double precision", + "description": "MJD(TAI) seconds at start of integration", + "unit": "s" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "tai_end", + "display_name": "Tai at end of integration", + "sql_type": "double precision", + "description": "MJD(TAI) seconds at end of integration", + "unit": "s" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "airmass", + "display_name": "Airmass", + "sql_type": "real", + "description": "Mean Airmass", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "exptime", + "display_name": "Exposure Time", + "sql_type": "real", + "description": "Total Exposure time", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "mapname", + "display_name": "Plugmap Name", + "sql_type": "VARCHAR", + "description": "ID of plate mapping file", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "tileid", + "display_name": "Tile ID", + "sql_type": "integer", + "description": "Tile ID for SDSS BOSS plates (-1 for SDSS)", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "designid", + "display_name": "Design ID", + "sql_type": "integer", + "description": "Plate Design ID", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "survey", + "display_name": "Survey", + "sql_type": "VARCHAR", + "description": "Survey that field is part of", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "programname", + "display_name": "Program Name", + "sql_type": "VARCHAR", + "description": "Program name within a given survey", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "fieldquality", + "display_name": "Field Quality", + "sql_type": "VARCHAR", + "description": "", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "fieldsn2", + "display_name": "Field SN2", + "sql_type": "real", + "description": "Overall (S/N)^2 for field; min of cameras", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "deredsn2", + "display_name": "Dereddened Field SN2", + "sql_type": "real", + "description": "Overall Dereddened (S/N)^2 for field; min of cameras", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "qsurvey", + "display_name": "Survey Quality", + "sql_type": "integer", + "description": "1 for an survey quality plate, 0 otherwise", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "mjdlist", + "display_name": "List of MJDs", + "sql_type": "VARCHAR", + "description": "List of MJD of each included exposures", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "nexp", + "display_name": "Number of exposures", + "sql_type": "integer", + "description": "Number of Included Exposures", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "nexp_b1", + "display_name": "SP1 blue number of exposures", + "sql_type": "integer", + "description": "Number of Included Exposures from b1", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "nexp_r1", + "display_name": "SP1 red number of exposures", + "sql_type": "integer", + "description": "Number of Included Exposures from r1", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "nexp_b2", + "display_name": "SP2 blue number of exposures", + "sql_type": "integer", + "description": "Number of Included Exposures from b2", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "nexp_r2", + "display_name": "SP2 red number of exposures", + "sql_type": "integer", + "description": "Number of Included Exposures from r2", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "expt_b1", + "display_name": "SP1 blue Exposure Time", + "sql_type": "real", + "description": "Total Exposure Time of b1", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "SP1 red Exposure Time", + "display_name": "EXPT_R1", + "sql_type": "real", + "description": "Total Exposure Time of r1", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "expt_b2", + "display_name": "SP2 blue Exposure Time", + "sql_type": "real", + "description": "Total Exposure Time of b2", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "expt_r2", + "display_name": "SP2 red Exposure Time", + "sql_type": "real", + "description": "Total Exposure Time of r2", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "sn2_g1", + "display_name": "SP1 g-band SN2", + "sql_type": "real", + "description": "Fit (S/N)^2 at g=20.20 for spectrograph #1", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "sn2_r1", + "display_name": "SP1 r-band SN2", + "sql_type": "real", + "description": "Fit (S/N)^2 at r=20.25 for spectrograph #1", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "sn2_i1", + "display_name": "SP1 i-band SN2", + "sql_type": "real", + "description": "Fit (S/N)^2 at i=19.90 for spectrograph #1", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "sn2_g2", + "display_name": "SP2 g-band SN2", + "sql_type": "real", + "description": "Fit (S/N)^2 at g=20.20 for spectrograph #2", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "sn2_r2", + "display_name": "SP2 r-band SN2", + "sql_type": "real", + "description": "Fit (S/N)^2 at r=20.25 for spectrograph #2", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "sn2_i2", + "display_name": "SP2 i-band SN2", + "sql_type": "real", + "description": "Fit (S/N)^2 at i=19.90 for spectrograph #2", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "goffstd", + "display_name": "Standards mag-g offset difference", + "sql_type": "real", + "description": "Mean g-band mag difference (spectro-photo) for standards", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "grmsstd", + "display_name": "Standards mag-g RMS difference", + "sql_type": "real", + "description": "Stddev g-band mag difference (spectro-photo) for standards", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "roffstd", + "display_name": "Standards mag-r Offset difference", + "sql_type": "real", + "description": "Mean r-band mag difference (spectro-photo) for standards", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "rrmsstd", + "display_name": "Standards mag-r RMS difference", + "sql_type": "real", + "description": "Stddev r-band mag difference (spectro-photo) for standards", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "ioffstd", + "display_name": "Standards mag-i Offset difference", + "sql_type": "real", + "description": "Mean i-band mag difference (spectro-photo) for standards", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "irmsstd", + "display_name": "Standards mag-i RMS difference", + "sql_type": "real", + "description": "Stddev i-band mag difference (spectro-photo) for standards", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "groffstd", + "display_name": "Standards Spectrophoto Offset for G-R", + "sql_type": "real", + "description": "Spectrophoto offset for G-R in standards", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "grrmsstd", + "display_name": "Standards Spectrophoto RMS for G-R", + "sql_type": "real", + "description": "Spectrophoto RMS for G-R in standards", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "rioffstd", + "display_name": "Standards Spectrophoto Offset for R-I", + "sql_type": "real", + "description": "Spectrophoto offset for R-I in standards", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "rirmsstd", + "display_name": "Standards Spectrophoto RMS for R-I", + "sql_type": "real", + "description": "Spectrophoto RMS for R-I in standards", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "goffgal", + "display_name": "Galaxy mag-g offset difference", + "sql_type": "real", + "description": "Mean g-band mag difference (spectro-photo) for galaxies", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "grmsgal", + "display_name": "Galaxy mag-g STD difference", + "sql_type": "real", + "description": "Stddev g-band mag difference (spectro-photo) for galaxies", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "roffgal", + "display_name": "Galaxy mag-r offset difference", + "sql_type": "real", + "description": "Mean r-band mag difference (spectro-photo) for galaxies", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "rrmsgal", + "display_name": "Galaxy mag-r RMS difference", + "sql_type": "real", + "description": "Stddev r-band mag difference (spectro-photo) for galaxies", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "ioffgal", + "display_name": "Galaxy mag-i offset difference", + "sql_type": "real", + "description": "Mean i-band mag difference (spectro-photo) for galaxies", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "irmsgal", + "display_name": "Galaxy mag-i RMS difference", + "sql_type": "real", + "description": "Stddev i-band mag difference (spectro-photo) for galaxies", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "groffgal", + "display_name": "Galaxy Spectrophoto Offset for G-R", + "sql_type": "real", + "description": "Spectrophoto offset for G-R in galaxies", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "grrmsgal", + "display_name": "Galaxy Spectrophoto RMS for G-R", + "sql_type": "real", + "description": "Spectrophoto RMS for G-R in galaxies", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "rioffgal", + "display_name": "Galaxy Spectrophoto Offset for R-I", + "sql_type": "real", + "description": "Spectrophoto offset for R-I in galaxies", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "rirmsgal", + "display_name": "Galaxy Spectrophoto RMS for R-I", + "sql_type": "real", + "description": "Spectrophoto RMS for R-I in galaxies", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "nguide", + "display_name": "Number of Guide Frames", + "sql_type": "integer", + "description": "Number of guider camera frames taken during the exposures", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "seeing20", + "display_name": "20% Seeing", + "sql_type": "real", + "description": "Mean 20% seeing during exposures", + "unit": "arcse" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "seeing50", + "display_name": "50% Seeing", + "sql_type": "real", + "description": "Mean 50% seeing during exposures", + "unit": "arcse" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "seeing80", + "display_name": "80% Seeing", + "sql_type": "real", + "description": "Mean 80% seeing during exposures", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "rmsoff20", + "display_name": "20% RMS offset of guider", + "sql_type": "real", + "description": "20% of RMS offset of guide fibers", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "rmsoff50", + "display_name": "50% RMS offset of guider", + "sql_type": "real", + "description": "50% of RMS offset of guide fibers", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "rmsoff80", + "display_name": "80% RMS offset of guider", + "sql_type": "real", + "description": "80% of RMS offset of guide fibers", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "airtemp", + "display_name": "Air Temperature", + "sql_type": "real", + "description": "Air temperature in the dome", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "xsigma", + "display_name": "Width of Extraction Profile", + "sql_type": "real", + "description": "Mean of median width of trace extraction profile", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "xsigmin", + "display_name": "Min Width of Extraction Profile", + "sql_type": "real", + "description": "Minimum of median width of trace extraction profile", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "xsigmax", + "display_name": "Max Width of Extraction Profile", + "sql_type": "real", + "description": "Maximum of median width of trace extraction profile", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "wsigma", + "display_name": "Width of Arc Lines", + "sql_type": "real", + "description": "Mean of median wavelength (Y) width of Arc Lines", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "wsigmin", + "display_name": "Min width of Arc Lines", + "sql_type": "real", + "description": "Minimum of median wavelength (Y) width of Arc Lines", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "wsigmax", + "display_name": "Max width of Arc Lines", + "sql_type": "real", + "description": "Maximum of median wavelength (Y) width of Arc Lines", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "xchi2", + "display_name": "reduced chi^2", + "sql_type": "real", + "description": "Mean of XCHI2 (reduced chi^2 of row-by-row extraction)", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "xchi2min", + "display_name": "Min reduced chi^2", + "sql_type": "real", + "description": "Minimum of XCHI2 (reduced chi^2 of row-by-row extraction)", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "xchi2max", + "display_name": "Max reduced chi^2", + "sql_type": "real", + "description": "Maximum of XCHI2 (reduced chi^2 of row-by-row extraction)", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "skychi2", + "display_name": "Sky Subtraction Chi2", + "sql_type": "real", + "description": "Average chi-squared from sky subtraction from all exposures", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "schi2min", + "display_name": "Min Sky Chi2", + "sql_type": "real", + "description": "Minimum skyChi2 over all exposures", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "schi2max", + "display_name": "Max Sky Chi2", + "sql_type": "real", + "description": "Maximum skyChi2 over all exposures", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "fbadpix", + "display_name": "Fraction of bad pixels", + "sql_type": "real", + "description": "Fraction of bad pixels", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "fbadpix1", + "display_name": "Fraction of bad pixels in SP1", + "sql_type": "real", + "description": "Fraction of bad pixels from spectrograph #1", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "fbadpix2", + "display_name": "Fraction of bad pixels in SP2", + "sql_type": "real", + "description": "Fraction of bad pixels from spectrograph #2", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "n_total", + "display_name": "Number of Sources", + "sql_type": "integer", + "description": "Number of Sources", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "n_galaxy", + "display_name": "Number of Galaxies", + "sql_type": "integer", + "description": "Number of Galaxies", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "n_qso", + "display_name": "Number of QSOs", + "sql_type": "integer", + "description": "Number of QSOs", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "n_star", + "display_name": "Number of Stars", + "sql_type": "integer", + "description": "Number of Stars", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "n_unknown", + "display_name": "Number of Unknown Sources", + "sql_type": "integer", + "description": "Number of Unknown Sources", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "n_sky", + "display_name": "Number of Skys", + "sql_type": "integer", + "description": "Number of Skys", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "n_std", + "display_name": "Number of Standard", + "sql_type": "integer", + "description": "Number of Standards", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "n_target_qso", + "display_name": "QSOs Targeted", + "sql_type": "integer", + "description": "Number of QSO Targeted", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "n_target_main", + "display_name": "Main Galaxies Targeted", + "sql_type": "integer", + "description": "Number of Main Galaxy targeted", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "n_target_lrg1", + "display_name": "LRG1s Targeted", + "sql_type": "integer", + "description": "Number of LRG1 targeted", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "n_target_lrg2", + "display_name": "LRG2s Targeted", + "sql_type": "integer", + "description": "Number of LRG2 targeted", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "n_target_elg", + "display_name": "ELGs Targeted", + "sql_type": "integer", + "description": "Number of ELG targted", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "success_main", + "display_name": "Main Galaxy Success Rate", + "sql_type": "real", + "description": "Success rate of Main Galaxy targets", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "success_lrg1", + "display_name": "LRG1 Success Rate", + "sql_type": "real", + "description": "Success rate of LRG1s", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "success_lrg2", + "display_name": "LRG2 Success Rate", + "sql_type": "real", + "description": "Success rate of LRG2s", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "success_elg", + "display_name": "ELG Success Rate", + "sql_type": "real", + "description": "Success rate of ELGs", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "success_qso", + "display_name": "QSO Success Rate", + "sql_type": "real", + "description": "Success rate of QSOs", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "status2d", + "display_name": "Status of 2D", + "sql_type": "VARCHAR", + "description": "Status of 2d extraction", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "statuscombine", + "display_name": "Status of Combine", + "sql_type": "VARCHAR", + "description": "Status of 1d combine", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "status1d", + "display_name": "Status of 1D", + "sql_type": "VARCHAR", + "description": "Status of 1d analysis", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "field_cadence", + "display_name": "Field Cadence", + "sql_type": "VARCHAR", + "description": "Planned Cadence of Observations", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "public", + "display_name": "Public", + "sql_type": "VARCHAR", + "description": "Is this Plate Public", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "qualcomments", + "display_name": "Quality Comments", + "sql_type": "VARCHAR", + "description": "Comments of Field Quality", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "moon_frac", + "display_name": "Moon Phase", + "sql_type": "real", + "description": "Mean Moon phase of the Coadded Spectra", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "created", + "display_name": "created", + "sql_type": "timestamp", + "description": "Time row was created", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_field", + "column_name": "modified", + "display_name": "modified", + "sql_type": "timestamp", + "description": "Time row was last updated", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_version", + "column_name": "id", + "display_name": "BOSS Version ID", + "sql_type": "SERIAL", + "description": "Identifier of Pipeline Version", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_version", + "column_name": "ipl", + "display_name": "ipl", + "sql_type": "INT2", + "description": "Associated IPL", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_version", + "column_name": "run2d", + "display_name": "BOSS run2d", + "sql_type": "VARCHAR", + "description": "Spectro-2D reduction name", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_version", + "column_name": "run1d", + "display_name": "BOSS run1d", + "sql_type": "VARCHAR", + "description": "Spectro-1D reduction name", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_version", + "column_name": "is_default", + "display_name": "Is Current Default?", + "sql_type": "BOOLEAN", + "description": "Is this the current default version", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_version", + "column_name": "is_epoch", + "display_name": "Is Epoch?", + "sql_type": "BOOLEAN", + "description": "Is this version associated with the field-epoch Coadds", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_version", + "column_name": "is_custom", + "display_name": "Is Custom?", + "sql_type": "BOOLEAN", + "description": "Is this version associated with a custom Coadd Schema", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_version", + "column_name": "custom_name", + "display_name": "Name of Custom", + "sql_type": "VARCHAR", + "description": "Name of Custom Coadd Schema", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_version", + "column_name": "created", + "display_name": "created", + "sql_type": "timestamp", + "description": "Time row was created", + "unit": "None" + }, + { + "schema": "boss_drp", + "table_name": "boss_version", + "column_name": "modified", + "display_name": "modified", + "sql_type": "timestamp", + "description": "Time row was last updated", + "unit": "None" + } + ] +} \ No newline at end of file diff --git a/schema/sdss5db/metadata/load_metadata.py b/schema/sdss5db/metadata/load_metadata.py index 8dbff49e..6e23e912 100644 --- a/schema/sdss5db/metadata/load_metadata.py +++ b/schema/sdss5db/metadata/load_metadata.py @@ -13,7 +13,15 @@ def read_json(file): return json.loads(f.read()) +def connect_db(host: str = None, port: str = None, user: str = None, password: str = None): + """ connect to the database """ + if not database.connected: + database.connect_from_parameters(dbname='sdss5db', host=host, port=port, + user=user, password=password) + + def load_metadata(schema: str = ''): + """ load the json metadata """ files = pathlib.Path(__file__).parent.rglob(f'*{schema}.json') rows = [] @@ -31,8 +39,13 @@ def load_metadata(schema: str = ''): prog='Load Metadata', description='Load into the sdss5db db_metadata table') parser.add_argument('-s', '--schema', type=str, help='the database schema name', default='') +parser.add_argument('-o', '--host', type=str, help='the database host', default=None) +parser.add_argument('-p', '--port', type=str, help='the database port', default=None) +parser.add_argument('-u', '--user', type=str, help='the database user', default=None) +parser.add_argument('-w', '--password', type=str, help='the database password', default=None) if __name__ == '__main__': args = parser.parse_args() + connect_db(host=args.host, port=args.port, user=args.user, password=args.password) load_metadata(schema=args.schema) From 33231f113403a2e320dee16c3c84c1481c3278b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Fri, 9 Aug 2024 08:17:06 -0700 Subject: [PATCH 10/30] Add metadata for sdss_id_to_catalog table (#264) * Add metadata for sdss_id_to_catalog table * Updated CHANGELOG.rst for issue #263 * Actually use the PR for the changelog instead of the issue number --- CHANGELOG.rst | 1 + schema/sdss5db/metadata/catalogdb.json | 292 +++++++++++++++++++++++++ 2 files changed, 293 insertions(+) create mode 100644 schema/sdss5db/metadata/catalogdb.json diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b5a0ddc9..ef296e09 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ Changelog This document records the main changes to the ``sdssdb`` code. +* :feature:`264` Add metadata for the ``sdss_id_to_catalog`` table. * Add missing columns to the ``SDSS_ID_To_Catalog`` models (the columns were being completed via reflection). * Change ``reflection=False`` to ``use_reflection=False`` in many ``catalogdb`` models. The previous setting was incorrect and was causing the models to be reflected. diff --git a/schema/sdss5db/metadata/catalogdb.json b/schema/sdss5db/metadata/catalogdb.json new file mode 100644 index 00000000..a1f687a1 --- /dev/null +++ b/schema/sdss5db/metadata/catalogdb.json @@ -0,0 +1,292 @@ +{ + "metadata": [ + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "pk", + "display_name": "PK", + "sql_type": "bigint", + "description": "Primary key", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "sdss_id", + "display_name": "SDSS ID", + "sql_type": "bigint", + "description": "The common, unifying, SDSS ID of an on-sky object", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "catalogid", + "display_name": "Catalog ID", + "sql_type": "bigint", + "description": "catalog ID of an object in a given cross-match", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "version_id", + "display_name": "Version ID", + "sql_type": "smallint", + "description": "The version ID of the cross-match for the given catalogid", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "lead", + "display_name": "Lead Catalog", + "sql_type": "text", + "description": "The lead catalog used for the cross-match", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "allstar_dr17_synspec_rev1__apstar_id", + "display_name": "AllStar DR17 SynSpec Rev1 Entry", + "sql_type": "text", + "description": "The primary key of the associated record in the AllStar DR17 SynSpec Rev1 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "allwise__cntr", + "display_name": "AllWISE Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the AllWISE catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "bhm_rm_v0__pk", + "display_name": "BHM RM v0 Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the BHM RM v0 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "bhm_rm_v0_2__pk", + "display_name": "BHM RM v0.2 Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the BHM RM v0.2 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "catwise__source_id", + "display_name": "CatWISE Entry", + "sql_type": "text", + "description": "The primary key of the associated record in the CatWISE catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "catwise2020__source_id", + "display_name": "CatWISE 2020 Entry", + "sql_type": "text", + "description": "The primary key of the associated record in the CatWISE 2020 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "gaia_dr2_source__source_id", + "display_name": "Gaia DR2 Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the Gaia DR2 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "gaia_dr3_source__source_id", + "display_name": "Gaia DR3 Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the Gaia DR3 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "glimpse__pk", + "display_name": "GLIMPSE Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the GLIMPSE catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "guvcat__objid", + "display_name": "GUVCat Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the GUVCat catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "legacy_survey_dr10__ls_id", + "display_name": "Legacy Survey DR10 Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the Legacy Survey DR10 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "legacy_survey_dr8__ls_id", + "display_name": "Legacy Survey DR8 Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the Legacy Survey DR8 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "mangatarget__mangaid", + "display_name": "MaNGA Target Entry", + "sql_type": "text", + "description": "The primary key of the associated record in the MaNGA Target catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "marvels_dr11_star__starname", + "display_name": "Marvekls DR11 Entry", + "sql_type": "text", + "description": "The primary key of the associated record in the Marvels DR11 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "marvels_dr12_star__pk", + "display_name": "Marvels DR12 Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the Marvels DR12 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "mastar_goodstars__mangaid", + "display_name": "MaStar Good Stars Entry", + "sql_type": "text", + "description": "The primary key of the associated record in the MaStar Good Stars catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "panstarrs1__catid_objid", + "display_name": "PanSTARRS DR1 Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the PanSTARRS DR1 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "ps1_g18__objid", + "display_name": "PanSTARRS DR1 G<18 Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the PanSTARRS DR1 G<18 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "sdss_dr13_photoobj__objid", + "display_name": "SDSS DR13 PhotoObj Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the SDSS DR13 PhotoObj catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "sdss_dr17_specobj__specobjid", + "display_name": "SDSS DR17 SpecObj Entry", + "sql_type": "text", + "description": "The primary key of the associated record in the SDSS DR17 SpecObj catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "skymapper_dr1_1__object_id", + "display_name": "SkyMapper DR1.1 Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the SkyMapper DR1.1 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "skymapper_dr2__object_id", + "display_name": "SkyMapper DR2 Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the SkyMapper DR2 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "supercosmos__objid", + "display_name": "SuperCOSMOS Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the SuperCOSMOS catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "tic_v8__id", + "display_name": "TIC v8 Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the TIC v8 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "twomass_psc__pts_key", + "display_name": "2MASS Point Source Catalog Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the 2MASS Point Source Catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "tycho2__designation", + "display_name": "Tycho-2 Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the Tycho-2 catalog", + "unit": "None" + }, + { + "schema": "catalogdb", + "table_name": "sdss_id_to_catalog", + "column_name": "unwise__unwise_objid", + "display_name": "unWISE Entry", + "sql_type": "bigint", + "description": "The primary key of the associated record in the unWISE catalog", + "unit": "None" + } + ] +} From bdf1e708ae19c7dc54421d9212f90a3cf50800b6 Mon Sep 17 00:00:00 2001 From: Pramod Gupta <61213683+astronomygupta@users.noreply.github.com> Date: Sat, 10 Aug 2024 09:33:46 -0700 Subject: [PATCH 11/30] edit legacy_survey_dr10_create_indexes_lowpriority.sql (#265) --- .../dr10/legacy_survey_dr10_create_indexes_lowpriority.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/schema/sdss5db/catalogdb/legacy_survey/dr10/legacy_survey_dr10_create_indexes_lowpriority.sql b/schema/sdss5db/catalogdb/legacy_survey/dr10/legacy_survey_dr10_create_indexes_lowpriority.sql index c71f314c..2cfedc0e 100644 --- a/schema/sdss5db/catalogdb/legacy_survey/dr10/legacy_survey_dr10_create_indexes_lowpriority.sql +++ b/schema/sdss5db/catalogdb/legacy_survey/dr10/legacy_survey_dr10_create_indexes_lowpriority.sql @@ -19,5 +19,7 @@ create index on catalogdb.legacy_survey_dr10(nobs_i); create index on catalogdb.legacy_survey_dr10(nobs_z); create index on catalogdb.legacy_survey_dr10(parallax); create index on catalogdb.legacy_survey_dr10(ref_id); - +create index on catalogdb.legacy_survey_dr10(ebv); +create index on catalogdb.legacy_survey_dr10(shape_r); +create index on catalogdb.legacy_survey_dr10(shape_r_ivar); \o From a08680cdd52dec9bc259a4742124e43e9b3a9f3b Mon Sep 17 00:00:00 2001 From: havok2063 Date: Wed, 14 Aug 2024 11:13:31 -0400 Subject: [PATCH 12/30] updating metadata for some vizdb columns --- schema/sdss5db/metadata/vizdb.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/schema/sdss5db/metadata/vizdb.json b/schema/sdss5db/metadata/vizdb.json index c595e546..215e275d 100644 --- a/schema/sdss5db/metadata/vizdb.json +++ b/schema/sdss5db/metadata/vizdb.json @@ -232,7 +232,7 @@ "column_name": "in_boss", "display_name": "In BOSS", "sql_type": "boolean", - "description": "Flag indicating if the sdss_id is in the boss reduction tables", + "description": "Flag indicating if the sdss_id has been reduced by the SDSS-V boss pipeline", "unit": "None" }, { @@ -241,7 +241,7 @@ "column_name": "in_apogee", "display_name": "In APOGEE", "sql_type": "boolean", - "description": "Flag indicating if the sdss_id is in the apogee reduction tables", + "description": "Flag indicating if the sdss_id has been reduced by the SDSS-V apogee pipeline", "unit": "None" }, { @@ -250,7 +250,7 @@ "column_name": "in_astra", "display_name": "In APOGEE", "sql_type": "boolean", - "description": "Flag indicating if the sdss_id is in the astra reduction tables", + "description": "Flag indicating if the sdss_id has been reduced by the Astra pipeline, either sdss5 or dr17 release data.", "unit": "None" }, { @@ -259,7 +259,7 @@ "column_name": "has_been_observed", "display_name": "Has Been Observed", "sql_type": "boolean", - "description": "Flag indicating if the sdss_id target has been observed or not", + "description": "Flag indicating if the sdss_id target has been observed or not, either in sdss5 or dr17 release data.", "unit": "None" }, { From 0e1fe88b8f8777a7123d678f6ddaa8746bf53f25 Mon Sep 17 00:00:00 2001 From: imedan Date: Thu, 15 Aug 2024 12:44:16 -0500 Subject: [PATCH 13/30] add *_no_apogee_skies designmodes --- .../design_mode/DesignMode_values.txt | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/schema/sdss5db/targetdb/data_table/design_mode/DesignMode_values.txt b/schema/sdss5db/targetdb/data_table/design_mode/DesignMode_values.txt index e7a89696..61583a6d 100644 --- a/schema/sdss5db/targetdb/data_table/design_mode/DesignMode_values.txt +++ b/schema/sdss5db/targetdb/data_table/design_mode/DesignMode_values.txt @@ -1,10 +1,15 @@ -bright_time ; 50 ; {1,95,75} ; 35 ; {1,95,85} ; 50 ; {-999,-999,-999,-999,13,-999,13,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,75} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,13,-999} ; {3,95,230} ; {12.7,-999,12.7,-999,13,13,13,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL -dark_plane ; 50 ; {1,95,75} ; 35 ; {1,95,85} ; 50 ; {-999,15,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,75} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,13,-999} ; {3,95,230} ; {15,15,15,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL -dark_monit ; 50 ; {1,95,75} ; 35 ; {1,95,85} ; 70 ; {-999,16,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,95} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,230} ; {16,16,16,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL -dark_rm ; 50 ; {1,95,75} ; 0 ; {-999,-999,-999} ; 70 ; {-999,16,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,95} ; 0 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999} ; {16,16,16,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL -dark_faint ; 80 ; {3,95,85} ; 35 ; {1,95,85} ; 20 ; {-999,16,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,130} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,13,-999} ; {3,95,230} ; {16,16,16,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL -bright_time_eng ; 50 ; {1,95,75} ; 35 ; {1,95,85} ; 50 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,75} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,230} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL -dark_plane_eng ; 50 ; {1,95,75} ; 35 ; {1,95,85} ; 50 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,75} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,230} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL -dark_monit_eng ; 50 ; {1,95,75} ; 35 ; {1,95,85} ; 70 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,95} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,230} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL -dark_rm_eng ; 50 ; {1,95,75} ; 0 ; {-999,-999,-999} ; 70 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,95} ; 0 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL -dark_faint_eng ; 80 ; {3,95,85} ; 35 ; {1,95,85} ; 20 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,130} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,230} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL +bright_time ; 50 ; {1,95,75} ; 35 ; {1,95,85} ; 50 ; {-999,-999,-999,-999,13,-999,13,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,75} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,13,-999} ; {3,95,230} ; {12.7,-999,12.7,-999,13,13,13,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL +dark_plane ; 50 ; {1,95,75} ; 35 ; {1,95,85} ; 50 ; {-999,15,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,75} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,13,-999} ; {3,95,230} ; {15,15,15,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL +dark_monit ; 50 ; {1,95,75} ; 35 ; {1,95,85} ; 70 ; {-999,16,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,95} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,230} ; {16,16,16,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL +dark_rm ; 50 ; {1,95,75} ; 0 ; {-999,-999,-999} ; 70 ; {-999,16,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,95} ; 0 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999} ; {16,16,16,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL +dark_faint ; 80 ; {3,95,85} ; 35 ; {1,95,85} ; 20 ; {-999,16,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,130} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,13,-999} ; {3,95,230} ; {16,16,16,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL +bright_time_eng ; 50 ; {1,95,75} ; 35 ; {1,95,85} ; 50 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,75} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,230} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL +dark_plane_eng ; 50 ; {1,95,75} ; 35 ; {1,95,85} ; 50 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,75} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,230} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL +dark_monit_eng ; 50 ; {1,95,75} ; 35 ; {1,95,85} ; 70 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,95} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,230} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL +dark_rm_eng ; 50 ; {1,95,75} ; 0 ; {-999,-999,-999} ; 70 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,95} ; 0 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL +dark_faint_eng ; 80 ; {3,95,85} ; 35 ; {1,95,85} ; 20 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,130} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,230} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL +bright_time_no_apogee_skies ; 50 ; {1,95,75} ; 0 ; {-999,-999,-999} ; 50 ; {-999,-999,-999,-999,13,-999,13,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,75} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,13,-999} ; {3,95,230} ; {12.7,-999,12.7,-999,13,13,13,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL +dark_plane_no_apogee_skies ; 50 ; {1,95,75} ; 0 ; {-999,-999,-999} ; 50 ; {-999,15,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,75} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,13,-999} ; {3,95,230} ; {15,15,15,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL +dark_monit_no_apogee_skies ; 50 ; {1,95,75} ; 0 ; {-999,-999,-999} ; 70 ; {-999,16,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,95} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,230} ; {16,16,16,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL +dark_rm_no_apogee_skies ; 50 ; {1,95,75} ; 0 ; {-999,-999,-999} ; 70 ; {-999,16,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,95} ; 0 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999} ; {16,16,16,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL +dark_faint_no_apogee_skies ; 80 ; {3,95,85} ; 0 ; {-999,-999,-999} ; 20 ; {-999,16,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,130} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,13,-999} ; {3,95,230} ; {16,16,16,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL \ No newline at end of file From 8b171f37f6d2da6f6a17e4deba5cf454b9a70af0 Mon Sep 17 00:00:00 2001 From: imedan Date: Thu, 15 Aug 2024 12:59:04 -0500 Subject: [PATCH 14/30] remove dark_rm_no_apogee_skies --- .../targetdb/data_table/design_mode/DesignMode_values.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/schema/sdss5db/targetdb/data_table/design_mode/DesignMode_values.txt b/schema/sdss5db/targetdb/data_table/design_mode/DesignMode_values.txt index 61583a6d..b48143a3 100644 --- a/schema/sdss5db/targetdb/data_table/design_mode/DesignMode_values.txt +++ b/schema/sdss5db/targetdb/data_table/design_mode/DesignMode_values.txt @@ -11,5 +11,4 @@ dark_faint_eng ; 80 ; {3,95,85} ; 35 bright_time_no_apogee_skies ; 50 ; {1,95,75} ; 0 ; {-999,-999,-999} ; 50 ; {-999,-999,-999,-999,13,-999,13,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,75} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,13,-999} ; {3,95,230} ; {12.7,-999,12.7,-999,13,13,13,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL dark_plane_no_apogee_skies ; 50 ; {1,95,75} ; 0 ; {-999,-999,-999} ; 50 ; {-999,15,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,75} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,13,-999} ; {3,95,230} ; {15,15,15,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL dark_monit_no_apogee_skies ; 50 ; {1,95,75} ; 0 ; {-999,-999,-999} ; 70 ; {-999,16,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,95} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,230} ; {16,16,16,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL -dark_rm_no_apogee_skies ; 50 ; {1,95,75} ; 0 ; {-999,-999,-999} ; 70 ; {-999,16,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {3,95,95} ; 0 ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999} ; {16,16,16,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL dark_faint_no_apogee_skies ; 80 ; {3,95,85} ; 0 ; {-999,-999,-999} ; 20 ; {-999,16,-999,-999,-999,-999,-999,-999,-999,-999} ; {-999,18,-999,-999,-999,-999,-999,-999,-999,-999} ; {1,95,130} ; 15 ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,13,-999} ; {3,95,230} ; {16,16,16,-999,-999,-999,-999,-999,-999,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; NULL ; NULL ; {-999,-999,-999,-999,-999,-999,-999,-999,7,-999} ; {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999} ; 5 ; NULL \ No newline at end of file From 63b54e55b985c8e9a65a8fc020c5975aebed5a14 Mon Sep 17 00:00:00 2001 From: johndonor3 Date: Mon, 19 Aug 2024 09:58:07 -0600 Subject: [PATCH 15/30] update assignmnet status scripts to ignore parquet files --- .../targetdb/load_table/assignment_status/daily_scrape.py | 2 ++ .../load_table/assignment_status/scrape_specific_night.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/schema/sdss5db/targetdb/load_table/assignment_status/daily_scrape.py b/schema/sdss5db/targetdb/load_table/assignment_status/daily_scrape.py index 61dd2096..7b8bd3af 100644 --- a/schema/sdss5db/targetdb/load_table/assignment_status/daily_scrape.py +++ b/schema/sdss5db/targetdb/load_table/assignment_status/daily_scrape.py @@ -55,6 +55,8 @@ def scrapeRecent(obs="APO", mjd_today=00000, base="", for sub in check_mid_level: sum_files = os.listdir(sub) for s in sum_files: + if "parquet" in s: + continue sum_name = os.path.join(sub, s) timeStamp = os.path.getctime(sum_name) if (unixNow - timeStamp) / secInDay > n_days: diff --git a/schema/sdss5db/targetdb/load_table/assignment_status/scrape_specific_night.py b/schema/sdss5db/targetdb/load_table/assignment_status/scrape_specific_night.py index de8c4a9a..6e2bca41 100644 --- a/schema/sdss5db/targetdb/load_table/assignment_status/scrape_specific_night.py +++ b/schema/sdss5db/targetdb/load_table/assignment_status/scrape_specific_night.py @@ -34,7 +34,7 @@ def scrapeRecent(obs="APO", mjd_today=00000, base="", doneDesigns = [d.design_id for d in doneDesigns] - base_dir = os.getenv('SDSSCORE_TEST_DIR') + base_dir = os.getenv('SDSSCORE_DIR') obs_dir = os.path.join(base_dir, f"{obs.lower()}/summary_files") @@ -65,6 +65,8 @@ def scrapeRecent(obs="APO", mjd_today=00000, base="", continue sum_files = os.listdir(sub) for s in sum_files: + if "parquet" in s: + continue sum_name = os.path.join(sub, s) with open(sum_name, "rt") as fhandle: text= fhandle.read() From 62c9609ade37abc7929f5f2df6bdbcf5485aa42d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Tue, 27 Aug 2024 12:29:09 -0700 Subject: [PATCH 16/30] Create lvmdb.gortdb schema --- CHANGELOG.rst | 1 + python/sdssdb/peewee/lvmdb/__init__.py | 17 ---- python/sdssdb/peewee/lvmdb/gortdb.py | 107 +++++++++++++++++++++++++ python/sdssdb/peewee/lvmdb/lvmopsdb.py | 13 --- schema/lvmdb/gortdb.sql | 101 +++++++++++++++++++++++ schema/lvmdb/lvmopsdb.sql | 14 ---- 6 files changed, 209 insertions(+), 44 deletions(-) create mode 100644 python/sdssdb/peewee/lvmdb/gortdb.py create mode 100644 schema/lvmdb/gortdb.sql diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ef296e09..cec752e2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,7 @@ This document records the main changes to the ``sdssdb`` code. * :feature:`264` Add metadata for the ``sdss_id_to_catalog`` table. * Add missing columns to the ``SDSS_ID_To_Catalog`` models (the columns were being completed via reflection). * Change ``reflection=False`` to ``use_reflection=False`` in many ``catalogdb`` models. The previous setting was incorrect and was causing the models to be reflected. +* Add ``gortdb`` schema and models to ``lvmdb``. Moved ``lvmopsdb.overhead`` to ``gortdb``. * :release:`0.12.4 <2024-08-07>` * Fix ``catalogid`` and ``version_id`` fields in ``SDSS_ID_To_Catalog`` model. diff --git a/python/sdssdb/peewee/lvmdb/__init__.py b/python/sdssdb/peewee/lvmdb/__init__.py index b1e56cb7..97e22c11 100644 --- a/python/sdssdb/peewee/lvmdb/__init__.py +++ b/python/sdssdb/peewee/lvmdb/__init__.py @@ -6,9 +6,6 @@ # @Filename: __init__.py # @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) -import importlib -import sys - from sdssdb.connection import PeeweeDatabaseConnection @@ -17,19 +14,5 @@ class LVMdbDatabaseConnection(PeeweeDatabaseConnection): dbname = 'lvmdb' auto_reflect = False - def post_connect(self): - """Force reload of catalogdb and targetdb. - - Needed because of the CatalogToXXX models that are generated - on the fly and are only available after a successful connection. - - """ - - modules = ['sdssdb.peewee.sdss5db.lvmopsdb'] - - for module in modules: - if module in sys.modules: - importlib.reload(sys.modules[module]) - database = LVMdbDatabaseConnection() # noqa diff --git a/python/sdssdb/peewee/lvmdb/gortdb.py b/python/sdssdb/peewee/lvmdb/gortdb.py new file mode 100644 index 00000000..5c27d61b --- /dev/null +++ b/python/sdssdb/peewee/lvmdb/gortdb.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# @Author: José Sánchez-Gallego (gallegoj@uw.edu) +# @Date: 2024-08-27 +# @Filename: gortdb.py +# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) + +from __future__ import annotations + +import datetime +from peewee import ( + AutoField, + BigIntegerField, + BooleanField, + DateTimeField, + DoubleField, + FloatField, + ForeignKeyField, + IntegerField, + TextField +) +from playhouse.postgres_ext import JSONField + +from .. import BaseModel +from . import database +from .lvmopsdb import Exposure as LVMOpsDBExposure + + +class GortDBBase(BaseModel): + class Meta: + schema = "gortdb" + database = database + + +class Overhead(GortDBBase): + pk = AutoField(primary_key=True) + observer_id = BigIntegerField() + tile_id = IntegerField() + stage = TextField() + start_time = DoubleField() + end_time = DoubleField() + duration = FloatField() + + class Meta: + table_name = 'overhead' + + +class Event(GortDBBase): + pk = AutoField(primary_key=True) + date = DateTimeField(default=datetime.datetime.now()) + mjd = IntegerField() + event = TextField() + payload = JSONField() + + class Meta: + table_name = 'event' + + +class Notification(GortDBBase): + pk = AutoField(primary_key=True) + date = DateTimeField(default=datetime.datetime.now()) + mjd = IntegerField() + level = TextField() + message = TextField() + payload = JSONField() + email = BooleanField() + slack = BooleanField() + + class Meta: + table_name = 'notification' + + +class Exposure(GortDBBase): + pk = AutoField(primary_key=True) + exposure_no = IntegerField() + spec = TextField() + ccd = TextField() + image_type = TextField() + tile_id = IntegerField() + start_time = DateTimeField() + mjd = IntegerField() + exposure_time = FloatField() + header = JSONField() + + class Meta: + table_name = 'exposure' + + +class NightLog(GortDBBase): + pk = AutoField(primary_key=True) + mjd = IntegerField() + sent = BooleanField() + + class Meta: + table_name = 'night_log' + + +class NightLogComment(GortDBBase): + pk = AutoField(primary_key=True) + night_log = ForeignKeyField(model=NightLog, + column_name='night_log_pk', + backref='comments') + comment = TextField() + + class Meta: + table_name = 'night_log_comment' diff --git a/python/sdssdb/peewee/lvmdb/lvmopsdb.py b/python/sdssdb/peewee/lvmdb/lvmopsdb.py index f77d0c79..745f66b6 100644 --- a/python/sdssdb/peewee/lvmdb/lvmopsdb.py +++ b/python/sdssdb/peewee/lvmdb/lvmopsdb.py @@ -324,16 +324,3 @@ class GuiderCoAdd(LVMOpsBase): class Meta: table_name = 'guider_coadd' - - -class Overhead(LVMOpsBase): - pk = AutoField(primary_key=True) - observer_id = BigIntegerField() - tile_id = IntegerField() - stage = TextField() - start_time = DoubleField() - end_time = DoubleField() - duration = FloatField() - - class Meta: - table_name = 'overhead' diff --git a/schema/lvmdb/gortdb.sql b/schema/lvmdb/gortdb.sql new file mode 100644 index 00000000..5f1b60c8 --- /dev/null +++ b/schema/lvmdb/gortdb.sql @@ -0,0 +1,101 @@ +/* + +gortdb schema version v0.1.0 + +Created Aug 2024 - J. Sanchez-Gallego + +*/ + +CREATE SCHEMA gortdb; + +CREATE TABLE gortdb.overhead ( + pk SERIAL PRIMARY KEY NOT NULL, + observer_id BIGINT, + tile_id INTEGER, + stage TEXT, + start_time DOUBLE PRECISION, + end_time DOUBLE PRECISION, + duration REAL +); + +CREATE TABLE gortdb.event ( + pk SERIAL PRIMARY KEY NOT NULL, + date TIMESTAMPTZ, + mjd INTEGER, + event TEXT, + payload JSONB +); + +CREATE TABLE gortdb.notification ( + pk SERIAL PRIMARY KEY NOT NULL, + date TIMESTAMPTZ, + mjd INTEGER, + level TEXT, + message TEXT, + payload JSONB, + email BOOLEAN, + slack BOOLEAN +); + +CREATE TABLE gortdb.exposure ( + pk SERIAL PRIMARY KEY NOT NULL, + exposure_no INTEGER, + spec TEXT, + ccd TEXT, + image_type TEXT, + tile_id INTEGER, + start_time TIMESTAMPTZ, + mjd INTEGER, + exposure_time REAL, + header JSONB +); + +CREATE TABLE gortdb.night_log ( + pk SERIAL PRIMARY KEY NOT NULL, + mjd INTEGER, + sent BOOLEAN +); + +CREATE TABLE gortdb.night_log_comment ( + pk SERIAL PRIMARY KEY NOT NULL, + night_log_pk INTEGER, + comment TEXT +); + + +CREATE INDEX CONCURRENTLY ON gortdb.overhead (observer_id); +CREATE INDEX CONCURRENTLY ON gortdb.overhead (tile_id); +CREATE INDEX CONCURRENTLY ON gortdb.overhead (stage); + +CREATE INDEX ON gortdb.event (date); +CREATE INDEX ON gortdb.event (event); +CREATE INDEX ON gortdb.event (mjd); + +CREATE INDEX ON gortdb.notification (date); +CREATE INDEX ON gortdb.notification (level); +CREATE INDEX ON gortdb.notification (mjd); + +CREATE INDEX ON gortdb.exposure (exposure_no); +CREATE INDEX ON gortdb.exposure (spec); +CREATE INDEX ON gortdb.exposure (ccd); +CREATE INDEX ON gortdb.exposure (image_type); +CREATE INDEX ON gortdb.exposure (tile_id); +CREATE INDEX ON gortdb.exposure (start_time); +CREATE INDEX ON gortdb.exposure (mjd); + +CREATE INDEX ON gortdb.night_log (mjd); + +CREATE INDEX ON gortdb.night_log_comment (night_log_pk); + + +ALTER TABLE ONLY gortdb.night_log_comment + ADD CONSTRAINT night_log_comment_night_log_pk_fk + FOREIGN KEY (night_log_pk) REFERENCES gortdb.night_log(pk) + ON UPDATE CASCADE ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED; + + +GRANT USAGE ON SCHEMA gortdb TO sdss_user; + +GRANT SELECT ON ALL TABLES IN SCHEMA gortdb TO sdss_user; +GRANT USAGE ON ALL SEQUENCES IN SCHEMA gortdb TO sdss_user; diff --git a/schema/lvmdb/lvmopsdb.sql b/schema/lvmdb/lvmopsdb.sql index 7baa69db..f644b0d8 100644 --- a/schema/lvmdb/lvmopsdb.sql +++ b/schema/lvmdb/lvmopsdb.sql @@ -214,16 +214,6 @@ CREATE TABLE lvmopsdb.guider_coadd ( exposure_no INTEGER ); -CREATE TABLE lvmopsdb.overhead ( - pk SERIAL PRIMARY KEY NOT NULL, - observer_id BIGINT, - tile_id INTEGER, - stage TEXT, - start_time DOUBLE PRECISION, - end_time DOUBLE PRECISION, - duration REAL -); - -- constraints @@ -365,10 +355,6 @@ CREATE INDEX CONCURRENTLY ON lvmopsdb.guider_coadd (exposure_no); CREATE INDEX CONCURRENTLY ON lvmopsdb.guider_frame (exposure_no); CREATE INDEX CONCURRENTLY ON lvmopsdb.agcam_frame (exposure_no); -CREATE INDEX CONCURRENTLY ON lvmopsdb.overhead (observer_id); -CREATE INDEX CONCURRENTLY ON lvmopsdb.overhead (tile_id); -CREATE INDEX CONCURRENTLY ON lvmopsdb.overhead (stage); - grant usage on schema lvmopsdb to sdss_user; GRANT ALL on lvmopsdb.dither, From b0fd161dbd8260acdceca5018e23c30def3937cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Tue, 3 Sep 2024 10:02:10 -0700 Subject: [PATCH 17/30] Support PEP 621 (#266) * Replace setup.cfg/.py with pyproject.toml * Support linting with flake8 or ruff and fix some linting issues * Fix test issues * Update workflows * Use uv in workflow for faster install * Change default postgres username in workflow * Delete STYLE.rst * Update changelog --- .github/workflows/lint.yml | 25 + .github/workflows/pythonapp.yml | 40 -- .github/workflows/test.yml | 51 ++ .pylintrc | 425 -------------- .travis.yml | 43 -- CHANGELOG.rst | 1 + CODEOWNERS | 1 + STYLE.rst | 527 ------------------ pyproject.toml | 149 +++++ python/sdssdb/__init__.py | 14 +- python/sdssdb/connection.py | 258 +++++---- python/sdssdb/peewee/lvmdb/gortdb.py | 24 +- python/sdssdb/peewee/sdss5db/astradb.py | 2 +- .../sdssdb/sqlalchemy/sdss5db/apogee_drpdb.py | 2 +- python/sdssdb/sqlalchemy/sdss5db/astradb.py | 2 +- python/sdssdb/sqlalchemy/sdss5db/boss_drp.py | 2 +- python/sdssdb/sqlalchemy/sdss5db/catalogdb.py | 2 +- python/sdssdb/sqlalchemy/sdss5db/opsdb.py | 3 +- python/sdssdb/sqlalchemy/sdss5db/targetdb.py | 4 +- python/sdssdb/sqlalchemy/sdss5db/vizdb.py | 2 +- setup.cfg | 120 ---- setup.py | 9 - tests/__init__.py | 16 + tests/conftest.py | 87 +-- 24 files changed, 461 insertions(+), 1348 deletions(-) create mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/pythonapp.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .pylintrc delete mode 100644 .travis.yml delete mode 100644 STYLE.rst create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..1f4911f3 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +name: Lint + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Lint with ruff + run: | + pip install ruff + ruff check python/ diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml deleted file mode 100644 index 31f6447d..00000000 --- a/.github/workflows/pythonapp.yml +++ /dev/null @@ -1,40 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python application - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install . - - - name: Lint with flake8 - run: | - pip install flake8 - flake8 python/ - - - name: Test basic import - run: | - python -c "from sdssdb.connection import DatabaseConnection" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..56562f10 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,51 @@ +name: Test + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + name: Test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Set up uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Restore uv cache + uses: actions/cache@v4 + with: + path: /tmp/.uv-cache + key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} + restore-keys: | + uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} + uv-${{ runner.os }} + + - name: Install Postgresql + uses: ikalnytskyi/action-setup-postgres@v6 + with: + username: postgres + id: postgres + + - name: Install dependencies + run: | + uv pip install --system -e .[dev] + + - name: Test with pytest + run: | + pytest -s + env: + PGSERVICE: ${{ steps.postgres.outputs.service-name }} + + - name: Minimize uv cache + run: uv cache prune --ci diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 1a2c0f7c..00000000 --- a/.pylintrc +++ /dev/null @@ -1,425 +0,0 @@ -[MASTER] - -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code -extension-pkg-whitelist= - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS - -# Add files or directories matching the regex patterns to the blacklist. The -# regex matches against base names, not paths. -ignore-patterns= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Use multiple processes to speed up Pylint. -jobs=1 - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - -# Pickle collected data for later comparisons. -persistent=yes - -# Specify a configuration file. -#rcfile= - -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. -unsafe-load-any-extension=no - - -[MESSAGES CONTROL] - -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED -confidence= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once).You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use"--disable=all --enable=classes -# --disable=W" -disable=C,R,W0703,W0221,W0511,W0212,W0621,import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). See also the "--disable" option for examples. -enable= - - -[REPORTS] - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details -#msg-template= - -# Set the output format. Available formats are text, parseable, colorized, json -# and msvs (visual studio).You can also give a reporter class, eg -# mypackage.mymodule.MyReporterClass. -output-format=text - -# Tells whether to display a full report or only the messages -reports=no - -# Activate the evaluation score. -score=yes - - -[REFACTORING] - -# Maximum number of nested blocks for function / method body -max-nested-blocks=5 - - -[LOGGING] - -# Logging modules to check that the string format arguments are in logging -# function parameter format -logging-modules=logging - - -[SPELLING] - -# Spelling dictionary name. Available dictionaries: none. To make it working -# install python-enchant package. -spelling-dict= - -# List of comma separated words that should not be checked. -spelling-ignore-words= - -# A path to a file that contains private dictionary; one word per line. -spelling-private-dict-file= - -# Tells whether to store unknown words to indicated private dictionary in -# --spelling-private-dict-file option instead of raising a message. -spelling-store-unknown-words=no - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - - -[TYPECHECK] - -# List of decorators that produce context managers, such as -# contextlib.contextmanager. Add to this list to register other decorators that -# produce valid context managers. -contextmanager-decorators=contextlib.contextmanager - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E1101 when accessed. Python regular -# expressions are accepted. -generated-members= - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# This flag controls whether pylint should warn about no-member and similar -# checks whenever an opaque object is returned when inferring. The inference -# can return multiple potential results while evaluating a Python object, but -# some branches might not be evaluated, which results in partial inference. In -# that case, it might be useful to still emit no-member and other checks for -# the rest of the inferred objects. -ignore-on-opaque-inference=yes - -# List of class names for which member attributes should not be checked (useful -# for classes with dynamically set attributes). This supports the use of -# qualified names. -ignored-classes=optparse.Values,thread._local,_thread._local - -# List of module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis. It -# supports qualified module names, as well as Unix pattern matching. -ignored-modules= - -# Show a hint with possible names when a member name was not found. The aspect -# of finding the hint is based on edit distance. -missing-member-hint=yes - -# The minimum edit distance a name should have in order to be considered a -# similar match for a missing member name. -missing-member-hint-distance=1 - -# The total number of similar names that should be taken in consideration when -# showing a hint for a missing member. -missing-member-max-choices=1 - - -[VARIABLES] - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - -# Tells whether unused global variables should be treated as a violation. -allow-global-unused-variables=yes - -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. -callbacks=cb_,_cb - -# A regular expression matching the name of dummy variables (i.e. expectedly -# not used). -dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.*|^ignored_|^unused_ - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# List of qualified module names which can have objects that can redefine -# builtins. -redefining-builtins-modules=six.moves,future.builtins - - -[FORMAT] - -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -expected-line-ending-format= - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines=^\s*(# )??$ - -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren=4 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - -# Maximum number of characters on a single line. -max-line-length=99 - -# Maximum number of lines in a module -max-module-lines=1000 - -# List of optional constructs for which whitespace checking is disabled. `dict- -# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. -# `trailing-comma` allows a space between comma and closing bracket: (a, ). -# `empty-line` allows space-only lines. -no-space-check=trailing-comma,dict-separator - -# Allow the body of a class to be on the same line as the declaration if body -# contains single statement. -single-line-class-stmt=no - -# Allow the body of an if to be on the same line as the test if there is no -# else. -single-line-if-stmt=no - - -[SIMILARITIES] - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - -# Ignore imports when computing similarities. -ignore-imports=no - -# Minimum lines number of a similarity. -min-similarity-lines=4 - - -[BASIC] - -# Naming hint for argument names -argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Regular expression matching correct argument names -argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Naming hint for attribute names -attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Regular expression matching correct attribute names -attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,baz,toto,tutu,tata - -# Naming hint for class attribute names -class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ - -# Regular expression matching correct class attribute names -class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ - -# Naming hint for class names -class-name-hint=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression matching correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Naming hint for constant names -const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Regular expression matching correct constant names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=-1 - -# Naming hint for function names -function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Regular expression matching correct function names -function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,ex,Run,_ - -# Include a hint for the correct naming format with invalid-name -include-naming-hint=no - -# Naming hint for inline iteration names -inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ - -# Regular expression matching correct inline iteration names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Naming hint for method names -method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Regular expression matching correct method names -method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Naming hint for module names -module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression matching correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=^_ - -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. -property-classes=abc.abstractproperty - -# Naming hint for variable names -variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Regular expression matching correct variable names -variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - - -[IMPORTS] - -# Allow wildcard imports from modules that define __all__. -allow-wildcard-with-all=no - -# Analyse import fallback blocks. This can be used to support both Python 2 and -# 3 compatible code, which means that the block might have code that exists -# only in one or another interpreter, leading to false positives when analysed. -analyse-fallback-blocks=no - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=optparse,tkinter.tix - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= - -# Force import order to recognize a module as part of the standard -# compatibility libraries. -known-standard-library= - -# Force import order to recognize a module as part of a third party library. -known-third-party=enchant - - -[CLASSES] - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected=_asdict,_fields,_replace,_source,_make - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=mcs - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=5 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Maximum number of boolean expressions in a if statement -max-bool-expr=5 - -# Maximum number of branch for function / method body -max-branches=12 - -# Maximum number of locals for function / method body -max-locals=15 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of statements in function / method body -max-statements=50 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=Exception diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 00cae40b..00000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -language: python - -cache: - pip: true - timeout: 1000 - -services: - - postgresql - -python: -- '3.6' -- '3.7' -- '3.8' - -os: -- linux - -matrix: - fast_finish: true - allow_failures: - - python: '3.6' - - -notifications: - email: false - -# repo branches to test -branches: -- main - -install: -- pip install -U pip wheel --quiet -- pip install --upgrade setuptools --quiet -- pip install pytest -- pip install pytest-coverage -- pip install coveralls -- pip install .[dev] - -script: -- pytest -p no:sugar tests --cov python/sdssdb --cov-report html - -after_success: -- coveralls diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cec752e2..e4c8ddf8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,7 @@ Changelog This document records the main changes to the ``sdssdb`` code. * :feature:`264` Add metadata for the ``sdss_id_to_catalog`` table. +* :feature:`266` Support PEP 621. * Add missing columns to the ``SDSS_ID_To_Catalog`` models (the columns were being completed via reflection). * Change ``reflection=False`` to ``use_reflection=False`` in many ``catalogdb`` models. The previous setting was incorrect and was causing the models to be reflected. * Add ``gortdb`` schema and models to ``lvmdb``. Moved ``lvmopsdb.overhead`` to ``gortdb``. diff --git a/CODEOWNERS b/CODEOWNERS index 2c08e4ea..ba4b949e 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -7,6 +7,7 @@ # review when someone opens a pull request. * @albireox * gallegoj@uw.edu +* bcherinka@stsci.edu # Order is important; the last matching pattern takes the most # precedence. When someone opens a pull request that only diff --git a/STYLE.rst b/STYLE.rst deleted file mode 100644 index d5f2839f..00000000 --- a/STYLE.rst +++ /dev/null @@ -1,527 +0,0 @@ -SDSS Python template and coding standards -========================================= - -So you want to write some Python code. Congratulations, you've arrived at -the right place! This repository has a dual purpose: it provides a -`template `__ for a basic but complete Python package; and lists the coding -standards and recommendations for developing code for SDSS. Please, read -this document carefully. If you decide to develop your product based on -this template, feel free to replace ``__ with a description -of your project, but keep the ``__ file as a reminder of the -coding conventions. - -While this document deals with Python product, and some of the solutions -and services suggested are specific for it, much of what is written here -is general good advice for developing software in any platform. - -Table of Contents ------------------ - -- `Python 2 vs Python 3: which one to - choose? <#python-2-vs-python-3-which-one-to-choose>`__ -- `Code storage and ownership. <#code-storage-and-ownership>`__ -- `Tagging, versioning, and change logs. <#tagging-versioning-and-change-logs>`__ -- `Deployment <#deployment>`__ -- `Coding style <#coding-style>`__ - - - `Docstrings <#docstrings>`__ - - `Linters <#linters>`__ - - `General advice <#general-advice>`__ - -- `Testing <#testing>`__ - - - `Unit testing <#unit-testing>`__ - - `Continuous integration and - coverage <#continuous-integration-and-coverage>`__ - -- `Automatic documentation - generation <#automatic-documentation-generation>`__ - - - `Read the Docs <#read-the-docs>`__ - -- `Git workflow <#git-workflow>`__ -- `Software Citation <#software-citation>`__ - - - `Zenodo <#zenodo>`__ - - `Astrophysical Source Code Library <#ascl>`__ - - -Python 2 vs Python 3: which one to choose? ------------------------------------------- - -SDSS has made the decision to transition to Python 3 by 2020. That means -that all new code must *at least* be compatible with Python 3.6. There is, -however, a very significant amount of ancillary code that is still -Python 2-only and that will not be ported to Python 3 for some time. - -When deciding what version of Python to write your code on, consider -which are its dependencies: - -- If your code is standalone, or depends on Python 3-compatible code, - write it in Python 3. **You don't need to make sure your code is - Python 2-backwards compatible.** - -- If your code depends on key packages that are Python 2-only (e.g., - ``actorcore``, ``opscore``, ``RO``, ``twistedActor``), write your - code in Python 2 **but** try to make it as much Python 3-ready as - possible, so that when those dependencies are upgraded you can - upgrade your code easily. - -- If your code is intended for a large user base, Python 2 and 3 compatibility is recommended, but the focus should be put into Python 3. - -Whenever you create a new Python file, make sure to add the following -lines at the top of the file - -.. code:: python - - from __future__ import division - from __future__ import print_function - from __future__ import absolute_import - from __future__ import unicode_literals - -That will force you to use ``import``, ``print``, and division in a way -that is Python 2 and 3-compatible. - -Some resources that can be useful to write code that is Python 2 and -3-compatible, and to port code from 2 to 3: - -- A `cheat sheet `__ - with advice to write code compatible with Python 2 and 3. -- The `six `__ library provides - functions to write code that will work in Python 2 and 3. -- When converting code from Python 2 to 3, consider using - `python-futurize `__ as the - starting point. It works very well for most files, and even for those - files that require manual interaction, it paves most of the way. - -Code storage and ownership --------------------------- - -All code must be version controlled using -`git `__. Older code, still under the SVN -repository, can be maintained using Subversion until it has been ported -to Git. Large data-only repositories that use SVN do not need to be ported. - -All code must live in the `SDSS GitHub -organisation `__. Code that is specific to Apache Point Observatory and it is shared with other on-site telescopes should be put in `their own `__ organisation. When starting a new -product, start a new repository in the GitHub organisation (you can -choose to make it public or private) and follow the instructions to -clone it to your computer. Feel free to create forks of the repositories -to your own GitHub account, but make sure the production version of the -code lives in the organisation repo. - -If your code is already in GitHub, move it to the SDSS GitHub organisation as soon as it is ready to be shared. This can be done easily by creating a new repository in the SDSS GitHub, adding it as a new remote to your local checkout, and pushing to the new remote. - -All code must have *at least* one owner, who is ultimately responsible -for keeping the code working and making editorial decisions. Owners can -make decisions on which code standards to follow (within the requirements -listed in this document), such as maximum line length, linter, or -testing framework. The owner(s) names should be obvious in the README of -the repo and in the ``setup.py`` file. - -Tagging, versioning, and change logs ------------------------------------ - -**All production software must run from tagged versions.** The only exception to this rule is when debugging new code during engineering or test runs. - -Following `PEP 440 `__, software versions should use the convention ``X.Y.Z`` (e.g., -``1.2.5``) where X indicates the major version (large, maybe -non-backwards compatible changes), Y is for minor changes and additions -(backwards compatible), and Z is for bug fixes (no added functionality). -Suffixes to the version, such as ``dev``, ``alpha``, ``beta``, are -accepted. Do not use a hyphen between version and suffix (``1.2.5dev`` -is ok, ``1.2.5-dev`` is not). Note that `PEP 440 `__ recommends separating suffixes with a period (``1.2.5.dev``) but we have found that sometimes causes problems with pip. - -For products that already have tagged versions using the old SDSS versioning standards (e.g., ``v1_2_3``), tag new versions using the new convention (e.g., ``1.2.4``) but do not rename or retag previous versions. - -Python packages must return its version via the ``__version__`` attribute. All other products, including metadata and datamodels, must also be versioned in a clear and obvious way. When tagging using git, prefer `annotated tags `__. - -Version tracking may be complicated so we recommend using -``bumpversion`` (see `here `__ -for documentation). This template already implements a `configuration -file <./.bumpversion.cfg>`__ that automates updating the version number -in all the places in the code where it appears. Let's say that your -current version is ``0.5.1`` and you are going to work on minor changes -to the product. You can go to the root of the package and run -``bumpversion minor``. This will update the version to ``0.6.0dev`` -everywhere needed, and will commit the changes. When you are ready to -release, you can do ``bumpversion release`` to change the version to -``0.6.0``. See the `template documentation `__ for more details. - -All files must include in their metadata the version of the software that produced them, along with the versions of all relevant dependencies. For instance, data FITS must include the version of the pipeline in the header. - -All changes should be logged in a ``CHANGELOG.rst`` or ``CHANGELOG.md`` -file. See `the template CHANGELOG.rst <./CHANGELOG.rst>`__ for an -example of formatting. When releasing a new version, copy the change log -for the relevant version in the GitHub release description. - -Deployment ----------- - -SDSS Python packages should follow the general Python standards for -packaging. If looking for documentation, `start -here `__. - -All packages must contains a `setup.py <./setup.py>`__ to automate -building, installation, and packaging. The ``setup.py`` file must take -care of compiling and linking all external code (e.g., C libraries) that -is used by the project. - -Dependencies must be maintained in two different locations. For -standard, pip-installable dependencies, use the -`requirements.txt <./requirements.txt>`__ file. See -`here `__ -for more information on using requirements.txt files. Consider using -multiple requirements.txt files (e.g, ``requirements.txt``, -``requirements_dev.txt``, ``requirements_docs.txt``) for different -pieces of functionality. Additionally, you must maintain the -`module `__ file for your product. If you -package depends on SDSS-specific, non pip-installable packages, use the -module file to load the necessary dependencies. - -Should you make your package pip-installable? The general answers is -yes, but consider the scope of your project. If your code is to be used -for mountain operations and needs to be maintained with modules/EUPS -version control, making it pip installable may not be necessary, since -it is unlikely to be installed in that way. However, if your product -will be distributed and installed widely in the collaboration (examples -of this include analysis tools, pipelines, schedulers), you *must* make -it pip-installable. Start `here `__ for -some documentation on making pip-installable packages. Another good -resource is `twine `__, which will help -you automate much of the packaging and uploading process. - -SDSS has a `PyPI account `__ that should be -used to host released version of your pip-installable projects. Do not -deploy the project in your own account. Instead, contact -``admin[at]sdss[dot]org`` to get access to the PyPI account. - -Coding style ------------- - -SDSS code follows the `PEP8 -standard `__. Please, read -that document carefully and follow every convention, unless there are -very good reasons not to. - -The only point in which SDSS slightly diverges from PEP8 is the line -length. While the suggested PEP8 maximum line length of 79 characters is -recommended, lines **up to** 99 characters are accepted. When deciding -what line length to use, follow this rule: if you are modifying code -that is not nominally owned by you, respect the line length employed by -the owner of the product; if you are creating a new product that you -will own, feel free to decide your line length, as long as it has fewer -than 99 characters. - -It is beyond the scope of this document to summarise the PEP8 -conventions, but here are some of the most salient points: - -- Indentation of four spaces. **No tabs. Ever.** -- Two blank lines between functions and classes. One blank line between - methods in a class. A single line at the end of each file. -- Always use spaces around operators and assignments (``a = 1``). The - only exception is for function and method keyword arguments - (``my_function(1, key='a')``). -- No trailing spaces. You can configure your editor to strip the lines - automatically for you. -- Imports go on the top of the file. Do **not** import more than one - package in the same line (``import os, sys``). Maintain the - namespace, do **not** import all functions in a package - (``from os import *``). You can import multiple functions from the - same package at the same time - (``from os.path import dirname, basename``). -- Use single quotes for strings. Double quotes must be reserved for - docstrings and string blocks. -- For inline comments, at least two spaces between the statement and - the beginning of the comment - (``a = 1­­  # This is a comment about a``). -- Class names must be in camelcase (``class MyClass``). Function, - method, and variable names should be all lowercase separated by - underscores for legibility (``def a_function_that_does_something``, - ``my_variable = 1``). For the latter ones, PEP8 allows some - flexibility. The general rule of thumb is to make your function, - method, and variable names descriptive and readable (avoid multiple - words in all lowercase). As such, if you prefer to use camelcase - (``aFunctionThatDoesSomething``, ``myVariable = 1``) for your project - that is accepted, as long as you are consistent throughout the - project. When modifying somebody else's code, stick to their naming - decisions. -- Use ``is`` for comparisons with ``None``, ``True``, or ``False``: - ``if foo is not None:``. - -.. _style-docstring: - -Docstrings -~~~~~~~~~~ - -Docstrings are special comments, wrapped between two sets of three -double quotes (``"""``). Their purpose is dual: on one side they provide -clear, well structured documentation for each class and function in your -code. But they are also intended to be read by an automatic -documentation generator (see the `Automatic documentation -generation <#automatic-documentation-generation>`__ section). For -docstrings, follow -`PEP257 `__. In our template, -`main.py <./python/python_template/main.py>`__ contains some examples of -functions and classes with docstrings; use those as an example. In -general: - -- **All** code should be commented. **All** functions, classes, and - methods should have a docstring. -- Use double quotes for docstrings; reserve single quotes for normal - strings. -- Limit your docstrings lines to 72 characters. This convention can be a bit constraining for some developers; it is ok to ignore it and use the line length you are using for your code (79 or 99 characters). -- A complete docstring should start with a single line describing the - general purpose of the function or class. Then a blank line and an - in-depth description of the function or class in one or more - paragraphs. A list of the input parameters (arguments and keywords) - follows, and a description of the values returned, if any. If the - class or function merits it, you should include an example of use. -- The docstring for the ``__init__()`` method in a class goes just - after the declaration of the class and it explains the general use - for the class, in addition to the list of parameters accepted by - ``__init__()``. -- Private methods and functions (those that start with an underscore) - may not have a docstring **only** if their purpose is really obvious. -- In general, we prefer `Google - style `__ - docstrings over `Numpy - style `__ - ones, but you are free to choose one as long as you stick with it - across all the product. Avoid styles such as - ``param path: The path of the file to wrap`` which are difficult to - read. - -Linters -~~~~~~~ - -Do use a linter. These are plugins available for almost every editor -(vim, emacs, Sublime Text, Atom) that are executed every time you save -your code and show you syntax errors and where you are not following -PEP8 conventions. They normally rely on an underlying library, usually -`pylint `__ or -`flake8 `__. This template includes -customised configuration files for both libraries. You can also place -``.flake8`` and ``.pylintrc`` files in your home directory and they will -be used for all your projects (configuration files *in* the root of the -project override the general configuration for that project). - -While ``pylint`` is a more fully fleshed library, and provides estimates -on code complexity, docstring linting, etc., it may be a bit excessive -and verbose for most users. ``flake8`` provides more limited features, -but its default configuration is usually what you want (and we enforce -in SDSS). It is up to you to test them and decide which one to use. - -Do update the ``.flake8`` or ``.pylintrc`` files in your project with -the specific configuration you want to use in for that product. That is -critical for other people to contribute to the code while keeping your -coding style choices. - -File headers -~~~~~~~~~~~~ - -Include a header in each Python file describing the author, license, -etc. We suggest - -.. code:: python - - # encoding: utf-8 - # - # @Author: - # @Date: - # @Filename: - # @License: - # @Copyright: - - - from __future__ import division - from __future__ import print_function - from __future__ import absolute_import - from __future__ import unicode_literals - -In general, do not include comments about when you last modified the -file since those become out of date really fast. Instead, use the `changelog <./CHANGELOG.rst>`__ and atomic git -commits. - -All executable files should live in the ``bin/`` directory. For those files, add a shebang at the beginning of the header :: - - #!/usr/bin/env python - -General advice -~~~~~~~~~~~~~~ - -- Blank lines only add one byte to your file size; use them prolifically to improve legibility. -- Read the `Zen of Python `__. Explicit is better than implicit. Simple is better than complex. -- Know when ignore these standards if there is a good reason or it improves readability (but don't use that as an excuse to just not follow the standards). - -Testing -------- - -Do test your code. Do test your code. Do test your code. As repository -owner, you are the ultimate responsible for making sure your code does -what it is supposed to do, and to avoid that new features break current -functionality. - -Modern testing standards are based on two cornerstone ideas: `unit -testing `__, and `continuous -integration `__ -(CI). - -Unit testing -~~~~~~~~~~~~ - -Unit testing advocates for breaking your code into small "units" that -you can write tests for (and then actually write the tests!) There are -multiple tutorials and manuals online, `this -one `__ is a good -starting point. - -Many libraries and frameworks for testing exist for Python. The basic -(but powerful) one is called -`unittest `__ and is a -standard Python library. -`nose2 `__ provides additional -features, and a nicer interface. -`pytest `__ includes all those extra -features plus a number of extremely convenient and powerful features, as -well as many third-party addons. On the other hand, its learning curve -may be a bit steep. - -So, what library should you use? If your code and testing needs are very -simple, ``unittest`` is a good option. - -For larger projects, SDSS recommends using ``pytest``. Features such as -`parametrising -tests `__ -and `fixtures `__ are -excellent to make sure your code gets a wide test coverage. This -template includes a simple `pytest -setup <./python/python_template/test>`__. You can also look at the -`Marvin test -suite `__ -for a more complete example. - -Continuous integration and coverage -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -It is critical that you not only write test but run them, and do so in a -suite of environments (different OS, Python versions, etc). Doing that -in your local computer can be convoluted, so we recommend the use of -`Travis CI `__. Travis gets integrated with a -GitHub repository and is triggered every time you commit, make a pull -request, or create a branch. On trigger, you can configure what happens -before the tests are run (e.g, download files, create a database), and -the platforms they run on. For an example of a full Travis setup see the -`Marvin travis -configuration `__. - -In addition to running tests, you will want to keep an eye on test -coverage, i.e., what percentage of your code gets "activated" and tested -with your unit tests. Increasing your test coverage should always be a -goal, as it is to make sure that any new feature or bug fix gets -associated tests. You can check your coverage using -`pytest-cov `__. -`Coveralls `__ is another CI service that can be -configured to run after Travis and that provides a nice HTML display of -your coverage and missing lines. - -Automatic documentation generation ----------------------------------- - -As a software developer, it is part of your responsibility to document -your code and keep that documentation up to date. Documentation takes -two forms: inline documentation in the form of comments and docstrings; -and explicit documentation, tutorials, plain-text explanations, etc. - -Explicit documentation can take many forms (PDFs, wiki pages, plain text -files) but the rule of thumb is that the best place to keep your -documentation is the product itself. That makes sure a user knows where -to look for the documentation, and keeps it under version control. - -SDSS uses and **strongly encourages** -`Sphinx `__ to -automatically generate documentation. Sphinx translates -`reStructuredText `__ source -files to HTML (plugins for Latex, HTML, and other are available). It -also automates the process of gathering the docstrings in your code and -generating nicely formatted HTML code. - -It is beyond the purpose of this document to explain how to use Sphinx, -but `its -documentation `__ is -quite good and multiple tutorials exist online. A large ecosystem of -plugins and extensions exist to perform almost any imaginable task. This -template includes a basic but functional `Sphinx -template <./docs/sphinx>`__ that you can build by running ``make html``. - -Read the Docs -~~~~~~~~~~~~~ - -Deploying your Sphinx documentation is critical. SDSS uses `Read the -Docs `__ to automatically build and deploy -documentation. Read the Docs can be added as a plugin to your GitHub -repo for continuous integration so that documentation is built on each -commit. SDSS owns a Read the Docs account. Contact -``admin[at]sdss[dot]org`` to deploy your documentation there. Alternatively, you can deploy your product in your own Read the Docs account and add the user ``sdss`` as a maintainer from the admin menu. - -Git workflow ------------- - -Working with Git and GitHub provides a series of extremely useful tools -to write code collaboratively. Atlassian provides a `good -tutorial `__ on Git -workflows. While the topic is an extensive one, here is a simplified -version of a typical Git workflow you should follow: - -1. `Clone `__ the repository. -2. Create a `branch `__ (usually - from master) to work on a bug fix or new feature. Develop all your - work in that branch. Commit frequently and modularly. Add tests. -3. Once your branch is ready and well tested, and your are ready to - integrate your changes, you have two options: - - 1. If you are the owner of the repo and no other people are - contributing code at the time (or your changes are **very** small - and non-controversial) you can simple - `merge `__ the branch back - into master and push it to the upstream repo. - 2. If several people are collaborating in a project, you *want* to - create a `pull - request `__ - for that branch. The change can then be discussed, changes made - and, when approved, you can merge the pull request. - -4. GOTO 2 - -You may want to consider the possibility of using -`forks `__ if you are -planning on doing a large-scope change to the code. - -Software Citation ------------------ - -All software should be archived and citable in some way by anyone who uses it. The AAS now has a -policy for `software citation `_, that SDSS should adopt -for all pieces of code it produces. This policy should be adopted by internal SDSS collaborators -as well as astronomers outside SDSS using SDSS software. - -Zenodo -~~~~~~ - -Zenodo allows you to generate a unique digital object identifier (DOI) for any piece of software code in a GitHub -repository. DOI's are citable snippets, and allow your software code to be identified by tools. See `Making Your Code Citable `_ for how to connect your GitHub repository to Zenodo. Once your GitHub repo is connected to Zenodo, every new GitHub tag or release gets a new DOI from Zenodo. Zenodo provides a citable formats for multiple journals as well as export to a Bibtex file. - -Astrophysical Source Code Library -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The `ASCL `_ is a registry of open-source astronomy software, indexed by the -`SAO/NASA Astrophysics Data System `_ (ADS). The process for submission -to the ASCL is outlined `here `_. - -Further reading ---------------- - -- Python's own `documentation style - guide `__ is a - good resource to learn to write good documentation. -- Astropy's `coding standards `__ and `documentation guide `__ are good resources. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..e94d5dd3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,149 @@ +[project] +name = "sdssdb" +version = "0.12.5a0" +authors = [ + {name = "José Sánchez-Gallego", email = "gallegoj@uw.edu"}, + {name = "Brian Cherinka", email = "bcherinka@stsci.edu"} +] +description = "SDSS product for database management" +keywords = ["astronomy", "software", "database"] +license = {text = "BSD 3-Clause License"} +requires-python = ">=3.6" +dependencies = [ + "pgpasslib>=1.1.0", + "psycopg2-binary>=2.7.7", + "peewee>=3.17.6", + "sqlalchemy>=1.3.6,<2", + 'sdsstools>=1.7.0; python_version >= "3.8"', + 'sdsstools>=0.1.0,<1.0.0; python_version < "3.8"', + "numpy>=1.18.2", +] + +[project.urls] +Homepage = "https://github.com/sdss/sdssdb" +Repository = "https://github.com/sdss/sdssdb" +Documentation = "https://sdssdb.readthedocs.org" + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.optional-dependencies] +all = [ + "progressbar2>=3.46.1", + "pydot>=1.4.1", + "astropy>=4.0.0", + "pandas>=1.0.0", + "inflect>=4.1.0", + "h5py>=3.8.0", + "sdssdb[dev]", + "sdssdb[docs]", +] +dev = [ + "pytest>=5.2", + "pytest-cov>=2.4.0", + "pytest-sugar>=0.8.0", + "ipython>=7.13.0", + "ipdb>=0.13.2", + "pytest-postgresql>=2.2.1,<6", + "factory_boy>=2.12.0", + "pytest-factoryboy>=2.0.3", + "astropy>=4.0.0", + "pydot>=1.4.2", + "pyyaml>=5.1", + "ruff>=0.6.3", + "flake8>=7.1.1", + "flake8-pyproject>=1.2.3" +] +docs = [ + "Sphinx>=7.0.0", + "sphinx_bootstrap_theme>=0.4.12", + "releases>=2.0.0", +] + +[build-system] +requires = ["setuptools>=61.2"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +zip-safe = false +package-dir = {"" = "python"} +license-files = ["LICENSE.md"] +include-package-data = false + +[tool.setuptools.packages.find] +where = ["python"] +exclude = ["*.tests"] +namespaces = false + +[tool.setuptools.package-data] +sdssdb = ["etc/*"] + +[tool.isort] +line_length = 79 +sections = [ + "FUTURE", + "STDLIB", + "THIRDPARTY", + "SQLA", + "PEEWEE", + "SDSS", + "FIRSTPARTY", + "LOCALFOLDER", +] +default_section = "THIRDPARTY" +known_first_party = ["sdssdb"] +known_sqla = ["sqlalchemy"] +known_peewee = [ + "peewee", + "playhouse", +] +known_sdss = ["sdsstools"] +balanced_wrapping = true +include_trailing_comma = false +lines_after_imports = 2 +use_parentheses = true + +[tool.flake8] +ignore = [ + "H101", + "E722", + "W503", + "W504", + "W505", + "E116", + "E114" +] +max-line-length = 99 +exclude = [ + "python/sdssdb/sqlalchemy/operationsdb/tools", + "python/sdssdb/sqlalchemy/archive", + "python/sdssdb/sqlalchemy/mangadb" +] + +[tool.ruff] +line-length = 99 +target-version = 'py312' +exclude = ["typings/"] + +[tool.ruff.lint] +select = ["E4", "E7", "E9", "F"] +exclude = [ + "python/sdssdb/sqlalchemy/operationsdb/**/*.py", + "python/sdssdb/sqlalchemy/archive/*.py", + "python/sdssdb/sqlalchemy/mangadb/*.py" +] + +[tool.ruff.lint.isort] +known-first-party = ["sdssdb"] +lines-after-imports = 2 +section-order = ["future", "standard-library", "typing", "third-party", "sqla", "peewee", "sdss", "first-party", "local-folder"] + +[tool.ruff.lint.isort.sections] +typing = ["typing"] +sdss = ["sdsstools"] +sqla = ["sqlalchemy"] +peewee = ["peewee", "playhouse"] + +[tool.coverage.run] +branch = true diff --git a/python/sdssdb/__init__.py b/python/sdssdb/__init__.py index 94eb9702..8c841df5 100644 --- a/python/sdssdb/__init__.py +++ b/python/sdssdb/__init__.py @@ -2,22 +2,26 @@ import warnings +from sqlalchemy.exc import MovedIn20Warning + from sdsstools import get_config, get_logger, get_package_version +warnings.filterwarnings("ignore", category=MovedIn20Warning) + warnings.filterwarnings( - 'ignore', - '.*Skipped unsupported reflection of expression-based index .*q3c.*', + "ignore", + ".*Skipped unsupported reflection of expression-based index .*q3c.*", ) warnings.filterwarnings( - 'ignore', - '.*invalid escape sequence.*', + "ignore", + ".*invalid escape sequence.*", category=SyntaxWarning, ) -NAME = 'sdssdb' +NAME = "sdssdb" __version__ = get_package_version(path=__file__, package_name=NAME) diff --git a/python/sdssdb/connection.py b/python/sdssdb/connection.py index 9e46de7f..fa971a4c 100644 --- a/python/sdssdb/connection.py +++ b/python/sdssdb/connection.py @@ -14,30 +14,33 @@ import re import socket -import peewee import pgpasslib import six -from peewee import OperationalError, PostgresqlDatabase -from playhouse.postgres_ext import ArrayField -from playhouse.reflection import Introspector, UnknownField + from sqlalchemy import MetaData, create_engine from sqlalchemy.engine import url from sqlalchemy.exc import OperationalError as OpError from sqlalchemy.orm import scoped_session, sessionmaker +import peewee +from peewee import OperationalError, PostgresqlDatabase +from playhouse.postgres_ext import ArrayField +from playhouse.reflection import Introspector, UnknownField + import sdssdb from sdssdb import config, log from sdssdb.utils.internals import get_database_columns -__all__ = ['DatabaseConnection', 'PeeweeDatabaseConnection', 'SQLADatabaseConnection'] + +__all__ = ["DatabaseConnection", "PeeweeDatabaseConnection", "SQLADatabaseConnection"] def _should_autoconnect(): """Determines whether we should autoconnect.""" - if 'SDSSDB_AUTOCONNECT' in os.environ: - envvar_autoconnect = os.environ['SDSSDB_AUTOCONNECT'].lower() - if envvar_autoconnect == '0' or envvar_autoconnect == 'false': + if "SDSSDB_AUTOCONNECT" in os.environ: + envvar_autoconnect = os.environ["SDSSDB_AUTOCONNECT"].lower() + if envvar_autoconnect == "0" or envvar_autoconnect == "false": return False else: return sdssdb.autoconnect @@ -111,14 +114,13 @@ class DatabaseConnection(six.with_metaclass(abc.ABCMeta)): auto_reflect = True def __init__(self, dbname=None, profile=None, autoconnect=None, dbversion=None): - self.profile = None self._config = {} self.dbname = dbname if dbname else self.dbname self.dbversion = dbversion or self.dbversion if self.dbversion: - self.dbname = f'{self.dbname}_{self.dbversion}' + self.dbname = f"{self.dbname}_{self.dbversion}" self.set_profile(profile=profile, connect=False) @@ -129,8 +131,9 @@ def __init__(self, dbname=None, profile=None, autoconnect=None, dbversion=None): self.connect(dbname=self.dbname, silent_on_fail=True) def __repr__(self): - return '<{} (dbname={!r}, profile={!r}, connected={})>'.format( - self.__class__.__name__, self.dbname, self.profile, self.connected) + return "<{} (dbname={!r}, profile={!r}, connected={})>".format( + self.__class__.__name__, self.dbname, self.profile, self.connected + ) def set_profile(self, profile=None, connect=True, **params): """Sets the profile from the configuration file. @@ -156,31 +159,29 @@ def set_profile(self, profile=None, connect=True, **params): previous_profile = self.profile if profile is not None: - - assert profile in config, 'profile not found in configuration file.' + assert profile in config, "profile not found in configuration file." self.profile = profile self._config = config[profile].copy() else: - # Get hostname hostname = socket.getfqdn() # Initially set location to local. - self.profile = 'local' + self.profile = "local" self._config = config[self.profile].copy() # Tries to find a profile whose domain matches the hostname for profile in config: - if 'domain' in config[profile] and config[profile]['domain'] is not None: - if re.match(config[profile]['domain'], hostname): + if "domain" in config[profile] and config[profile]["domain"] is not None: + if re.match(config[profile]["domain"], hostname): self.profile = profile self._config = config[profile].copy() # If the profile host matches the current hostname set the # value to None to force using localhost to prevent cases # in which the loopback is not configured properly in PostgreSQL. - if hostname == self._config['host']: - self._config['host'] = None + if hostname == self._config["host"]: + self._config["host"] = None break self._config.update(params) @@ -229,13 +230,15 @@ def connect(self, dbname=None, silent_on_fail=False, **connection_params): """ if self.profile is None: - raise RuntimeError('the profile was not set when ' - 'DatabaseConnection was instantiated. Use ' - 'set_profile to set the profile in runtime.') + raise RuntimeError( + "the profile was not set when " + "DatabaseConnection was instantiated. Use " + "set_profile to set the profile in runtime." + ) # Gets the necessary configuration values from the profile db_configuration = {} - for item in ['user', 'host', 'port']: + for item in ["user", "host", "port"]: if item in connection_params: db_configuration[item] = connection_params[item] else: @@ -244,14 +247,16 @@ def connect(self, dbname=None, silent_on_fail=False, **connection_params): dbname = dbname or self.dbname if dbname is None: - raise RuntimeError('the database name was not set when ' - 'DatabaseConnection was instantiated. ' - 'To set it in runtime change the dbname ' - 'attribute.') + raise RuntimeError( + "the database name was not set when " + "DatabaseConnection was instantiated. " + "To set it in runtime change the dbname " + "attribute." + ) - return self.connect_from_parameters(dbname=dbname, - silent_on_fail=silent_on_fail, - **db_configuration) + return self.connect_from_parameters( + dbname=dbname, silent_on_fail=silent_on_fail, **db_configuration + ) def connect_from_parameters(self, dbname=None, **params): """Initialises the database from a dictionary of parameters. @@ -272,18 +277,20 @@ def connect_from_parameters(self, dbname=None, **params): """ # Make hostname an alias of host. - if 'hostname' in params: - if 'host' not in params: - params['host'] = params.pop('hostname') + if "hostname" in params: + if "host" not in params: + params["host"] = params.pop("hostname") else: - raise KeyError('cannot use hostname and host at the same time.') + raise KeyError("cannot use hostname and host at the same time.") dbname = dbname or self.dbname if dbname is None: - raise RuntimeError('the database name was not set when ' - 'DatabaseConnection was instantiated. ' - 'To set it in runtime change the dbname ' - 'attribute.') + raise RuntimeError( + "the database name was not set when " + "DatabaseConnection was instantiated. " + "To set it in runtime change the dbname " + "attribute." + ) return self._conn(dbname, **params) @@ -309,7 +316,7 @@ def get_connection_uri(self): params = self.connection_params if not self.connected or params is None: - raise RuntimeError('The database is not connected.') + raise RuntimeError("The database is not connected.") return get_database_uri(self.dbname, **params) @@ -332,18 +339,19 @@ def become(self, user): """Change the connection to a certain user.""" if not self.connected: - raise RuntimeError('DB has not been initialised.') + raise RuntimeError("DB has not been initialised.") dsn_params = self.connection_params - dsn_params.pop('password', None) # Do not keep the password since it may change. + dsn_params.pop("password", None) # Do not keep the password since it may change. if dsn_params is None: - raise RuntimeError('cannot determine the DSN parameters. ' - 'The DB may be disconnected.') + raise RuntimeError( + "cannot determine the DSN parameters. " "The DB may be disconnected." + ) - dsn_params['user'] = user - if 'dbname' not in dsn_params: - dsn_params['dbname'] = self.dbname + dsn_params["user"] = user + if "dbname" not in dsn_params: + dsn_params["dbname"] = self.dbname self.connect_from_parameters(**dsn_params) @@ -354,12 +362,13 @@ def become_admin(self, admin=None): """ - assert self.profile is not None, \ - 'this connection was not initialised from a profile. Try using become().' + assert ( + self.profile is not None + ), "this connection was not initialised from a profile. Try using become()." - assert 'admin' in self._config, 'admin user not defined in profile' + assert "admin" in self._config, "admin user not defined in profile" - self.become(admin or self._config['admin']) + self.become(admin or self._config["admin"]) def become_user(self, user=None): """Becomes the read-only user. @@ -368,24 +377,25 @@ def become_user(self, user=None): """ - assert self.profile is not None, \ - 'this connection was not initialised from a profile. Try using become().' + assert ( + self.profile is not None + ), "this connection was not initialised from a profile. Try using become()." if user is None: - user = self._config['user'] if 'user' in self._config else None + user = self._config["user"] if "user" in self._config else None self.become(user) def change_version(self, dbversion=None): - ''' Change database version and attempt to reconnect + """Change database version and attempt to reconnect Parameters: dbversion (str): A database version - ''' + """ self.dbversion = dbversion - dbname, *dbver = self.dbname.split('_') - self.dbname = f'{dbname}_{self.dbversion}' if dbversion else dbname + dbname, *dbver = self.dbname.split("_") + self.dbname = f"{dbname}_{self.dbversion}" if dbversion else dbname self.connect(dbname=self.dbname, silent_on_fail=True) def post_connect(self): @@ -406,15 +416,12 @@ class PeeweeDatabaseConnection(DatabaseConnection, PostgresqlDatabase): """ def __init__(self, *args, **kwargs): - self.models = {} self.introspector = {} self._metadata = {} - autorollback = kwargs.pop('autorollback', True) - - PostgresqlDatabase.__init__(self, None, autorollback=autorollback) + PostgresqlDatabase.__init__(self, None) DatabaseConnection.__init__(self, *args, **kwargs) @property @@ -435,15 +442,15 @@ def connection_params(self): def _conn(self, dbname, silent_on_fail=False, **params): """Connects to the DB and tests the connection.""" - if 'password' not in params: - pgpass_params = {key: value - for key, value in params.copy().items() - if value is not None} + if "password" not in params: + pgpass_params = { + key: value for key, value in params.copy().items() if value is not None + } try: - params['password'] = pgpasslib.getpass(dbname=dbname, **pgpass_params) + params["password"] = pgpasslib.getpass(dbname=dbname, **pgpass_params) except pgpasslib.FileNotFound: - params['password'] = None + params["password"] = None PostgresqlDatabase.init(self, dbname, **params) self._metadata = {} @@ -453,14 +460,14 @@ def _conn(self, dbname, silent_on_fail=False, **params): self.dbname = dbname except OperationalError as ee: if not silent_on_fail: - log.warning(f'failed connecting to database {self.database!r}: {ee}') + log.warning(f"failed connecting to database {self.database!r}: {ee}") PostgresqlDatabase.init(self, None) if self.is_connection_usable() and self.auto_reflect: with self.atomic(): for model in self.models.values(): - if getattr(model._meta, 'use_reflection', False): - if hasattr(model, 'reflect'): + if getattr(model._meta, "use_reflection", False): + if hasattr(model, "reflect"): model.reflect() if self.connected: @@ -498,18 +505,17 @@ def get_model(self, table_name, schema=None): def get_introspector(self, schema=None): """Gets a Peewee database :class:`peewee:Introspector`.""" - schema_key = schema or '' + schema_key = schema or "" if schema_key not in self.introspector: - self.introspector[schema_key] = Introspector.from_database( - self, schema=schema) + self.introspector[schema_key] = Introspector.from_database(self, schema=schema) return self.introspector[schema_key] def get_fields(self, table_name, schema=None, cache=True): """Returns a list of Peewee fields for a table.""" - schema = schema or 'public' + schema = schema or "public" if schema not in self._metadata or not cache: self._metadata[schema] = get_database_columns(self, schema=schema) @@ -519,21 +525,21 @@ def get_fields(self, table_name, schema=None, cache=True): table_metadata = self._metadata[schema][table_name] - pk = table_metadata['pk'] + pk = table_metadata["pk"] composite_key = pk is not None and len(pk) > 1 - columns = table_metadata['columns'] + columns = table_metadata["columns"] fields = [] for col_name, field_type, array_type, nullable in columns: + is_pk = True if (pk is not None and not composite_key and pk[0] == col_name) else False - is_pk = True if (pk is not None and not composite_key and - pk[0] == col_name) else False - - params = {'column_name': col_name, - 'null': nullable, - 'primary_key': is_pk, - 'unique': is_pk} + params = { + "column_name": col_name, + "null": nullable, + "primary_key": is_pk, + "unique": is_pk, + } if array_type: field = ArrayField(array_type, **params) @@ -549,7 +555,7 @@ def get_fields(self, table_name, schema=None, cache=True): def get_primary_keys(self, table_name, schema=None, cache=True): """Returns the primary keys for a table.""" - schema = schema or 'public' + schema = schema or "public" if schema not in self._metadata or not cache: self._metadata[schema] = get_database_columns(self, schema=schema) @@ -557,11 +563,11 @@ def get_primary_keys(self, table_name, schema=None, cache=True): if table_name not in self._metadata[schema]: return [] else: - return self._metadata[schema][table_name]['pk'] or [] + return self._metadata[schema][table_name]["pk"] or [] class SQLADatabaseConnection(DatabaseConnection): - ''' SQLAlchemy database connection implementation ''' + """SQLAlchemy database connection implementation""" engine = None bases = [] @@ -569,7 +575,6 @@ class SQLADatabaseConnection(DatabaseConnection): metadata = None def __init__(self, *args, **kwargs): - #: Reports whether the connection is active. self.connected = False @@ -583,7 +588,7 @@ def connection_params(self): return self._connect_params def _get_password(self, **params): - ''' Get a db password from a pgpass file + """Get a db password from a pgpass file Parameters: params (dict): @@ -592,19 +597,23 @@ def _get_password(self, **params): Returns: The database password for a given set of connection parameters - ''' + """ - password = params.get('password', None) + password = params.get("password", None) if not password: try: - password = pgpasslib.getpass(params['host'], params['port'], - params['database'], params['username']) + password = pgpasslib.getpass( + params["host"], + params["port"], + params["database"], + params["username"], + ) except KeyError: - raise RuntimeError('ERROR: invalid server configuration') + raise RuntimeError("ERROR: invalid server configuration") return password def _make_connection_string(self, dbname, **params): - ''' Build a db connection string + """Build a db connection string Parameters: dbname (str): @@ -615,33 +624,32 @@ def _make_connection_string(self, dbname, **params): Returns: A database connection string - ''' + """ db_params = params.copy() - db_params['drivername'] = 'postgresql+psycopg2' - db_params['database'] = dbname - db_params['username'] = db_params.pop('user', None) - db_params['host'] = db_params.pop('host', 'localhost') - db_params['port'] = db_params.pop('port', 5432) - if db_params['username']: - db_params['password'] = self._get_password(**db_params) + db_params["drivername"] = "postgresql+psycopg2" + db_params["database"] = dbname + db_params["username"] = db_params.pop("user", None) + db_params["host"] = db_params.pop("host", "localhost") + db_params["port"] = db_params.pop("port", 5432) + if db_params["username"]: + db_params["password"] = self._get_password(**db_params) db_connection_string = url.URL(**db_params) self._connect_params = params return db_connection_string def _conn(self, dbname, silent_on_fail=False, **params): - '''Connects to the DB and tests the connection.''' + """Connects to the DB and tests the connection.""" # get connection string db_connection_string = self._make_connection_string(dbname, **params) try: - self.create_engine(db_connection_string, echo=False, - pool_size=10, pool_recycle=1800) + self.create_engine(db_connection_string, echo=False, pool_size=10, pool_recycle=1800) self.engine.connect() except OpError: if not silent_on_fail: - log.warning('Failed to connect to database {0}'.format(dbname)) + log.warning("Failed to connect to database {0}".format(dbname)) self.engine.dispose() self.engine = None self.connected = False @@ -658,7 +666,7 @@ def _conn(self, dbname, silent_on_fail=False, **params): return self.connected def reset_engine(self): - ''' Reset the engine, metadata, and session ''' + """Reset the engine, metadata, and session""" self.bases = [] if self.engine: @@ -668,27 +676,37 @@ def reset_engine(self): self.Session.close() self.Session = None - def create_engine(self, db_connection_string=None, echo=False, pool_size=10, - pool_recycle=1800, expire_on_commit=True): - ''' Create a new database engine + def create_engine( + self, + db_connection_string=None, + echo=False, + pool_size=10, + pool_recycle=1800, + expire_on_commit=True, + ): + """Create a new database engine Resets and creates a new sqlalchemy database engine. Also creates and binds engine metadata and a new scoped session. - ''' + """ self.reset_engine() if not db_connection_string: dbname = self.dbname or self.DATABASE_NAME - db_connection_string = self._make_connection_string(dbname, - **self.connection_params) - - self.engine = create_engine(db_connection_string, echo=echo, pool_size=pool_size, - pool_recycle=pool_recycle) + db_connection_string = self._make_connection_string(dbname, **self.connection_params) + + self.engine = create_engine( + db_connection_string, + echo=echo, + pool_size=pool_size, + pool_recycle=pool_recycle, + ) self.metadata = MetaData(bind=self.engine) - self.Session = scoped_session(sessionmaker(bind=self.engine, autocommit=True, - expire_on_commit=expire_on_commit)) + self.Session = scoped_session( + sessionmaker(bind=self.engine, autocommit=True, expire_on_commit=expire_on_commit) + ) def add_base(self, base, prepare=True): """Binds a base to this connection.""" @@ -717,7 +735,7 @@ def prepare_bases(self, base=None): # If the base has an attribute _relations that's the function # to call to set up the relationships once the engine has been # bound to the base. - if hasattr(base, '_relations'): + if hasattr(base, "_relations"): if isinstance(base._relations, str): module = importlib.import_module(base.__module__) relations_func = getattr(module, base._relations) diff --git a/python/sdssdb/peewee/lvmdb/gortdb.py b/python/sdssdb/peewee/lvmdb/gortdb.py index 5c27d61b..8c685b07 100644 --- a/python/sdssdb/peewee/lvmdb/gortdb.py +++ b/python/sdssdb/peewee/lvmdb/gortdb.py @@ -6,9 +6,12 @@ # @Filename: gortdb.py # @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) +# fmt: on + from __future__ import annotations import datetime + from peewee import ( AutoField, BigIntegerField, @@ -18,13 +21,12 @@ FloatField, ForeignKeyField, IntegerField, - TextField + TextField, ) from playhouse.postgres_ext import JSONField from .. import BaseModel from . import database -from .lvmopsdb import Exposure as LVMOpsDBExposure class GortDBBase(BaseModel): @@ -43,7 +45,7 @@ class Overhead(GortDBBase): duration = FloatField() class Meta: - table_name = 'overhead' + table_name = "overhead" class Event(GortDBBase): @@ -54,7 +56,7 @@ class Event(GortDBBase): payload = JSONField() class Meta: - table_name = 'event' + table_name = "event" class Notification(GortDBBase): @@ -68,7 +70,7 @@ class Notification(GortDBBase): slack = BooleanField() class Meta: - table_name = 'notification' + table_name = "notification" class Exposure(GortDBBase): @@ -84,7 +86,7 @@ class Exposure(GortDBBase): header = JSONField() class Meta: - table_name = 'exposure' + table_name = "exposure" class NightLog(GortDBBase): @@ -93,15 +95,15 @@ class NightLog(GortDBBase): sent = BooleanField() class Meta: - table_name = 'night_log' + table_name = "night_log" class NightLogComment(GortDBBase): pk = AutoField(primary_key=True) - night_log = ForeignKeyField(model=NightLog, - column_name='night_log_pk', - backref='comments') + night_log = ForeignKeyField( + model=NightLog, column_name="night_log_pk", backref="comments" + ) comment = TextField() class Meta: - table_name = 'night_log_comment' + table_name = "night_log_comment" diff --git a/python/sdssdb/peewee/sdss5db/astradb.py b/python/sdssdb/peewee/sdss5db/astradb.py index ff9c1031..dc88e20b 100644 --- a/python/sdssdb/peewee/sdss5db/astradb.py +++ b/python/sdssdb/peewee/sdss5db/astradb.py @@ -7,7 +7,7 @@ # Database: sdss5db # Peewee version: 3.17.1 -# flake8: noqa=E501,E741 +# flake8: noqa: E501,E741 from peewee import (AutoField, BigIntegerField, BigBitField, BitField, BooleanField, DateTimeField, DoubleField, FloatField, ForeignKeyField, diff --git a/python/sdssdb/sqlalchemy/sdss5db/apogee_drpdb.py b/python/sdssdb/sqlalchemy/sdss5db/apogee_drpdb.py index f86a1317..95bef970 100644 --- a/python/sdssdb/sqlalchemy/sdss5db/apogee_drpdb.py +++ b/python/sdssdb/sqlalchemy/sdss5db/apogee_drpdb.py @@ -3,7 +3,7 @@ # # this file was autogenerated with sqlacodegen and then adapted for sdssdb -# flake8: noqa=E501,E741 +# flake8: noqa: E501,E741 from sqlalchemy import (ARRAY, BigInteger, Boolean, Column, DateTime, Float, ForeignKey, Index, Integer, SmallInteger, Text, UniqueConstraint, text) diff --git a/python/sdssdb/sqlalchemy/sdss5db/astradb.py b/python/sdssdb/sqlalchemy/sdss5db/astradb.py index 4a79ed30..ccf50bb1 100644 --- a/python/sdssdb/sqlalchemy/sdss5db/astradb.py +++ b/python/sdssdb/sqlalchemy/sdss5db/astradb.py @@ -1,7 +1,7 @@ # coding: utf-8 # this file was autogenerated with sqlacodegen and then adapted for sdssdb -# flake8: noqa=E501,E741 +# flake8: noqa: E501,E741 from sqlalchemy.ext.declarative import AbstractConcreteBase, declared_attr from sqlalchemy import ARRAY, BigInteger, Boolean, Column, DateTime, Float, ForeignKey, Index, Integer, LargeBinary, Text, text diff --git a/python/sdssdb/sqlalchemy/sdss5db/boss_drp.py b/python/sdssdb/sqlalchemy/sdss5db/boss_drp.py index da70bbed..a4c8ddcc 100644 --- a/python/sdssdb/sqlalchemy/sdss5db/boss_drp.py +++ b/python/sdssdb/sqlalchemy/sdss5db/boss_drp.py @@ -3,7 +3,7 @@ # # this file was autogenerated with sqlacodegen and then adapted for sdssdb -# flake8: noqa=E501,E741 +# flake8: noqa: E501,E741 from sqlalchemy import (ARRAY, BigInteger, Boolean, Column, DateTime, Float, ForeignKey, Integer, LargeBinary, SmallInteger, String, text) diff --git a/python/sdssdb/sqlalchemy/sdss5db/catalogdb.py b/python/sdssdb/sqlalchemy/sdss5db/catalogdb.py index 1e4d8913..4168ff82 100644 --- a/python/sdssdb/sqlalchemy/sdss5db/catalogdb.py +++ b/python/sdssdb/sqlalchemy/sdss5db/catalogdb.py @@ -3,7 +3,7 @@ # # this file was autogenerated with sqlacodegen and then adapted for sdssdb -# flake8: noqa=E501,E741 +# flake8: noqa: E501,E741 from sqlalchemy import ( ARRAY, diff --git a/python/sdssdb/sqlalchemy/sdss5db/opsdb.py b/python/sdssdb/sqlalchemy/sdss5db/opsdb.py index 2b2b5162..5114bc83 100644 --- a/python/sdssdb/sqlalchemy/sdss5db/opsdb.py +++ b/python/sdssdb/sqlalchemy/sdss5db/opsdb.py @@ -3,10 +3,9 @@ # # this file was autogenerated with sqlacodegen and then adapted for sdssdb -# flake8: noqa=E501 +# flake8: noqa: E501 import os -from ast import In from sqlalchemy import ( ARRAY, diff --git a/python/sdssdb/sqlalchemy/sdss5db/targetdb.py b/python/sdssdb/sqlalchemy/sdss5db/targetdb.py index 5ea5dec2..944a4bd8 100644 --- a/python/sdssdb/sqlalchemy/sdss5db/targetdb.py +++ b/python/sdssdb/sqlalchemy/sdss5db/targetdb.py @@ -3,9 +3,7 @@ # # this file was autogenerated with sqlacodegen and then adapted for sdssdb -# flake8: noqa=E501 - -from cgi import print_form +# flake8: noqa: E501 from sqlalchemy import ( ARRAY, diff --git a/python/sdssdb/sqlalchemy/sdss5db/vizdb.py b/python/sdssdb/sqlalchemy/sdss5db/vizdb.py index 195c43d5..eb6b2c4a 100644 --- a/python/sdssdb/sqlalchemy/sdss5db/vizdb.py +++ b/python/sdssdb/sqlalchemy/sdss5db/vizdb.py @@ -3,7 +3,7 @@ # # this file was autogenerated with sqlacodegen and then adapted for sdssdb -# flake8: noqa=E501,E741 +# flake8: noqa: E501,E741 from sqlalchemy.ext.declarative import AbstractConcreteBase, declared_attr diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index e2eca799..00000000 --- a/setup.cfg +++ /dev/null @@ -1,120 +0,0 @@ -[metadata] -name = sdssdb -version = 0.12.5a0 -author = José Sánchez-Gallego -author_email = gallegoj@uw.edu -description = SDSS product for database management -url = https://github.com/sdss/sdssdb -project_urls = - Repository = https://github.com/sdss/sdssdb - Documentation = https://sdssdb.readthedocs.org -long_description = file: README.md -long_description_content_type = text/markdown -keywords = astronomy, software, database -license = BSD 3-Clause License -license_file = LICENSE.md -classifiers = - Development Status :: 4 - Beta - Intended Audience :: Science/Research - Natural Language :: English - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Topic :: Documentation :: Sphinx - Topic :: Software Development :: Libraries :: Python Modules - -[options] -zip_safe = False -python_requires = >=3.6 -packages = find: -package_dir = - = python -install_requires = - pyyaml>=5.1 - pygments - pgpasslib>=1.1.0 - psycopg2-binary>=2.7.7 - six>=1.12.0 - peewee>=3.17.3 - sqlalchemy>=1.3.6 - sdsstools>=1.7.0; python_version >= "3.8" - sdsstools>=0.1.0,<1.0.0; python_version < "3.8" - numpy>=1.18.2 - h5py>=3.8.0 - -[options.packages.find] -where = - python -exclude = - *.tests - -[options.package_data] -sdssdb = - etc/* - -[options.extras_require] -all = - progressbar2>=3.46.1 - pydot>=1.4.1 - astropy>=4.0.0 - pandas>=1.0.0 - inflect>=4.1.0 -dev = - pytest>=5.2 - pytest-cov>=2.4.0 - pytest-sugar>=0.8.0 - ipython>=7.13.0 - ipdb>=0.13.2 - pytest-postgresql>=2.2.1 - factory_boy>=2.12.0 - pytest-factoryboy>=2.0.3 - astropy>=4.0.0 - pydot>=1.4.2 -docs = - Sphinx>=7.0.0 - sphinx_bootstrap_theme>=0.4.12 - releases>=2.0.0 - -[isort] -line_length = 79 -sections = - FUTURE - STDLIB - THIRDPARTY - SQLA - PEEWEE - SDSS - FIRSTPARTY - LOCALFOLDER -default_section = THIRDPARTY -known_first_party = - sdssdb -known_sqla = - sqlalchemy -known_peewee = - peewee - playhouse -known_sdss = - sdsstools -balanced_wrapping = true -include_trailing_comma = false -lines_after_imports = 2 -use_parentheses = true - -[flake8] -ignore = - H101 - E722 - W504 - W505 - E116 - E114 -max-line-length = 99 -exclude = - python/sdssdb/sqlalchemy/operationsdb/tools/ - python/sdssdb/sqlalchemy/archive - python/sdssdb/sqlalchemy/mangadb - -[coverage:run] -branch = true diff --git a/setup.py b/setup.py deleted file mode 100644 index 578f6d67..00000000 --- a/setup.py +++ /dev/null @@ -1,9 +0,0 @@ -# encoding: utf-8 -# -# setup.py -# - -from setuptools import setup - - -setup() diff --git a/tests/__init__.py b/tests/__init__.py index e69de29b..5a58977b 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# @Author: José Sánchez-Gallego (gallegoj@uw.edu) +# @Date: 2024-09-02 +# @Filename: __init__.py +# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) + +from __future__ import annotations + +import warnings + +from sqlalchemy.exc import MovedIn20Warning + + +warnings.filterwarnings("ignore", category=MovedIn20Warning) diff --git a/tests/conftest.py b/tests/conftest.py index 3dc60736..9aa2778a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,52 +3,66 @@ # conftest.py # -from __future__ import print_function, division, absolute_import, unicode_literals +from __future__ import absolute_import, division, print_function, unicode_literals -import re -import pytest import importlib import inspect -from .sqladbs import prepare_testdb as sqla_prepdb +import re + +import pytest +from pytest_postgresql.janitor import DatabaseJanitor + from .pwdbs import prepare_testdb as pw_prepdb -from pytest_postgresql.factories import DatabaseJanitor +from .sqladbs import prepare_testdb as sqla_prepdb def pytest_addoption(parser): - """ Add new options to the pytest command-line """ + """Add new options to the pytest command-line""" # only run peewee tests - parser.addoption('--peewee', action='store_true', default=False, - help='Only run tests for peewee dbs') + parser.addoption( + "--peewee", + action="store_true", + default=False, + help="Only run tests for peewee dbs", + ) # only run sqla tests - parser.addoption('--sqla', action='store_true', default=False, - help='Only run tests for sqlalchemy dbs') + parser.addoption( + "--sqla", + action="store_true", + default=False, + help="Only run tests for sqlalchemy dbs", + ) # persist the sqla session and peewee transaction - parser.addoption('--persist-sessions', action='store_true', default=False, - help='Switch session and transaction fixtures to module scope') + parser.addoption( + "--persist-sessions", + action="store_true", + default=False, + help="Switch session and transaction fixtures to module scope", + ) def pytest_ignore_collect(path, config): - ''' pytest hook to identify tests to be ignored during collection + """pytest hook to identify tests to be ignored during collection Looks through all test_xxx.py files in pwdbs and sqladbs and determines which ones have databases that fail to connect and ignores them. - ''' + """ only_peewee = config.getoption("--peewee", None) only_sqla = config.getoption("--sqla", None) - assert not all([only_peewee, only_sqla]), 'both --peewee and --sqla options cannot be set' + assert not all([only_peewee, only_sqla]), "both --peewee and --sqla options cannot be set" if only_peewee: - if 'sqladbs' in str(path): + if "sqladbs" in str(path): return True if only_sqla: - if 'pwdbs' in str(path): + if "pwdbs" in str(path): return True # identify and ignore test modules where no local # database is set up for those tests - if re.search('test_[a-z]+.py', str(path)): + if re.search("test_[a-z]+.py", str(path)): # get module name modname = inspect.getmodulename(path) # find and load the underlying module @@ -57,38 +71,38 @@ def pytest_ignore_collect(path, config): # execute load spec.loader.exec_module(foo) # get the database from the module - db = getattr(foo, 'database', None) + db = getattr(foo, "database", None) # check if db is connected - if db and db.connected is False and db.dbname != 'test': + if db and db.connected is False and db.dbname != "test": return True -@pytest.fixture(scope='module', autouse=True) +@pytest.fixture(scope="module", autouse=True) def skipdb(database): - ''' fixture to skip database tests if the db does not exist ''' + """fixture to skip database tests if the db does not exist""" if database.connected is False: - pytest.skip(f'no {database.dbname} found') + pytest.skip(f"no {database.dbname} found") database = None -@pytest.fixture(scope='module') -def dropdb(): - janitor = DatabaseJanitor('postgres', 'localhost', 5432, 'test', '11.4') - janitor.drop() - - -@pytest.fixture(scope='module') -def database(dropdb, request): - ''' Module fixture to initialize a real database or a test postgresql database ''' - if hasattr(request, 'param'): +@pytest.fixture(scope="module") +def database(request): + """Module fixture to initialize a real database or a test postgresql database""" + if hasattr(request, "param"): # yield a real database yield request.param else: # check if request is coming from a sqla db or peewee db - issqla = 'sqladbs' in request.module.__name__ or 'sqlalchemy' in request.module.__name__ + issqla = "sqladbs" in request.module.__name__ or "sqlalchemy" in request.module.__name__ # initialize the test database # uses https://github.com/ClearcodeHQ/pytest-postgresql - janitor = DatabaseJanitor('postgres', 'localhost', 5432, 'test', '11.4') + janitor = DatabaseJanitor( + user="postgres", + host="localhost", + port=5432, + dbname="test", + version="11.4", + ) janitor.init() db = sqla_prepdb() if issqla else pw_prepdb() yield db @@ -97,8 +111,7 @@ def database(dropdb, request): def determine_scope(fixture_name, config): - ''' determine the scope of the session and transaction fixtures ''' + """determine the scope of the session and transaction fixtures""" if config.getoption("--persist-sessions", None): return "module" return "function" - From aa1113a71832611b971b0396690e78d7de8030a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Tue, 3 Sep 2024 13:08:31 -0700 Subject: [PATCH 18/30] Support psycopg 3.x (#268) * Replace setup.cfg/.py with pyproject.toml * Support linting with flake8 or ruff and fix some linting issues * Fix test issues * Update workflows * Use uv in workflow for faster install * Change default postgres username in workflow * Delete STYLE.rst * Update changelog * Support psycopg 3.x * Add documentation for the new connection flags * Update changelog * Make sdssdb.use_psycopg3 a boolean --- CHANGELOG.rst | 1 + docs/sphinx/intro.rst | 18 +++++++++++++++++- pyproject.toml | 6 +++++- python/sdssdb/__init__.py | 3 +++ python/sdssdb/connection.py | 24 ++++++++++++++++++++---- 5 files changed, 46 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e4c8ddf8..fb1aba8a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,7 @@ This document records the main changes to the ``sdssdb`` code. * :feature:`264` Add metadata for the ``sdss_id_to_catalog`` table. * :feature:`266` Support PEP 621. +* :feature:`268` Allows to use `psycopy3 `__ as a driver for the Peewee database connection. * Add missing columns to the ``SDSS_ID_To_Catalog`` models (the columns were being completed via reflection). * Change ``reflection=False`` to ``use_reflection=False`` in many ``catalogdb`` models. The previous setting was incorrect and was causing the models to be reflected. * Add ``gortdb`` schema and models to ``lvmdb``. Moved ``lvmopsdb.overhead`` to ``gortdb``. diff --git a/docs/sphinx/intro.rst b/docs/sphinx/intro.rst index e5322cea..33541337 100644 --- a/docs/sphinx/intro.rst +++ b/docs/sphinx/intro.rst @@ -245,7 +245,7 @@ There are two database connections, ``SQLADatabaseConnection`` and ``PeeWeeDatab A note about passwords ----------------------- +^^^^^^^^^^^^^^^^^^^^^^ ``sdssdb`` does not allow you to pass plaintext passwords when creating a connection, or to store them in the profiles. Instead, you should use `pgpass `__ to set your passwords. A typical ``~/.pgpass`` file looks something like :: @@ -256,6 +256,22 @@ A note about passwords where ``XXXX``, ``YYYY``, etc are the associated passwords for each set of parameters. +Connection flags +^^^^^^^^^^^^^^^^ + +``sdssdb`` supports two flags that change the behaviour of the database connection. + +* **autoconnect**: if set to `False` the connection will not attempt to connect to the database when created. This is useful when you want to create a connection object but connect to the database later. ``autoconnect`` defaults to `True` and can be changed either by setting the environment variable ``SDSSDB_AUTOCONNECT=0`` before importing the model classes, or by doing :: + + >>> import sdssdb + >>> sdssdb.autoconnect = False + ... import your model classes ... + + When instantiating a `.DatabaseConnection` object manually, you can also pass the ``autoconnect=False`` keyword argument. + +* **use_psycopg3**: prefers to use `psycopg3 `__ instead of the default ``psycopg2``. If ``psycopg3`` is not installed, ``psycopg2`` will be used instead. This flag can be set via the environment variable ``SDSSDB_PSYCOPG3=1`` or by importing ``sdssdb`` and setting ``sdssdb.use_psycopg3 = True`` before importing the model classes. + + .. _profile: Supported Profiles diff --git a/pyproject.toml b/pyproject.toml index e94d5dd3..cf35eb79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ content-type = "text/markdown" [project.optional-dependencies] all = [ + "psycopg[binary]", "progressbar2>=3.46.1", "pydot>=1.4.1", "astropy>=4.0.0", @@ -37,7 +38,7 @@ all = [ "inflect>=4.1.0", "h5py>=3.8.0", "sdssdb[dev]", - "sdssdb[docs]", + "sdssdb[docs]" ] dev = [ "pytest>=5.2", @@ -145,5 +146,8 @@ sdss = ["sdsstools"] sqla = ["sqlalchemy"] peewee = ["peewee", "playhouse"] +[tool.ruff.format] +preview = true + [tool.coverage.run] branch = true diff --git a/python/sdssdb/__init__.py b/python/sdssdb/__init__.py index 8c841df5..224014a2 100644 --- a/python/sdssdb/__init__.py +++ b/python/sdssdb/__init__.py @@ -1,5 +1,6 @@ # encoding: utf-8 +import os import warnings from sqlalchemy.exc import MovedIn20Warning @@ -32,6 +33,8 @@ config = get_config(NAME) autoconnect = True +use_psycopg3 = os.environ.get("SDSSDB_PSYCOPG3", "false").lower() in ["true", "1"] + from .connection import PeeweeDatabaseConnection # noqa from .connection import SQLADatabaseConnection # noqa diff --git a/python/sdssdb/connection.py b/python/sdssdb/connection.py index fa971a4c..925088dc 100644 --- a/python/sdssdb/connection.py +++ b/python/sdssdb/connection.py @@ -13,6 +13,7 @@ import os import re import socket +import warnings import pgpasslib import six @@ -23,18 +24,30 @@ from sqlalchemy.orm import scoped_session, sessionmaker import peewee -from peewee import OperationalError, PostgresqlDatabase +from peewee import OperationalError from playhouse.postgres_ext import ArrayField from playhouse.reflection import Introspector, UnknownField import sdssdb -from sdssdb import config, log +from sdssdb import config, log, use_psycopg3 from sdssdb.utils.internals import get_database_columns __all__ = ["DatabaseConnection", "PeeweeDatabaseConnection", "SQLADatabaseConnection"] +if use_psycopg3 is True: + try: + import psycopg # noqa + from playhouse.psycopg3_ext import Psycopg3Database as PostgresqlDatabase + except ImportError: + warnings.warn("psycopg3 is not installed. Using psycopg2.") + from peewee import PostgresqlDatabase + +else: + from peewee import PostgresqlDatabase + + def _should_autoconnect(): """Determines whether we should autoconnect.""" @@ -62,7 +75,7 @@ def get_database_uri( else: auth: str = f"{user}:{password}@" - host_port: str = f"{host or ''}" if port is None else f"{host or ''}:{port}" + host_port: str = f"{host or ""}" if port is None else f"{host or ""}:{port}" if auth == "" and host_port == "": return f"postgresql://{dbname}" @@ -132,7 +145,10 @@ def __init__(self, dbname=None, profile=None, autoconnect=None, dbversion=None): def __repr__(self): return "<{} (dbname={!r}, profile={!r}, connected={})>".format( - self.__class__.__name__, self.dbname, self.profile, self.connected + self.__class__.__name__, + self.dbname, + self.profile, + self.connected, ) def set_profile(self, profile=None, connect=True, **params): From 864f8618f20c844ab1abe87fa3a345136e01779b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Tue, 3 Sep 2024 13:12:39 -0700 Subject: [PATCH 19/30] Fix test badge --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 91a6a30e..7b2e2c92 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ ![Versions](https://img.shields.io/badge/python->=3.6-blue) [![Documentation Status](https://readthedocs.org/projects/sdssdb/badge/?version=latest)](https://sdssdb.readthedocs.io/en/latest/?badge=latest) -[![Python application](https://github.com/sdss/sdssdb/actions/workflows/pythonapp.yml/badge.svg)](https://github.com/sdss/sdssdb/actions/workflows/pythonapp.yml) - +[![Test](https://github.com/sdss/sdssdb/actions/workflows/test.yml/badge.svg)](https://github.com/sdss/sdssdb/actions/workflows/test.yml) [SDSS](https://sdss.org>) product for database management. From 587630c48cd1745d023f4793c0ddb3eb5142d37c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Tue, 3 Sep 2024 13:13:27 -0700 Subject: [PATCH 20/30] Release 0.13.0 --- CHANGELOG.rst | 1 + pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fb1aba8a..5442e8ef 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ Changelog This document records the main changes to the ``sdssdb`` code. +* :release:`0.13.0 <2024-09-03>` * :feature:`264` Add metadata for the ``sdss_id_to_catalog`` table. * :feature:`266` Support PEP 621. * :feature:`268` Allows to use `psycopy3 `__ as a driver for the Peewee database connection. diff --git a/pyproject.toml b/pyproject.toml index cf35eb79..7a562af7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "sdssdb" -version = "0.12.5a0" +version = "0.13.0" authors = [ {name = "José Sánchez-Gallego", email = "gallegoj@uw.edu"}, {name = "Brian Cherinka", email = "bcherinka@stsci.edu"} From de5480710c0b3ae7a3cbb6e689061f521b887175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Tue, 3 Sep 2024 13:17:04 -0700 Subject: [PATCH 21/30] Bump version from 0.13.0 to 0.13.1a0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7a562af7..0dc33a95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "sdssdb" -version = "0.13.0" +version = "0.13.1a0" authors = [ {name = "José Sánchez-Gallego", email = "gallegoj@uw.edu"}, {name = "Brian Cherinka", email = "bcherinka@stsci.edu"} From 7c9e1486d148ccd1272a0687956bf7974f6c463e Mon Sep 17 00:00:00 2001 From: johndonor3 Date: Wed, 4 Sep 2024 14:30:18 -0600 Subject: [PATCH 22/30] single quotes inside f string --- python/sdssdb/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/sdssdb/connection.py b/python/sdssdb/connection.py index 925088dc..14252b2f 100644 --- a/python/sdssdb/connection.py +++ b/python/sdssdb/connection.py @@ -75,7 +75,7 @@ def get_database_uri( else: auth: str = f"{user}:{password}@" - host_port: str = f"{host or ""}" if port is None else f"{host or ""}:{port}" + host_port: str = f"{host or ''}" if port is None else f"{host or ''}:{port}" if auth == "" and host_port == "": return f"postgresql://{dbname}" From 562b55c821b0f1dd5ff9f1a225ce5dd45d2ed20f Mon Sep 17 00:00:00 2001 From: John Donor Date: Mon, 9 Sep 2024 16:34:31 -0500 Subject: [PATCH 23/30] updates to proposed views --- .../load_table/metrics/created_views.sql | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/schema/sdss5db/targetdb/load_table/metrics/created_views.sql b/schema/sdss5db/targetdb/load_table/metrics/created_views.sql index 0eb8a6cf..2d282e39 100644 --- a/schema/sdss5db/targetdb/load_table/metrics/created_views.sql +++ b/schema/sdss5db/targetdb/load_table/metrics/created_views.sql @@ -1,12 +1,26 @@ CREATE MATERIALIZED VIEW sandbox.done_to_sdssid AS select at.mjd, t.catalogid, c.program, c.carton, -i.label, i.default_lambda_eff, sdssid.sdss_id +i.label, i.default_lambda_eff, sdssid.sdss_id, +obs.label as observatory from targetdb.assignment_status as at join targetdb.assignment as assn on assn.pk = at.assignment_pk +join targetdb.hole as hole on hole.pk = assn.hole_pk +join targetdb.observatory as obs on obs.pk = hole.observatory_pk join targetdb.carton_to_target as c2t on c2t.pk = assn.carton_to_target_pk join targetdb.target as t on c2t.target_pk = t.pk join targetdb.carton as c on c.pk = c2t.carton_pk join targetdb.instrument as i on i.pk = assn.instrument_pk join catalogdb.sdss_id_flat as sdssid on sdssid.catalogid = t.catalogid where at.status = 1; + +CREATE MATERIALIZED VIEW sandbox.carton_to_sdssid +AS +select t.catalogid, c.program, c.carton, +i.label, i.default_lambda_eff, sdssid.sdss_id +from targetdb.carton_to_target as c2t +join targetdb.target as t on c2t.target_pk = t.pk +join targetdb.carton as c on c.pk = c2t.carton_pk +join targetdb.instrument as i on i.pk = c2t.instrument_pk +join catalogdb.sdss_id_flat as sdssid on sdssid.catalogid = t.catalogid +where c.version_pk >= 136; From 9316fa223167db125ae2db3289cbd02f167d9302 Mon Sep 17 00:00:00 2001 From: johndonor3 Date: Wed, 11 Sep 2024 14:12:08 -0600 Subject: [PATCH 24/30] example rs run to sdssid load --- .../load_table/metrics/created_views.sql | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/schema/sdss5db/targetdb/load_table/metrics/created_views.sql b/schema/sdss5db/targetdb/load_table/metrics/created_views.sql index 2d282e39..9ba20393 100644 --- a/schema/sdss5db/targetdb/load_table/metrics/created_views.sql +++ b/schema/sdss5db/targetdb/load_table/metrics/created_views.sql @@ -1,8 +1,9 @@ -CREATE MATERIALIZED VIEW sandbox.done_to_sdssid +CREATE MATERIALIZED VIEW sandbox.rs_run_to_sdssid AS -select at.mjd, t.catalogid, c.program, c.carton, +select assn.pk as assignment_pk, at.mjd, t.catalogid, c.program, c.carton, i.label, i.default_lambda_eff, sdssid.sdss_id, -obs.label as observatory +obs.label as observatory, at.status as done, +f.field_id from targetdb.assignment_status as at join targetdb.assignment as assn on assn.pk = at.assignment_pk join targetdb.hole as hole on hole.pk = assn.hole_pk @@ -12,15 +13,34 @@ join targetdb.target as t on c2t.target_pk = t.pk join targetdb.carton as c on c.pk = c2t.carton_pk join targetdb.instrument as i on i.pk = assn.instrument_pk join catalogdb.sdss_id_flat as sdssid on sdssid.catalogid = t.catalogid -where at.status = 1; +join targetdb.design_to_field as d2f on d2f.design_id = assn.design_id +join targetdb.field as f on f.pk = d2f.field_pk +join targetdb.version as v on v.pk = f.version_pk +where v.plan = 'eta-9'; -CREATE MATERIALIZED VIEW sandbox.carton_to_sdssid -AS -select t.catalogid, c.program, c.carton, -i.label, i.default_lambda_eff, sdssid.sdss_id -from targetdb.carton_to_target as c2t -join targetdb.target as t on c2t.target_pk = t.pk -join targetdb.carton as c on c.pk = c2t.carton_pk -join targetdb.instrument as i on i.pk = c2t.instrument_pk -join catalogdb.sdss_id_flat as sdssid on sdssid.catalogid = t.catalogid -where c.version_pk >= 136; +-- CREATE MATERIALIZED VIEW sandbox.done_to_sdssid +-- AS +-- select at.mjd, t.catalogid, c.program, c.carton, +-- i.label, i.default_lambda_eff, sdssid.sdss_id, +-- obs.label as observatory +-- from targetdb.assignment_status as at +-- join targetdb.assignment as assn on assn.pk = at.assignment_pk +-- join targetdb.hole as hole on hole.pk = assn.hole_pk +-- join targetdb.observatory as obs on obs.pk = hole.observatory_pk +-- join targetdb.carton_to_target as c2t on c2t.pk = assn.carton_to_target_pk +-- join targetdb.target as t on c2t.target_pk = t.pk +-- join targetdb.carton as c on c.pk = c2t.carton_pk +-- join targetdb.instrument as i on i.pk = assn.instrument_pk +-- join catalogdb.sdss_id_flat as sdssid on sdssid.catalogid = t.catalogid +-- where at.status = 1; + +-- CREATE MATERIALIZED VIEW sandbox.carton_to_sdssid +-- AS +-- select t.catalogid, c.program, c.carton, +-- i.label, i.default_lambda_eff, sdssid.sdss_id +-- from targetdb.carton_to_target as c2t +-- join targetdb.target as t on c2t.target_pk = t.pk +-- join targetdb.carton as c on c.pk = c2t.carton_pk +-- join targetdb.instrument as i on i.pk = c2t.instrument_pk +-- join catalogdb.sdss_id_flat as sdssid on sdssid.catalogid = t.catalogid +-- where c.version_pk >= 136; From a5ea48b9d4b4433ab733be383ba78f9e89700afa Mon Sep 17 00:00:00 2001 From: Michael Blanton Date: Sun, 15 Sep 2024 16:34:37 -0600 Subject: [PATCH 25/30] change long cadence to be more flexible --- .../sdss5db/targetdb/data_table/cadence/bright_2x1_long.cfg | 4 ++-- .../sdss5db/targetdb/data_table/cadence/bright_2x1_long.csv | 2 +- .../targetdb/data_table/cadence/bright_2x1_long_generator.py | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/schema/sdss5db/targetdb/data_table/cadence/bright_2x1_long.cfg b/schema/sdss5db/targetdb/data_table/cadence/bright_2x1_long.cfg index a6fa1386..8463fd12 100644 --- a/schema/sdss5db/targetdb/data_table/cadence/bright_2x1_long.cfg +++ b/schema/sdss5db/targetdb/data_table/cadence/bright_2x1_long.cfg @@ -2,8 +2,8 @@ nepochs=2 skybrightness= 1.00 1.00 delta= 0.00 100.00 - delta_min= 0.00 99.00 - delta_max= 0.00 1800.00 + delta_min= 0.00 2.00 + delta_max= 0.00 100000.00 nexp= 1 1 max_length= 0.20 0.20 min_moon_sep= 15.00 15.00 diff --git a/schema/sdss5db/targetdb/data_table/cadence/bright_2x1_long.csv b/schema/sdss5db/targetdb/data_table/cadence/bright_2x1_long.csv index ae1983f6..84beacf8 100644 --- a/schema/sdss5db/targetdb/data_table/cadence/bright_2x1_long.csv +++ b/schema/sdss5db/targetdb/data_table/cadence/bright_2x1_long.csv @@ -1 +1 @@ -bright_2x1_long_v2;2;{0.,100.};{1.,1.};{0.,1800.};{0.,99.};{1,1};{0.2,0.2};{"bright_time","bright_time"};bright_2x1_long;_v2 +bright_2x1_long_v2;2;{0.,100.};{1.,1.};{0.,100000.};{0.,2.};{1,1};{0.2,0.2};{"bright_time","bright_time"};bright_2x1_long;_v2 diff --git a/schema/sdss5db/targetdb/data_table/cadence/bright_2x1_long_generator.py b/schema/sdss5db/targetdb/data_table/cadence/bright_2x1_long_generator.py index c5d09c97..90fd4ef3 100755 --- a/schema/sdss5db/targetdb/data_table/cadence/bright_2x1_long_generator.py +++ b/schema/sdss5db/targetdb/data_table/cadence/bright_2x1_long_generator.py @@ -32,7 +32,8 @@ def copy_cadence(from_cadence, to_cadence, nepochs=None): copy_cadence('bright_2x1', 'bright_2x1_long_v2') -cadencelist.cadences['bright_2x1_long_v2'].delta_min[1] = 99. +cadencelist.cadences['bright_2x1_long_v2'].delta_min[1] = 2. +cadencelist.cadences['bright_2x1_long_v2'].delta_max[1] = 100000. cadencelist.cadences['bright_2x1_long_v2'].delta[1] = 100. cadencelist.cadences['bright_2x1_long_v2'].label_root = 'bright_2x1_long' cadencelist.cadences['bright_2x1_long_v2'].label_version = '_v2' From 56f590cdd894692b5d0fd4e9c00861f4d1855867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Mon, 16 Sep 2024 18:42:41 -0700 Subject: [PATCH 26/30] Add table and models for lvmopsdb.ln2_fill --- CHANGELOG.rst | 2 ++ python/sdssdb/peewee/lvmdb/lvmopsdb.py | 26 +++++++++++++++++++- schema/lvmdb/lvmopsdb.sql | 33 ++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5442e8ef..eb1ce29f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,8 @@ Changelog This document records the main changes to the ``sdssdb`` code. +* Add table and models for ``lvmopsdb.ln2_fill``. + * :release:`0.13.0 <2024-09-03>` * :feature:`264` Add metadata for the ``sdss_id_to_catalog`` table. * :feature:`266` Support PEP 621. diff --git a/python/sdssdb/peewee/lvmdb/lvmopsdb.py b/python/sdssdb/peewee/lvmdb/lvmopsdb.py index 745f66b6..466390b2 100644 --- a/python/sdssdb/peewee/lvmdb/lvmopsdb.py +++ b/python/sdssdb/peewee/lvmdb/lvmopsdb.py @@ -17,8 +17,9 @@ FloatField, ForeignKeyField, IntegerField, - TextField + TextField, ) +from playhouse.postgres_ext import JSONField from .. import BaseModel from . import database # noqa @@ -324,3 +325,26 @@ class GuiderCoAdd(LVMOpsBase): class Meta: table_name = 'guider_coadd' + + +class LN2Fill(LVMOpsBase): + pk = AutoField() + action = TextField() + start_time = DateTimeField() + end_time = DateTimeField() + purge_start = DateTimeField() + purge_complete = DateTimeField() + fill_start = DateTimeField() + fill_complete = DateTimeField() + fail_time = DateTimeField() + abort_time = DateTimeField() + failed = BooleanField() + aborted = BooleanField() + error = TextField() + log_file = TextField() + json_file = TextField() + configuration = JSONField() + log_data = JSONField() + + class Meta: + table_name = 'ln2_fill' diff --git a/schema/lvmdb/lvmopsdb.sql b/schema/lvmdb/lvmopsdb.sql index f644b0d8..e575e402 100644 --- a/schema/lvmdb/lvmopsdb.sql +++ b/schema/lvmdb/lvmopsdb.sql @@ -214,6 +214,25 @@ CREATE TABLE lvmopsdb.guider_coadd ( exposure_no INTEGER ); +CREATE TABLE lvmopsdb.ln2_fill ( + pk SERIAL PRIMARY KEY NOT NULL, + action TEXT, + start_time TIMESTAMPTZ, + end_time TIMESTAMPTZ, + purge_start TIMESTAMPTZ, + purge_complete TIMESTAMPTZ, + fill_start TIMESTAMPTZ, + fill_complete TIMESTAMPTZ, + fail_time TIMESTAMPTZ, + abort_time TIMESTAMPTZ, + failed BOOLEAN, + aborted BOOLEAN, + error TEXT, + log_file TEXT, + json_file TEXT, + configuration JSONB, + log_data JSONB +); -- constraints @@ -349,6 +368,18 @@ CREATE INDEX CONCURRENTLY standard_qc3_index ON lvmopsdb.standard (q3c_ang2ipix(ra, dec)); +CREATE INDEX ON lvmopsdb.ln2_fill (action); +CREATE INDEX ON lvmopsdb.ln2_fill (start_time); +CREATE INDEX ON lvmopsdb.ln2_fill (end_time); +CREATE INDEX ON lvmopsdb.ln2_fill (purge_start); +CREATE INDEX ON lvmopsdb.ln2_fill (purge_complete); +CREATE INDEX ON lvmopsdb.ln2_fill (fill_start); +CREATE INDEX ON lvmopsdb.ln2_fill (fill_complete); +CREATE INDEX ON lvmopsdb.ln2_fill (fail_time); +CREATE INDEX ON lvmopsdb.ln2_fill (abort_time); +CREATE INDEX ON lvmopsdb.ln2_fill (failed); +CREATE INDEX ON lvmopsdb.ln2_fill (aborted); + CLUSTER standard_qc3_index ON lvmopsdb.standard; CREATE INDEX CONCURRENTLY ON lvmopsdb.guider_coadd (exposure_no); @@ -368,5 +399,7 @@ lvmopsdb.completion_status to sdss_user; grant select on all tables in schema lvmopsdb to sdss_user; grant usage on all sequences in schema lvmopsdb to sdss_user; +grant insert on TABLE lvmopsdb.ln2_fill to sdss_user; + alter table lvmopsdb.sky add column darkest_wham_flag bool; alter table lvmopsdb.sky add column valid bool; From 5379c9656d21bc22aeaae817a3b7c3c3a5911f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Tue, 17 Sep 2024 11:26:22 -0700 Subject: [PATCH 27/30] Add plot_paths columns to lvmopsdb.ln2_fill --- python/sdssdb/peewee/lvmdb/lvmopsdb.py | 1 + schema/lvmdb/lvmopsdb.sql | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/python/sdssdb/peewee/lvmdb/lvmopsdb.py b/python/sdssdb/peewee/lvmdb/lvmopsdb.py index 466390b2..c2831967 100644 --- a/python/sdssdb/peewee/lvmdb/lvmopsdb.py +++ b/python/sdssdb/peewee/lvmdb/lvmopsdb.py @@ -345,6 +345,7 @@ class LN2Fill(LVMOpsBase): json_file = TextField() configuration = JSONField() log_data = JSONField() + plot_paths = JSONField() class Meta: table_name = 'ln2_fill' diff --git a/schema/lvmdb/lvmopsdb.sql b/schema/lvmdb/lvmopsdb.sql index e575e402..07494786 100644 --- a/schema/lvmdb/lvmopsdb.sql +++ b/schema/lvmdb/lvmopsdb.sql @@ -231,7 +231,8 @@ CREATE TABLE lvmopsdb.ln2_fill ( log_file TEXT, json_file TEXT, configuration JSONB, - log_data JSONB + log_data JSONB, + plot_paths JSONB ); -- constraints @@ -394,12 +395,11 @@ lvmopsdb.weather, lvmopsdb.observation_to_standard, lvmopsdb.observation_to_sky, lvmopsdb.exposure, -lvmopsdb.completion_status to sdss_user; +lvmopsdb.completion_status, +lvmopsdb.ln2_fill to sdss_user; grant select on all tables in schema lvmopsdb to sdss_user; grant usage on all sequences in schema lvmopsdb to sdss_user; -grant insert on TABLE lvmopsdb.ln2_fill to sdss_user; - alter table lvmopsdb.sky add column darkest_wham_flag bool; alter table lvmopsdb.sky add column valid bool; From 8000b375d96cf00228463535ca2d4cc305c9289a Mon Sep 17 00:00:00 2001 From: Pramod Gupta <61213683+astronomygupta@users.noreply.github.com> Date: Tue, 17 Sep 2024 11:29:41 -0700 Subject: [PATCH 28/30] add peewee models for gaia_dr3_source_g_lt_16 and gaia_dr2_source_g_lt_18 (#270) --- python/sdssdb/peewee/sdss5db/catalogdb.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/python/sdssdb/peewee/sdss5db/catalogdb.py b/python/sdssdb/peewee/sdss5db/catalogdb.py index da3be67d..47e0b37d 100644 --- a/python/sdssdb/peewee/sdss5db/catalogdb.py +++ b/python/sdssdb/peewee/sdss5db/catalogdb.py @@ -241,6 +241,13 @@ class Meta: table_name = 'gaia_dr2_source' +class Gaia_DR2_g_lt_18(CatalogdbModel): + source_id = BigIntegerField(primary_key=True) + + class Meta: + table_name = "gaia_dr2_source_g_lt_18" + + class Gaia_EDR3(CatalogdbModel): source_id = BigIntegerField(primary_key=True) @@ -257,6 +264,13 @@ class Meta: table_name = 'gaia_dr3_source' +class Gaia_DR3_g_lt_16(CatalogdbModel): + source_id = BigIntegerField(primary_key=True) + + class Meta: + table_name = "gaia_dr3_source_g_lt_16" + + class Gaia_DR2_Neighbourhood(CatalogdbModel): pkey = BigIntegerField(primary_key=True) From ac639d7475e7c5178c8699105ce16992ecf4cdce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Tue, 17 Sep 2024 14:05:16 -0700 Subject: [PATCH 29/30] Add column valve_times to ln2_fill table --- python/sdssdb/peewee/lvmdb/lvmopsdb.py | 1 + schema/lvmdb/lvmopsdb.sql | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/python/sdssdb/peewee/lvmdb/lvmopsdb.py b/python/sdssdb/peewee/lvmdb/lvmopsdb.py index c2831967..8c50424f 100644 --- a/python/sdssdb/peewee/lvmdb/lvmopsdb.py +++ b/python/sdssdb/peewee/lvmdb/lvmopsdb.py @@ -346,6 +346,7 @@ class LN2Fill(LVMOpsBase): configuration = JSONField() log_data = JSONField() plot_paths = JSONField() + valve_times = JSONField() class Meta: table_name = 'ln2_fill' diff --git a/schema/lvmdb/lvmopsdb.sql b/schema/lvmdb/lvmopsdb.sql index 07494786..1945ebe8 100644 --- a/schema/lvmdb/lvmopsdb.sql +++ b/schema/lvmdb/lvmopsdb.sql @@ -232,7 +232,8 @@ CREATE TABLE lvmopsdb.ln2_fill ( json_file TEXT, configuration JSONB, log_data JSONB, - plot_paths JSONB + plot_paths JSONB, + valve_times JSONB ); -- constraints From 1cf97d7b41be8002b1126c4010ad40483f6b7628 Mon Sep 17 00:00:00 2001 From: johndonor3 Date: Wed, 18 Sep 2024 08:39:05 -0600 Subject: [PATCH 30/30] model classes for CartonToSdssID and RSRunRoSdssID --- python/sdssdb/peewee/sdss5db/sandbox.py | 44 +++++++++++++++++++ .../load_table/metrics/created_views.sql | 43 +++++++----------- 2 files changed, 60 insertions(+), 27 deletions(-) diff --git a/python/sdssdb/peewee/sdss5db/sandbox.py b/python/sdssdb/peewee/sdss5db/sandbox.py index 6276fb31..32004021 100644 --- a/python/sdssdb/peewee/sdss5db/sandbox.py +++ b/python/sdssdb/peewee/sdss5db/sandbox.py @@ -361,3 +361,47 @@ class Epoch(TargetdbBase): class Meta: table_name = 'epoch' + + +class RsRunToSdssID(TargetdbBase): + assignment_pk = IntegerField() + mjd = FloatField() + catalogid = ForeignKeyField(column_name='catalogid', + field='catalogid', + model=catalogdb.Catalog, + null=False) + program = TextField() + carton = TextField() + label = TextField() # FIX! To instrument in net table load + default_lambda_eff = FloatField() + sdss_id = ForeignKeyField(column_name='sdss_id', + field='sdss_id', + model=catalogdb.SDSS_ID_flat, + null=False) + observatory = TextField() + done = IntegerField() + field_id = IntegerField() + + class Meta: + table_name = 'rs_run_to_sdssid' + + +class CartonToSdssID(TargetdbBase): + assignment_pk = IntegerField() + mjd = FloatField() + catalogid = ForeignKeyField(column_name='catalogid', + field='catalogid', + model=catalogdb.Catalog, + null=False) + program = TextField() + carton = TextField() + label = TextField() # FIX! To instrument in net table load + default_lambda_eff = FloatField() + sdss_id = ForeignKeyField(column_name='sdss_id', + field='sdss_id', + model=catalogdb.SDSS_ID_flat, + null=False) + nexp = IntegerField() + + class Meta: + table_name = 'carton_to_sdssid' diff --git a/schema/sdss5db/targetdb/load_table/metrics/created_views.sql b/schema/sdss5db/targetdb/load_table/metrics/created_views.sql index 9ba20393..d2608009 100644 --- a/schema/sdss5db/targetdb/load_table/metrics/created_views.sql +++ b/schema/sdss5db/targetdb/load_table/metrics/created_views.sql @@ -1,7 +1,7 @@ CREATE MATERIALIZED VIEW sandbox.rs_run_to_sdssid AS -select assn.pk as assignment_pk, at.mjd, t.catalogid, c.program, c.carton, -i.label, i.default_lambda_eff, sdssid.sdss_id, +select assn.pk as assignment_pk, at.mjd, t.catalogid, c.program, c.carton, +i.label as instrument, i.default_lambda_eff, sdssid.sdss_id, obs.label as observatory, at.status as done, f.field_id from targetdb.assignment_status as at @@ -18,29 +18,18 @@ join targetdb.field as f on f.pk = d2f.field_pk join targetdb.version as v on v.pk = f.version_pk where v.plan = 'eta-9'; --- CREATE MATERIALIZED VIEW sandbox.done_to_sdssid --- AS --- select at.mjd, t.catalogid, c.program, c.carton, --- i.label, i.default_lambda_eff, sdssid.sdss_id, --- obs.label as observatory --- from targetdb.assignment_status as at --- join targetdb.assignment as assn on assn.pk = at.assignment_pk --- join targetdb.hole as hole on hole.pk = assn.hole_pk --- join targetdb.observatory as obs on obs.pk = hole.observatory_pk --- join targetdb.carton_to_target as c2t on c2t.pk = assn.carton_to_target_pk --- join targetdb.target as t on c2t.target_pk = t.pk --- join targetdb.carton as c on c.pk = c2t.carton_pk --- join targetdb.instrument as i on i.pk = assn.instrument_pk --- join catalogdb.sdss_id_flat as sdssid on sdssid.catalogid = t.catalogid --- where at.status = 1; +CREATE MATERIALIZED VIEW sandbox.carton_to_sdssid +AS +select t.catalogid, c.program, c.carton, +i.label as instrument, +i.default_lambda_eff, sdssid.sdss_id, +(select sum(n) from unnest(cad.nexp) as n) as nexp +from targetdb.carton_to_target as c2t +join targetdb.target as t on c2t.target_pk = t.pk +join targetdb.carton as c on c.pk = c2t.carton_pk +join targetdb.cadence as cad on cad.pk = c2t.cadence_pk +join targetdb.instrument as i on i.pk = c2t.instrument_pk +join catalogdb.sdss_id_flat as sdssid on sdssid.catalogid = t.catalogid +where c.version_pk >= 136; --- CREATE MATERIALIZED VIEW sandbox.carton_to_sdssid --- AS --- select t.catalogid, c.program, c.carton, --- i.label, i.default_lambda_eff, sdssid.sdss_id --- from targetdb.carton_to_target as c2t --- join targetdb.target as t on c2t.target_pk = t.pk --- join targetdb.carton as c on c.pk = c2t.carton_pk --- join targetdb.instrument as i on i.pk = c2t.instrument_pk --- join catalogdb.sdss_id_flat as sdssid on sdssid.catalogid = t.catalogid --- where c.version_pk >= 136; +-- TO DO: use Tom's targeting generation table once it's on pipelines