-
Notifications
You must be signed in to change notification settings - Fork 3
function for lar inside / outside NMS (l200) #21
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9bf31bb
function for lar inside / outside NMS (l200)
tdixon97 891ee76
Update workflow/src/legendsimflow/utils.py
tdixon97 e16e993
attempt to integrate in the simflow
tdixon97 5de77f2
Update workflow/src/legendsimflow/commands.py
tdixon97 b5bad54
Update workflow/src/legendsimflow/commands.py
tdixon97 7bf8732
implement the function mode
tdixon97 4c48d12
doc fix
tdixon97 097f2fd
fix
tdixon97 9e36abd
improve docs
tdixon97 2d06b11
[docs] minor fix
tdixon97 49351bb
move fixture
tdixon97 3a08982
fix
tdixon97 66cafed
oops
tdixon97 277dc9f
minor adjustment
gipert e473d36
improve testing
tdixon97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import pytest | ||
|
|
||
| from legendsimflow import commands, confine | ||
|
|
||
|
|
||
| def test_get_lar_minishroud_confine_commands(test_generate_gdml): | ||
| lines = confine.get_lar_minishroud_confine_commands(test_generate_gdml, inside=True) | ||
|
|
||
| assert len(lines) > 0 | ||
| assert isinstance(lines, list) | ||
|
|
||
| assert "/RMG/Generator/Confinement/Geometrical/AddSolid Cylinder" in lines | ||
|
|
||
| lines_outside = confine.get_lar_minishroud_confine_commands( | ||
| test_generate_gdml, inside=False | ||
| ) | ||
|
|
||
| assert len(lines_outside) > 0 | ||
| assert isinstance(lines_outside, list) | ||
|
|
||
| assert ( | ||
| "/RMG/Generator/Confinement/Geometrical/AddExcludedSolid Cylinder" | ||
| in lines_outside | ||
| ) | ||
|
|
||
| with pytest.raises(ValueError): | ||
| confine.get_lar_minishroud_confine_commands( | ||
| test_generate_gdml, pattern="non_existent_pattern*" | ||
| ) | ||
| with pytest.raises(ValueError): | ||
| # exist pattern but not a nms | ||
| confine.get_lar_minishroud_confine_commands(test_generate_gdml, pattern="V**") | ||
|
|
||
| # test with eval | ||
|
|
||
| lines_eval = commands.get_confinement_from_function( | ||
| "legendsimflow.confine.get_lar_minishroud_confine_commands(<...>,inside=True)", | ||
| test_generate_gdml, | ||
| ) | ||
| assert lines_eval == lines | ||
|
|
||
| lines_outside_eval = commands.get_confinement_from_function( | ||
| "legendsimflow.confine.get_lar_minishroud_confine_commands(<...>,inside=False)", | ||
| test_generate_gdml, | ||
| ) | ||
| assert lines_outside_eval == lines_outside | ||
|
|
||
| # test with string | ||
| lines_eval_string = commands.get_confinement_from_function( | ||
| "legendsimflow.confine.get_lar_minishroud_confine_commands(<...>,lar_name= 'liquid_argon',inside=True)", | ||
| test_generate_gdml, | ||
| ) | ||
| assert lines_eval_string == lines | ||
|
|
||
| # without any kwarg | ||
| lines_eval_args = commands.get_confinement_from_function( | ||
| "legendsimflow.confine.get_lar_minishroud_confine_commands(<...>,'minishroud_tube*',True,lar_name= 'liquid_argon')", | ||
| test_generate_gdml, | ||
| ) | ||
| assert lines_eval_args == lines |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.