aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/utils
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-07-19 16:34:40 +0800
committerAaron LI <aly@aaronly.me>2017-07-19 16:34:40 +0800
commit9b7f99bbd0eca0e611601dd936c1f7948f8cd58a (patch)
treecde8dd145d1a560213fa1f4eacefe9ad80b7e40b /fg21sim/utils
parentbfc2b52d6c12553290742fcf793e48b1133e7dad (diff)
downloadfg21sim-9b7f99bbd0eca0e611601dd936c1f7948f8cd58a.tar.bz2
Use [arcsec] as the unit for pixel size and resolution
Signed-off-by: Aaron LI <aly@aaronly.me>
Diffstat (limited to 'fg21sim/utils')
-rw-r--r--fg21sim/utils/units.py7
-rw-r--r--fg21sim/utils/wcs.py14
2 files changed, 18 insertions, 3 deletions
diff --git a/fg21sim/utils/units.py b/fg21sim/utils/units.py
index aea0f92..bb8f670 100644
--- a/fg21sim/utils/units.py
+++ b/fg21sim/utils/units.py
@@ -50,6 +50,13 @@ class UnitConversions:
keV2erg = au.keV.to(au.erg)
# Angle
rad2deg = au.rad.to(au.deg)
+ deg2rad = au.deg.to(au.rad)
+ arcmin2deg = au.arcmin.to(au.deg)
+ deg2arcmin = au.deg.to(au.arcmin)
+ arcsec2deg = au.arcsec.to(au.deg)
+ deg2arcsec = au.deg.to(au.arcsec)
+ arcmin2arcsec = au.arcmin.to(au.arcsec)
+ arcsec2arcmin = au.arcsec.to(au.arcmin)
class Constants:
diff --git a/fg21sim/utils/wcs.py b/fg21sim/utils/wcs.py
index b4a9ed1..3cb76b9 100644
--- a/fg21sim/utils/wcs.py
+++ b/fg21sim/utils/wcs.py
@@ -8,6 +8,8 @@ Create WCS for sky projection.
import numpy as np
from astropy.wcs import WCS
+from .units import UnitConversions as AUC
+
def make_wcs(center, size, pixelsize, frame="ICRS", projection="TAN"):
"""
@@ -16,11 +18,13 @@ def make_wcs(center, size, pixelsize, frame="ICRS", projection="TAN"):
Parameters
----------
center : (xcenter, ycenter) float tuple
- The equatorial/galactic coordinate of the sky/image center [ deg ].
+ The equatorial/galactic coordinate of the sky/image center.
+ Unit: [deg]
size : (xsize, ysize) int tuple
The size (width, height) of the sky/image.
pixelsize : float
- The pixel size of the sky/image [ arcmin ]
+ The pixel size of the sky/image.
+ Unit: [arcsec]
frame : str, "ICRS" or "Galactic"
The coordinate frame, only one of ``ICRS`` or ``Galactic``.
projection : str, "TAN" or "CAR"
@@ -31,10 +35,14 @@ def make_wcs(center, size, pixelsize, frame="ICRS", projection="TAN"):
-------
w : `~astropy.wcs.WCS`
Created WCS header/object
+
+ TODO/XXX
+ ---------
+ To support other projections, e.g., ``SIN`` (common in radio astronomy).
"""
xcenter, ycenter = center # [ deg ]
xsize, ysize = size
- delt = pixelsize / 60.0 # [ deg ]
+ delt = pixelsize * AUC.arcsec2deg # [ deg ]
if projection.upper() not in ["TAN", "CAR"]:
raise ValueError("unsupported projection: " % projection)
if frame.upper() == "ICRS":