def create_initial_assignment(sid, value): """ Helper for creating initial assignments """ # check if valid identifier if "(" in sid: warnings.warn( "sid is not valid: {}. Initial assignment is not generated". format(sid)) return try: f_value = float(value) parameters.append( fac.Parameter( sid=sid, value=f_value, name="{} = {}".format(sid, value), constant=False, )) except ValueError: """ Initial data are optional, XPP sets them to zero by default (many xpp model don't write the p(0)=0. """ parameters.append( fac.Parameter(sid=sid, value=0.0, name=sid, constant=False)) initial_assignments.append( fac.InitialAssignment(sid=sid, value=value, name="{} = {}".format(sid, value)))
def create_initial_assignment(sid: str, value: str) -> None: """Create initial assignments helper.""" # check if valid identifier if "(" in sid: warnings.warn( f"sid is not valid: {sid}. Initial assignment is not generated" ) return try: f_value = float(value) parameters.append( fac.Parameter( sid=sid, value=f_value, name=f"{sid} = {value}", constant=False, )) except ValueError: """ Initial data are optional, XPP sets them to zero by default (many xpp model don't write the p(0)=0. """ parameters.append( fac.Parameter(sid=sid, value=0.0, name=sid, constant=False)) initial_assignments.append( fac.InitialAssignment(sid=sid, value=value, name=f"{sid} = {value}"))
mc.Parameter('x_glu4', 6.40, 'dimensionless', True), mc.Parameter('x_epi1', 6090, 'pM', True), mc.Parameter('x_epi2', 100, 'pM', True), mc.Parameter('x_epi3', 3.10, 'mM', True), mc.Parameter('x_epi4', 8.40, 'dimensionless', True), mc.Parameter('K_val', 0.1, 'dimensionless', True), mc.Parameter('epi_f', 0.8, 'dimensionless', True), ]) ############################################################## # Assignments ############################################################## assignments.extend([ mc.InitialAssignment('V_mito', 'f_mito * V_cyto', 'm3', name='mitochondrial volume'), mc.InitialAssignment('flux_conversion', 'mumole_per_mmole/bodyweight', 'mumole_per_mmole_kg'), # scaling factors mc.InitialAssignment('scale', '1 dimensionless', 'dimensionless', name='scaling factor rates'), mc.InitialAssignment('f_gly', 'scale', 'dimensionless', name='scaling factor glycolysis'), mc.InitialAssignment('f_glyglc', 'scale', 'dimensionless', name='scaling factor glycogen metabolism'), ]) ############################################################## # Rules ############################################################## rules.extend([ # hormonal regulation mc.AssignmentRule('ins', 'x_ins2 + (x_ins1-x_ins2) * glc_ext^x_ins4/(glc_ext^x_ins4 + x_ins3^x_ins4)', 'pM',
0, 'litre_per_h', constant=True, name='renal clearance [L/hr] caffeine'), mc.Parameter('CLrenal_px', 0, 'litre_per_h', constant=True, name='renal clearance [L/hr] paraxanthine'), ] ############################################################## # Assignments ############################################################## assignments = [ mc.InitialAssignment('Ave_caf', 'IVDOSE_caf', 'mg'), mc.InitialAssignment('D_caf', 'PODOSE_caf', 'mg'), mc.InitialAssignment('Ave_px', 'IVDOSE_px', 'mg'), mc.InitialAssignment('D_px', 'PODOSE_px', 'mg'), ] ############################################################## # Rules ############################################################## rules = [ # absorption px identical to caf mc.AssignmentRule('Ka_px', 'Ka_caf', 'per_h'), # clearance of px relative to caf (both via Cyp1a2) mc.AssignmentRule('HLM_CLint_px', 'fcl_px_caf*HLM_CLint_caf', 'mulitre_per_min_mg'),