gbrammer / grizli

Grizli: The "Grism redshift and line" analysis software
MIT License
68 stars 51 forks source link

Problems when running grism_prep #256

Open x12red opened 4 days ago

x12red commented 4 days ago

Hello,

I am using grizli to work on some NIRISS data. Everything seems going well, but when it comes to run the auto_script.grism_prep function, something goes wrong. All the files are converted without any problem in the grizli format, but then I get this:

auto_script.grism_prep: group = f200wn-clear auto_script.grism_prep: N = 2 auto_script.grism_prep: file 0 = jw04681172001_04201_00002_nis_rate.fits auto_script.grism_prep: file 1 = jw04681172001_04201_00001_nis_rate.fits auto_script.grism_prep: ref_file = HPS145-f200wn-clear_drz_sci.fits auto_script.grism_prep: seg_file = HPS145-f200wn-clear_seg.fits auto_script.grism_prep: catalog = HPS145-ir.cat.fits auto_script.grism_prep: polyx = [0.6, 2.5] auto_script.grism_prep: pad = (64, 256) !! Shift GR150C.F200W.220725.conf along dispersion Image cutout: x=slice(0, 2672, None), y=slice(0, 2691, None) [Out of range] jw04681172001_04201_00002_nis_rate.fits / blot reference HPS145-f200wn-clear_drz_sci.fits[0] Using default C-based coordinate transformation... Image cutout: x=slice(0, 2672, None), y=slice(0, 2691, None) [Out of range] jw04681172001_04201_00002_nis_rate.fits / Pad ref HDU with 518 pixels jw04681172001_04201_00002_nis_rate.fits / blot segmentation HPS145-f200wn-clear_seg.fits[0] Using default C-based coordinate transformation... Using default C-based coordinate transformation... Transform JWST WFSS: flip=True !! Shift GR150C.F200W.220725.conf along dispersion Image cutout: x=slice(0, 2672, None), y=slice(0, 2691, None) [Out of range] jw04681172001_04201_00001_nis_rate.fits / blot reference HPS145-f200wn-clear_drz_sci.fits[0] Using default C-based coordinate transformation... Image cutout: x=slice(0, 2672, None), y=slice(0, 2691, None) [Out of range] jw04681172001_04201_00001_nis_rate.fits / Pad ref HDU with 513 pixels jw04681172001_04201_00001_nis_rate.fits / blot segmentation HPS145-f200wn-clear_seg.fits[0] Using default C-based coordinate transformation... Using default C-based coordinate transformation... Transform JWST WFSS: flip=True !! Shift GR150C.F200W.220725.conf along dispersion !! Shift GR150C.F200W.220725.conf along dispersion Files loaded - 1.21 sec. 2024-10-23 12:22:43,542 - stpipe - WARNING - /opt/anaconda3/envs/prinaldi/lib/python3.10/site-packages/astropy/wcs/wcs.py:805: FITSFixedWarning: 'obsfix' made the change 'Set OBSGEO-L to -96.356546 from OBSGEO-[XYZ]. Set OBSGEO-B to -29.183595 from OBSGEO-[XYZ]. Set OBSGEO-H to 1662567142.305 from OBSGEO-[XYZ]'. warnings.warn(

2024-10-23 12:22:43,576 - stpipe - WARNING - /opt/anaconda3/envs/prinaldi/lib/python3.10/site-packages/astropy/units/core.py:2157: UnitsWarning: 'FLAM CGS per ELECTRON/S' did not parse as fits unit: At col 0, Unit 'FLAM' not supported by the FITS standard. Did you mean flm? If this is meant to be a custom unit, define it with 'u.def_unit'. To have it recognized inside a file reader or other code, enable it with 'u.add_enabled_units'. For details, see https://docs.astropy.org/en/latest/units/combining_and_defining.html warnings.warn(msg, UnitsWarning)

2024-10-23 12:22:43,577 - stpipe - WARNING - /opt/anaconda3/envs/prinaldi/lib/python3.10/site-packages/astropy/units/core.py:2157: UnitsWarning: 'ELECTRON per PHOTON' did not parse as fits unit: At col 0, Unit 'ELECTRON' not supported by the FITS standard. If this is meant to be a custom unit, define it with 'u.def_unit'. To have it recognized inside a file reader or other code, enable it with 'u.add_enabled_units'. For details, see https://docs.astropy.org/en/latest/units/combining_and_defining.html warnings.warn(msg, UnitsWarning)

!! Shift GR150C.F200W.220725.conf along dispersion 2024-10-23 12:22:43,841 - stpipe - WARNING - /opt/anaconda3/envs/prinaldi/lib/python3.10/site-packages/astropy/wcs/wcs.py:805: FITSFixedWarning: 'obsfix' made the change 'Set OBSGEO-L to -96.380537 from OBSGEO-[XYZ]. Set OBSGEO-B to -29.166489 from OBSGEO-[XYZ]. Set OBSGEO-H to 1662298686.938 from OBSGEO-[XYZ]'. warnings.warn(

2024-10-23 12:22:43,869 - stpipe - WARNING - /opt/anaconda3/envs/prinaldi/lib/python3.10/site-packages/astropy/units/core.py:2157: UnitsWarning: 'FLAM CGS per ELECTRON/S' did not parse as fits unit: At col 0, Unit 'FLAM' not supported by the FITS standard. Did you mean flm? If this is meant to be a custom unit, define it with 'u.def_unit'. To have it recognized inside a file reader or other code, enable it with 'u.add_enabled_units'. For details, see https://docs.astropy.org/en/latest/units/combining_and_defining.html warnings.warn(msg, UnitsWarning)

2024-10-23 12:22:43,871 - stpipe - WARNING - /opt/anaconda3/envs/prinaldi/lib/python3.10/site-packages/astropy/units/core.py:2157: UnitsWarning: 'ELECTRON per PHOTON' did not parse as fits unit: At col 0, Unit 'ELECTRON' not supported by the FITS standard. If this is meant to be a custom unit, define it with 'u.def_unit'. To have it recognized inside a file reader or other code, enable it with 'u.add_enabled_units'. For details, see https://docs.astropy.org/en/latest/units/combining_and_defining.html warnings.warn(msg, UnitsWarning)

!! Shift GR150C.F200W.220725.conf along dispersion jw04681172001_04201_00002_nis_rate.fits: _compute_model Done jw04681172001_04201_00001_nis_rate.fits: _compute_model Done !! Shift GR150C.F200W.220725.conf along dispersion !! Shift GR150C.F200W.220725.conf along dispersion Models computed - 5.28 sec. Save jw04681172001_04201_00002_nis.01.GrismFLT.fits !! Shift GR150C.F200W.220725.conf along dispersion Save jw04681172001_04201_00001_nis.01.GrismFLT.fits !! Shift GR150C.F200W.220725.conf along dispersion

grism_mode_bg jw04681172001_04201_00002_nis_rate.fits GR150C 0.3036

grism_mode_bg jw04681172001_04201_00001_nis_rate.fits GR150C 0.3025

(2024-10-23 19:22:47.397)

Refine contamination

Then, here, when it comes to print the contamination information, I get only NaN. Indeed, the final 1D spectrum has only NaN.

Do you know why it happens? I think the problem must be in this !! Shift GR150C.F200W.220725.conf along dispersion..., but cannot understand where this problem could come from. I am using the latest version of grizli.

Thank you in advance for your help.

Best, Pier

x12red commented 3 days ago

Edit:

I fixed the nan problem, apparently grizli does not like images containing NaN; this is still there though: !! Shift GR150C.F200W.220725.conf along dispersion

I see that there also 221215, but cannot fetch them apparently. Where can I get them?