8#include "LunarLambertEmpirical.h"
12 LunarLambertEmpirical::LunarLambertEmpirical(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 QString msg =
"The empirical Lunar Lambert phase list was not provided by user";
21 throw IException(IException::User, msg, _FILEINFO_);
23 if (algo.hasKeyword(
"LList")) {
24 SetPhotoLList(algo[
"LList"]);
26 QString msg =
"The empirical Lunar Lambert l exponent list was not provided by user";
27 throw IException(IException::User, msg, _FILEINFO_);
29 if (algo.hasKeyword(
"PhaseCurveList")) {
30 SetPhotoPhaseCurveList(algo[
"PhaseCurveList"]);
32 QString msg =
"The empirical Lunar Lambert 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_photoLList.size()) {
40 QString msg =
"Number of empirical Lunar Lambert l 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 QString msg =
"Number of empirical Lunar Lambert phase curve list values must be equal";
47 msg +=
"to number of phase angles provided";
48 throw IException(IException::User, msg, _FILEINFO_);
52 p_photoLSpline.Reset();
53 p_photoLSpline.SetInterpType(NumericalApproximation::CubicClamped);
54 p_photoLSpline.AddData(p_photoPhaseList,p_photoLList);
55 p_photoLSpline.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 LunarLambertEmpirical::~LunarLambertEmpirical() {
63 p_photoLSpline.Reset();
64 p_photoBSpline.Reset();
65 p_photoPhaseList.clear();
67 p_photoPhaseCurveList.clear();
80 void LunarLambertEmpirical::SetPhotoPhaseList(QString phasestrlist) {
83 p_photoPhaseList.clear();
85 while (strlist.length()) {
86 phaseangle = strlist.Token(
",");
87 if (phaseangle < 0.0 || phaseangle > 180.0) {
88 QString msg =
"Invalid value of empirical Lunar Lambert phase angle list value [" +
90 throw IException(IException::User, msg, _FILEINFO_);
92 p_photoPhaseList.push_back(phaseangle);
106 void LunarLambertEmpirical::SetPhotoPhaseList(
PvlKeyword phaseList) {
109 if (phaseList.size() == 1) {
110 SetPhotoPhaseList(QString(phaseList));
115 p_photoPhaseList.clear();
117 for (
int i=0; i< phaseList.size(); i++) {
118 phaseAngle = phaseList[i].toDouble();
120 if (phaseAngle < 0.0 || phaseAngle > 180.0) {
121 QString msg =
"Invalid value of empirical Lunar Lambert phase angle list value [" +
123 throw IException(IException::User, msg, _FILEINFO_);
125 p_photoPhaseList.push_back(phaseAngle);
140 void LunarLambertEmpirical::SetPhotoLList(QString lstrlist) {
143 p_photoLList.clear();
145 while (strlist.length()) {
146 lvalue = strlist.Token(
",");
147 p_photoLList.push_back(lvalue);
162 void LunarLambertEmpirical::SetPhotoLList(
PvlKeyword lstrList) {
165 if (lstrList.size() == 1) {
166 SetPhotoLList(QString(lstrList));
170 p_photoLList.clear();
171 for (
int i=0; i<lstrList.size(); i++) {
172 p_photoLList.push_back(lstrList[i].
toDouble());
184 void LunarLambertEmpirical::SetPhotoPhaseCurveList(QString phasecurvestrlist) {
186 IString strlist(phasecurvestrlist);
187 p_photoPhaseCurveList.clear();
189 while (strlist.length()) {
190 phasecurve = strlist.Token(
",");
191 p_photoPhaseCurveList.push_back(phasecurve);
204 void LunarLambertEmpirical::SetPhotoPhaseCurveList(
PvlKeyword photocurvestrList) {
207 if (photocurvestrList.size() == 1) {
208 SetPhotoPhaseCurveList(QString(photocurvestrList));
212 p_photoPhaseCurveList.clear();
213 for (
int i=0; i<photocurvestrList.size(); i++) {
214 p_photoPhaseCurveList.push_back(photocurvestrList[i].
toDouble());
219 double LunarLambertEmpirical::PhotoModelAlgorithm(
double phase,
double incidence,
221 static double pht_lunarlambert_empirical;
226 double lInterpolated = 0;
227 double bInterpolated = 0;
229 static double old_phase = -9999;
230 static double old_incidence = -9999;
231 static double old_emission= -9999;
234 if (old_phase == phase && old_incidence == incidence && old_emission == emission) {
235 return pht_lunarlambert_empirical;
238 old_incidence = incidence;
239 old_emission = emission;
241 incrad = incidence *
Isis::PI / 180.0;
242 emarad = emission *
Isis::PI / 180.0;
246 if (phase != old_phase) {
247 lInterpolated = p_photoLSpline.Evaluate(phase, NumericalApproximation::Extrapolate);
248 bInterpolated = p_photoBSpline.Evaluate(phase, NumericalApproximation::Extrapolate);
252 if(munot <= 0.0 || mu <= 0.0) {
253 pht_lunarlambert_empirical = 0.0;
255 else if(lInterpolated == 0.0) {
256 pht_lunarlambert_empirical = munot * bInterpolated;
258 else if(lInterpolated == 1.0) {
259 pht_lunarlambert_empirical = bInterpolated * 2.0 * munot / (munot + mu);
262 pht_lunarlambert_empirical = bInterpolated * munot * ((1.0 - lInterpolated) + 2.0 * lInterpolated / (munot + mu));
265 return pht_lunarlambert_empirical;
Adds specific functionality to C++ strings.
Empirical Lunar Lambert photometric model Derive model albedo using phase dependent Minnaert equation...
Container for cube-like labels.
A single keyword-value pair.
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.