spacetelescope / pysiaf

Handling of Science Instrument Aperture Files (SIAF) for space telescopes
https://pysiaf.readthedocs.io
BSD 3-Clause "New" or "Revised" License
13 stars 28 forks source link

Puzzling behavior of matched apertures #219

Open mgennaro opened 2 years ago

mgennaro commented 2 years ago

The grism_ts_sw NIRcam apertures are apertures on the SW detectors that "tag along" existing LW apertures. The generate_nircam.py code calls the tools.match_v2v3 method to match the (V2,V3) of the tag along apertures to a corresponding LW one.

In theory the method should also modify the distortion coefficients associated to the SW aperture, once the SW aperture is moved to match the LW one.

I have however seen that explicitly calling the tools.set_reference_point_and_distortion method after the tools.match_v2v3 further modifies the aperture. Several quantities are affected: V2Ref, V3Ref, V3SciXAngle, V3SciYAngle, Idl2SciX00, Idl2SciY00 and this, for example changes the roundtrip erorr. I wonder if this is the expected behavior. In theory I would be expecting the second call to tools.set_reference_point_and_distortion to have no effect.

For consistency with the treatment of all other apertures distortion coefficient I wonder if we should explicitly call tools.set_reference_point_and_distortion once more, as the generate_nircam code in this PR does. But possibly first we need to understand what is really going on behind the scenes

Witchblade101 commented 1 year ago

@mgennaro I just want to confirm that the new threshold should be 0.2:

test_aperture.test_jwst_aperture_transforms([pre_delivery_siaf], verbose=False, threshold=0.2)