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

Integer 32768 out of bounds for int16 when generating the master bias #464

Open
u0615206 opened this issue Jul 25, 2024 · 3 comments
Open
Assignees
Labels
bug 🐛 Something should be working but it isn't compatibility Compatibility issues. eg with Python, dependencies like astropy, IRAF or other software

Comments

@u0615206
Copy link

u0615206 commented Jul 25, 2024

Hi,

I got OverflowError: Python integer 32768 out of bounds for int16 when trying to run the Example 3 of the DRAGONS tutorials: https://dragons.readthedocs.io/projects/gmosls-drtutorial/en/release-3.2.x/ex3_gmosls_ns_api.html (line 46 of the example). But I checked the actual bias fits file, and the maximum value of all extensions is way smaller than 32768. Does anyone have an idea of what went wrong? Thanks.

I'm using Python 3.10.14 and version 3.2.0 for DRAGONS.

@u0615206
Copy link
Author

u0615206 commented Jul 25, 2024

By checking the actual code, I think I know what happened. The bias frame got rescaled on line 299 of the attached screenshot (from astrodata/fits.py), and bzero in the fits header is 32768. Is it supposed to work this way?

Screenshot 2024-07-25 at 14 39 20

@teald
Copy link
Member

teald commented Jul 25, 2024

Hi @u0615206, thanks for submitting this issue! What version of numpy are you using?

For conda installations, here's a copy/paste for the terminal:

conda list | grep numpy

This looks like an issue caused by numpy>=2 being installed (see NEP 50 if you are curious about the details). We're working on updating our dependency specifications in an upcoming patch release; for now, there's a workaround by specifying numpy<2 at install or downgrading it:

# Assuming you're in an environment with the correct channels
conda install dragons "numpy<2"

# Create an environment from scratch
conda create --channel http://astroconda.gemini.edu/public --channel conda-forge --channel defaults -n "dragons_clean" python=3.10 dragons "numpy<2"

I will keep this issue up-to-date on the latest developments for this. Thank you again for opening this issue! Let us know if you have any other problems or questions.

@teald teald self-assigned this Jul 25, 2024
@teald teald added bug 🐛 Something should be working but it isn't compatibility Compatibility issues. eg with Python, dependencies like astropy, IRAF or other software labels Jul 25, 2024
@u0615206
Copy link
Author

Many thanks for the quick reply, @teald . I downgraded numpy to 1.26.4, and the issue is now solved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something should be working but it isn't compatibility Compatibility issues. eg with Python, dependencies like astropy, IRAF or other software
Projects
None yet
Development

No branches or pull requests

2 participants