Skip to content

Conversation

@morpinma-wing
Copy link

@morpinma-wing morpinma-wing commented Dec 19, 2025

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?

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);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this fail?

Copy link
Author

@morpinma-wing morpinma-wing Jan 20, 2026

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));
Copy link
Collaborator

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

Copy link
Author

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();
Copy link
Collaborator

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?

Copy link
Author

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.

@zoglauer
Copy link
Collaborator

Very clean code. You follow the standards. You know how to program C++!
Now we just need test data!

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