Skip to content

Commit

Permalink
siaf additions
Browse files Browse the repository at this point in the history
  • Loading branch information
JarronL committed Mar 6, 2019
1 parent c4b2e5f commit 5815135
Show file tree
Hide file tree
Showing 6 changed files with 680 additions and 174 deletions.
4 changes: 3 additions & 1 deletion TODO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ Detector updates in ngNRC.py

PSF Related
+++++++++++
- Coronagraph target acquisition uncertainties
- Small grid dither strategy in coronagraphic observations
- Actual coronagraphic throughput from FITS files
- More PSF Jitter options
- PSF convolution based on geometric spot size

Observation Classes
+++++++++++++++++++
- Grism time series
- Photometric time series (incl. weak lens)
- Grism time series
- Wide-field grism
- Wide field imaging (esp. SW modules)

Expand Down
227 changes: 227 additions & 0 deletions pynrc/apertures.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
# Full instrument aperture
'NRCALL_FULL'

# SW module Apertures
'NRCAS_FULL'
'NRCBS_FULL'

# Mod A SCAs
'NRCA1_FULL'
'NRCA2_FULL'
'NRCA3_FULL'
'NRCA4_FULL'
'NRCA5_FULL'

# Mod B SCAs
'NRCB1_FULL'
'NRCB2_FULL'
'NRCB3_FULL'
'NRCB4_FULL'
'NRCB5_FULL'

# Mod B SW/LW full frame point source obs
'NRCB1_FULLP'
'NRCB5_FULLP'

# 160x160 direct imaging subarray
'NRCA1_SUB160'
'NRCA2_SUB160'
'NRCA3_SUB160'
'NRCA4_SUB160'
'NRCA5_SUB160'
'NRCB1_SUB160'
'NRCB2_SUB160'
'NRCB3_SUB160'
'NRCB4_SUB160'
'NRCB5_SUB160'

# 320x320 subarray
'NRCA1_SUB320'
'NRCA2_SUB320'
'NRCA3_SUB320'
'NRCA4_SUB320'
'NRCA5_SUB320'
'NRCB1_SUB320'
'NRCB2_SUB320'
'NRCB3_SUB320'
'NRCB4_SUB320'
'NRCB5_SUB320'

# 6400x640 subarray
'NRCA1_SUB640'
'NRCA2_SUB640'
'NRCA3_SUB640'
'NRCA4_SUB640'
'NRCA5_SUB640'
'NRCB1_SUB640'
'NRCB2_SUB640'
'NRCB3_SUB640'
'NRCB4_SUB640'
'NRCB5_SUB640'

# Grism STRIPE observations (filter dependent)
'NRCA5_GRISM256_F322W2'
'NRCA5_GRISM128_F322W2'
'NRCA5_GRISM64_F322W2'
'NRCA5_GRISM256_F277W'
'NRCA5_GRISM128_F277W'
'NRCA5_GRISM64_F277W'
'NRCA5_GRISM256_F356W'
'NRCA5_GRISM128_F356W'
'NRCA5_GRISM64_F356W'
'NRCA5_GRISM256_F444W'
'NRCA5_GRISM128_F444W'
'NRCA5_GRISM64_F444W'

# Grism Full frame observations (filter dependent)
'NRCA5_GRISM_F322W2'
'NRCA5_GRISM_F277W'
'NRCA5_GRISM_F356W'
'NRCA5_GRISM_F444W'

# Time series grism observations
'NRCA1_GRISMTS'
'NRCA1_GRISMTS256'
'NRCA1_GRISMTS128'
'NRCA1_GRISMTS64'
'NRCA3_GRISMTS'
'NRCA3_GRISMTS256'
'NRCA3_GRISMTS128'
'NRCA3_GRISMTS64'

# Time series grism target acquisition
'NRCA5_TAGRISMTS32'
'NRCA5_TAGRISMTS_SCI_F322W2'
'NRCA5_TAGRISMTS_SCI_F444W'

# Wide field slitless
'NRCA5_GRISMC_WFSS'
'NRCA5_GRISMR_WFSS'
'NRCALL_GRISMC_WFSS'
'NRCALL_GRISMR_WFSS'
'NRCB5_GRISMC_WFSS'
'NRCB5_GRISMR_WFSS'


