Skip to content

Commit

Permalink
Configurable SkyMapper release.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkelley committed Mar 25, 2021
1 parent 9f68a66 commit 78a63be
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions calviacat/skymapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
('z_flags', 'INTEGER'),
('z_ngood', 'INTEGER'),
('class_star', 'FLOAT'),
('a', 'FLOAT'),
('e_a', 'FLOAT'),
('b', 'FLOAT'),
('e_b', 'FLOAT'),
('u_psf', 'FLOAT'),
('e_u_psf', 'FLOAT'),
('v_psf', 'FLOAT'),
Expand All @@ -57,7 +53,33 @@


class SkyMapper(Catalog):
def __init__(self, dbfile, max_records=2000, **kwargs):
"""Calibrate to SkyMapper catalog data.
Parameters
----------
dbfile : string
Sqlite3 database file name. If a database at the provided file name
does not exist, a new one will be created.
max_records : int, optional
Maximum number of records to return from online queries to SkyMapper.
dr : int
Use this SkyMapper data release number.
logger : Logger
Use this python logger for logging.
match_limit : astropy Quantity
Plane of sky tolerance for catalog matches.
min_matches : int
Throw an error if fewer than this many matches are found.
"""

def __init__(self, dbfile, max_records=2000, dr=2, **kwargs):
filter2col = {}
for f in 'uvgriz':
filter2col[f] = {
Expand All @@ -66,6 +88,7 @@ def __init__(self, dbfile, max_records=2000, **kwargs):
}
skym = TableDefinition('skymapper', COLUMN_DEFS, 'object_id',
'raj2000', 'dej2000', filter2col)
self.dr = dr
super().__init__(dbfile, skym, max_records=max_records, **kwargs)

def fetch_field(self, sources, scale=1.25):
Expand All @@ -91,11 +114,12 @@ def fetch_field(self, sources, scale=1.25):
q = '''
SELECT TOP {max}
{columns}
FROM dr1.master
FROM dr{dr}.master
WHERE 1=CONTAINS(POINT('ICRS', raj2000, dej2000),
CIRCLE('ICRS', {ra}, {dec}, {sr}))
ORDER BY ngood DESC
'''.format(
dr=self.dr,
max=self.max_records,
columns=','.join(self.table.columns),
ra=np.mean(sources.ra.deg),
Expand Down

0 comments on commit 78a63be

Please sign in to comment.