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

Setting saturated pixels to NaN fails if image is integer #157

Closed
mwcraig opened this issue Aug 16, 2023 · 3 comments · Fixed by #158
Closed

Setting saturated pixels to NaN fails if image is integer #157

mwcraig opened this issue Aug 16, 2023 · 3 comments · Fixed by #158
Labels
bug Something isn't working refactor Summer 2023 project to rewrite stellarphot

Comments

@mwcraig
Copy link
Contributor

mwcraig commented Aug 16, 2023

While testing some of the changes with the new photometry settings I was using an uncalibrated image. single_image_photometetry failed on this line with

File ~/Development/astronomy/stellarphot/stellarphot/photometry/photometry.py:222, in single_image_photometry(ccd_image, sourcelist, camera, observatory_location, aperture_radius, inner_annulus, outer_annulus, shift_tolerance, max_adu, fwhm_estimate, use_coordinates, include_dig_noise, reject_too_close, reject_background_outliers, passband_map, fwhm_by_fit, fname, logline)
    219     return None, None
    221 # Set high pixels to NaN
--> 222 ccd_image.data[ccd_image.data > max_adu] = np.nan
    224 # Extract necessary values from sourcelist structure
    225 star_ids = sourcelist['star_id'].value

ValueError: cannot convert float NaN to integer

I think the fix can be just converting the data to float.

@mwcraig mwcraig added bug Something isn't working refactor Summer 2023 project to rewrite stellarphot labels Aug 16, 2023
@JuanCab
Copy link
Contributor

JuanCab commented Aug 16, 2023

Do you want to do this (cast image to float) or do you want me to do this?

@mwcraig
Copy link
Contributor Author

mwcraig commented Aug 17, 2023

Either works, but if you are interested in trying out pydantic then maybe try making a Camera setting instead. This branch on my fork has, in stellarphot/settings/models.py my intial attempt at adding units to committee (ignore the ApertureUnits class and look at Length instead.

Not directly relevant to Camera but moving in the right direction.

JuanCab added a commit to JuanCab/stellarphot that referenced this issue Aug 17, 2023
@JuanCab
Copy link
Contributor

JuanCab commented Aug 17, 2023

Submitted PR #158 to address this. Can you test your integer image against it?

JuanCab added a commit to JuanCab/stellarphot that referenced this issue Aug 18, 2023
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in stellarphot refactoring Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working refactor Summer 2023 project to rewrite stellarphot
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants