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

Fixing non-NaNable ccd images #158

Merged
merged 7 commits into from
Aug 20, 2023

Conversation

JuanCab
Copy link
Contributor

@JuanCab JuanCab commented Aug 17, 2023

I implemented a fix for the ccddata not being NaN-able by converting it to float if needed. Can you check that your image will now process.

I also updated the CHANGES.rst file to cover recent changes.

Fixes #157

stellarphot/photometry/photometry.py Outdated Show resolved Hide resolved
@@ -255,8 +255,8 @@ def single_image_photometry(ccd_image, sourcelist, camera, observatory_location,
"SKIPPING THIS IMAGE!")
return None, None

# Set high pixels to NaN
ccd_image.data[ccd_image.data > max_adu] = np.nan
# Set high pixels to NaN (make sure ccd_image.data is a float array first)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you still need a line here making the data float, it just doesn't need a type check:

Suggested change
# Set high pixels to NaN (make sure ccd_image.data is a float array first)
# Set high pixels to NaN (make sure ccd_image.data is a float array first)
ccd_image.data = ccd_image.data.astype(float)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't I cast it to float during the NaN replacement? (On iPhone, can't see code)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cast it as float for the comparison (inside the brackets) but the data itself is still int I think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I fixed it now.

@JuanCab
Copy link
Contributor Author

JuanCab commented Aug 17, 2023 via email

@mwcraig
Copy link
Contributor

mwcraig commented Aug 17, 2023

I just pushed a test which I verified fails without your fix 🎉 but unfortunately found out about #161 along the way 😭 .

@JuanCab JuanCab force-pushed the PreSemesterTweaks branch from 9e6e437 to 56c7e28 Compare August 18, 2023 20:06
@mwcraig mwcraig merged commit 1c1f81f into feder-observatory:main Aug 20, 2023
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

Successfully merging this pull request may close these issues.

Setting saturated pixels to NaN fails if image is integer
2 participants