pub struct AnthroLibrary { /* private fields */ }Expand description
A library of AnthroProfile entries that can be searched and sampled.
Implementations§
Source§impl AnthroLibrary
impl AnthroLibrary
Sourcepub fn add(&mut self, profile: AnthroProfile)
pub fn add(&mut self, profile: AnthroProfile)
Add a profile to the library.
Sourcepub fn find(&self, name: &str) -> Option<&AnthroProfile>
pub fn find(&self, name: &str) -> Option<&AnthroProfile>
Find a profile by exact name.
Sourcepub fn who_reference() -> Self
pub fn who_reference() -> Self
Build a library pre-populated with generic WHO/CDC reference profiles.
Data references:
- WHO Global Reference Data for BMI-for-age
- NCD-RisC (2016) — worldwide height trends
- CDC NHANES anthropometric surveys
Sourcepub fn blend_profiles(
a: &AnthroProfile,
b: &AnthroProfile,
t: f32,
) -> AnthroProfile
pub fn blend_profiles( a: &AnthroProfile, b: &AnthroProfile, t: f32, ) -> AnthroProfile
Linearly blend two profiles, producing a new profile with interpolated statistics.
t = 0.0 returns a clone of a; t = 1.0 returns a clone of b.
Sourcepub fn sample_population(&self, count: usize, seed: u32) -> Vec<AnthroSample>
pub fn sample_population(&self, count: usize, seed: u32) -> Vec<AnthroSample>
Sample count individuals from the library, cycling through profiles evenly.
Seeds are derived deterministically from seed and the sample index so
results are reproducible.
Sourcepub fn diversity_score(samples: &[AnthroSample]) -> f32
pub fn diversity_score(samples: &[AnthroSample]) -> f32
Compute a diversity score for a slice of samples.
Returns the mean pairwise L2 distance across the four anthropometric dimensions (height_m, bmi, shoulder_hip_ratio, limb_torso_ratio), each normalised to roughly [0..1] before computing distances.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AnthroLibrary
impl RefUnwindSafe for AnthroLibrary
impl Send for AnthroLibrary
impl Sync for AnthroLibrary
impl Unpin for AnthroLibrary
impl UnsafeUnpin for AnthroLibrary
impl UnwindSafe for AnthroLibrary
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more