Skip to content
Closed
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
40 changes: 34 additions & 6 deletions pyaccel/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def line_pass(
accelerator: _Accelerator,
particles,
indices=None,
element_offset: float = 0,
element_offset: int = 0,
parallel=False
):
"""Track particle(s) along an accelerator.
Expand Down Expand Up @@ -522,7 +522,7 @@ def ring_pass(
particles,
nr_turns: int = 1,
turn_by_turn: bool = False,
element_offset: float = 0,
element_offset: int = 0,
parallel=False
):
"""Track particle(s) along a ring.
Expand Down Expand Up @@ -928,6 +928,13 @@ def find_m66(
else:
trackcpp_idx.push_back(len(accelerator))

# timeaware_element_indices = _trackcpp.CppUnsigIntVector()
# timeaware_element_positions = _trackcpp.CppDoubleVector()
# linelength = accelerator.trackcpp_acc.get_time_aware_elements_info(
# timeaware_element_indices,
# timeaware_element_positions
# )

if fixed_point is None:
# Closed orbit is calculated by trackcpp
fixed_point_guess = _trackcpp.CppDoublePos()
Expand All @@ -945,8 +952,15 @@ def find_m66(
m66 = _np.zeros((6, 6), dtype=float)
_v0 = _trackcpp.CppDoublePos()
ret = _trackcpp.track_findm66_wrapper(
accelerator.trackcpp_acc, _closed_orbit[0], cumul_trans_matrices,
m66, _v0, trackcpp_idx)
accelerator.trackcpp_acc,
_closed_orbit[0],
cumul_trans_matrices,
m66,
_v0,
trackcpp_idx)
# linelength,
# timeaware_element_indices,
# timeaware_element_positions)
if ret > 0:
raise TrackingError(_trackcpp.string_error_messages[ret])

Expand Down Expand Up @@ -1016,12 +1030,26 @@ def find_m44(
_closed_orbit = _trackcpp.CppDoublePosVector()
_closed_orbit.push_back(_fixed_point)

# timeaware_element_indices = _trackcpp.CppUnsigIntVector()
# timeaware_element_positions = _trackcpp.CppDoubleVector()
# linelength = accelerator.trackcpp_acc.get_time_aware_elements_info(
# timeaware_element_indices,
# timeaware_element_positions
# )

cumul_trans_matrices = _np.zeros((trackcpp_idx.size(), 4, 4), dtype=float)
m44 = _np.zeros((4, 4), dtype=float)
_v0 = _trackcpp.CppDoublePos()
ret = _trackcpp.track_findm66_wrapper(
accelerator.trackcpp_acc, _closed_orbit[0], cumul_trans_matrices,
m44, _v0, trackcpp_idx)
accelerator.trackcpp_acc,
_closed_orbit[0],
cumul_trans_matrices,
m44,
_v0,
trackcpp_idx)
# linelength,
# timeaware_element_indices,
# timeaware_element_positions)
if ret > 0:
raise TrackingError(_trackcpp.string_error_messages[ret])

Expand Down