Struct Data
pub struct Data { /* private fields */ }
Expand description
The main data container for pharmacokinetic/pharmacodynamic data
Data is a collection of Subject instances, which themselves contain Occasion instances with Events. This structure represents the complete dataset for pharmacometric analysis.
§Examples
use pharmsol::*;
// Create subjects
let subject1 = Subject::builder("patient_001")
.bolus(0.0, 100.0, 0)
.observation(1.0, 5.0, 0)
.build();
let subject2 = Subject::builder("patient_002")
.bolus(0.0, 120.0, 0)
.observation(1.0, 6.0, 0)
.build();
// Create dataset with multiple subjects
let mut data = Data::new(vec![subject1]);
data.add_subject(subject2);
// Filter data
let filtered = data.filter_include(&["patient_001".to_string()]);
Implementations§
§impl Data
impl Data
pub fn get_subjects(&self) -> Vec<&Subject>
pub fn get_subjects(&self) -> Vec<&Subject>
Get a vector of references to all subjects in the dataset
§Returns
Vector of references to all subjects
pub fn add_subject(&mut self, subject: Subject)
pub fn add_subject(&mut self, subject: Subject)
pub fn get_subject(&self, id: &str) -> Option<&Subject>
pub fn get_subject(&self, id: &str) -> Option<&Subject>
pub fn write_pmetrics(&self, file: &File) -> Result<(), PharmsolError>
pub fn write_pmetrics(&self, file: &File) -> Result<(), PharmsolError>
pub fn filter_include(&self, include: &[String]) -> Data
pub fn filter_include(&self, include: &[String]) -> Data
pub fn filter_exclude(&self, exclude: Vec<String>) -> Data
pub fn filter_exclude(&self, exclude: Vec<String>) -> Data
pub fn expand(&self, idelta: f64, tad: f64) -> Data
pub fn expand(&self, idelta: f64, tad: f64) -> Data
Expand the dataset by adding observations at regular time intervals
This is useful for creating a dense grid of time points for simulations.
§Arguments
idelta
- Time interval between added observationstad
- Additional time to add after the last observation
§Returns
A new Data
object with expanded observations
Trait Implementations§
§impl<'de> Deserialize<'de> for Data
impl<'de> Deserialize<'de> for Data
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Data, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Data, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl IntoIterator for Data
impl IntoIterator for Data
§impl Serialize for Data
impl Serialize for Data
§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,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for Data
impl RefUnwindSafe for Data
impl Send for Data
impl Sync for Data
impl Unpin for Data
impl UnwindSafe for Data
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
Mutably borrows from an owned value. Read more
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> 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>
Converts
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>
Converts
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>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.