Exemplo n.º 1
0
 def setUp(self) -> None:
     self.t = np.linspace(0, 100, 230)
     self.pdf = pdf.GaussianFixedDispersion(self.t, 0.2)
     self.uo_id = "ft_ws"
     self.gui_title = "Flow-Through with switching"
     self.uo = fc_uo.FlowThroughWithSwitching(self.t, self.pdf, self.uo_id, self.gui_title)
     self.uo.log = TestLogger()
     self.uo._f = np.ones_like(self.t) * 0.53
     self.uo._n_species = 2
     self.uo._c = np.ones([self.uo._n_species, self.t.size]) * np.array([[0.2], [0.7]])
Exemplo n.º 2
0
    def cvi_column(uo: dict):
        d = uo['data']
        rt_target = d['mean RT [min]']
        t_sigma = d['peak sigma [min]']

        uo['uo_class'] = fc_uo.FlowThrough
        uo['parameters'] = {
            "uo_id": uo['id'],
            "pdf": pdf.GaussianFixedDispersion(t, t_sigma ** 2 / rt_target),
            "gui_title": uo['title'],
        }
        uo['attributes'] = {
            "rt_target": rt_target,
        }
Exemplo n.º 3
0
 def run_gauss_fixed_dispersion(self, t, rt_mean_list, sigma_list,
                                cutoff) -> None:
     for rt_mean in rt_mean_list:
         for sigma in sigma_list:
             p = self.get_gauss_pdf_with_cutoff(t, rt_mean, sigma, cutoff)
             pd = pdf.GaussianFixedDispersion(t,
                                              dispersion_index=sigma**2 /
                                              rt_mean,
                                              cutoff=cutoff)
             pd.log.log_level = pd.log.ERROR + 10
             pd.update_pdf(rt_mean=rt_mean)
             np.testing.assert_array_equal(pd.get_p(), p)
             pd.update_pdf(rt_mean=rt_mean / 2)
             p = self.get_gauss_pdf_with_cutoff(t, rt_mean / 2,
                                                sigma / np.sqrt(2), cutoff)
             np.testing.assert_array_almost_equal(pd.get_p(), p, 5)
Exemplo n.º 4
0
    def test_gauss_fixed_dispersion(self) -> None:
        t = np.linspace(0, 100, 1500)
        self.run_gauss_fixed_dispersion(t,
                                        sigma_list=[20, 5.5, 30, 80],
                                        rt_mean_list=[5, 10, 0.4, 100],
                                        cutoff=0.001)
        t = np.linspace(0, 900, 901)
        self.run_gauss_fixed_dispersion(t,
                                        sigma_list=[200, 5.5, 30, 880],
                                        rt_mean_list=[5, 0.4, 100],
                                        cutoff=0.001)

        pd = pdf.GaussianFixedDispersion(t, dispersion_index=5, cutoff=0.03)
        pd.log.log_level = pd.log.ERROR
        with self.assertRaises(RuntimeError):
            pd.update_pdf(rt_mean=6.6)
        pd.log.log_level = pd.log.ERROR + 10
        pd.update_pdf(rt_mean=6.6)
        p1 = pd.get_p().copy()
        pd.trim_and_normalize = False
        pd.update_pdf(rt_mean=6.6)
        p2 = pd.get_p()
        self.assertTrue(p1.size < p2.size)
        self.assertAlmostEqual(0.892, p2.sum() * t[1], 3)
Exemplo n.º 5
0
import numpy as np
from typing import List

from bio_rtd.uo.sc_uo import ACC
from bio_rtd.chromatography import bt_load
from bio_rtd import core, pdf

"""Direct instance creation."""

tmp_t = np.linspace(0, 1000, 10001)
tmp_dt = tmp_t[1]
tmp_acc = ACC(
    t=tmp_t,
    uo_id="acc_direct_instance",
    load_bt=bt_load.ConstantPatternSolution(tmp_dt, dbc_100=240, k=0.05),
    peak_shape_pdf=pdf.GaussianFixedDispersion(tmp_t, 8 ** 2 / 30)
)

tmp_acc.cv = 13
tmp_acc.equilibration_cv = 3
tmp_acc.equilibration_f_rel = 1
tmp_acc.load_cv = 25
tmp_acc.wash_cv = 5
tmp_acc.unaccounted_losses_rel = 0.2
tmp_acc.elution_cv = 3
tmp_acc.elution_f_rel = 1 / 4
tmp_acc.elution_peak_position_cv = 1.6
tmp_acc.elution_peak_cut_start_cv = 1.05
tmp_acc.elution_peak_cut_end_cv = 2.3
tmp_acc.regeneration_cv = 1
Exemplo n.º 6
0
__version__ = '0.7.1'
__author__ = 'Jure Sencar'

import numpy as np
from typing import List

from bio_rtd.uo.fc_uo import FlowThroughWithSwitching
from bio_rtd import core, pdf
"""Direct instance creation."""

t = np.linspace(0, 10, 100)

