Exemplo n.º 1
0
    if K[i, i] != 0:
        name = "k_{0}".format(sv[i])
        code = "{0}=Symbol('{0}')".format(name)
        print(code)
        exec(code)

K_sym = ImmutableMatrix(
    n, n, lambda i, j: Symbol("k_" + str(sv[i])) if i == j else 0)
K_sym
# -

M_sym = A_sym * K_sym
M_sym

import CompartmentalSystems.helpers_reservoir as hr
hr.out_fluxes_by_symbol(sv, M_sym)

# we create a dictionary for the outfluxrates (flux divided by dono pool content)
outflux_rates = {
    "r_" + str(key) + "_rh": value / key
    for key, value in hr.out_fluxes_by_symbol(sv, M_sym).items()
}
internal_flux_rates = {
    "r_" + str(key[0]) + "_2_" + str(key[1]): value / key[0]
    for key, value in hr.internal_fluxes_by_symbol(sv, M_sym).items()
}
from copy import deepcopy
all_rates = deepcopy(outflux_rates)
all_rates.update(internal_flux_rates)
all_rates
Exemplo n.º 2
0
        code="{0}=Symbol('{0}')".format(name)
        print(code)
        exec(code)
        
K_sym=ImmutableMatrix(
    n,n,
    lambda i,j: Symbol("k_" + str(sv[i])) if i==j else 0
)
K_sym
# -

M_sym=A_sym*K_sym
M_sym

import  CompartmentalSystems.helpers_reservoir as hr
hr.out_fluxes_by_symbol(sv,M_sym)

# we create a dictionary for the outfluxrates (flux divided by dono pool content)
outflux_rates = {"r_"+str(key)+"_rh":value/key for key,value in hr.out_fluxes_by_symbol(sv,M_sym).items()}
internal_flux_rates = {"r_"+str(key[0])+"_2_"+str(key[1]):value/key[0] for key,value in hr.internal_fluxes_by_symbol(sv,M_sym).items()}
from copy import  deepcopy
all_rates=deepcopy(outflux_rates)
all_rates.update(internal_flux_rates)
all_rates

# +
# and one for the internal fluxrates
# -

old_par_dict = {
    beta_leaf: 0.6,
Exemplo n.º 3
0
def nitrogen_out_fluxes_by_symbol_1(
    cm: NitrogenCompartmentalMatrix,
    svt: NitrogenStateVariableTuple
) -> NitrogenOutFluxesBySymbol:
    return NitrogenOutFluxesBySymbol(hr.out_fluxes_by_symbol(svt,cm))
Exemplo n.º 4
0
def carbon_out_fluxes_by_symbol_1(
    cm: CarbonCompartmentalMatrix,
    svt: CarbonStateVariableTuple
) -> CarbonOutFluxesBySymbol:
    return CarbonOutFluxesBySymbol(hr.out_fluxes_by_symbol(svt,cm))
Exemplo n.º 5
0
def out_fluxes_by_symbol_1(
    cm: CompartmentalMatrix,
    svt: StateVariableTuple
) -> OutFluxesBySymbol:
    return OutFluxesBySymbol(hr.out_fluxes_by_symbol(svt,cm))