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

List parameters from each parameter group #140

Open
TermeHansen opened this issue Jun 28, 2023 · 2 comments
Open

List parameters from each parameter group #140

TermeHansen opened this issue Jun 28, 2023 · 2 comments
Labels
feature Proposal for a new feature.

Comments

@TermeHansen
Copy link

How can I easy get the parameters split out into the parameter groups they exists as?

model.parameters() just give me the full dict for all parameters, but how do I get the same dicts for each parameter group instead?
I can get the groups by using the children on the 'parameters', those nodes have no properties however?!?

display(n.children())
print(n.properties())
p = n.children()[0]
print(p.name())
print(p.properties())

gives:

[Node('parameters/Parameters | geometry'),
 Node('parameters/Parameters | mole fractions'),
 Node('parameters/Parameters | Molar weight'),
 Node('parameters/Parameters | CFD'),
 Node('parameters/Parameters | porous'),
 Node('parameters/Parameters ASR'),
 Node('parameters/Parameters | current'),
 Node('parameters/Parameters | heat transfer')]
{}
Parameters | geometry
{}
@TermeHansen
Copy link
Author

using the java handle I can get what I want, but shouldn't properties() return this?

{k:p.java.get(k) for k in p.java.varnames()}

@john-hen
Copy link
Collaborator

john-hen commented Jun 28, 2023

As far as I can tell, this is all expected behavior. As in: It works as documented. So I guess you wish the high-level Python API would support this use case. Which it doesn't: It simply returns all parameters, it doesn't let you narrow it down to specific groups. Though you've already figured out how to use the low-level Comsol Java API to accomplish that.

Those nodes have no properties because the Comsol API does not treat parameter names like properties. This is why you have to call java.varnames() instead of java.properties().

I guess if you're looking to change the Python API, we could discuss adding an optional argument group=None (or something) to Model.parameters(). I don't see any harm in that.

@john-hen john-hen added the feature Proposal for a new feature. label Jun 30, 2023
@john-hen john-hen changed the title list parameters from each parameter group List parameters from each parameter group Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Proposal for a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants