46 CSVReader csv(smileDefFilename.toString());
48 if (csv.columns() != 2) {
49 QString msg = QObject::tr(
"Input calibration file [%1] must have 2 columns with "
50 "the format: wavelength centers, wavelength widths").
51 arg(smileDefFilename.toString());
56 QString msg = QObject::tr(
"Input calibration file [%1] must have at least 2 lines.").
57 arg(smileDefFilename.toString());
67 if (centers[0] < centers[1]) {
74 double lastWavelength = centers[0].toDouble();
77 for (
int i=0; i <csv.rows(); i++) {
86 Spectel temp(Isis::NULL8, Isis::NULL8, i+1, Isis::NULL8, centers[i].
toDouble(),
88 tempList->append(temp);
89 lastWavelength = centers[i].toDouble();
105 QString msg = QObject::tr(
"Unable to open input file [%1]. Is it a valid CSV?").
106 arg(smileDefFilename.toString());
118 temp +=
"----Section ";
119 temp +=QString::number(i);
122 temp+=
"Wavelength= ";
123 temp+=QString::number(
m_spectelList->at(i)->at(j).centerWavelength());
125 temp+=QString::number(
m_spectelList->at(i)->at(j).filterWidth());
196 if (tempBand <= m_spectelList->at(i)->length()) {
245 double bestDiff = DBL_MAX;
246 double bestBand = -DBL_MAX;
249 QString msg = QObject::tr(
"Input section number is greater than total number of sections.");
253 for (
int i=0; i<
m_spectelList->at(sectionNumber)->length(); i++) {
254 diff =
m_spectelList->at(sectionNumber)->at(i).centerWavelength() - wavelength;
255 if (std::abs(diff) < std::abs(bestDiff)) {
262 if (bestBand == -DBL_MAX) {
const double Null
Value for an Isis Null pixel.
File name manipulation and expansion.
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.
double toDouble(const QString &string)
Global function to convert from a string to a double.
#define _FILEINFO_
Macro for the filename and line number.
A type of error that could only have occurred due to a mistake on the user's part (e...
A type of error that cannot be classified as any of the other error types.
Parser::TokenList CSVAxis
Row/Column token list.
Reads strings and parses them into tokens separated by a delimiter character.
QList< QList< Spectel > * > * m_spectelList
Stores each center wavelength and width.
int m_nl
Number of lines in input Cube.
int m_nb
Number of bands in input Cube.
Spectel findSpectelByWavelength(double wavelength, int sectionNumber) const
Finds the Spectel with the closest center wavelength (in the given sectionNumber) to the input wavele...
int m_ns
Number of samples in input Cube.
Spectel findSpectel(const int sample, const int line, const int band) const
Get the Spectel from this SpectralDefinition at a (s,l,b).
virtual ~SpectralDefinition1D()
destructor
Stores information about a "Spectral pixel" or spectel.
int m_numSections
The number of different sections of the Spectral Definition.
double centerWavelength() const
Gets central wavelength of spectel.
virtual int sectionCount() const
Returns the number of sections in this Spectral Definition.
SpectralDefinition1D()
construct an empty 1D SpectralDef