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

Show example how to access model attributes #128

Open
nanophyto opened this issue Jan 27, 2025 · 1 comment
Open

Show example how to access model attributes #128

nanophyto opened this issue Jan 27, 2025 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@nanophyto
Copy link
Contributor

Something like the pseudo code below would be very useful for analysis (e.g. quickly deriving the size of each P).

N5P5ZD = construct_size_structured_NPZD()

N5PZD.Atributes #to return all parameter values
@nanophyto nanophyto changed the title Include model attributes with constructed model object Show example how to access model attributes Jan 27, 2025
@nanophyto nanophyto self-assigned this Jan 27, 2025
@radka-j
Copy link
Contributor

radka-j commented Jan 28, 2025

Note that attributes can only be accessed from a concrete instance of an object.

In the example above, N5P5ZD = construct_size_structured_NPZD() creates an abstract type that can then be instantiated. Once a concrete model is created (with specific parameter values) one can access its attributes. For example, to get all alpha values:

N5P5ZD = construct_size_structured_NPZD()
model = N5P5ZD()
model.alpha

To get names of all parameters do one of:

fieldnames(N5P5ZD)
fieldnames(typeof(model))

@radka-j radka-j added the documentation Improvements or additions to documentation label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants