pharmsol 0.26.1

Rust library for solving analytic and ode-defined pharmacometric models.
Documentation
use thiserror::Error;

use crate::data::error_model::ErrorModelError;
use crate::data::row::DataError;

use crate::CovariateError;

use ndarray::ShapeError;

#[derive(Error, Debug, Clone)]
pub enum PharmsolError {
    #[error("Error in the error model: {0}")]
    ErrorModelError(#[from] ErrorModelError),
    #[error("Covariate error: {0}")]
    CovariateError(#[from] CovariateError),
    #[error("Shape error: {0}")]
    NdarrayShapeError(#[from] ShapeError),
    #[error("Error parsing data: {0}")]
    DataError(#[from] DataError),
    #[error("Diffsol error: {0}")]
    DiffsolError(String),
    #[error("Other error: {0}")]
    OtherError(String),
    #[error("Error setting up progress bar: {0}")]
    ProgressBarError(String),
    #[error("Likelihood is not finite: {0}")]
    NonFiniteLikelihood(f64),
    #[error("The calculated likelihood is zero")]
    ZeroLikelihood,
    #[error("Missing observation in prediction")]
    MissingObservation,
    #[error("Input channel {input} is out of range (ndrugs = {ndrugs})")]
    InputOutOfRange { input: usize, ndrugs: usize },
}

impl From<diffsol::error::DiffsolError> for PharmsolError {
    fn from(error: diffsol::error::DiffsolError) -> Self {
        PharmsolError::DiffsolError(error.to_string())
    }
}