romancal icon indicating copy to clipboard operation
romancal copied to clipboard

Request to add the kernel used for resampling in the meta of the mosaiced image

Open darioflute opened this issue 2 months ago • 3 comments

When reading the meta of a mosaiced image generated with MosaicPipeline, the meta has a resample field which contains the main parameters used for the resampling. Unfortunately, the information about the kernel used for resampling is not conserved.

A different kernel can be used for resampling, for instance, one can use the "Lanczos3" kernel as in this example: from romancal.pipeline import MosaicPipeline steps = {'resample': {'kernel': 'lanczos3','weight_type':'ivm'},'outlier_detection':{'skip':True}} result = MosaicPipeline.call('r4444401001001001001_wfi11_asn.json', save_results=True,steps=steps)

However, when reading the meta about the resampling:

import roman_datamodels as rdm path = '/grp/roman/SCIENCE_PLATFORM_DATA/roman-17.0.0/Mosaic_Lanczos3/' with rdm.open(path+'r0003201001001001004_wfi11_coadd.asdf') as f: meta = f.meta.copy() print(meta.resample)

the information about the kernel used for resampling is lost:

{'good_bits': '~DO_NOT_USE+NON_SCIENCE', 'members': ['r0003201001001001004_0001_wfi11_f106_cal.asdf', 'r0003201001001001004_0002_wfi11_f106_cal.asdf', 'r0003201001001001004_0003_wfi11_f106_cal.asdf', 'r0003201001001001004_0004_wfi11_f106_cal.asdf'], 'pixel_scale_ratio': 1.0, 'pixfrac': 1.0, 'pointings': 4, 'product_exposure_time': 182.55169677734375, 'weight_type': 'ivm'}

This is confusing when looking back to products since it is no more clear what has been used to generate them.

darioflute avatar Oct 24 '25 17:10 darioflute

Thanks Dario. @braingram , this reminds me that this is a special case of our discussion to add the 'spec' parameters generically to all of the outputs, e.g., roman.meta.kwargs.{step} = kwargs or something along those lines?

Dario, we don't intend to use more than one kernel in operations, so I'm reluctant to add this as a generic archive-searchable field, but we could capture this and any other keyword parameters via this kind of approach. Were we to do that, would that address your concerns? In this case these parameters would not make it to the archive but would be in the individual files for people using the pipeline.

schlafly avatar Oct 27 '25 17:10 schlafly

@darioflute is the information in the cal_logs for the produced files? I'm not advocating for this as "the solution" but perhaps it is helpful in this case.

I do think recording step parameters would be useful. I can't immediately find a ticket for that work though.

braingram avatar Oct 27 '25 17:10 braingram

I'll make a ticket (not for you, but at least so we record the discussion)---see https://github.com/spacetelescope/romancal/issues/2019.

schlafly avatar Oct 27 '25 17:10 schlafly