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();
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 [" +
92 p_photoPhaseList.push_back(phaseangle);
109 if (phaseList.
size() == 1) {
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 [" +
125 p_photoPhaseList.push_back(phaseAngle);
143 p_photoLList.clear();
145 while (strlist.length()) {
146 lvalue = strlist.
Token(
",");
147 p_photoLList.push_back(lvalue);
165 if (lstrList.
size() == 1) {
170 p_photoLList.clear();
171 for (
int i=0; i<lstrList.
size(); i++) {
172 p_photoLList.push_back(lstrList[i].
toDouble());
186 IString strlist(phasecurvestrlist);
187 p_photoPhaseCurveList.clear();
189 while (strlist.length()) {
190 phasecurve = strlist.
Token(
",");
191 p_photoPhaseCurveList.push_back(phasecurve);
207 if (photocurvestrList.
size() == 1) {
212 p_photoPhaseCurveList.clear();
213 for (
int i=0; i<photocurvestrList.
size(); i++) {
214 p_photoPhaseCurveList.push_back(photocurvestrList[i].
toDouble());
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) {
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;
@ 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 Lunar Lambert photometric model Derive model albedo using phase dependent Minnaert equation...
void SetPhotoPhaseCurveList(QString phasecurvestrlist)
Set the empirical Lunar Lambert function phase curve list.
void SetPhotoLList(QString kstrlist)
Set the empirical Lunar Lambert function L exponent list.
virtual double PhotoModelAlgorithm(double phase, double incidence, double emission)
Return photometric phase angle list.
void SetPhotoPhaseList(QString phasestrlist)
Set the empirical Lunar Lambert function phase angle 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.