Skip to content

Commit

Permalink
workaround if astropy.wcs fails on distortion parameters, docs updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Mommert committed Mar 3, 2017
1 parent 8d84d31 commit f688011
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 40 deletions.
68 changes: 41 additions & 27 deletions diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,19 +345,26 @@ def add_registration(data, extraction_data):

# plot reference sources
if refcat.shape[0] > 0:
w = wcs.WCS(header)
world_coo = numpy.array(list(zip(refcat['ra.deg'],
refcat['dec.deg'])))
img_coo = w.wcs_world2pix(world_coo, True )
img_coo = [c for c in img_coo if (c[0] > 0 and c[1] > 0 and
c[0] < header[obsparam['extent'][0]]
and
c[1] < header[obsparam['extent'][1]])]
plt.scatter([c[0]*resize_factor for c in img_coo],
[c[1]*resize_factor for c in img_coo],
s=5, marker='o', edgecolors='red', linewidth=0.1,
facecolor='none')
try:
w = wcs.WCS(header)
world_coo = numpy.array(list(zip(refcat['ra.deg'],
refcat['dec.deg'])))
img_coo = w.wcs_world2pix(world_coo, True )
img_coo = [c for c
in img_coo if (c[0] > 0 and c[1] > 0 and
c[0] < header[obsparam['extent'][0]]
and
c[1] < header[obsparam['extent'][1]])]
plt.scatter([c[0]*resize_factor for c in img_coo],
[c[1]*resize_factor for c in img_coo],
s=5, marker='o', edgecolors='red', linewidth=0.1,
facecolor='none')
except astropy.wcs._wcs.InvalidTransformError:
logging.error('could not plot reference sources due to '
'astropy.wcs._wcs.InvalidTransformError; '
'most likely unknown distortion parameters.')


plt.savefig(framefilename, format='png', bbox_inches='tight',
pad_inches=0, dpi=200)
plt.close()
Expand Down Expand Up @@ -664,21 +671,28 @@ def add_calibration(data):

# plot reference sources
if len(dat['match'][0][3]) > 0 and len(dat['match'][0][4]) > 0:
w = wcs.WCS(header)
world_coo = [[dat['match'][0][3][idx], dat['match'][0][4][idx]] \
for idx in dat['zp_usedstars']]
img_coo = w.wcs_world2pix(world_coo, True )
print(img_coo)
plt.scatter([c[0]*resize_factor for c in img_coo],
[c[1]*resize_factor for c in img_coo],
s=10, marker='o', edgecolors='red', linewidth=0.1,
facecolor='none')
for i in range(len(dat['zp_usedstars'])):
plt.annotate(str(i+1), xy=((img_coo[i][0]*resize_factor)+15,
img_coo[i][1]*resize_factor),
color='red', horizontalalignment='left',
verticalalignment='center')

try:
w = wcs.WCS(header)
world_coo = [[dat['match'][0][3][idx],
dat['match'][0][4][idx]] \
for idx in dat['zp_usedstars']]
img_coo = w.wcs_world2pix(world_coo, True )

plt.scatter([c[0]*resize_factor for c in img_coo],
[c[1]*resize_factor for c in img_coo],
s=10, marker='o', edgecolors='red', linewidth=0.1,
facecolor='none')
for i in range(len(dat['zp_usedstars'])):
plt.annotate(str(i+1), xy=((img_coo[i][0]*resize_factor)+15,
img_coo[i][1]*resize_factor),
color='red', horizontalalignment='left',
verticalalignment='center')
except astropy.wcs._wcs.InvalidTransformError:
logging.error('could not plot reference sources due to '
'astropy.wcs._wcs.InvalidTransformError; '
'most likely unknown distortion parameters.')


plt.savefig(catframe, format='png', bbox_inches='tight',
pad_inches=0, dpi=200)
plt.close()
Expand Down
9 changes: 1 addition & 8 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,8 @@ Mommert 2016) are documented here.

* 2017-02-04: catalog.data is now an astropy.table, catalog downloads using astroquery.vizier (no effect to the user), pp now supports Gaia DR1 (CMC, USNOB1, and PPMX have been removed)

* 2017-02-24: ``pillow`` is now a required python module; the pipeline now supports default distortion parameters for wide-field cameras

TBD
===

A list of things that will be implemented in the future:

* Pan-STARRS support for photometric calibration
* compatibility with Python 3
* fully exploit astropy.table functionality in catalog class
* implement image combination using SWARP
* better support for satellite observations

4 changes: 1 addition & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.autosummary',
'numpydoc'
]
'sphinx.ext.autosummary']

numpydoc_show_class_members = False

Expand Down
4 changes: 2 additions & 2 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Python 2.7 modules (available from the `Python Package Index`_ through
* `matplotlib`_
* `callhorizons`_
* `future`_
* `Pillow`_ (only required for manual target identification)
* `pillow`_


and some freely available software:
Expand Down Expand Up @@ -144,7 +144,7 @@ and I will take care of implementing your telescope.
.. _matplotlib: http://matplotlib.org/
.. _callhorizons: https://pypi.python.org/pypi/CALLHORIZONS
.. _future: http://python-future.org/
.. _Pillow: http://python-pillow.org/
.. _pillow: http://python-pillow.org/
.. _Source Extractor: http://www.astromatic.net/software/sextractor
.. _SCAMP: http://www.astromatic.net/software/scamp
.. _r345: http://www.astromatic.net/wsvn/public/dl.php?repname=public+software.scamp&path=%2Ftrunk%2F&rev=0&isdir=1
Expand Down
8 changes: 8 additions & 0 deletions doc/problems.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ General Problems
symbolic link to ``pp_run.py``; if the former does not work, try
the latter.


**Running the pipeline creates warnings (e.g., FutureWarning); what
should I do?**
Warnings are usually caused by Python module version issues and
cause no harm whatsoever. In theory, there should be no warnings,
but they happen occasionally. If you are haunted by some warnings,
let me know and I will try to resolve the issue.

pp_calibrate (Photometric Calibration)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
7 changes: 7 additions & 0 deletions doc/supported.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ observatories/instruments:
| Discovery Channel | Large Monolithic | DCTLMI |
| Telescope | Imager | |
+--------------------------+--------------------+----------------+
| KMTnet SAAO | --- * | KMTNETS |
+--------------------------+--------------------+----------------+
| Lowell 31" | NASACAM | LOWELL31 |
+--------------------------+--------------------+----------------+
| Lowell 42" | NASA42 | LOWELL42 |
Expand All @@ -46,6 +48,11 @@ observatories/instruments:
| Generic Telescope | any | GENERIC |
+--------------------------+--------------------+----------------+

*: This camera is a multi-detector instrument; it is recommended to
split multi-extension FITS frames from this instrument into
individual single-extension FITS images and to run the pipeline on
these individual FITS images.
If you would like to use the pipeline for other observatories, please
contact me.

Expand Down

0 comments on commit f688011

Please sign in to comment.