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

Fix two small bugs in image loading. #385

Merged
merged 2 commits into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/kbmod/search/raw_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ void RawImage::load_time_from_file(fitsfile* fptr) {
// Read image observation time, trying the MJD field first and DATE-AVG second.
// Ignore error if does not exist.
if (fits_read_key(fptr, TDOUBLE, "MJD", &obstime, NULL, &mjd_status)) {

// Reset the status flag and try with DATE-AVG.
mjd_status = 0;
if (fits_read_key(fptr, TDOUBLE, "DATE-AVG", &obstime, NULL, &mjd_status)) {
obstime = -1.0;
}
Expand Down Expand Up @@ -124,6 +127,7 @@ void RawImage::load_from_file(const std::string& file_path, int layer_num) {
if (fits_open_file(&fptr, file_path.c_str(), READONLY, &status))
throw std::runtime_error("Could not open FITS file to read RawImage");
load_time_from_file(fptr);
if (fits_close_file(fptr, &status)) fits_report_error(stderr, status);
}
}

Expand Down