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

@findall macro for multiple IDS objects #42

Merged
merged 3 commits into from
Nov 16, 2024

Conversation

mgyoo86
Copy link
Contributor

@mgyoo86 mgyoo86 commented Nov 14, 2024

Summary

The previous findall method for multiple IDS objects is removed due to the ambiguous type inferences.
Instead, a new @findall macro handles multiple IDS objects by calling the findall function for a single IDS object.
The macro captures the input argument's names and passes them into a new keyword argument of the root_name of the findall function.
This is beneficial for distinguishing different IDS objects more clearly as shown in below.

Existing feature

Existing findall cannot distinguish different IDS objects as it set the root_name by using the location function.
Suppose we have multiple different dd data, such as dd_D3D and dd_FPP.

# The results look the same
findall(dd_D3D, :label)
findall(dd_FPP, :label)

Screenshot 2024-11-14 at 2 30 39 PM

# findall results cannot capture the given variable names
eqt_D3D = dd_D3D.equilibrium.time_slice[]
eqt_FPP = dd_FPP.equilibrium.time_slice[]
findall(eqt_D3D, :psi)
findall(eqt_FPP, :psi)

Screenshot 2024-11-14 at 2 30 50 PM

New feature

eqt_D3D = dd_D3D.equilibrium.time_slice[]
# One can specify the `root_name` as the keyword argument
findall(eqt_D3D, :psi; root_name="eqt_D3D")

Screenshot 2024-11-14 at 2 33 15 PM

# @findall macro can handle multiple IDS objects,
# and use given variable names as root_names
@findall [dd_D3D, dd_FPP] :label

Screenshot 2024-11-14 at 2 35 19 PM

@findall [ dd_FPP, eqt_D3D] r"prof.*1d.*psi$"

Screenshot 2024-11-14 at 2 37 09 PM

Note

New testset for "findall" is implemented.
[v] All tests passed

@mgyoo86 mgyoo86 requested a review from orso82 November 14, 2024 22:39
@orso82 orso82 merged commit e632752 into ProjectTorreyPines:master Nov 16, 2024
2 of 3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants