Skip to content

Commit

Permalink
Calculated v mags now NAN if phase>160 degrees (#141)
Browse files Browse the repository at this point in the history
* Calculated v mags now NAN if phase>160 degrees

* add citation

* fixed citation
  • Loading branch information
dahlend authored Oct 18, 2024
1 parent 1f5af85 commit 29451f5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/kete/rust/flux/reflected.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub fn hg_apparent_flux_py(
///
/// The HG IAU model is not technically defined above 120 degrees phase, however this
/// will continue to return values fit to the model until 160 degrees. Phases larger
/// than 160 degrees will return an apparent magnitude of infinity.
/// than 160 degrees will return nan.
///
/// Parameters
/// ----------
Expand Down
20 changes: 17 additions & 3 deletions src/kete_core/src/flux/reflected.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ use crate::{
use nalgebra::Vector3;
use serde::{Deserialize, Serialize};

/// This computes the phase curve correction using the IAU standard for the HG model.
/// This computes the phase curve correction using the IAU standard for the HG model.
///
/// Specifically page Page 550 - Equation (A4):
///
/// Asteroids II. University of Arizona Press, Tucson, pp. 524–556.
/// Bowell, E., Hapke, B., Domingue, D., Lumme, K., Peltoniemi, J., Harris,
/// A.W., 1989. Application of photometric models to asteroids, in: Binzel,
/// R.P., Gehrels, T., Matthews, M.S. (Eds.)
///
/// # Arguments
///
Expand All @@ -30,6 +37,13 @@ pub fn hg_phase_curve_correction(g_param: f64, phase: f64) -> f64 {
///
/// H, Albedo, and Diameter are all related by the relation:
/// diameter = c_hg / albedo.sqrt() * (10f64).powf(-h_mag / 5.0);
///
/// Specifically page Page 549 - Equation (A1) of:
///
/// Asteroids II. University of Arizona Press, Tucson, pp. 524–556.
/// Bowell, E., Hapke, B., Domingue, D., Lumme, K., Peltoniemi, J., Harris,
/// A.W., 1989. Application of photometric models to asteroids, in: Binzel,
/// R.P., Gehrels, T., Matthews, M.S. (Eds.)
///
/// # Arguments
/// * `desig` - Designation of the object.
Expand Down Expand Up @@ -214,7 +228,7 @@ impl HGParams {
///
/// The IAU model is not technically defined above 120 degrees phase, however this will
/// continue to return values fit to the model until 160 degrees. Phases larger than
/// 160 degrees will return an apparent magnitude of infinity.
/// 160 degrees will return nan.
///
/// Note that this typically assumes that H/G have been fit in the V band, thus this
/// will return a V band apparent magnitude.
Expand All @@ -232,7 +246,7 @@ impl HGParams {

// 2.7925... == 160 degrees in radians
if phase > 2.792526803190927 {
return f64::INFINITY;
return f64::NAN;
}

let correction = hg_phase_curve_correction(self.g_param, phase).log10();
Expand Down
1 change: 1 addition & 0 deletions src/kete_core/src/frames/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub enum Frame {
/// - isize value represents the frame identifier.
/// - array of 6 floats represent the euler angles and their derivatives to move to
/// this frame from the ecliptic frame.
///
/// Rotation is done with a ZXZ set of chained rotations.
EclipticNonInertial(isize, [f64; 6]),
// Other non inertial frames will require multi-step conversions
Expand Down

0 comments on commit 29451f5

Please sign in to comment.