Skip to content

Commit

Permalink
Dictionary type conversion
Browse files Browse the repository at this point in the history
allow nonfloat64 value

Julian style

Allow different typing for odekwargs and senskwargs
  • Loading branch information
hwpang committed May 13, 2023
1 parent 448c7df commit a3409bb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/ThreadedSensitivities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ returns a dictionary mapping the index of the parameter to the ODESolution objec
corresponding to the associated sensitivities of every variable to that parameter
"""
function threadedsensitivities(react, paramindices; odesolver=nothing, senssolver=nothing,

Check warning on line 55 in src/ThreadedSensitivities.jl

View check run for this annotation

Codecov / codecov/patch

src/ThreadedSensitivities.jl#L55

Added line #L55 was not covered by tests
odekwargs=Dict([:abstol => 1e-20, :reltol => 1e-6]), senskwargs=Dict([:abstol => 1e-6, :reltol => 1e-3]))
odekwargs::Dict{Symbol,T1}=Dict([:abstol => 1e-20, :reltol => 1e-6]),
senskwargs::Dict{Symbol,T2}=Dict([:abstol => 1e-6, :reltol => 1e-3])) where {T1,T2}

if odesolver === nothing

Check warning on line 59 in src/ThreadedSensitivities.jl

View check run for this annotation

Codecov / codecov/patch

src/ThreadedSensitivities.jl#L59

Added line #L59 was not covered by tests
odesolver = react.recommendedsolver
Expand All @@ -80,6 +81,18 @@ function threadedsensitivities(react, paramindices; odesolver=nothing, senssolve

return solutiondictionary
end

function threadedsensitivities(react, paramindices; odesolver=nothing, senssolver=nothing,

Check warning on line 85 in src/ThreadedSensitivities.jl

View check run for this annotation

Codecov / codecov/patch

src/ThreadedSensitivities.jl#L85

Added line #L85 was not covered by tests
odekwargs::Dict{Any,Any},
senskwargs::Dict{Any,Any})
# Convert to Dict{Symbol, T}
# Needed for pyrms compatability: Python string gets converted to String and runs into expected Symbol, got a value of type String error
odekwargs = Dict(Symbol(key) => value for (key, value) in odekwargs)
senskwargs = Dict(Symbol(key) => value for (key, value) in senskwargs)
return threadedsensitivities(react, paramindices; odesolver=odesolver, senssolver=senssolver,

Check warning on line 92 in src/ThreadedSensitivities.jl

View check run for this annotation

Codecov / codecov/patch

src/ThreadedSensitivities.jl#L90-L92

Added lines #L90 - L92 were not covered by tests
odekwargs=odekwargs, senskwargs=senskwargs)
end

export threadedsensitivities

"""
Expand Down

0 comments on commit a3409bb

Please sign in to comment.