Skip to content

More tools for dual energy matching #251

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

More tools for dual energy matching #251

wants to merge 4 commits into from

Conversation

pluflou
Copy link
Collaborator

@pluflou pluflou commented Mar 12, 2025

Creating this for @williamColocho
Adding tools for energy gain in dual energy matching mode. The Dump energy PV needs to be determined dynamically depending on primary/secondary beam path.

@pluflou pluflou marked this pull request as ready for review March 12, 2025 17:01
Copy link
Collaborator

@eloise-nebula eloise-nebula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi William, thanks for the PR. I left a couple of comments. Once we get those resolved, the PR will be ready to merge. Please merge with main so that the tests run as they should. We can move this PR back to your fork to make it easier for you to change.

YAML_LOCATION = os.path.join(os.path.dirname(__file__), "yaml/")
print(YAML_LOCATION)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this print statement trying to accomplish? The only time this print statement will run is when we import the bmad_modeling path, which is not intuitive for the user.

@@ -45,6 +47,7 @@ def get_energy_gain_pvlist(beam_path):
except FileNotFoundError:
print(f"Could not find yaml file {yaml_file_name}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to throw an error here. It can provide more information than the regular FileNotFoundError does. I don't think there's a situation where the caller of this function wants to proceed even if there's a file not found error. If that's the case, the caller can wrap this function in their own try/catch statement.

Copy link
Member

@nneveu nneveu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the comments are addressed, this can get merged. Linting as well. Thanks!

@@ -31,6 +32,7 @@ def get_rf_quads_pvlist(tao, all_data_maps, beam_code=1):
for pv in map.pvlist:
if "BEAMCODE" in pv:
pv = map.accelerate_pvname
pv = pv[0:21] + beam_code + pv[22:]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a more general way to grab this info? i.e. slit on colon (:) or something else? Or can we always be sure the 0:21 and 22: will be correct?

@@ -3,10 +3,11 @@ cu:
L0: REFS:IN20:751:EDES
L1: REFS:LI21:231:EDES
L2: REFS:LI24:790:EDES
L3: REFS:LI30:901:EDES
L3: REFS:DMP?:400:EDES

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this PV have ? in it? I'm unfamiliar w/ this.

@eloise-nebula
Copy link
Collaborator

@williamColocho any updates on this PR? If it's on hold can we close it for now?

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.

4 participants