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

Feature/aperture model check and temporary patch #15

Merged
merged 22 commits into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions examples/lhc_run3_lossmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
line['acsca.c5r4.b1'].frequency = 400e6
line['acsca.d5r4.b1'].frequency = 400e6

# Aperture model check
print('\nAperture model check on imported model:')
df_imported = line.check_aperture()
assert not np.any(df_imported.has_aperture_problem)

# Initialise collmanager,on the specified buffer
coll_manager = xc.CollimatorManager(
line=line,
Expand All @@ -51,12 +56,14 @@
# or manually override with the option gaps={collname: gap}
coll_manager.set_openings()



# Aperture model check
print('\nAperture model check after introducing collimators:')
df_with_coll = line.check_aperture()
assert not np.any(df_with_coll.has_aperture_problem)


# Horizontal loss map
num_particles = 500
num_particles = 5000
coll = 'tcp.c6l7.b1'

# Collimator plane: generate pencil distribution in normalized coordinates
Expand All @@ -78,16 +85,25 @@
at_element=coll,
match_at_s=coll_manager.s_match[coll])



# Track
tracker.track(part, num_turns=10)


collimator_losses = part.s[part.state==-333]
aperture_losses = part.s[part.state==0]

## Plot histogram of losses along the acceleratores
part_before_refinement = part.copy()

# Loss location refinement
loss_loc_refinement = xt.LossLocationRefinement(tracker,
n_theta = 360, # Angular resolution in the polygonal approximation of the aperture
r_max = 0.5, # Maximum transverse aperture in m
dr = 50e-6, # Transverse loss refinement accuracy [m]
ds = 0.05, # Longitudinal loss refinement accuracy [m]
)

loss_loc_refinement.refine_loss_location(part)

## Plot histogram of losses along the accelerator
## ------------------------------------------------------------------

wdth=0.1;
Expand Down
937,114 changes: 937,113 additions & 1 deletion examples/machines/lhc_run3_b1.json

Large diffs are not rendered by default.

Loading