-
Notifications
You must be signed in to change notification settings - Fork 12
ADD: ability to read FITS and save FITS #82
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
base: develop/em
Are you sure you want to change the base?
ADD: ability to read FITS and save FITS #82
Conversation
| if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": Creating FITS file "<<string(FileName)<<endl; | ||
|
|
||
| // Create new FITS file (overwrite if exists) | ||
| m_FITSFile = new FITS(string(FileName), RWmode::Write); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could fail, and it would throw one of the 2 exceptions. This is in a try-catch block. Is that good enough? Are you looking for something different than a try-catch?
NoSuchHDU: thrown on HDU seek error either by index or {name,version}
FitsError: thrown on non-zero status code from cfitsio when not overriden by
FitsException error to produce more illuminating message.
| if (g_Verbosity >= c_Error) cout<<m_XmlTag<<"FITFileName "<<string(FileName)<<endl; | ||
|
|
||
| // Open the FITS file in read-only, default: rwmode=Read, readDataFlag = false | ||
| m_FITSFile = new FITS(string(FileName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an error message if it fails, not just a try-catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrapped in a try–catch block, and an error message is logged in the catch when it fails.
Are you looking for a different error-handling behavior here? If so, could you clarify what you’d prefer?
| m_FITSFile = new FITS(string(FileName)); | ||
|
|
||
| // Store const pointer to Primary HDU (HDU 0) - header/metadata | ||
| m_PrimaryHDU = &m_FITSFile->pHDU(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any check that we have the right kind of fits file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a simple check on the primary HDU to see if do we have the right EXTNAME and ORIGIN.
|
Very clean code. You follow the standards. You know how to program C++! |
Added/Changed 10 files:
MModuleLoaderMeasurementsFITS.cxx, MModuleLoaderMeasurementsFITS.h. (FITS read, c++ & header)
MGUIOptionsLoaderMeasurementsFITS.cxx, MGUIOptionsLoaderMeasurementsFITS.h (FITS read GUI, c++ & header)
MModuleSaverMeasurementsFITS.cxx, MModuleSaverMeasurementsFITS.h. (FITS save, c++ & header)
MGUIOptionsSaverMeasurementsFITS.cxx, MGUIOptionsSaverMeasurementsFITS.h, (FITS save GUI, c++ & header)
make file (check is CCfits installed)
MAssembly (add the loader and saver)
I tested the loader with the FITS file that I have. However, I cannot test the write-out because I think the data in that FITS file is not good enough to passed through multiple layer of nuclearizer?