Story

Minimal: As a scientist reducing grism data, I'd like to be able to combine data from different visits. This absolutely requires that the direct images associated with the visits are registered on the same astrometric system. The astrometric solution changes need to be then propagated to the grism images appropriately.

Better: Correct for astrometry against an external catalog such as GAIA or PANSTARRS.

Inputs

Two or more different direct-grism visits of the same area on the sky.

CASE A: Simple example with the same filter-grism combination:

Visit 1:

Image 1: F140W / Grism 1: G141 / Image 2: F140W / Grism 2: G141 / Image 3: F140W / Grism 3: G141 / Image 4: F140W / Grism 4: G141

Visit 2:

Image 1: F140W / Grism 1: G141 / Image 2: F140W / Grism 2: G141 / Image 3: F140W / Grism 3: G141 / Image 4: F140W / Grism 4: G141

CASE B: Can be different filters and grisms:

Visit 1:

Image 1: F140W / Grism 1: G141 / Image 2: F140W / Grism 2: G141 / Image 3: F140W / Grism 3: G141 / Image 4: F140W / Grism 4: G141

Visit 2:

Image 1: F105W / Grism 1: G102 / Image 2: F105W / Grism 2: G102 / Image 3: F105W / Grism 3: G102 / Image 4: F105W / Grism 4: G102

CASE C: Not every grism image has a corresponding direct image:

Visit 1:

Image 1: F140W / Grism 1: G141 / Grism 2: G141 / Grism 3: G141 / Grism 4: G141

Visit 2:

Image 1: F105W / Grism 1: G102 / Grism 2: G102 / Image 3: F105W / Grism 3: G102 / Grism 4: G102

Outputs

The same files as the inputs but with new WCSs such that:

Computations

The script that does this for a single visit is in grizli.prep.process_direct_grism_visit. The script that loops over multiple visits as in the examples above is in girzli.pipeline.auto_script.preprocess. If you are writing this code, do not reinvent the wheel and just look there. There are lots of small things that need to be done for this to work for ACS and WFC3. For ACS I think it currently only calculates the offsets for the 1st detector for simplicity.

Drawbacks

Some of these tasks are not grism specific. However this is really important for being able to combine grism visits that these tasks should exist somewhere. As can be seen from the several hundred lines of code grizli takes to do this, the task is not straightforward and even an expert user will struggle stringing all of these together.