Skip to content

Commit

Permalink
add precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Oct 18, 2021
1 parent 201abc6 commit 0eabae6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
27 changes: 27 additions & 0 deletions src/GrowthMaps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,31 @@ include("models.jl")
include("framework.jl")
include("fit.jl")

function run_precompile()
p = Param(3e-1; bounds=(3e-2, 3e0))
ΔH_A = Param(3e4; units=u"cal/mol", bounds=(3e3, 3e5))
ΔH_L = Param(-1e5; units=u"cal/mol", bounds=(-1e6, -1e4))
ΔH_H = Param(3e5; units=u"cal/mol", bounds=(3e4, 3e6))
Thalf_L = Param(2e2; units=u"K", bounds=(2e1, 2e3))
Thalf_H = Param(3e2; units=u"K", bounds=(3e1, 3e3))
T_ref = u"K"(25.0u"°C")
growthmodel = SchoolfieldIntrinsicGrowth(p, ΔH_A, ΔH_L, Thalf_L, ΔH_H, Thalf_H, T_ref)
growth = Layer(:x, u"K", growthmodel)
model = Model(growth)

coldthresh = Param(ustrip(u"K", -10.0f0u"°C"); units=u"K", bounds=(240, 290))
coldmort = Param(-log(1.23f0); units=u"K"^-1, bounds=(0, 0.4))
coldstress = Layer(:x, u"K", LowerStress(coldthresh, coldmort))
log(1.23f0)

heatthresh = Param(ustrip(u"K"(30.0u"°C")); units=u"K", bounds=(280, 330))
heatmort = Param(-log(1.15); units= u"K"^-1, bounds=(0, 0.4))
heatstress = Layer(:x, u"K", UpperStress(heatthresh, heatmort))
model = Model((growth, coldstress, heatstress))

return nothing
end

run_precompile()

end # module
1 change: 0 additions & 1 deletion src/fit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ function manualfit!(
kwargs...
)
InteractModel(model; throttle=throttle, submodel=RateModel) do updated_model
@show params(updated_model)
ModelParameters.setparent!(model, updated_model)
manualfit(stripparams(updated_model), (observations, data); kwargs...)
end
Expand Down

0 comments on commit 0eabae6

Please sign in to comment.