7 Mixed::Mixed(Pvl &pvl, PhotoModel &pmodel) : NormModel(pvl, pmodel) {
8 PvlGroup &algorithm = pvl.findObject(
"NormalizationModel").findGroup(
"Algorithm",
Pvl::Traverse);
21 if(algorithm.hasKeyword(
"Pharef")) {
22 SetNormPharef(algorithm[
"Pharef"]);
25 if(algorithm.hasKeyword(
"Incref")) {
26 SetNormIncref(algorithm[
"Incref"]);
29 if(algorithm.hasKeyword(
"Emaref")) {
30 SetNormEmaref(algorithm[
"Emaref"]);
33 if(algorithm.hasKeyword(
"Incmat")) {
34 SetNormIncmat(algorithm[
"Incmat"]);
37 if(algorithm.hasKeyword(
"Phamat")) {
38 SetNormPhamat(algorithm[
"Phamat"]);
40 p_normPhamat = p_normIncmat;
43 if(algorithm.hasKeyword(
"Emamat")) {
44 SetNormEmamat(algorithm[
"Emamat"]);
47 if(algorithm.hasKeyword(
"Thresh")) {
48 SetNormThresh(algorithm[
"Thresh"]);
51 if(algorithm.hasKeyword(
"Albedo")) {
52 SetNormAlbedo(algorithm[
"Albedo"]);
58 GetPhotoModel()->SetStandardConditions(
true);
59 p_psurfref = GetPhotoModel()->CalcSurfAlbedo(p_normPharef, p_normIncref, p_normEmaref);
60 double pprimeref = GetPhotoModel()->PhtTopder(p_normPharef, p_normIncref, p_normEmaref);
62 if(p_psurfref == 0.0) {
63 std::string err =
"Divide by zero error";
67 p_rhobar = p_normAlbedo / p_psurfref;
71 p_psurfmatch = GetPhotoModel()->CalcSurfAlbedo(p_normPhamat, p_normIncmat, p_normEmamat);
72 p_pprimematch = GetPhotoModel()->PhtTopder(p_normPhamat, p_normIncmat, p_normEmamat);
76 double arg = pow(p_psurfref, 2.0) + pow(p_psurfmatch * pprimeref / std::max(1.0e-30, p_pprimematch), 2.0);
77 if((arg < 1.0e-10) || (arg > 1.0e10)) {
78 std::string err =
"Bad reference state encountered";
83 GetPhotoModel()->SetStandardConditions(
false);
86 void Mixed::NormModelAlgorithm(
double phase,
double incidence,
double emission,
87 double demincidence,
double dememission,
double dn,
88 double &albedo,
double &mult,
double &base) {
93 static double old_phase = -9999;
94 static double old_incidence = -9999;
95 static double old_emission = -9999;
96 static double old_demincidence = -9999;
97 static double old_dememission = -9999;
99 if (old_phase != phase || old_incidence != incidence || old_emission != emission ||
100 old_demincidence != demincidence || old_dememission != dememission) {
103 psurf = GetPhotoModel()->
CalcSurfAlbedo(phase, demincidence, dememission);
104 pprime = GetPhotoModel()->
PhtTopder(phase, demincidence, dememission);
105 double arg = pow(psurf, 2.0) + pow(p_psurfmatch * pprime / std::max(1.0e-30, p_pprimematch), 2.0);
106 aden = sqrt(std::max(1.0e-30, arg));
109 old_incidence = incidence;
110 old_emission = emission;
111 old_demincidence = demincidence;
112 old_dememission = dememission;
119 if(aden > p_anum * p_normThresh) {
123 albedo = dn * p_anum / aden + p_rhobar * (p_psurfref - p_anum / aden * psurf);
137 if(pharef < 0.0 || pharef >= 180.0) {
138 std::string msg =
"Invalid value of normalization pharef [" +
143 p_normPharef = pharef;
156 if(incref < 0.0 || incref >= 90.0) {
157 std::string msg =
"Invalid value of normalization incref [" +
162 p_normIncref = incref;
175 if(emaref < 0.0 || emaref >= 90.0) {
176 std::string msg =
"Invalid value of normalization emaref [" +
181 p_normEmaref = emaref;
195 if(phamat < 0.0 || phamat >= 180.0) {
196 std::string msg =
"Invalid value of normalization phamat [" +
201 p_normPhamat = phamat;
215 if(incmat < 0.0 || incmat >= 90.0) {
216 std::string msg =
"Invalid value of normalization incmat [" +
221 p_normIncmat = incmat;
235 if(emamat < 0.0 || emamat >= 90.0) {
236 std::string msg =
"Invalid value of normalization emamat [" +
241 p_normEmamat = emamat;
251 p_normAlbedo = albedo;
269 p_normThresh = thresh;
double CalcSurfAlbedo(double pha, double inc, double ema)
Calculate the surface brightness using photometric angle information.
void SetNormEmamat(const double emamat)
Set the normalization function parameter.
void SetNormPhamat(const double phamat)
Set the normalization function parameter.
double PhtTopder(double phase, double incidence, double emission)
Obtain topographic derivative of an arbitrary photometric function.
void SetNormAlbedo(const double albedo)
Set the normalization function parameter.
#define _FILEINFO_
Macro for the filename and line number.
A type of error that could only have occurred due to a mistake on the user's part (e...
A type of error that cannot be classified as any of the other error types.
void SetNormIncref(const double incref)
Set the normalization function parameter.
Container for cube-like labels.
void SetNormPharef(const double pharef)
Set parameters needed for albedo normalization.
void SetNormIncmat(const double incmat)
Set the normalization function parameter.
Adds specific functionality to C++ strings.
Namespace for ISIS/Bullet specific routines.
Mixed albedo/topo normalization without atmosphere.
void SetNormEmaref(const double emaref)
Set the normalization function parameter.
void SetNormThresh(const double thresh)
Set the normalization function parameter.