12#include "SpectralDefinition1D.h"
30 CSVReader csv(smileDefFilename.toString());
32 if (csv.columns() != 2) {
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());
40 QString msg = QObject::tr(
"Input calibration file [%1] must have at least 2 lines.").
41 arg(smileDefFilename.toString());
51 if (centers[0] < centers[1]) {
58 double lastWavelength = centers[0].toDouble();
59 QList<Spectel> *tempList =
new QList<Spectel>;
61 for (
int i=0; i <csv.rows(); i++) {
67 tempList =
new QList<Spectel>;
70 Spectel temp(Isis::NULL8, Isis::NULL8, i+1, Isis::NULL8, centers[i].
toDouble(),
72 tempList->append(temp);
73 lastWavelength = centers[i].toDouble();
89 QString msg = QObject::tr(
"Unable to open input file [%1]. Is it a valid CSV?").
90 arg(smileDefFilename.toString());
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.");
239 if (std::abs(diff) < std::abs(bestDiff)) {
246 if (bestBand == -DBL_MAX) {
Reads strings and parses them into tokens separated by a delimiter character.
Parser::TokenList CSVAxis
Row/Column token list.
File name manipulation and expansion.
@ Unknown
A type of error that cannot be classified as any of the other error types.
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Stores information about a "Spectral pixel" or 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.
const double Null
Value for an Isis Null pixel.
double toDouble(const QString &string)
Global function to convert from a string to a double.