8 #include "LunarLambertEmpirical.h"
9 #include "IException.h"
12 LunarLambertEmpirical::LunarLambertEmpirical(Pvl &pvl) : PhotoModel(pvl) {
13 PvlGroup &algo = pvl.findObject(
"PhotometricModel")
17 if (algo.hasKeyword(
"PhaseList")) {
18 SetPhotoPhaseList(algo[
"PhaseList"]);
20 QString msg =
"The empirical Lunar Lambert phase list was not provided by user";
23 if (algo.hasKeyword(
"LList")) {
24 SetPhotoLList(algo[
"LList"]);
26 QString msg =
"The empirical Lunar Lambert l exponent list was not provided by user";
29 if (algo.hasKeyword(
"PhaseCurveList")) {
30 SetPhotoPhaseCurveList(algo[
"PhaseCurveList"]);
32 QString msg =
"The empirical Lunar Lambert phase brightness list was not provided by user";
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";
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";
52 p_photoLSpline.
Reset();
54 p_photoLSpline.
AddData(p_photoPhaseList,p_photoLList);
56 p_photoBSpline.
Reset();
58 p_photoBSpline.
AddData(p_photoPhaseList,p_photoPhaseCurveList);
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;