# DHS PIL
'NRCA3_DHSPIL'
'NRCA3_DHSPIL_SUB96'
'NRCA3_DHSPIL_WEDGES'
'NRCB4_DHSPIL'
'NRCB4_DHSPIL_SUB96'
'NRCB4_DHSPIL_WEDGES'

# Field points for wavefront sensing
'NRCA3_FP1'
'NRCA3_FP1_SUB8'
'NRCA3_FP1_SUB64'
'NRCA3_FP2MIMF'
'NRCA1_FP3MIMF'
'NRCA2_FP4MIMF'
'NRCA4_FP5MIMF'
'NRCB4_FP1'
'NRCB4_FP1_SUB8'
'NRCB4_FP1_SUB64'
'NRCB4_FP2MIMF'
'NRCB2_FP3MIMF'
'NRCB1_FP4MIMF'
'NRCB3_FP5MIMF'

# Point source subarrays
'NRCA3_SUB64P'
'NRCA3_SUB160P'
'NRCA3_SUB400P'
'NRCA5_SUB64P'
'NRCA5_SUB160P'
'NRCA5_SUB400P'
'NRCB1_SUB64P'
'NRCB1_SUB160P'
'NRCB1_SUB400P'
'NRCB5_SUB64P'
'NRCB5_SUB160P'
'NRCB5_SUB400P'

# Target acq for point source imaging?
'NRCB5_TAPSIMG32'


# Module A masks and ND Squares
'NRCA2_MASK210R'
'NRCA5_MASK335R'
'NRCA5_MASK430R'
'NRCA4_MASKSWB'
'NRCA5_MASKLWB'
'NRCA2_TAMASK210R'
'NRCA5_TAMASK335R'
'NRCA5_TAMASK430R'
'NRCA4_TAMASKSWB'
'NRCA5_TAMASKLWB'
'NRCA5_TAMASKLWBL'
'NRCA4_TAMASKSWBS'

# Module B masks and ND Squares
'NRCB1_MASK210R'
'NRCB5_MASK335R'
'NRCB5_MASK430R'
'NRCB3_MASKSWB'
'NRCB5_MASKLWB'
'NRCB1_TAMASK210R'
'NRCB5_TAMASK335R'
'NRCB5_TAMASK430R'
'NRCB3_TAMASKSWB'
'NRCB5_TAMASKLWB'
'NRCB5_TAMASKLWBL'
'NRCB3_TAMASKSWBS'

# Module A faint target acq
'NRCA2_FSTAMASK210R'
'NRCA4_FSTAMASKSWB'
'NRCA5_FSTAMASKLWB'
'NRCA5_FSTAMASK335R'
'NRCA5_FSTAMASK430R'

# Module A SWBar wavelength reference points
'NRCA4_MASKSWB_F182M'
'NRCA4_MASKSWB_F187N'
'NRCA4_MASKSWB_F210M'
'NRCA4_MASKSWB_F212N'
'NRCA4_MASKSWB_F200W'
'NRCA4_MASKSWB_NARROW'


# Module A LWBar wavelength reference points
'NRCA5_MASKLWB_F250M'
'NRCA5_MASKLWB_F300M'
'NRCA5_MASKLWB_F277W'
'NRCA5_MASKLWB_F335M'
'NRCA5_MASKLWB_F360M'
'NRCA5_MASKLWB_F356W'
'NRCA5_MASKLWB_F410M'
'NRCA5_MASKLWB_F430M'
'NRCA5_MASKLWB_F460M'
'NRCA5_MASKLWB_F480M'
'NRCA5_MASKLWB_F444W'
'NRCA5_MASKLWB_NARROW'

