Skip to content

NIRCam coronagraphy coordinate transformation inconsistencies #373

@JarronL

Description

@JarronL

All of the NIRCam coronagraphic apertures appear to not be reversible when transforming between sci/det pixel coordinates and idl/tel angular coordinates, then back.

For instance:

ap = nrc_siaf['NRCA5_MASK335R']
xsci, ysci = (160., 160.)
# Convert to IDL coord frame
xidl, yidl = ap.sci_to_idl(xsci, ysci)
# Convert back to sci pixels (should be the same!)
xsci2, ysci2 = ap.idl_to_sci(xidl, yidl)
print(xsci2, ysci2)
# Returns (160.000490 159.549532), but expected (160.0, 160.0)

So, we're seeing an inconsistency of order -0.45 pixels along the y-axis. I tried different values across the entire aperture and get a similar result.

This appears to be primarily an issue with the coronagraphic apertures. I tried this on a couple direct imaging subarray (NRCA5_SUB320, NRCA5_SUB160P), and everything looked fine, with pixel consistency on the order 1E-4.

Here's a little script to test aperture difference across their field of view:

def test_ap_reverse(ap):
    xsci_arr = np.arange(1., ap.XSciSize+1)
    ysci_arr = np.arange(1., ap.YSciSize+1)
    xg, yg = np.meshgrid(xsci_arr, ysci_arr)
    xidl_arr, yidl_arr = ap.sci_to_idl(xg, yg)
    xg2, yg2 = ap.idl_to_sci(xidl_arr, yidl_arr)
    xdiff = xg - xg2
    ydiff = yg - yg2

    print(f"xdiff_mean: {np.mean(xdiff):.6f}, xdiff_min: {np.min(xdiff):.6f}, xdiff_max: {np.max(xdiff):.6f}")
    print(f"ydiff_mean: {np.mean(ydiff):.6f}, ydiff_min: {np.min(ydiff):.6f}, ydiff_max: {np.max(ydiff):.6f}")

And here are some results:

apname: NRCA5_TAMASK335R
xdiff_mean: -0.003125, xdiff_min: -0.003496, xdiff_max: -0.002652
ydiff_mean: 0.450492, ydiff_min: 0.450422, ydiff_max: 0.450539

apname: NRCA5_MASK335R
xdiff_mean: -0.000443, xdiff_min: -0.003339, xdiff_max: 0.001951
ydiff_mean: 0.450349, ydiff_min: 0.449878, ydiff_max: 0.450602

apname: NRCA5_FULL_MASK335R
xdiff_mean: -0.000106, xdiff_min: -0.013535, xdiff_max: 0.026609
ydiff_mean: 0.448994, ydiff_min: 0.444262, ydiff_max: 0.455327

apname: NRCA2_MASK335R
xdiff_mean: 0.003562, xdiff_min: 0.002166, xdiff_max: 0.004319
ydiff_mean: 0.700701, ydiff_min: 0.699110, ydiff_max: 0.702016

apname: NRCA2_FULL_MASK335R
xdiff_mean: 0.000496, xdiff_min: -0.014397, xdiff_max: 0.011275
ydiff_mean: 0.699327, ydiff_min: 0.690276, ydiff_max: 0.719769


# Direct imaging aperture
apname: NRCA5_FULL
xdiff_mean: -0.000180, xdiff_min: -0.042135, xdiff_max: 0.040512
ydiff_mean: 0.000038, ydiff_min: -0.001396, ydiff_max: 0.001195

apname: NRCA5_SUB160P
xdiff_mean: 0.000223, xdiff_min: -0.000471, xdiff_max: 0.000770
ydiff_mean: -0.000329, ydiff_min: -0.001342, ydiff_max: 0.000363

So, I suspect the transformation in one direction (pix->ang, or ang->pix) is "correct" but the other direction might no have been correctly updated during a revision to the distortion correction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions