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 to passed through multiple layer of nuclearizer?

m_ScienceTable->addKey("HDUCLAS1", "ARRAY", "hduclass1");
m_ScienceTable->addKey("HDUCLAS2", "TOTAL", "hduclas2");

cout<<"FITS file created successfully"<<endl;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Something like :
if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": FITS file created successfully"<<endl;

return true;

} catch (FitsException& e) {
cout<<"Error creating FITS file: "<<e.message()<<endl;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Something like :
if (g_Verbosity >= c_Error) cout<<m_XmlTag<<": ...

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?

return true;

} catch (FitsException& e) {
cout<<"Error writing FITS batch: "<<e.message()<<endl;
Copy link
Collaborator

Choose a reason for hiding this comment

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

if (g_Verbosity >= c_Error) cout<<m_XmlTag<<": ...

// }

} catch (FitsException& e) {
cout<<"Error reading FITS batch: "<<e.message()<<endl;
Copy link
Collaborator

Choose a reason for hiding this comment

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

if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": ...

return true;

} catch (FitsException& e) {
cout<<"Error opening FITS file: "<<e.message()<<endl;
Copy link
Collaborator

Choose a reason for hiding this comment

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

if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": ...

m_TotalRows = m_ComptonTable->rows();
int nCols = m_ComptonTable->numCols();

cout<<"FITS table metadata:"<<endl;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Put those into a c_Info block:
if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": ...

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

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?

/*
* MGUIOptionsLoaderMeasurementsFITS.h
*
* Copyright (C) by Andreas Zoglauer.
Copy link
Collaborator

@zoglauer zoglauer Jan 13, 2026

Choose a reason for hiding this comment

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

Please add your name here everywhere (check all files)

@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