coordinates – Coordinates transformation

tangent_projection – Tangent projection transformation

Tangent projection transformation: a wrapper around astropy.wcs.WCS

Examples

Example of use of this module:

>>> ra0 = 0.
>>> dec0 = 70.
>>> rot = 0.
>>> x_in, y_in = 10., 0.
>>> # multiply by -1 to make positive x point east for 0 Deg rotation
>>> tp = TangentPlane(ra0=ra0, dec0=dec0, rot=rot, x_scale= -1, y_scale=1)
>>> ra, dec = tp.xy2raDec(x_in, y_in)
>>> x_out, y_out = tp.raDec2xy(ra, dec)
>>> ra -= 360
>>> print((ra).round(8), dec.round(8))
-0.00812168 69.99999981
>>> print(x_out.round(8), y_out.round(8))
10.0 0.0
>>> print(abs(x_out - x_in) < 1e-10, abs(y_out - y_in) < 1e-10)
True True
>>> # Naive calculation
>>> import numpy as np
>>> print(round(-1. * (ra - ra0) * 3600. * np.cos(np.deg2rad(dec0)), 8))
9.99999993
>>> print(round((dec - dec0) * 3600., 8))
-0.00066601
class pyhetdex.coordinates.tangent_projection.TangentPlane(ra0, dec0, rot, x_scale=-1.0, y_scale=1.0)[source]

Class to do tangent plane and inverse tangent plane transformations

Creates a WCS object for tangent plane projections by creating a FITS header and feeding it to astropy

Parameters:
ra0, dec0 : float

tangent point, i.e. x=0, y=0 in tangent plane (in deg.)

rot : float

rotation angle, clockwise from North (in deg.)

x_scale, y_scale : float, optional

plate scale (arcsec per pixel).

Attributes:
w : WCS

a WCS object to store the tangent plane info

raDec2xy(ra, dec)[source]

Return the x, y position in the tangent plane for a given ra, dec

Parameters:
ra, dec : float or array

the input position (in degrees)

Returns:
x, y : array

the x and y position in arcseconds

xy2raDec(x, y)[source]

Return the ra, dec position in the tangent plane for a given x, y

Parameters:
x, y : floats or arrays

the input position (in arcseconds)

Returns:
ra, dec : array

the ra and dec position in degrees

astrometry – Routines to add Astrometry Information

Astrometry module

Module to add astrometry to HETDEX catalgoues and images

pyhetdex.coordinates.astrometry.add_ifu_xy(args=None)[source]

Convert ra, dec to x, y in an IFU.

Parameters:
args : list of strings, optional

command line

pyhetdex.coordinates.astrometry.add_ra_dec(args=None)[source]

Add ra, dec to detect, daophot catalogues and IFU cen files

Parameters:
args : list of strings, optional

command line

pyhetdex.coordinates.astrometry.add_wcs(args=None)[source]

Add WCS to fits file

Parameters:
args : list of strings, optional

command line

pyhetdex.coordinates.astrometry.ihmp_astrometry(opts, xscale=1.0, yscale=1.0)[source]

Set up a tangent plane projection from parsed command line arguments from ArgParse

Parameters:
opts :

command line options, either ‘image’ for a fits file with TELRA, TELDEC, PARANGLE, MJD or and ‘astrometry’ option to manually specify coordinates

xscale, yscale : float

number of arcseconds per pixel for the WCS header created (default 1,1)

Returns:
tp : pyhetdex.coordinates.tangent_projection.TangentPlane

tangent plane object to use for astrometry

pyhetdex.coordinates.astrometry.ra_dec_to_xy(ra, dec, fplane, tp)[source]

Given ras and a decs, return a table of x, y of the nearest IFU, x and y in the focal plane and IFU slot of nearest IFU

Parameters:
ra, dec : float arrays

ra and dec on objects in decmal degrees

fplane : pyhetdex.het.fplane:FPlane class

an instance of the focal plane class

tp : pyhetdex.coordinates.tangent_projection:TangentPlane

a tangent plane that converts ra, dec to the appropriate x,y in axes aligned with the IFU axes

Returns:
table : astropy.table:Table

an astropy table containing the positions in the IFUs

pyhetdex.coordinates.astrometry.xy_to_ra_dec(args=None)[source]

Convert between x y within an IFU and ra, dec

Parameters:
args : list of strings, optional

command line