Skip to content

Support faster pixel coordinate computations for mosaics #9440

@stscijgbot-jp

Description

@stscijgbot-jp

Issue JP-3997 was created on JIRA by Timothy Brandt:

The mosaic pipelines for both Roman and JWST combine the drizzle package with outlier rejection.  The bulk of the time in this part of the pipeline typically goes into pixel coordinate transformations rather than drizzling (about 70% to 80% of the time in romancal tests is in coordinate transformations).  The time is spent in the lines

https://github.com/spacetelescope/stcal/blob/094753ec250db8f92e7f5b6b01357580275ced1e/src/stcal/outlier_detection/utils.py#L287

and

https://github.com/spacetelescope/drizzle/blob/63749f487b766e814edcafc50f5ceed1e470d71e/drizzle/utils.py#L115

The calculation of the transformation between pixel in the input image and pixel in the drizzled image is being done on every pixel, which is not needed when the underlying transformations are smooth.  In that case we can perform the full transformation on a sparser grid (by, say, a factor of 10) and use bilinear interpolation to fill in the rest.  This dramatically improves performance, by a factor of 20-30 on a 4096x4096 Roman image, with a negligible cost in accuracy (<1e-4 pixels).  Since most of the time in the mosaic pipeline is in coordinate transformations, this change can speed up the overall performance by a substantial factor.

The suggestion in this ticket is to add the option to use an interpolation-supplemented pixel map for one of the routines referenced above and to use that single routine consistently.  Total performance improvement in mosaics with Roman is a factor of ~4 in runtime with this change; changes in the resulting images are typically at the level of floating point epsilon.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions