spacetelescope / romanisim

Nancy Grace Roman Space Telescope WFI Data Simulator
https://romanisim.readthedocs.io
Other
15 stars 13 forks source link

[Solved]: All SCAs option in romanisim-make-image only generates one SCA #168

Open Borlaff opened 1 week ago

Borlaff commented 1 week ago

Hi,

I am trying to generate a complete (SCAs 1 to 18) Roman/WFI image using romanisim but the resulting ASDF file only contains one "data" array.

Example:

romanisim-make-image --radec 0 0 RST_WFI_test_v3.asdf --roll 0 --sca -1 --bandpass F087 --level 2 --usecrds

Result tree:

oot (AsdfObject) ├─asdf_library (Software) │ ├─author (str): The ASDF Developers │ ├─homepage (str): http://github.com/asdf-format/asdf │ ├─name (str): asdf │ └─version (str): 3.4.0 ├─history (dict) │ └─extensions (list) ... ├─roman (WfiImage) # The Schema for WFI Level 2 Images. │ ├─meta (dict) ... │ ├─data (Quantity): shape=(4088, 4088), dtype=float32 # Science Data (DN / s) or (M (truncated) │ ├─dq (NDArrayType): shape=(4088, 4088), dtype=uint32 # Data Quality Flags │ ├─err (Quantity): shape=(4088, 4088), dtype=float32 # Error (DN / s) or (MJy / sr) │ ├─var_poisson (Quantity): shape=(4088, 4088), dtype=float32 # Poisson Variance (DN (truncated) │ ├─var_rnoise (Quantity): shape=(4088, 4088), dtype=float32 # Read Noise (DN^2 / s^ (truncated) │ ├─var_flat (Quantity): shape=(4088, 4088), dtype=float32 # Variance for Estimate o (truncated) │ ├─amp33 (Quantity): shape=(6, 4096, 128), dtype=uint16 # Amp 33 Reference Pixel Da (truncated) │ ├─border_ref_pix_left (Quantity): shape=(6, 4096, 4), dtype=float32 # Border Refer (truncated) │ ├─border_ref_pix_right (Quantity): shape=(6, 4096, 4), dtype=float32 # Border Refe (truncated) │ ├─border_ref_pix_top (Quantity): shape=(6, 4096, 4), dtype=float32 # Border Refere (truncated) │ ├─border_ref_pix_bottom (Quantity): shape=(6, 4096, 4), dtype=float32 # Border Ref (truncated) │ └─5 not shown └─romanisim (dict) ... Some nodes not shown.

roman_exp["roman"]["data"].shape (4088, 4088)

The total size of the ASDF file is the same (~400 Mb) as the one generated using --sca 1, for example, so no additional data arrays are hidden in the ASDF structure.

Alex

schlafly commented 1 week ago

Hi Alex---I think the issue is that it needs to know where to build the WFI sca number into the file name. I think if you replace the filename with something like RST_WFI{}_test_v3.asdf then it will make 18 files. This might be a useful example: https://github.com/spacetelescope/romanisim/blob/main/scripts/romancal_make_all_l1s.sh#L17

See if that helps? Thanks!

Borlaff commented 1 week ago

100% correct, thank you so much. Adding {} to the output name allowed romanisim to allocate different filenames for the different SCA. Thanks a lot.

My follow-up question would be: Is this the format that level 1 and 2 WFI images will have, different files per SCA?

schlafly commented 1 week ago

Yes, this is the way that L1 and L2 files are being made. For example, we use romanisim to make the L1 files used to test the pipeline via that script I linked above.

When you're happy, please go ahead and close the issue. I'll push an update to the docs to make this undocumented '{}' feature more clear in the future; thanks for the reminder there.