8#include "MinnaertEmpirical.h"
12 MinnaertEmpirical::MinnaertEmpirical(
Pvl &pvl) :
PhotoModel(pvl) {
13 PvlGroup &algo = pvl.findObject(
"PhotometricModel")
14 .findGroup(
"Algorithm", Pvl::Traverse);
17 if (algo.hasKeyword(
"PhaseList")) {
18 SetPhotoPhaseList(algo[
"PhaseList"]);
20 std::string msg =
"The empirical Minnaert phase list was not provided by user";
21 throw IException(IException::User, msg, _FILEINFO_);
23 if (algo.hasKeyword(
"KList")) {
24 SetPhotoKList(algo[
"KList"]);
26 std::string msg =
"The empirical Minnaert k exponent list was not provided by user";
27 throw IException(IException::User, msg, _FILEINFO_);
29 if (algo.hasKeyword(
"PhaseCurveList")) {
30 SetPhotoPhaseCurveList(algo[
"PhaseCurveList"]);
32 std::string msg =
"The empirical Minnaert phase brightness list was not provided by user";
33 throw IException(IException::User, msg, _FILEINFO_);
37 p_photoPhaseAngleCount = (
int)p_photoPhaseList.size();
39 if (p_photoPhaseAngleCount != (
int)p_photoKList.size()) {
40 std::string msg =
"Number of empirical Minnaert k list values must be equal";
41 msg +=
"to number of phase angles provided";
42 throw IException(IException::User, msg, _FILEINFO_);
45 if (p_photoPhaseAngleCount != (
int)p_photoPhaseCurveList.size()) {
46 std::string msg =
"Number of empirical Minnaert phase curve list values must be equal";
47 msg +=
"to number of phase angles provided";
48 throw IException(IException::User, msg, _FILEINFO_);
52 p_photoKSpline.Reset();
53 p_photoKSpline.SetInterpType(NumericalApproximation::CubicClamped);
54 p_photoKSpline.AddData(p_photoPhaseList,p_photoKList);
55 p_photoKSpline.SetCubicClampedEndptDeriv(1.0e30,1.0e30);
56 p_photoBSpline.Reset();
57 p_photoBSpline.SetInterpType(NumericalApproximation::CubicClamped);
58 p_photoBSpline.AddData(p_photoPhaseList,p_photoPhaseCurveList);
59 p_photoBSpline.SetCubicClampedEndptDeriv(1.0e30,1.0e30);
62 MinnaertEmpirical::~MinnaertEmpirical() {
63 p_photoKSpline.Reset();
64 p_photoBSpline.Reset();
65 p_photoPhaseList.clear();
67 p_photoPhaseCurveList.clear();
82 p_photoPhaseList.clear();
84 while (strlist.length()) {
85 phaseangle = strlist.
Token(
",");
86 if (phaseangle < 0.0 || phaseangle > 180.0) {
87 std::string msg =
"Invalid value of empirical Minnaert phase angle list value [" +
91 p_photoPhaseList.push_back(phaseangle);
107 if (phaseList.
size() == 1) {
113 p_photoPhaseList.clear();
115 for (
int i=0; i< phaseList.
size(); i++) {
116 phaseAngle = phaseList[i].toDouble();
118 if (phaseAngle < 0.0 || phaseAngle > 180.0) {
119 QString msg =
"Invalid value of empirical Minnaert phase angle list value [" +
123 p_photoPhaseList.push_back(phaseAngle);
139 p_photoKList.clear();
141 while (strlist.length()) {
142 kvalue = strlist.
Token(
",");
144 std::string msg =
"Invalid value of Minnaert k list value [" +
148 p_photoKList.push_back(kvalue);
164 if (kstrList.
size() == 1) {
169 p_photoKList.clear();
170 for (
int i=0; i<kstrList.
size(); i++) {
171 p_photoKList.push_back(kstrList[i].
toDouble());
184 IString strlist(phasecurvestrlist);
185 p_photoPhaseCurveList.clear();
187 while (strlist.length()) {
188 phasecurve = strlist.
Token(
",");
189 p_photoPhaseCurveList.push_back(phasecurve);
204 if (photocurvestrList.
size() == 1) {
209 p_photoPhaseCurveList.clear();
210 for (
int i=0; i<photocurvestrList.
size(); i++) {
211 p_photoPhaseCurveList.push_back(photocurvestrList[i].
toDouble());
217 static double pht_minnaert_empirical;
222 double kInterpolated = 0;
223 double bInterpolated = 0;
225 static double old_phase = -9999;
226 static double old_incidence = -9999;
227 static double old_emission= -9999;
230 if (old_phase == phase && old_incidence == incidence && old_emission == emission) {
231 return pht_minnaert_empirical;
234 old_incidence = incidence;
235 old_emission = emission;
237 incrad = incidence *
Isis::PI / 180.0;
238 emarad = emission *
Isis::PI / 180.0;
242 if (phase != old_phase) {
248 if(munot <= 0.0 || mu <= 0.0 || incidence == 90.0 ||
250 pht_minnaert_empirical = 0.0;
252 else if(kInterpolated == 1.0) {
253 pht_minnaert_empirical = munot * bInterpolated;
256 pht_minnaert_empirical = bInterpolated * munot * pow((munot * mu), (kInterpolated - 1.0));
259 return pht_minnaert_empirical;
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Adds specific functionality to C++ strings.
IString Token(const IString &separator)
Returns the first token in the IString.
Empirical Minnaert photometric model Derive model albedo using phase dependent Minnaert equation and ...
void SetPhotoKList(QString kstrlist)
Set the empirical Minnaert function K exponent list.
virtual double PhotoModelAlgorithm(double phase, double incidence, double emission)
Return photometric phase angle list.
void SetPhotoPhaseList(QString phasestrlist)
Set the empirical Minnaert function phase angle list.
void SetPhotoPhaseCurveList(QString phasecurvestrlist)
Set the empirical Minnaert function phase curve list.
@ Extrapolate
Evaluate() attempts to extrapolate if a is outside of the domain. This is only valid for NumericalApp...
Container for cube-like labels.
A single keyword-value pair.
int size() const
Returns the number of values stored in this keyword.
This is free and unencumbered software released into the public domain.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
double toDouble(const QString &string)
Global function to convert from a string to a double.
const double PI
The mathematical constant PI.