tmp_uo = FlowThroughWithSwitching(
    t=t,
    pdf=pdf.GaussianFixedDispersion(t, 2 * 2 / 45),
    uo_id="ft_with_switching_direct",
    gui_title="FlowThroughWithSwitching, direct instance"  # Optional.
)
tmp_uo.v_void = 3.4
tmp_uo.t_cycle = 20
"""Using dict of parameters and attributes.

Guide

1. Define a time step and a simulation time vector.
2. Use `PARAMETERS` and `ATTRIBUTES` as a template.
   Replace variable types with values.
   Remove or comment out the ones that are not needed.
3. Instantiate the unit operation with parameters.
   Updated instance with attributes.
Exemplo n.º 7
0
    peak_fitting.calc_emg_parameters_from_peak_shape(t_peak_start=9,
                                                     t_peak_max=16,
                                                     t_peak_end=27.5,
                                                     relative_threshold=0.05)
# Assuming the above experiments were done with 10 mL column.
ep_rt_mean_cv = ep_rt_mean / 10
# Elution peak shape pdf.
peak_shape_pdf = pdf.ExpModGaussianFixedRelativeWidth(
    t,
    sigma_relative=sigma / ep_rt_mean,
    tau_relative=1 / skew / ep_rt_mean,
    pdf_id="emg_rw_el_peak")
# Load recycle pdf. We try to describe the propagation of unbound and/or
# desorbed material throughout the column during load (and wash) step.
load_recycle_pdf = pdf.GaussianFixedDispersion(t,
                                               dispersion_index=2 * 2 / 30,
                                               pdf_id="g_fd_load_recycle_pdf")
pcc_pro_a = sc_uo.PCC(
    t,
    load_bt=load_bt,
    peak_shape_pdf=peak_shape_pdf,
    load_recycle_pdf=load_recycle_pdf,
    # Porosity of the column for protein.
    column_porosity_retentate=0.64,
    uo_id="pro_a_pcc",
    gui_title="ProteinA PCC",
)
pcc_pro_a.cv = 100  # mL
# Equilibration step.
pcc_pro_a.equilibration_cv = 1.5
# Equilibration flow rate is same as load flow rate.
Exemplo n.º 8
0
    def pcc_pro_a(uo: dict):
        d = uo['data']
        # Column volume.
        cv = d['CV [mL]']
        # Operating linear flow rate during load.
        v_lin_load = d['load flowrate [cm/h]'] / 60  # cm/min
        # Other steps info (durations and flow rates).
        f_eq_rel = d['equilibration / load flowrate []']
        f_wash_rel = d['wash / load flowrate []']
        f_elution_rel = d['elution / load flowrate []']
        f_reg_rel = d['regeneration / load flowrate []']
        v_eq_cv = d['equilibration [CV]']
        v_wash_cv = d['wash [CV]']
        v_elution_cv = d['elution [CV]']
        v_reg_cv = d['regeneration [CV]']
        # Switch columns at x % protein breakthrough during load.
        load_switch_c_rel = d['load col1 outlet conc ratio []']
        # Breakthrough profile.
        dbc_10 = d['DBC_10% [mg/mL]']
        dbc_100 = d['DBC_100% [mg/mL]']
        k = np.log(9) / (dbc_100 - dbc_10)
        # Elution peak (experimental data with column of different size).
        ep_rt, ep_sigma, ep_skew = \
            peak_fitting.calc_emg_parameters_from_peak_shape(
                t_peak_start=d['peak_a [mL]'],
                t_peak_max=d['peak_max [mL]'],
                t_peak_end=d['peak_b [mL]'],
                relative_threshold=d['peak_ab / peak_max []'])
        v_elution_peak_cv = ep_rt / d['peak_eval_CV [mL]']
        # Elution peak cut.
        el_peak_cut_start_cv = d['peak collection start [CV]']
        el_peak_cut_end_cv = d['peak collection end [CV]']
        protein_porosity = d['porosity protein []']
        hetp = d['HETP [cm]']
        unaccounted_losses = d['unaccounted_losses []']
        wash_recycle = d['recycle_wash []']
        extend_first_cycle = d['extend first load []']

        uo['uo_class'] = sc_uo.PCC
        uo['parameters'] = {
            "uo_id": uo['id'],
            "load_bt": ConstantPatternSolution(dt, dbc_100=dbc_100, k=k),
            "peak_shape_pdf": pdf.ExpModGaussianFixedRelativeWidth(
                t,
                sigma_relative=ep_sigma / ep_rt,
                tau_relative=1 / ep_skew / ep_rt),
            "load_recycle_pdf": pdf.GaussianFixedDispersion(
                t, dispersion_index=hetp / v_lin_load),
            # Porosity of the column for protein.
            "column_porosity_retentate": protein_porosity,
            "gui_title": uo['title'],
        }
        uo['attributes'] = {
            "cv": cv,
            "equilibration_cv": v_eq_cv,
            "equilibration_f_rel": f_eq_rel,
            "load_c_end_relative_ss": load_switch_c_rel,
            "load_c_end_estimate_with_iterative_solver": True,
            "load_extend_first_cycle": extend_first_cycle,
            "load_target_lin_velocity": v_lin_load,
            "wash_cv": v_wash_cv,
            "wash_f_rel": f_wash_rel,
            "wash_recycle": wash_recycle,
            "unaccounted_losses_rel": unaccounted_losses,
            "elution_cv": v_elution_cv,
            "elution_f_rel": f_elution_rel,
            "elution_peak_position_cv": v_elution_peak_cv,
            "elution_peak_cut_start_cv": el_peak_cut_start_cv,
            "elution_peak_cut_end_cv": el_peak_cut_end_cv,
            "regeneration_cv": v_reg_cv,
            "regeneration_f_rel": f_reg_rel,
        }