Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array shape mismatch between different exposures #33

Open
themiyan opened this issue Apr 13, 2023 · 0 comments
Open

Array shape mismatch between different exposures #33

themiyan opened this issue Apr 13, 2023 · 0 comments

Comments

@themiyan
Copy link

When extracting spectra to perform background subtraction at the slit level NirspecPipeline.extract_spectrum for some sources the dimensions between slits seems to be off by 1 which causes extractions to fail.

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Input In [17], in <cell line: 5>()
      1 ### check in nrs2
      3 key_nrs2 = '2565_32130' 
----> 5 _data = gratings['clear-prism'][1].extract_spectrum(key_nrs2, skip=[], yoffset=0, prof_sigma=0.6, trace_sign=-1, 
      6                               fit_profile_params=None)

File ~/opt/anaconda3/envs/grizli39/lib/python3.9/site-packages/msaexp/pipeline.py:1356, in NirspecPipeline.extract_spectrum(self, key, slit_key, prof_sigma, fit_profile_params, pstep, show_sn, flux_unit, vmax, yoffset, skip, bad_dq_bits, clip_sigma, ntrim, get_slit_data, verbose, center2d, trace_sign, min_dyoffset, **kwargs)
   1354 _dq = (_sbg.dq & bad_dq_bits) == 0
   1355 try:                    
-> 1356     _bkg[_dq] += _sbg.data[_dq]
   1357     _bkgn[_dq] += 1
   1359 except ValueError:
   1360     #print('background failed', j)

IndexError: boolean index did not match indexed array along dimension 1; dimension is 142 but corresponding boolean dimension is 143

ipdb>  np.shape(_dq)
(30, 143)
ipdb>  np.shape(_sbg.data)
(30, 143)
ipdb>  np.shape(_bkg)
(30, 142)

This is coming because

ipdb>  pipe[0].slits[0].data.shape
(35, 425)
ipdb>  pipe[1].slits[1].data.shape
(35, 425)
ipdb>  pipe[2].slits[2].data.shape
(35, 426)

using
grizli version = 1.8.4.dev4+ga5d2ece
msaexp version = 0.6.8.dev8+gf5c84b2.d20230403
jwst version = 1.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant