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

header keyword not found: KeyError: "Keyword 'STD1EXP' not found." #40

Closed
havok2063 opened this issue Nov 7, 2023 · 7 comments
Closed
Labels
bug Something isn't working

Comments

@havok2063
Copy link
Collaborator

havok2063 commented Nov 7, 2023

Trying to reduce exposure 3507 from 60178 crashes during flux calibration. This exposure is missing all the STD keywords, likely as they weren't added in yet. The pipeline should be able reduce data from all MJDs successfully. At least from 60177 onwards, and ideally from 60142 onwards. Or at least fail cleanly with a message why it can't proceed.

  File "/Users/Brian/Work/github_projects/sdss/lvm/lvmdrp/python/lvmdrp/functions/run_quickdrp.py", line 280, in quick_reduction
    flux_tasks.apply_fluxcal(in_rss=sci_path, out_rss=sci_path)
  File "/Users/Brian/Work/github_projects/sdss/lvm/lvmdrp/python/lvmdrp/functions/fluxCalMethod.py", line 104, in apply_fluxcal
    exptime = rss._header[f"{std_hd[:-3]}EXP"]
  File "/Users/Brian/anaconda3/envs/lvmdrp/lib/python3.9/site-packages/astropy/io/fits/header.py", line 169, in __getitem__
    card = self._cards[self._cardindex(key)]
  File "/Users/Brian/anaconda3/envs/lvmdrp/lib/python3.9/site-packages/astropy/io/fits/header.py", line 1819, in _cardindex
    raise KeyError(f"Keyword {keyword!r} not found.")
KeyError: "Keyword 'STD1EXP' not found."
@havok2063 havok2063 added the bug Something isn't working label Nov 7, 2023
@havok2063
Copy link
Collaborator Author

havok2063 commented Nov 7, 2023

Or the other alternative is to ignore all MJDs before the required header keys for flux calibration were in place. In which case, can you give me the minimum MJD where that is the case?

@ndrory
Copy link
Contributor

ndrory commented Nov 7, 2023 via email

@EvelynJ
Copy link

EvelynJ commented Nov 7, 2023 via email

@havok2063
Copy link
Collaborator Author

That all makes sense to me. We can wait until Alfredo is back to fix it. We do have a mechanism in place to fix headers with the hdrfix files in lvmcore, that the pipeline already understands. The pipeline uses these files to correct the raw headers during the metadata collection before reductions. We could put that info there. Although with 15 standards and 8 keywords per standard, it might be a bit clunky to add for all those mjds.

@ndrory
Copy link
Contributor

ndrory commented Nov 7, 2023 via email

@havok2063
Copy link
Collaborator Author

havok2063 commented Nov 7, 2023

That's fine too. In that case, I think we should try to avoid having lvmCFrame files that are flux-calibrated for some MJDs but not for others. I think we want to try to be consistent with what the data products mean/contain. We may want to create a separate output file for before/after flux calibration. For those MJDs where we can't flux calibrate, the pipeline ends there, updating some header flag about what stage of the pipeline it stopped at and why.

@ajmejia
Copy link
Contributor

ajmejia commented Nov 28, 2023

Fixed this in commit:

b5fb588

The only caveat is that DRP runs of exposures without std fibers metadata will produce lvmCFrames in electrons. I'll address this in a separated PR.

@ajmejia ajmejia closed this as completed Nov 28, 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
Projects
None yet
Development

No branches or pull requests

4 participants