Skip to content

FLAGS extension not properly combined during master object creation #197

@BMazzilliCiraulo

Description

@BMazzilliCiraulo

Hi! I've been investigating saturation in my reduced cubes and discovered what appears to be a bug in how FLAGS extensions are handled during master object creation.

Summary:

The MakeMasterObject process correctly combines intensity data from multiple 2D images but fails to properly combine their FLAGS extensions. This results in master images (and subsequently 3D cubes) having FLAGS from only one of the input exposures —the first frame used when combining— instead of the logical combination of all input FLAGS.

Expected behaviour should be, I believe: The resulting FLAGS should represent the union of bad pixels across all exposures.

Current behaviour is:
Only FLAGS from one input image (the first frame used when combining) are preserved in the master object;
All other FLAGS information is lost during stacking;
Results in identical FLAGS between single-exposure from first frame and multi-exposure cubes.

From the source code:

I think the process is such that:

  1. Individual 2D images → MakeMasterObject (stacking) → 2D master image with incomplete FLAGS

  2. 2D master image → MakeCube → 3D cube with same incomplete FLAGS

MakeCube correctly processes FLAGS slice-by-slice: data_flg = self.action.args.ccddata.flags
out_fube[:, :, slice_number] = partial_cube[4]

Impact:

This could lead to both bad pixels being treated as valid data and valid pixels being incorrectly flagged, depending on which frame's FLAGS are preserved.

Proposed Solution:

Modify MakeMasterObject to include FLAGS combination logic:
Implement proper FLAGS merging during the stacking process;
Ensure all bad pixels from input images are preserved in master object;
Maintain consistency with how intensity data is currently combined

Thanks for any help investigating this issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions