Closed stscijgbot-jp closed 7 months ago
Comment by Tyler Pauly on JIRA:
Looking at the program in APT, it looks like each observed source has four observations: a “science” pointing, a “reference” pointing, and one background for each of the prior. Those backgrounds use the same stored target_id but are different shapes to match the science and reference exposures. Looking through the pool, I don't see any metadata that would allow for association rules to differentiate the backgrounds. It could be (have been) fixed by using separate target_id for the two backgrounds, even if they are at the same location.
Comment by Tyler Pauly on JIRA:
That would work! I don't know the details of how the pools are made and how entries are selected for inclusion, but that would simplify the fix for cal, if it's possible.
Comment by Jonathan Aguilar on JIRA:
I'm the MIRI coronagraphy lead. Matching exposure parameters is fine for now. I will add "Users should make a separate background target" to the instrument scientist checklist so that this doesn't happen again.
I might also request that this be enforced in APT (i.e., if you want to reuse the same background target, then you have to make a copy of it first), but I will talk with my team about that first.
Comment by Howard Bushouse on JIRA:
Another possible fix for this, without the need to modify the ASN pool contents or ASN rules (in order to discriminate exposures based on NINTS), would be to add a check into the background step itself that skips over any background members that have NINTS different from the science exposure. And in the worst case, where none of the backgrounds have a matching NINTS, it would end up just skipping the background step entirely. This kind of trap would likely be good to have in the step anyway, just to guard against users mistakenly creating custom ASN files that have incompatible background exposures in them.
Comment by Howard Bushouse on JIRA:
After looking in detail at the actual code that's used in the background step to handle 3-D (multi-integration) background files, I've determined that it does NOT try to do an integration-by-integration subtraction from the corresponding multi-int science exposure. Instead, it computes the sigma-clipped mean of all the integrations in each background exposure (i.e. collapses the integrations into a single 2-D image), and then takes the sigma-clipped mean of all the 2-D background images to form a final mean 2-D background image. That mean 2-D bkg image is then subtracted from all integrations of the 3-D science exposure.
So the step does not actually require the science and background exposures to have the same NINTS. There was just an issue down in the guts of the code that was using the shape of the science image to construct a temporary accumulation array for working on the background exposures, which then led to the crash when the science and background exposures didn't have the same NINTS. A minor modification to that part of code allows the use of background exposures that have any arbitrary NINTS and successfully collapses them all into a mean 2-D background image, which is then subtracted from each science integration.
So this modification to the cal pipeline code allows this processing to succeed and produces valid scientific results (why not use as many background exposures as are available?).
We can also still proceed with the previously suggested modifications to the ASN pool and rules, if desired, in order to prevent the association of background exposures from different observations in the first place.
Comment by Howard Bushouse on JIRA:
Basic issue of cal pipeline background step not being able to handle inputs with varying values of NINTS fixed in #8326
Comment by John Scott on JIRA:
more cases
jw03254-c1009_20240417t042916_image2_00005 jw03254-c1009_20240417t042916_image2_00001 jw03254-c1009_20240417t042916_image2_00002 jw03254-c1009_20240417t042916_image2_00007 jw03254-c1009_20240417t042916_image2_00008 jw03254-c1009_20240417t042916_image2_00009 jw03254-c1009_20240417t042916_image2_00004 jw03254-c1009_20240417t042916_image2_00006 jw03254-c1013_20240417t042916_image2_00002 jw03254-c1013_20240417t042916_image2_00001 jw03254-c1009_20240417t042916_image2_00003 jw03254-c1013_20240417t042916_image2_00003 jw03254-c1013_20240417t042916_image2_00004 jw03254-c1013_20240417t042916_image2_00005 jw03254-c1013_20240417t042916_image2_00007 jw03254-c1013_20240417t042916_image2_00006 jw03254-c1013_20240417t042916_image2_00008 jw03254-c1013_20240417t042916_image2_00009 jw03254-c1011_20240417t042916_image2_00001 jw03254-c1011_20240417t042916_image2_00002 jw03254-c1011_20240417t042916_image2_00003 jw03254-c1011_20240417t042916_image2_00004 jw03254-c1011_20240417t042916_image2_00005 jw03254-c1011_20240417t042916_image2_00006 jw03254-c1011_20240417t042916_image2_00007 jw03254-c1011_20240417t042916_image2_00008 jw03254-c1011_20240417t042916_image2_00009
Issue JP-3553 was created on JIRA by Hien Tran:
ops saw all 9 exposures of the mir_4qpm dataset jw03254-c1009_20240118t185403_image2_0000* (for observation 4) crash in level2b processing with b10.0, in the bkg_subtract step,