JuliaRheology / RHEOS.jl

RHEOS - Open Source Rheology data analysis software
MIT License
39 stars 9 forks source link

Modelpredict to accept RheoModelClass and parameters #150

Closed akabla closed 1 year ago

akabla commented 2 years ago

This is a request from @fr293 who noticed that creating a RheoModel takes time. He needs to generate many simulated responses for a statistical analysis and only need one of the moduli functions.

akabla commented 2 years ago

This should now work fine:

data=timeline(0:0.1:10)
strainfunction!(data,ramp)
modelpredict(data,Maxwell,η=10,k=5)
fr293 commented 2 years ago

@akabla thanks!

I can't find the right way to drive modelpredict from python

I'm trying rh.modelpredict(stress_history, rh.FractD_Maxwell, paramdict)

which gives JULIA: MethodError: no method matching modelpredict(::RHEOS.RheoTimeData, ::RHEOS.RheoModelClass, ::Dict{Any, Any}) Closest candidates are: modelpredict(::RHEOS.RheoTimeData, ::RHEOS.RheoModelClass; diff_method, kwargs...) at C:\Users\fr293\.julia\packages\RHEOS\a4nns\src\processing.jl:621 modelpredict(::RHEOS.RheoTimeData, !Matched::RHEOS.RheoModel; diff_method) at C:\Users\fr293\.julia\packages\RHEOS\a4nns\src\processing.jl:598

and

data_predict = rh.modelpredict(stress_history, rh.FractD_Maxwell, rh.symbol_to_unicode(paramdict))

which just gives

RuntimeError: <exception str() failed>

akabla commented 2 years ago

Try to pass the parameters as keywords parameters directly, rather than a dict. See examples in the new test functions on commit 79efaca

fr293 commented 2 years ago

that works, thanks!