Struct Covariates
pub struct Covariates { /* private fields */ }
Expand description
A collection of Covariates
This struct provides methods to manage multiple covariates and retrieve interpolated values for all covariates at specific time points.
Implementations§
§impl Covariates
impl Covariates
pub fn new() -> Covariates
pub fn new() -> Covariates
Create a new empty collection of covariates
pub fn covariates(&self) -> HashMap<String, &Covariate>
pub fn covariates(&self) -> HashMap<String, &Covariate>
Get all covariates in this collection
pub fn add_covariate(&mut self, name: String, covariate: Covariate)
pub fn add_covariate(&mut self, name: String, covariate: Covariate)
Add a covariate to the collection
This method allows you to add a new covariate with a specific name and its associated data.
pub fn get_covariate(&self, name: &str) -> Option<&Covariate>
pub fn get_covariate(&self, name: &str) -> Option<&Covariate>
Get access to a specific covariate by name
pub fn get_covariate_mut(&mut self, name: &str) -> Option<&mut Covariate>
pub fn get_covariate_mut(&mut self, name: &str) -> Option<&mut Covariate>
Get access to a specific covariate by name
pub fn remove_covariate(&mut self, name: &str) -> Option<Covariate>
pub fn remove_covariate(&mut self, name: &str) -> Option<Covariate>
Remove a covariate by name
pub fn add_observation(&mut self, name: &str, time: f64, value: f64)
pub fn add_observation(&mut self, name: &str, time: f64, value: f64)
Add an observation to a covariate, creating the covariate if it doesn’t exist
If a value already exists at the specified time, it will update that value silently
pub fn update_observation(
&mut self,
name: &str,
time: f64,
new_value: f64,
) -> bool
pub fn update_observation( &mut self, name: &str, time: f64, new_value: f64, ) -> bool
Update an observation for a specific covariate
pub fn remove_observation(&mut self, name: &str, time: f64) -> bool
pub fn remove_observation(&mut self, name: &str, time: f64) -> bool
Remove an observation from a specific covariate
pub fn set_covariate_fixed(&mut self, name: &str, fixed: bool) -> bool
pub fn set_covariate_fixed(&mut self, name: &str, fixed: bool) -> bool
Set a covariate as fixed (use carry-forward interpolation)
This is a common operation in pharmacokinetic modeling where you want to treat a covariate as constant.
pub fn to_hashmap(
&mut self,
time: f64,
) -> Result<HashMap<String, f64>, CovariateError>
pub fn to_hashmap( &mut self, time: f64, ) -> Result<HashMap<String, f64>, CovariateError>
Trait Implementations§
§impl Clone for Covariates
impl Clone for Covariates
§fn clone(&self) -> Covariates
fn clone(&self) -> Covariates
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for Covariates
impl Debug for Covariates
§impl Default for Covariates
impl Default for Covariates
§fn default() -> Covariates
fn default() -> Covariates
§impl<'de> Deserialize<'de> for Covariates
impl<'de> Deserialize<'de> for Covariates
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Covariates, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Covariates, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Display for Covariates
impl Display for Covariates
§impl Serialize for Covariates
impl Serialize for Covariates
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Covariates
impl RefUnwindSafe for Covariates
impl Send for Covariates
impl Sync for Covariates
impl Unpin for Covariates
impl UnwindSafe for Covariates
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Context for T
impl<T> Context for T
fn vector_from_element<V>(&self, len: usize, value: <V as VectorCommon>::T) -> Vwhere
V: Vector<C = Self>,
fn vector_from_vec<V>(&self, vec: Vec<<V as VectorCommon>::T>) -> Vwhere
V: Vector<C = Self>,
fn vector_zeros<V>(&self, len: usize) -> Vwhere
V: Vector<C = Self>,
fn dense_mat_zeros<V>(
&self,
rows: usize,
cols: usize,
) -> <V as DefaultDenseMatrix>::Mwhere
V: Vector<C = Self> + DefaultDenseMatrix,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.