Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode symbols cause problems with PyJulia #118

Closed
akabla opened this issue Jul 20, 2021 · 1 comment
Closed

Unicode symbols cause problems with PyJulia #118

akabla opened this issue Jul 20, 2021 · 1 comment
Milestone

Comments

@akabla
Copy link
Member

akabla commented Jul 20, 2021

This is related to #116

I think we should provide options to access all RHEOS functionalities without having to use Unicode symbols.

This would involve:

  1. providing alternative names for passing model parameter values, eg eta or c_beta, and let RHEOS convert the symbols where appropriate.
  2. allowing several keyword parameters for certain functions, such as importcsv and RheoTimeData constructor.
  3. providing functions to access the stress and strain fields of RheoTimeData, and in other relevant places.

One option for 1 is to have a const named tuple with a symbol conversion table, and then convert symbols in check_and_reorder_parameters

julia> d=(eta=:η, c_alpha=:c_α)
(eta = :η, c_alpha = :c_α)

julia> nt = (k=1.0, eta=2.0, c_alpha=4.5)
(k = 1.0, eta = 2.0, c_alpha = 4.5)

julia> NamedTuple{Tuple([ s in keys(d) ? d[s] : s for s in keys(nt) ])}(values(nt))
(k = 1.0, η = 2.0, c_α = 4.5)

For 2, this could maybe be achieved like this:

function RheoTimeData(;strain = RheoFloat[],  ϵ::Vector{T1} = strain, stress = RheoFloat[], σ::Vector{T2} = stress, ...
@akabla
Copy link
Member Author

akabla commented Jul 27, 2021

Here is a bit of code that now works fine without using unicode symbols.

using RHEOS
using Plots

data = importcsv("C1_S_0A5_90_rheos.csv", time = 1, strain = 2, stress = 3)
plot(gettime(data), getstrain(data), getstress(data))

model=modelfit(data, FractD_Maxwell, stress_imposed, p0=(beta=0.05, c_beta=0.05, eta=10.0))

print(getparams(model, unicode=false))
# (eta = 65.17997591394088, c_beta = 0.08515319205963537, beta = 0.08989064046489526)

data_stress = extract(data, stress_only)

data_fit = modelpredict(data_stress, model)

plot(gettime(data_fit),[getstrain(data_fit), getstrain(data)])

akabla added a commit that referenced this issue Jul 27, 2021
Modelfit now support non-unicode parameters #116 #118
akabla added a commit that referenced this issue Jul 27, 2021
Larger selection of symbols converted #118
@akabla akabla closed this as completed Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant