12#include "SpectralDefinition1D.h"
30 CSVReader csv(smileDefFilename.toString());
33 QString msg = QObject::tr(
"Input calibration file [%1] must have 2 columns with "
34 "the format: wavelength centers, wavelength widths").
35 arg(smileDefFilename.toString());
36 throw IException(IException::User, msg, _FILEINFO_);
40 QString msg = QObject::tr(
"Input calibration file [%1] must have at least 2 lines.").
41 arg(smileDefFilename.toString());
42 throw IException(IException::User, msg, _FILEINFO_);
51 if (centers[0] < centers[1]) {
58 double lastWavelength = centers[0].toDouble();
61 for (
int i=0; i <csv.
rows(); i++) {
70 Spectel temp(Isis::NULL8, Isis::NULL8, i+1, Isis::NULL8, centers[i].toDouble(),
71 widths[i].toDouble());
72 tempList->append(temp);
73 lastWavelength = centers[i].toDouble();
84 }
catch (IException &e) {
89 QString msg = QObject::tr(
"Unable to open input file [%1]. Is it a valid CSV?").
90 arg(smileDefFilename.toString());
91 throw IException(e, IException::Unknown, msg, _FILEINFO_);
102 temp +=
"----Section ";
103 temp +=QString::number(i);
106 temp+=
"Wavelength= ";
107 temp+=QString::number(
m_spectelList->at(i)->at(j).centerWavelength());
109 temp+=QString::number(
m_spectelList->at(i)->at(j).filterWidth());
180 if (tempBand <= m_spectelList->at(i)->length()) {
229 double bestDiff = DBL_MAX;
230 double bestBand = -DBL_MAX;
233 QString msg = QObject::tr(
"Input section number is greater than total number of sections.");
234 throw IException(IException::User, msg, _FILEINFO_);
239 if (std::abs(diff) < std::abs(bestDiff)) {
246 if (bestBand == -DBL_MAX) {
247 return Spectel(Isis::Null, Isis::Null, Isis::Null, Isis::Null, 0.0, 0.0);
Reads strings and parses them into tokens separated by a delimiter character.
int rows() const
Reports the number of rows in the table.
Parser::TokenList CSVAxis
Row/Column token list.
CSVAxis getColumn(int index) const
Parse and return a column specified by index order.
int columns() const
Determine the number of columns in the input source.
Stores information about a "Spectral pixel" or spectel.
double centerWavelength() const
Gets central wavelength of spectel.
SpectralDefinition1D()
construct an empty 1D SpectralDef
virtual ~SpectralDefinition1D()
destructor
Spectel findSpectel(const int sample, const int line, const int band) const
Get the Spectel from this SpectralDefinition at a (s,l,b).
Spectel findSpectelByWavelength(double wavelength, int sectionNumber) const
Finds the Spectel with the closest center wavelength (in the given sectionNumber) to the input wavele...
virtual int sectionCount() const
Returns the number of sections in this Spectral Definition.
QList< QList< Spectel > * > * m_spectelList
Stores each center wavelength and width.
int sectionNumber(int s, int l, int b) const
Returns the section number that a spectel is in.
QString toString()
Returns the QString representation of the SpectralDefinition1D.
bool m_ascendingWavelengths
Do the wavelengths in a given section ascend? Used to determine sections.
int m_numSections
The number of different sections of the Spectral Definition.
int m_nl
Number of lines in input Cube.
int m_ns
Number of samples in input Cube.
int m_nb
Number of bands in input Cube.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.