# Module A Full Frame
'NRCA2_FULL_MASK210R'
'NRCA5_FULL_MASK335R'
'NRCA5_FULL_MASK430R'
'NRCA4_FULL_MASKSWB'
'NRCA4_FULL_MASKSWB_F182M'
'NRCA4_FULL_MASKSWB_F187N'
'NRCA4_FULL_MASKSWB_F210M'
'NRCA4_FULL_MASKSWB_F212N'
'NRCA4_FULL_MASKSWB_F200W'
'NRCA5_FULL_MASKLWB'
'NRCA5_FULL_MASKLWB_F250M'
'NRCA5_FULL_MASKLWB_F300M'
'NRCA5_FULL_MASKLWB_F277W'
'NRCA5_FULL_MASKLWB_F335M'
'NRCA5_FULL_MASKLWB_F360M'
'NRCA5_FULL_MASKLWB_F356W'
'NRCA5_FULL_MASKLWB_F410M'
'NRCA5_FULL_MASKLWB_F430M'
'NRCA5_FULL_MASKLWB_F460M'
'NRCA5_FULL_MASKLWB_F480M'
'NRCA5_FULL_MASKLWB_F444W'
41 changes: 26 additions & 15 deletions pynrc/maths/coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

__epsilon = np.finfo(float).eps

import webbpsf, pysiaf

def dist_image(image, pixscale=None, center=None, return_theta=False):
"""Pixel distances
Expand Down Expand Up @@ -129,7 +131,7 @@ def xy_rot(x, y, ang):
def Tel2Sci_info(channel, coords, output="Sci"):
"""Telescope coords converted to Science coords
Returns the detector name associated with these coordinates
Returns the detector name associated with input coordinates.
Parameters
----------
Expand All @@ -149,7 +151,8 @@ def Tel2Sci_info(channel, coords, output="Sci"):
V2, V3 = coords

# Figure out the detector and pixel position for some (V2,V3) coord
mysiaf = webbpsf.webbpsf_core.SIAF('NIRCam')
# mysiaf = webbpsf.webbpsf_core.SIAF('NIRCam')
mysiaf = pysiaf.Siaf('NIRCam')
swa = ['A1', 'A2', 'A3', 'A4']
swb = ['B1', 'B2', 'B3', 'B4']
lwa = ['A5']
Expand Down Expand Up @@ -178,13 +181,12 @@ def Tel2Sci_info(channel, coords, output="Sci"):
return detector, detector_position



def det_to_V2V3(image, detid):
"""Detector to V2/V3 coordinates
def det_to_sci(image, detid):
"""Detector to science orientation
Reorient image from detector coordinates to V2/V3 coordinate system.
Reorient image from detector coordinates to 'sci' coordinate system.
This places +V3 up and +V2 to the LEFT. Detector pixel (0,0) is assumed
to be in the bottom left. For now, we're simply performing axes flips.
to be in the bottom left. Simply performs axes flips.
Parameters
----------
Expand Down Expand Up @@ -216,13 +218,12 @@ def det_to_V2V3(image, detid):

return image

def V2V3_to_det(image, detid):
"""V2/V3 coordinate to detector orientation
def sci_to_det(image, detid):
"""Science coordinate to detector orientation
Reorient image from V2/V3 coordinates to detector coordinate system.
Reorient image from 'sci' coordinates to detector coordinate system.
Assumes +V3 up and +V2 to the LEFT. The result places the detector
pixel (0,0) in the bottom left. For now, we're simply performing
axes flips.
pixel (0,0) in the bottom left. Simply performs axes flips.
Parameters
----------
Expand All @@ -232,10 +233,20 @@ def V2V3_to_det(image, detid):
NIRCam detector/SCA ID, either 481-490 or A1-B5.
"""

# Flips occur along the same axis and manner as in det_to_V2V3()
return det_to_V2V3(image, detid)

# Flips occur along the same axis and manner as in det_to_sci()
return det_to_sci(image, detid)

def det_to_V2V3(image, detid):
"""Same as `det_to_sci`"""
_log.warning('det_to_V2V3 function is deprecated. Please use det_to_sci()')
return det_to_sci(image, detid)

def V2V3_to_det(image, detid):
"""Same as `sci_to_det`"""
_log.warning('V2V3_to_det function is deprecated. Please use sci_to_det()')
return sci_to_det(image, detid)


def plotAxes(ax, position=(0.9,0.1), label1='V2', label2='V3', dir1=[-1,0], dir2=[0,1],
angle=0, alength=0.12, width=2, headwidth=8, color='w'):
"""Compass arrows
Expand Down

0 comments on commit 5815135

Please sign in to comment.