DRAGONS icon indicating copy to clipboard operation
DRAGONS copied to clipboard

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

Open u0615206 opened this issue 1 year ago • 3 comments

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 avatar Jul 25 '24 02:07 u0615206

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

u0615206 avatar Jul 25 '24 06:07 u0615206

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 avatar Jul 25 '24 18:07 teald

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

u0615206 avatar Jul 26 '24 02:07 u0615206