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

Adds support for amptek detector files #7

Merged
merged 17 commits into from
Nov 19, 2024

Conversation

ehsteve
Copy link
Member

@ehsteve ehsteve commented Sep 25, 2024

This adds preliminary support for amptek detector files which are used for ground-based calibration.

Copy link

codecov bot commented Sep 25, 2024

Codecov Report

Attention: Patch coverage is 88.57143% with 16 lines in your changes missing coverage. Please review.

Project coverage is 62.38%. Comparing base (c83669f) to head (16c482f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
padre_meddea/calibration/spectrum.py 44.82% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #7      +/-   ##
==========================================
+ Coverage   56.30%   62.38%   +6.07%     
==========================================
  Files          10       10              
  Lines         595      731     +136     
==========================================
+ Hits          335      456     +121     
- Misses        260      275      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link

The processed files are available as an artifact: https://github.com/PADRESat/padre_meddea/actions/runs/11024020059/artifacts/1974472210

Copy link

The processed files are available as an artifact: https://github.com/PADRESat/padre_meddea/actions/runs/11024046119/artifacts/1974479076

Copy link

The processed files are available as an artifact: https://github.com/PADRESat/padre_meddea/actions/runs/11032939286/artifacts/1976727130

Copy link

github-actions bot commented Oct 2, 2024

The processed files are available as an artifact: https://github.com/PADRESat/padre_meddea/actions/runs/11143408317/artifacts/2005618929

Copy link

The processed files are available as an artifact: https://github.com/PADRESat/padre_meddea/actions/runs/11370965566/artifacts/2064883527

Copy link

The processed files are available as an artifact: https://github.com/PADRESat/padre_meddea/actions/runs/11376173449/artifacts/2066472762

value = float(value)
except ValueError:
pass
hdr.append((keyword.replace(" ", "")[0:7], value))

Choose a reason for hiding this comment

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

Running Line 119 returns the following error:
ERROR: ValueError: FITS header values must contain standard printable ASCII characters; '27°C' contains characters not representable in ASCII or non-printable characters. [astropy.io.fits.card]

I have not found a way to easily get around this. Perhaps the easiest thing to do is to modify the .mca file itself, since it's just this one character that is causing the problem.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's weird. My test mca file does not have this symbol in it (see here) which has the lines
2143 TEC Temp: 252K
2144 Board Temp: 29C
at the bottom of the file. Can you paste the offending line from your file here please?

if filename.suffix == "bin": # raw binary file
result = read_raw_file(filename)
if filename.suffix == ".bin": # raw binary file
result = read_raw_file(Path(filename))
elif filename.suffix == "fits": # level 0 or above

Choose a reason for hiding this comment

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

Should there be a "." in front of "fits"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. I actually fixed this in my other pull request.

value = float(value)
except ValueError:
pass
hdr.append((keyword.replace(" ", "")[0:7], value, description))

Choose a reason for hiding this comment

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

Running Line 111 returns the following warnings:

WARNING: VerifyWarning: Keyword name 'DESCRIPTION' is greater than 8 characters or contains characters not allowed by the FITS standard; a HIERARCH card will be created. [astropy.io.fits.card]
WARNING: VerifyWarning: Keyword name 'THRESHOLD' is greater than 8 characters or contains characters not allowed by the FITS standard; a HIERARCH card will be created. [astropy.io.fits.card]
WARNING: VerifyWarning: Keyword name 'LIVE_MODE' is greater than 8 characters or contains characters not allowed by the FITS standard; a HIERARCH card will be created. [astropy.io.fits.card]
WARNING: VerifyWarning: Keyword name 'PRESET_TIME' is greater than 8 characters or contains characters not allowed by the FITS standard; a HIERARCH card will be created. [astropy.io.fits.card]
WARNING: VerifyWarning: Keyword name 'LIVE_TIME' is greater than 8 characters or contains characters not allowed by the FITS standard; a HIERARCH card will be created. [astropy.io.fits.card]
WARNING: VerifyWarning: Keyword name 'REAL_TIME' is greater than 8 characters or contains characters not allowed by the FITS standard; a HIERARCH card will be created. [astropy.io.fits.card]
WARNING: VerifyWarning: Keyword name 'START_TIME' is greater than 8 characters or contains characters not allowed by the FITS standard; a HIERARCH card will be created. [astropy.io.fits.card]
WARNING: VerifyWarning: Keyword name 'SERIAL_NUMBER' is greater than 8 characters or contains characters not allowed by the FITS standard; a HIERARCH card will be created. [astropy.io.fits.card]
ERROR: ValueError: FITS header values must contain standard printable ASCII characters; '27°C' contains characters not representable in ASCII or non-printable characters. [astropy.io.fits.card]

Copy link
Member Author

Choose a reason for hiding this comment

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

All of those warnings can be ignored. The ERROR at the bottom is what is important but you already referred to it in your previous comment.

Copy link

github-actions bot commented Nov 5, 2024

The processed files are available as an artifact: https://github.com/PADRESat/padre_meddea/actions/runs/11693830291/artifacts/2149474081

Copy link

The processed files are available as an artifact: https://github.com/PADRESat/padre_meddea/actions/runs/11900626846/artifacts/2203824507

Copy link

The processed files are available as an artifact: https://github.com/PADRESat/padre_meddea/actions/runs/11900730590/artifacts/2203857307

Copy link

The processed files are available as an artifact: https://github.com/PADRESat/padre_meddea/actions/runs/11905671750/artifacts/2205219950

@ehsteve ehsteve merged commit f294bc4 into PADRESat:main Nov 19, 2024
13 checks passed
@ehsteve ehsteve deleted the amptek_support branch November 19, 2024 03:32
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.

2 participants