Skip to content

Commit

Permalink
Merge pull request #40 from sdss/skymapper_dr2_peewee
Browse files Browse the repository at this point in the history
Skymapper dr2 peewee
  • Loading branch information
astronomygupta authored Oct 13, 2020
2 parents f02d896 + c9b0556 commit e0619aa
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
42 changes: 42 additions & 0 deletions python/sdssdb/peewee/sdss5db/catalogdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,48 @@ class Meta:
table_name = 'skymapper_dr1_1'


class SkyMapper_DR2(CatalogdbModel):

object_id = BigIntegerField(primary_key=True)

allwise = ForeignKeyField(AllWise, field='cntr',
column_name='allwise_cntr',
object_id_name='allwise_cntr',
backref='skymapper_dr2')

gaia = ForeignKeyField(Gaia_DR2, field='source_id',
column_name='gaia_dr2_id1',
object_id_name='gaia_dr2_id1',
backref='skymapper_dr2')

tic = ForeignKeyField(TIC_v8,
field='gaia_int',
column_name='gaia_dr2_id1',
object_id_name='gaia_dr2_id1',
backref='+')

@property
def twomass1(self):
"""Returns the closest 2MASS PSC source, if defined."""

if self.twomass_cat1 != 'PSC':
return None

return TwoMassPSC.get(pts_key=self.twomass_key1)

@property
def twomass2(self):
"""Returns the second closest 2MASS PSC source, if defined."""

if self.twomass_cat2 != 'PSC':
return None

return TwoMassPSC.get(pts_key=self.twomass_key2)

class Meta:
table_name = 'skymapper_dr2'


class PS1_g18(CatalogdbModel):

objid = BigIntegerField(primary_key=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
\o skymapper_dr2_alter_table_fkey.out

ALTER TABLE catalogdb.skymapper_dr2
ADD FOREIGN KEY (allwise_cntr)
REFERENCES catalogdb.allwise(cntr);

ALTER TABLE catalogdb.skymapper_dr2
ADD FOREIGN KEY (gaia_dr2_id2)
REFERENCES catalogdb.gaia_dr2_source(source_id);

ALTER TABLE catalogdb.skymapper_dr2
ADD FOREIGN KEY (gaia_dr2_id1)
REFERENCES catalogdb.gaia_dr2_source(source_id);

\o

0 comments on commit e0619aa

Please sign in to comment.