Struct Occasion
pub struct Occasion { /* private fields */ }
Expand description
An occasion within a subject’s dataset
An Occasion represents a distinct period of data collection for a subject, such as a hospital visit or dosing regimen. It contains events (doses, observations) and time-varying covariates.
Implementations§
§impl Occasion
impl Occasion
pub fn events(&self) -> Vec<&Event>
pub fn events(&self) -> Vec<&Event>
Get a vector of references to all events in this occasion
§Returns
Vector of references to all events
pub fn get_events(
&self,
reorder: Option<(&fn(&NalgebraVec<f64>, f64, &Covariates) -> HashMap<usize, f64>, &fn(&NalgebraVec<f64>, f64, &Covariates) -> HashMap<usize, f64>, &Vec<f64>, &Covariates)>,
ignore: bool,
) -> Vec<Event>
pub fn get_events( &self, reorder: Option<(&fn(&NalgebraVec<f64>, f64, &Covariates) -> HashMap<usize, f64>, &fn(&NalgebraVec<f64>, f64, &Covariates) -> HashMap<usize, f64>, &Vec<f64>, &Covariates)>, ignore: bool, ) -> Vec<Event>
Get events with modifications for lag time and bioavailability
§Arguments
lagtime
- Optional map of compartment-specific lag timesbioavailability
- Optional map of compartment-specific bioavailability factorsignore
- Whether to exclude events marked as “ignore”
§Returns
Vector of events, potentially filtered and with times adjusted for lag and bioavailability
pub fn covariates(&self) -> &Covariates
pub fn covariates(&self) -> &Covariates
pub fn add_observation(
&mut self,
time: f64,
value: f64,
outeq: usize,
errorpoly: Option<ErrorPoly>,
)
pub fn add_observation( &mut self, time: f64, value: f64, outeq: usize, errorpoly: Option<ErrorPoly>, )
Add an Observation event to the Occasion
pub fn add_missing_observation(&mut self, time: f64, outeq: usize)
pub fn add_missing_observation(&mut self, time: f64, outeq: usize)
Add a missing Observation event to the Occasion
pub fn add_observation_with_error(
&mut self,
time: f64,
value: f64,
outeq: usize,
errorpoly: ErrorPoly,
)
pub fn add_observation_with_error( &mut self, time: f64, value: f64, outeq: usize, errorpoly: ErrorPoly, )
Add a missing Observation with a custom ErrorPoly to the Occasion
This is useful if you want a different weight for the observation
pub fn add_infusion(
&mut self,
time: f64,
amount: f64,
input: usize,
duration: f64,
)
pub fn add_infusion( &mut self, time: f64, amount: f64, input: usize, duration: f64, )
pub fn events_mut(&mut self) -> &mut Vec<Event>
pub fn events_mut(&mut self) -> &mut Vec<Event>
Get a mutable reference to the events
pub fn events_iter_mut(&mut self) -> IterMut<'_, Event>
pub fn events_iter_mut(&mut self) -> IterMut<'_, Event>
Get a mutable iterator to the events
Trait Implementations§
§impl<'de> Deserialize<'de> for Occasion
impl<'de> Deserialize<'de> for Occasion
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Occasion, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Occasion, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl<'a> IntoIterator for &'a Occasion
impl<'a> IntoIterator for &'a Occasion
§impl<'a> IntoIterator for &'a mut Occasion
impl<'a> IntoIterator for &'a mut Occasion
§impl IntoIterator for Occasion
impl IntoIterator for Occasion
§impl Serialize for Occasion
impl Serialize for Occasion
§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 Occasion
impl RefUnwindSafe for Occasion
impl Send for Occasion
impl Sync for Occasion
impl Unpin for Occasion
impl UnwindSafe for Occasion
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> 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.