spc-factor-results / utils /reflectance.py
Travis Driver
Add calibrated results
a4c58e7
"""Different Reflectance function definition.
Author: Travis Driver
"""
import numpy as np
from typing import Tuple
def lunar_lambert_reflectance(
R_CB: np.ndarray, r_BC_C: np.ndarray, l_B: np.ndarray, s_C: np.ndarray, n_B: np.ndarray
) -> Tuple[float, float, float, float]:
s_B = (R_CB.T @ s_C.reshape((3, -1))).flatten()
r_B = (-R_CB.T @ r_BC_C.reshape((3, -1))).flatten()
e_B = r_B - l_B
e_B /= np.linalg.norm(e_B)
cs = np.sum(s_B * n_B)
ce = np.sum(e_B * n_B)
phi = np.arccos(np.sum(s_B * e_B))
L = np.exp(-np.rad2deg(phi) / 60.0)
reflect = (1 - L) * cs + L * 2.0 * cs / (cs + ce)
return reflect, np.arccos(cs), np.arccos(ce), phi
def schroder2013_reflectance(
R_CB: np.ndarray, r_BC_C: np.ndarray, l_B: np.ndarray, s_C: np.ndarray, n_B: np.ndarray
) -> Tuple[float, float, float, float]:
s_B = (R_CB.T @ s_C.reshape((3, -1))).flatten()
r_B = (-R_CB.T @ r_BC_C.reshape((3, -1))).flatten()
e_B = r_B - l_B
e_B /= np.linalg.norm(e_B)
cs = np.sum(s_B * n_B)
ce = np.sum(e_B * n_B)
phi = np.arccos(np.sum(s_B * e_B))
cp0, cp1 = 0.830, -7.22e-3 * 180 / np.pi
L = cp0 + cp1 * phi
c0, c1, c2, c3, c4 = (
0.301,
-5.17e-3 * 180.0 / np.pi,
5.51e-5 * (180.0 / np.pi) ** 2,
-3.13e-7 * (180.0 / np.pi) ** 3,
0.699e-9 * (180.0 / np.pi) ** 4,
)
aeq = c0 + c1 * phi + c2 * phi ** 2 + c3 * phi ** 3 + c4 * phi ** 4
reflect = aeq / 0.301 * ((1 - L) * cs + L * 2.0 * cs / (cs + ce))
return reflect, np.arccos(cs), np.arccos(ce), phi