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

Minor improvements to RheoModelClass outer constructor #52

Closed
3 tasks done
moustachio-belvedere opened this issue Sep 22, 2019 · 4 comments
Closed
3 tasks done
Labels
enhancement New feature or request
Milestone

Comments

@moustachio-belvedere
Copy link
Member

moustachio-belvedere commented Sep 22, 2019

Migrated from definitions.jl comment:

Regarding RheoModelClass Constructor, add:

  • Define Null Expression, and make it default parameter
  • Model name and parameters should be required --> assert
  • info should have generic default value, such as "Model with $n params named $s..."
@moustachio-belvedere moustachio-belvedere added the enhancement New feature or request label Sep 22, 2019
@moustachio-belvedere moustachio-belvedere changed the title Minor improvements to RheoModelClass constructor Minor improvements to RheoModelClass outer constructor Sep 22, 2019
@akabla akabla modified the milestones: 1.0.0, 0.9.3 May 23, 2020
@akabla
Copy link
Member

akabla commented May 26, 2020

Name and params are now required by deleting their default value.
https://docs.julialang.org/en/v1/manual/functions/index.html#Keyword-Arguments-1

"If a keyword argument is not assigned a default value in the method definition, then it is required: an UndefKeywordError exception will be thrown if the caller does not assign it a value:

function f(x; y)
    ###
end
f(3, y=5) # ok, y is assigned
f(3)      # throws UndefKeywordError(:y)

"

@akabla
Copy link
Member

akabla commented May 26, 2020

Introducing null expressions for undefined moduli, rather than NaN, is not straight forward.

We need something in the moduli/compliance functionwrappers slots, and returning NaN seems appropriate. The easiest way to get there is to have a NaN expression to begin with.

We may want to reconsider how the "modulusexists" function works though, and how it is used in processing.jl. This utility function could look into the "expressions" named tuple as part of the RheoModelClass object and determine then if the modulus is defined, rather than evaluating the function. The external moduli/compliance functions could also check and send an error where appropriate.

@akabla
Copy link
Member

akabla commented May 26, 2020

I improved the content of the info field, but then commented it out to leave it an empty string by default. In fact, this string is only useful to provide extra info since the basic info is already visible:

julia> m = RheoModelClass(name="MyModel", p=[:x,:y])

Model name: MyModel

Free parameters: x and y

@moustachio-belvedere
Copy link
Member Author

All sounds good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants