Skip to content

Commit

Permalink
README attributions; Avoid all sources masked crash; Fix astropy vers…
Browse files Browse the repository at this point in the history
…ion testing.
  • Loading branch information
mkelley committed Jan 27, 2019
1 parent 15f00a5 commit 2e0751b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Michael Kelley
Copyright (c) 2018-2019 University of Maryland and the calviacat contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# calviacat v1.0.1
# calviacat v1.0.2
Calibrate star photometry by comparison to a catalog. PanSTARRS 1 and SkyMapper catalogs currently implemented. Catalog queries are cached so that subsequent calibrations of the same or similar fields can be more quickly executed.

## Attribution and license

calviacat is written by Michael S. P. Kelley, with contributions from: Tim Lister. It is licensed with the MIT License (see LICENSE for details).

## Requirements

* sqlite3
Expand Down
25 changes: 20 additions & 5 deletions calviacat/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@
from astropy.coordinates import SkyCoord
from astropy.stats import sigma_clipped_stats, sigma_clip
from astropy.modeling import models, fitting
from astropy.version import version_info as astropy_version

try:
from astropy.version import version_info as astropy_version
except ImportError:
import astropy.version
astropy_version = [int(x) for x in astropy.version.version.split('.')]


class CalibrationError(Exception):
pass


class TableDefinition:
Expand Down Expand Up @@ -418,10 +427,16 @@ def cal_color(self, matched, m_inst, filt, color, C=None,
fitting.LinearLSQFitter(), sigma_clip)

i = np.isfinite(dm) * ~dm.mask
if astropy_version[0] > 3 or (astropy_version[0] == 3 and astropy_version[1] >= 1):
# Return order changed in astropy 3.1 (http://docs.astropy.org/en/stable/changelog.html#id10)
# Also now returns a boolean mask array rather than a MaskedArray of the data which could
# be applied back to reconstuct 'line' if needed (not currently used)
if sum(i) == 0:
raise CalibrationError('All sources masked.')

if (astropy_version[0] > 3 or
(astropy_version[0] == 3 and astropy_version[1] >= 1)):
# Return order changed in astropy 3.1
# (http://docs.astropy.org/en/stable/changelog.html#id10)
# Also now returns a boolean mask array rather than a
# MaskedArray of the data which could be applied back to
# reconstuct 'line' if needed (not currently used)
fit, mask = fitter(model, cindex[i], dm[i])
else:
line, fit = fitter(model, cindex[i], dm[i])
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from distutils.core import setup

setup(name='calviacat',
version='1.0.1',
version='1.0.2',
description='Calibrate star photometry by comparison to a catalog.',
author='Michael S. P. Kelley',
author_email='msk@astro.umd.edu',
Expand Down

0 comments on commit 2e0751b

Please sign in to comment.