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

Extraction background edge case bug #8431

Closed
stscijgbot-jp opened this issue Apr 19, 2024 · 2 comments · Fixed by #8433
Closed

Extraction background edge case bug #8431

stscijgbot-jp opened this issue Apr 19, 2024 · 2 comments · Fixed by #8433

Comments

@stscijgbot-jp
Copy link
Collaborator

Issue JP-3601 was created on JIRA by Melanie Clarke:

While experimenting with setting polynomial background regions in extract_1d for BOTS data, I came across a crash when background upper and lower limits are both out of range for some part of the array.  This happens when setting a region above and below the curved spectral trace in a narrow subarray: there is data within the background limits for part of the array, but not the full array.  In this case, the limits are checked and both upper and lower limits are set to the edge of the array (0 at the bottom, ns at the top).

The crash comes from line 702 in jwst/extract_1d/extract1d.py:

IndexError: index 6 is out of bounds for axis 0 with size 6

I think the problem is that when counting intervals (npts, line 680), intervals with equal upper and lower limits are not counted, but when computing background levels, the value at that point is added to the val array (line 702).  I think the fix should be to skip intervals for which upper and lower limits are equal – it is not likely that that point contains a valid background level anyway.

@stscijgbot-jp
Copy link
Collaborator Author

stscijgbot-jp commented Apr 19, 2024

Comment by Melanie Clarke on JIRA:

Pull request with a possible simple fix here:

#8433

A more complex one might be needed if we want to preserve the case where a single region is specified with the same upper and lower limits, and the intent is to extract one pixel.

@stscijgbot-jp
Copy link
Collaborator Author

Comment by Howard Bushouse on JIRA:

Fixed by #8433

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

Successfully merging a pull request may close this issue.

1 participant