This PR solves #51 . The code will be able to accept either pixel coordinates and quantities as well as sky coordianates and astropy quantities. Here are some details of the implementation:
frame.get_pixel now expects SkyCoord objects (or list of) and returns pixel coordinates as arrays and frame.get_sky_coord expects pixel coordiantes as arrays and returns SkyCoord (or list of), to remove any ambiguity. If it's an array, then it is pixel coordinates, if it is SkyCoord, then it is sky coordinates.
Anytime a SkyCoord of u.Quantity object is used in __init__, it looks for the scene and convert it to pixels
Same thing for Parameter, but in addition:
a. I had to move the content of set_constraint() from the Parameter.__init__ to Parameter.__iadd__because we need to convert the constraints parameters to pixels before checking the constraints, which expects arrays and floating arguments.
b. numpyro priors require a special treatement because we not only need to update the distribution parameters (e.g. loc and scale) but also the batch and event shape. For instance
Simplified frame.get_sky_coord as suggested and changed frame.get_pixel accordingly. Also updated the conversion now performed in arcsec. The tests in the notebook still pass!
This PR solves #51 . The code will be able to accept either pixel coordinates and quantities as well as sky coordianates and astropy quantities. Here are some details of the implementation:
frame.get_pixel
now expectsSkyCoord
objects (or list of) and returns pixel coordinates as arrays andframe.get_sky_coord
expects pixel coordiantes as arrays and returnsSkyCoord
(or list of), to remove any ambiguity. If it's an array, then it is pixel coordinates, if it isSkyCoord
, then it is sky coordinates.SkyCoord
ofu.Quantity
object is used in__init__
, it looks for the scene and convert it to pixelsParameter
, but in addition: a. I had to move the content ofset_constraint()
from theParameter.__init__
toParameter.__iadd__
because we need to convert the constraints parameters to pixels before checking the constraints, which expects arrays and floating arguments. b. numpyro priors require a special treatement because we not only need to update the distribution parameters (e.g. loc and scale) but also the batch and event shape. For instancewould set
batch_shape=0
andevent_shape=0
and converting loc and scale to pixels does not automatically update the batch_shape, whilewould set
batch_shape=2
andevent_shape=0
Here is a notebook which uses
SkyCoord
andu.Quantity
for all fieldname in ['node', 'constraint', 'prior', 'stepsize']