Skip to content

Commit a932828

Browse files
authored
Merge pull request #100 from xsuite/release/v0.5.2
Release 0.5.2
2 parents ebfb1f5 + 752c25e commit a932828

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "xcoll"
3-
version = "0.5.1"
3+
version = "0.5.2"
44
description = "Xsuite collimation package"
55
homepage = "https://github.com/xsuite/xcoll"
66
repository = "https://github.com/xsuite/xcoll"

tests/test_install.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_install_single_existing_marker(beam, test_context):
3535
assert np.isclose(pos_centre - line[name].length/2, line.get_s_position(name))
3636
assert isinstance(line[name], xc.BlackAbsorber)
3737
tab = line.get_table()
38-
idx = tab.mask[[name]][0]
38+
idx = tab.rows.indices[[name]][0]
3939
assert xt.line._is_aperture(line[idx-1], line)
4040
assert xt.line._is_aperture(line[idx+1], line)
4141

@@ -47,14 +47,14 @@ def test_install_single_existing_marker(beam, test_context):
4747
tab = line.get_table()
4848
existing_length = 0.12
4949
line[name].length += existing_length
50-
idx = tab.mask[[name]][0]
50+
idx = tab.rows.indices[[name]][0]
5151
while True:
5252
idx -= 1
5353
if tab.element_type[idx].startswith('Drift'):
5454
assert line[idx].length > existing_length/2
5555
line[idx].length -= existing_length/2
5656
break
57-
idx = tab.mask[[name]][0]
57+
idx = tab.rows.indices[[name]][0]
5858
while True:
5959
idx += 1
6060
if tab.element_type[idx].startswith('Drift'):
@@ -68,7 +68,7 @@ def test_install_single_existing_marker(beam, test_context):
6868
assert np.isclose(pos_centre - line[name].length/2, line.get_s_position(name))
6969
assert isinstance(line[name], xc.EverestCollimator)
7070
tab = line.get_table()
71-
idx = tab.mask[[name]][0]
71+
idx = tab.rows.indices[[name]][0]
7272
assert xt.line._is_aperture(line[idx-1], line)
7373
assert xt.line._is_aperture(line[idx+1], line)
7474

@@ -84,7 +84,7 @@ def test_install_single_existing_marker(beam, test_context):
8484
assert np.isclose(pos_centre - line[name].length/2, line.get_s_position(name))
8585
assert isinstance(line[name], xc.EverestCrystal)
8686
tab = line.get_table()
87-
idx = tab.mask[[name]][0]
87+
idx = tab.rows.indices[[name]][0]
8888
assert xt.line._is_aperture(line[idx-1], line)
8989
assert xt.line._is_aperture(line[idx+1], line)
9090

@@ -121,7 +121,7 @@ def test_install_single_no_marker(beam, test_context):
121121
assert np.isclose(line.get_s_position(name), 12.4)
122122
assert isinstance(line[name], xc.BlackAbsorber)
123123
tab = line.get_table()
124-
idx = tab.mask[[name]][0]
124+
idx = tab.rows.indices[[name]][0]
125125
assert xt.line._is_aperture(line[idx-1], line)
126126
assert isinstance(line[idx-1], xt.LimitEllipse)
127127
assert np.isclose(line[idx-1].a_squ, 0.16)

tests/test_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
from xcoll import __version__
77

88
def test_version():
9-
assert __version__ == '0.5.1'
9+
assert __version__ == '0.5.2'
1010

xcoll/beam_elements/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ def assign_optics(self, *, nemitt_x=None, nemitt_y=None, beta_gamma_rel=None, na
629629
raise ValueError("When using `twiss`, need to provide the name as well.")
630630
else:
631631
tw_up = twiss.rows[name]
632-
tw_down = twiss.rows[twiss.mask[[name]]+1]
632+
tw_down = twiss.rows[twiss.rows.indices[[name]]+1]
633633
if not np.isclose(tw_up.s[0] + self.length, tw_down.s[0]):
634634
raise ValueError(f"Downstream twiss not compatible with length {self.length}m.")
635635
self._optics = {

xcoll/general.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# ======================
1313
# Do not change
1414
# ======================
15-
__version__ = '0.5.1'
15+
__version__ = '0.5.2'
1616
# ======================

xcoll/initial_distribution.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ def generate_pencil_on_collimator(line, name, num_particles, *, side='+-', penci
6161
if is_converging:
6262
# pencil at front of jaw
6363
match_at_s = s_front
64-
sigma = beam_sizes.rows[name:f'{name}%%1'][f'sigma_{plane}'][0]
65-
sigma_transv = beam_sizes.rows[name:f'{name}%%1'][f'sigma_{transv_plane}'][0]
64+
sigma = beam_sizes.rows[name:f'{name}>>1'][f'sigma_{plane}'][0]
65+
sigma_transv = beam_sizes.rows[name:f'{name}>>1'][f'sigma_{transv_plane}'][0]
6666
else:
6767
# pencil at back of jaw
6868
match_at_s = s_back
69-
sigma = beam_sizes.rows[name:f'{name}%%1'][f'sigma_{plane}'][1]
70-
sigma_transv = beam_sizes.rows[name:f'{name}%%1'][f'sigma_{transv_plane}'][1]
69+
sigma = beam_sizes.rows[name:f'{name}>>1'][f'sigma_{plane}'][1]
70+
sigma_transv = beam_sizes.rows[name:f'{name}>>1'][f'sigma_{transv_plane}'][1]
7171
dr_sigmas = pencil_spread/sigma
7272

7373
# Generate 4D coordinates
@@ -157,7 +157,7 @@ def generate_delta_from_dispersion(line, at_element, *, plane, position_mm, nemi
157157
twiss = line.twiss()
158158

159159
beam_sizes = twiss.get_beam_covariance(nemitt_x=nemitt_x, nemitt_y=nemitt_y)
160-
beam_sizes = beam_sizes.rows[at_element:f'{at_element}%%1'][f'sigma_{plane}']
160+
beam_sizes = beam_sizes.rows[at_element:f'{at_element}>>1'][f'sigma_{plane}']
161161
sigma = beam_sizes[0] if match_at_front else beam_sizes[1]
162162
delta = (position_mm - betatron_cut*sigma - twiss.rows[at_element][plane])
163163
delta /= twiss.rows[at_element][f'd{plane}']

xcoll/line_tools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ def get_optics_at(names, *, twiss=None, line=None):
2626
twiss = line.twiss()
2727
if not hasattr(names, '__iter__') and not isinstance(names, str):
2828
names = [names]
29-
coll_entry_mask = twiss.mask[names]
30-
tw_entry = twiss.rows[coll_entry_mask]
31-
tw_exit = twiss.rows[coll_entry_mask+1]
29+
coll_entry_indices = twiss.rows.indices[names]
30+
tw_entry = twiss.rows[coll_entry_indices]
31+
tw_exit = twiss.rows[coll_entry_indices+1]
3232
tw_exit.name = tw_entry.name
3333
return tw_entry, tw_exit
3434

0 commit comments

Comments
 (0)