-
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
| m_ScienceTable->addKey("HDUCLAS1", "ARRAY", "hduclass1"); | ||
| m_ScienceTable->addKey("HDUCLAS2", "TOTAL", "hduclas2"); | ||
|
|
||
| cout<<"FITS file created successfully"<<endl; |
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.
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; |
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.
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); |
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?
| return true; | ||
|
|
||
| } catch (FitsException& e) { | ||
| cout<<"Error writing FITS batch: "<<e.message()<<endl; |
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.
if (g_Verbosity >= c_Error) cout<<m_XmlTag<<": ...
| // } | ||
|
|
||
| } catch (FitsException& e) { | ||
| cout<<"Error reading FITS batch: "<<e.message()<<endl; |
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.
if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": ...
| return true; | ||
|
|
||
| } catch (FitsException& e) { | ||
| cout<<"Error opening FITS file: "<<e.message()<<endl; |
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.
if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": ...
| m_TotalRows = m_ComptonTable->rows(); | ||
| int nCols = m_ComptonTable->numCols(); | ||
|
|
||
| cout<<"FITS table metadata:"<<endl; |
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.
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)); |
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
| 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?
| /* | ||
| * MGUIOptionsLoaderMeasurementsFITS.h | ||
| * | ||
| * Copyright (C) by Andreas Zoglauer. |
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.
Please add your name here everywhere (check all files)
|
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 to passed through multiple layer of nuclearizer?