-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds ORM for sqla for sdss5db (#224)
* adding apogee schema to post connect reflect * adding init for sdss5db in sqla * adding init orm for targetdb and apogeedb * add schema for opsdb * updating orms * updating some docs * fixing opsdb schema * updating apogee drp * adding init schema of catalogdb * remove duplicate tables, add s to status * adding boss_drp orm * updating docs for boss_drp * linting * fixing linting * remove sqa instrument duplciate * updating array fields in boss * adding a note to revised_magnitude table --------- Co-authored-by: johndonor3 <[email protected]>
- Loading branch information
1 parent
3d044fc
commit 417d88c
Showing
15 changed files
with
12,046 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,317 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# | ||
|
||
# Code generated by: | ||
# python -m pwiz -e postgresql sdss5db -s boss_drp -i -o -H localhost -p 6000 -u u0857802 | ||
# Date: September 28, 2023 11:13AM | ||
# Database: sdss5db | ||
# Peewee version: 3.15.1 | ||
|
||
|
||
from peewee import (AutoField, BigIntegerField, BlobField, BooleanField, CharField, DateTimeField, | ||
FloatField, ForeignKeyField, IntegerField, DoubleField, SmallIntegerField) | ||
from peewee import SQL | ||
from playhouse.postgres_ext import ArrayField | ||
|
||
from .. import BaseModel | ||
from . import database # noqa | ||
|
||
|
||
class BossBase(BaseModel): | ||
|
||
class Meta: | ||
schema = 'boss_drp' | ||
database = database | ||
|
||
|
||
class BossVersion(BossBase): | ||
id = AutoField() | ||
ipl = SmallIntegerField(null=True) | ||
run2d = CharField(null=True) | ||
run1d = CharField(null=True) | ||
is_default = BooleanField(null=True) | ||
is_epoch = BooleanField(null=True) | ||
is_custom = BooleanField(null=True) | ||
custom_name = CharField(null=True) | ||
created = DateTimeField(null=True) | ||
modified = DateTimeField(constraints=[SQL("DEFAULT now()")], null=True) | ||
|
||
class Meta: | ||
table_name = 'boss_version' | ||
|
||
|
||
class BossField(BossBase): | ||
id = AutoField() | ||
boss_version = ForeignKeyField(column_name='boss_version_id', field='id', model=BossVersion) | ||
field = IntegerField(null=True) | ||
designs = CharField(null=True) | ||
configs = CharField(null=True) | ||
mjd = IntegerField(null=True) | ||
observatory = CharField(null=True) | ||
run2d = CharField(null=True) | ||
run1d = CharField(null=True) | ||
racen = FloatField(null=True) | ||
deccen = FloatField(null=True) | ||
epoch = FloatField(null=True) | ||
cartid = CharField(null=True) | ||
tai = DoubleField(null=True) | ||
tai_beg = DoubleField(null=True) | ||
tai_end = DoubleField(null=True) | ||
airmass = FloatField(null=True) | ||
exptime = FloatField(null=True) | ||
mapname = CharField(null=True) | ||
tileid = IntegerField(null=True) | ||
designid = IntegerField(null=True) | ||
survey = CharField(null=True) | ||
programname = CharField(null=True) | ||
chunk = CharField(null=True) | ||
fieldquality = CharField(null=True) | ||
fieldsn2 = FloatField(null=True) | ||
deredsn2 = FloatField(null=True) | ||
qsurvey = IntegerField(null=True) | ||
mjdlist = CharField(null=True) | ||
nexp = IntegerField(null=True) | ||
nexp_b1 = IntegerField(null=True) | ||
nexp_r1 = IntegerField(null=True) | ||
nexp_b2 = IntegerField(null=True) | ||
nexp_r2 = IntegerField(null=True) | ||
expt_b1 = FloatField(null=True) | ||
expt_r1 = FloatField(null=True) | ||
expt_b2 = FloatField(null=True) | ||
expt_r2 = FloatField(null=True) | ||
sn2_g1 = FloatField(null=True) | ||
sn2_r1 = FloatField(null=True) | ||
sn2_i1 = FloatField(null=True) | ||
sn2_g2 = FloatField(null=True) | ||
sn2_r2 = FloatField(null=True) | ||
sn2_i2 = FloatField(null=True) | ||
goffstd = FloatField(null=True) | ||
grmsstd = FloatField(null=True) | ||
roffstd = FloatField(null=True) | ||
rrmsstd = FloatField(null=True) | ||
ioffstd = FloatField(null=True) | ||
irmsstd = FloatField(null=True) | ||
groffstd = FloatField(null=True) | ||
grrmsstd = FloatField(null=True) | ||
rioffstd = FloatField(null=True) | ||
rirmsstd = FloatField(null=True) | ||
goffgal = FloatField(null=True) | ||
grmsgal = FloatField(null=True) | ||
roffgal = FloatField(null=True) | ||
rrmsgal = FloatField(null=True) | ||
ioffgal = FloatField(null=True) | ||
irmsgal = FloatField(null=True) | ||
groffgal = FloatField(null=True) | ||
grrmsgal = FloatField(null=True) | ||
rioffgal = FloatField(null=True) | ||
rirmsgal = FloatField(null=True) | ||
nguide = IntegerField(null=True) | ||
seeing20 = FloatField(null=True) | ||
seeing50 = FloatField(null=True) | ||
seeing80 = FloatField(null=True) | ||
rmsoff20 = FloatField(null=True) | ||
rmsoff50 = FloatField(null=True) | ||
rmsoff80 = FloatField(null=True) | ||
airtemp = FloatField(null=True) | ||
xsigma = FloatField(null=True) | ||
xsigmin = FloatField(null=True) | ||
xsigmax = FloatField(null=True) | ||
wsigma = FloatField(null=True) | ||
wsigmin = FloatField(null=True) | ||
wsigmax = FloatField(null=True) | ||
xchi2 = FloatField(null=True) | ||
xchi2min = FloatField(null=True) | ||
xchi2max = FloatField(null=True) | ||
skychi2 = FloatField(null=True) | ||
schi2min = FloatField(null=True) | ||
schi2max = FloatField(null=True) | ||
fbadpix = FloatField(null=True) | ||
fbadpix1 = FloatField(null=True) | ||
fbadpix2 = FloatField(null=True) | ||
n_total = IntegerField(null=True) | ||
n_galaxy = IntegerField(null=True) | ||
n_qso = IntegerField(null=True) | ||
n_star = IntegerField(null=True) | ||
n_unknown = IntegerField(null=True) | ||
n_sky = IntegerField(null=True) | ||
n_std = IntegerField(null=True) | ||
n_target_qso = IntegerField(null=True) | ||
n_target_main = IntegerField(null=True) | ||
n_target_lrg1 = IntegerField(null=True) | ||
n_target_elg = IntegerField(null=True) | ||
success_main = FloatField(null=True) | ||
success_lrg1 = FloatField(null=True) | ||
success_lrg2 = FloatField(null=True) | ||
success_elg = FloatField(null=True) | ||
success_qso = FloatField(null=True) | ||
status2d = CharField(null=True) | ||
statuscombine = CharField(null=True) | ||
status1d = CharField(null=True) | ||
public = CharField(null=True) | ||
qualcomments = CharField(null=True) | ||
moon_frac = FloatField(null=True) | ||
created = DateTimeField(null=True) | ||
modified = DateTimeField(constraints=[SQL("DEFAULT now()")], null=True) | ||
|
||
class Meta: | ||
table_name = 'boss_field' | ||
|
||
|
||
class BossSpectrum(BossBase): | ||
id = AutoField() | ||
boss_version = ForeignKeyField(column_name='boss_version_id', field='id', model=BossVersion) | ||
field = SmallIntegerField(null=True) | ||
mjd = IntegerField(null=True) | ||
mjd_final = FloatField(null=True) | ||
obs = CharField(null=True) | ||
run2d = CharField(null=True) | ||
run1d = CharField(null=True) | ||
nexp = SmallIntegerField(null=True) | ||
exptime = FloatField(null=True) | ||
target_index = IntegerField(null=True) | ||
spec_file = CharField(null=True) | ||
programname = CharField(null=True) | ||
survey = CharField(null=True) | ||
cadence = CharField(null=True) | ||
firstcarton = CharField(null=True) | ||
sdss5_target_flags = BlobField(null=True) | ||
objtype = CharField(null=True) | ||
catalogid = BigIntegerField(null=True) | ||
sdss_id = BigIntegerField(null=True) | ||
specobjid = BigIntegerField(null=True) | ||
calibflux = FloatField(null=True) | ||
calibflux_ivar = FloatField(null=True) | ||
optical_prov = CharField(null=True) | ||
mag = ArrayField(FloatField, null=True) # ARRAY | ||
psfmag = ArrayField(FloatField, null=True) # ARRAY | ||
fiber2mag = ArrayField(FloatField, null=True) # ARRAY | ||
catdb_mag = ArrayField(FloatField, null=True) # ARRAY | ||
gaia_bp_mag = FloatField(null=True) | ||
gaia_rp_mag = FloatField(null=True) | ||
gaia_g_mag = FloatField(null=True) | ||
gaia_id = BigIntegerField(null=True) | ||
wise_mag = ArrayField(FloatField, null=True) # ARRAY | ||
twomass_mag = ArrayField(FloatField, null=True) # ARRAY | ||
guvcat_mag = ArrayField(FloatField, null=True) # ARRAY | ||
ebv = FloatField(null=True) | ||
ebv_type = CharField(null=True) | ||
fiber_ra = DoubleField(null=True) | ||
fiber_dec = DoubleField(null=True) | ||
plug_ra = DoubleField(null=True) | ||
plug_dec = DoubleField(null=True) | ||
racat = DoubleField(null=True) | ||
deccat = DoubleField(null=True) | ||
coord_epoch = FloatField(null=True) | ||
pmra = FloatField(null=True) | ||
pmdec = FloatField(null=True) | ||
parallax = FloatField(null=True) | ||
fiber_offset = IntegerField(null=True) | ||
lambda_eff = FloatField(null=True) | ||
healpix = IntegerField(null=True) | ||
healpixgrp = SmallIntegerField(null=True) | ||
healpix_dir = CharField(null=True) | ||
fieldquality = CharField(null=True) | ||
exp_disp_med = DoubleField(null=True) | ||
fieldsn2 = FloatField(null=True) | ||
spec1_g = FloatField(null=True) | ||
spec1_r = FloatField(null=True) | ||
spec1_i = FloatField(null=True) | ||
spec2_g = FloatField(null=True) | ||
spec2_r = FloatField(null=True) | ||
spec2_i = FloatField(null=True) | ||
sn_median = ArrayField(FloatField, null=True) # ARRAY | ||
sn_median_all = FloatField(null=True) | ||
airmass = FloatField(null=True) | ||
seeing20 = FloatField(null=True) | ||
seeing50 = FloatField(null=True) | ||
seeing80 = FloatField(null=True) | ||
moon_dist = FloatField(null=True) | ||
moon_phase = FloatField(null=True) | ||
assigned = BooleanField(null=True) | ||
on_target = BooleanField(null=True) | ||
valid = BooleanField(null=True) | ||
decollided = BooleanField(null=True) | ||
anyandmask = IntegerField(null=True) | ||
anyormask = IntegerField(null=True) | ||
specprimary = SmallIntegerField(null=True) | ||
specboss = SmallIntegerField(null=True) | ||
boss_specobj_id = IntegerField(null=True) | ||
nspecobs = SmallIntegerField(null=True) | ||
spectroflux = ArrayField(FloatField, null=True) # ARRAY | ||
spectroflux_ivar = ArrayField(FloatField, null=True) # ARRAY | ||
spectrosynflux = ArrayField(FloatField, null=True) # ARRAY | ||
spectrosynflux_ivar = ArrayField(FloatField, null=True) # ARRAY | ||
spectroskyflux = ArrayField(FloatField, null=True) # ARRAY | ||
wavemin = FloatField(null=True) | ||
wavemax = FloatField(null=True) | ||
wcoverage = FloatField(null=True) | ||
objclass = CharField(null=True) | ||
subclass = CharField(null=True) | ||
z = FloatField(null=True) | ||
z_err = FloatField(null=True) | ||
zwarning = IntegerField(null=True) | ||
rchi2 = FloatField(null=True) | ||
dof = IntegerField(null=True) | ||
rchi2diff = FloatField(null=True) | ||
tfile = CharField(null=True) | ||
vdisp = FloatField(null=True) | ||
vdisp_err = FloatField(null=True) | ||
vdispz = FloatField(null=True) | ||
vdispz_err = FloatField(null=True) | ||
vdispchi2 = FloatField(null=True) | ||
vdispnpix = FloatField(null=True) | ||
vdispdof = IntegerField(null=True) | ||
chi68p = FloatField(null=True) | ||
z_noqso = FloatField(null=True) | ||
z_err_noqso = FloatField(null=True) | ||
znum_noqso = IntegerField(null=True) | ||
zwarning_noqso = IntegerField(null=True) | ||
class_noqso = CharField(null=True) | ||
subclass_noqso = CharField(null=True) | ||
rchi2diff_noqso = FloatField(null=True) | ||
xcsao_rv = FloatField(null=True) | ||
xcsao_erv = FloatField(null=True) | ||
xcsao_rxc = FloatField(null=True) | ||
xcsao_teff = FloatField(null=True) | ||
xcsao_eteff = FloatField(null=True) | ||
xcsao_logg = FloatField(null=True) | ||
xcsao_elogg = FloatField(null=True) | ||
xcsao_feh = FloatField(null=True) | ||
xcsao_efeh = FloatField(null=True) | ||
created = DateTimeField(null=True) | ||
modified = DateTimeField(constraints=[SQL("DEFAULT now()")], null=True) | ||
|
||
class Meta: | ||
table_name = 'boss_spectrum' | ||
|
||
|
||
class BossSpectrumLine(BossBase): | ||
id = AutoField() | ||
boss_version = ForeignKeyField(column_name='boss_version_id', field='id', model=BossVersion) | ||
field = IntegerField(null=True) | ||
mjd = IntegerField(null=True) | ||
target_index = IntegerField(null=True) | ||
catalogid = BigIntegerField(null=True) | ||
sdss_id = BigIntegerField(null=True) | ||
linename = CharField(null=True) | ||
linewave = DoubleField(null=True) | ||
linez = FloatField(null=True) | ||
linez_err = FloatField(null=True) | ||
linesigma = FloatField(null=True) | ||
linesigma_err = FloatField(null=True) | ||
linearea = FloatField(null=True) | ||
linearea_err = FloatField(null=True) | ||
lineew = FloatField(null=True) | ||
lineew_err = FloatField(null=True) | ||
linecontlevel = FloatField(null=True) | ||
linecontlevel_err = FloatField(null=True) | ||
linenpixleft = IntegerField(null=True) | ||
linenpixright = IntegerField(null=True) | ||
linedof = FloatField(null=True) | ||
linechi2 = FloatField(null=True) | ||
created = DateTimeField(null=True) | ||
modified = DateTimeField(constraints=[SQL("DEFAULT now()")], null=True) | ||
|
||
class Meta: | ||
table_name = 'boss_spectrum_line' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.