xcoll 0.5.6__py3-none-any.whl → 0.5.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of xcoll might be problematic. Click here for more details.
- xcoll/beam_elements/__init__.py +0 -5
- xcoll/beam_elements/base.py +0 -3
- xcoll/beam_elements/elements_src/everest_crystal.h +1 -0
- xcoll/colldb.py +2 -2
- xcoll/general.py +1 -1
- xcoll/initial_distribution.py +2 -2
- xcoll/interaction_record/interaction_record.py +4 -3
- xcoll/line_tools.py +5 -5
- xcoll/lossmap.py +3 -3
- {xcoll-0.5.6.dist-info → xcoll-0.5.8.dist-info}/METADATA +1 -1
- {xcoll-0.5.6.dist-info → xcoll-0.5.8.dist-info}/RECORD +14 -14
- {xcoll-0.5.6.dist-info → xcoll-0.5.8.dist-info}/LICENSE +0 -0
- {xcoll-0.5.6.dist-info → xcoll-0.5.8.dist-info}/NOTICE +0 -0
- {xcoll-0.5.6.dist-info → xcoll-0.5.8.dist-info}/WHEEL +0 -0
xcoll/beam_elements/__init__.py
CHANGED
|
@@ -20,8 +20,3 @@ crystal_classes = tuple(v for v in globals().values()
|
|
|
20
20
|
if isinstance(v, type) and issubclass(v, BaseCrystal) and v != BaseCrystal)
|
|
21
21
|
|
|
22
22
|
element_classes = block_classes + (BlowUp, EmittanceMonitor)
|
|
23
|
-
|
|
24
|
-
# For compatibility with _K2Collimators
|
|
25
|
-
_all_block_classes = block_classes
|
|
26
|
-
_all_collimator_classes = collimator_classes
|
|
27
|
-
_all_crystal_classes = crystal_classes
|
xcoll/beam_elements/base.py
CHANGED
|
@@ -597,9 +597,6 @@ class BaseCollimator(BaseBlock):
|
|
|
597
597
|
|
|
598
598
|
def assign_optics(self, *, nemitt_x=None, nemitt_y=None, beta_gamma_rel=None, name=None, twiss=None,
|
|
599
599
|
twiss_upstream=None, twiss_downstream=None):
|
|
600
|
-
from xcoll.beam_elements import _all_collimator_classes
|
|
601
|
-
if not isinstance(self, _all_collimator_classes):
|
|
602
|
-
raise ValueError("Please install collimator before assigning optics.")
|
|
603
600
|
if nemitt_x is None:
|
|
604
601
|
if self.nemitt_x is None:
|
|
605
602
|
raise ValueError("Need to provide `nemitt_x`.")
|
|
@@ -138,6 +138,7 @@ EverestCollData EverestCrystal_init(EverestCrystalData el, LocalParticle* part0,
|
|
|
138
138
|
coll->csref[0] = CrystalMaterialData_get_cross_section(material, 0);
|
|
139
139
|
coll->csref[1] = CrystalMaterialData_get_cross_section(material, 1);
|
|
140
140
|
coll->csref[5] = CrystalMaterialData_get_cross_section(material, 5);
|
|
141
|
+
coll->only_mcs = CrystalMaterialData_get__only_mcs(material);
|
|
141
142
|
coll->dlri = CrystalMaterialData_get_crystal_radiation_length(material);
|
|
142
143
|
coll->dlyi = CrystalMaterialData_get_crystal_nuclear_length(material);
|
|
143
144
|
coll->ai = CrystalMaterialData_get_crystal_plane_distance(material);
|
xcoll/colldb.py
CHANGED
|
@@ -13,7 +13,7 @@ from pathlib import Path
|
|
|
13
13
|
import xtrack as xt
|
|
14
14
|
|
|
15
15
|
from .beam_elements import BlackAbsorber, BlackCrystal, EverestCollimator, EverestCrystal, \
|
|
16
|
-
BaseCollimator, BaseCrystal,
|
|
16
|
+
BaseCollimator, BaseCrystal, collimator_classes
|
|
17
17
|
from .scattering_routines.everest.materials import SixTrack_to_xcoll
|
|
18
18
|
|
|
19
19
|
|
|
@@ -526,7 +526,7 @@ class CollimatorDatabase:
|
|
|
526
526
|
def _check_installed(self, line, name, collimator_class):
|
|
527
527
|
# Check that collimator is not installed as different type
|
|
528
528
|
# TODO: automatically replace collimator type and print warning
|
|
529
|
-
if isinstance(line[name],
|
|
529
|
+
if isinstance(line[name], collimator_classes):
|
|
530
530
|
raise ValueError(f"Trying to install {name} as {collimator_class.__name__}, "
|
|
531
531
|
+ f"but it is already installed as {line[name].__class__.__name__}!\n"
|
|
532
532
|
+ f"Please reconstruct the line.")
|
xcoll/general.py
CHANGED
xcoll/initial_distribution.py
CHANGED
|
@@ -10,7 +10,7 @@ import xtrack as xt
|
|
|
10
10
|
import xobjects as xo
|
|
11
11
|
import xpart as xp
|
|
12
12
|
|
|
13
|
-
from .beam_elements import
|
|
13
|
+
from .beam_elements import collimator_classes, EverestCrystal
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def generate_pencil_on_collimator(line, name, num_particles, *, side='+-', pencil_spread=1e-6,
|
|
@@ -25,7 +25,7 @@ def generate_pencil_on_collimator(line, name, num_particles, *, side='+-', penci
|
|
|
25
25
|
|
|
26
26
|
coll = line[name]
|
|
27
27
|
|
|
28
|
-
if not isinstance(coll, tuple(
|
|
28
|
+
if not isinstance(coll, tuple(collimator_classes)):
|
|
29
29
|
raise ValueError("Need to provide a valid collimator!")
|
|
30
30
|
|
|
31
31
|
if coll.optics is None:
|
|
@@ -238,14 +238,14 @@ class InteractionRecord(xt.BeamElement):
|
|
|
238
238
|
'int': [shortcuts[inter] for inter in self._inter[mask]],
|
|
239
239
|
'pid': self.id_before[mask]
|
|
240
240
|
})
|
|
241
|
-
return df.groupby('pid', sort=False)['int'].agg(list)
|
|
241
|
+
return df.groupby('pid', sort=False, group_keys=False)['int'].agg(list)
|
|
242
242
|
else:
|
|
243
243
|
df = pd.DataFrame({
|
|
244
244
|
'int': [shortcuts[inter] for inter in self._inter[mask]],
|
|
245
245
|
'turn': self.at_turn[mask],
|
|
246
246
|
'pid': self.id_before[mask]
|
|
247
247
|
})
|
|
248
|
-
return df.groupby(['pid', 'turn'], sort=False)['int'].apply(list)
|
|
248
|
+
return df.groupby(['pid', 'turn'], sort=False, group_keys=False)['int'].apply(list)
|
|
249
249
|
|
|
250
250
|
def first_touch_per_turn(self, frame=None):
|
|
251
251
|
n_rows = self._index.num_recorded
|
|
@@ -253,7 +253,8 @@ class InteractionRecord(xt.BeamElement):
|
|
|
253
253
|
'at_turn': self.at_turn[:n_rows],
|
|
254
254
|
'at_element': self.at_element[:n_rows]})
|
|
255
255
|
mask = np.char.startswith(self.interaction_type[:n_rows], 'Enter Jaw')
|
|
256
|
-
idx_first = [group.at_element.idxmin() for _, group in df[mask].groupby(
|
|
256
|
+
idx_first = [group.at_element.idxmin() for _, group in df[mask].groupby(
|
|
257
|
+
['at_turn', 'id_before'], sort=False, group_keys=False)]
|
|
257
258
|
df_first = self.to_pandas(frame=frame).loc[idx_first]
|
|
258
259
|
df_first.insert(2, "jaw", df_first.interaction_type.astype(str).str[-1])
|
|
259
260
|
to_drop = ['interaction_type',
|
xcoll/line_tools.py
CHANGED
|
@@ -8,7 +8,7 @@ from warnings import warn
|
|
|
8
8
|
|
|
9
9
|
import xtrack as xt
|
|
10
10
|
|
|
11
|
-
from .beam_elements import element_classes,
|
|
11
|
+
from .beam_elements import element_classes, collimator_classes, block_classes
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class XcollScatteringAPI:
|
|
@@ -79,7 +79,7 @@ class XcollCollimatorAPI:
|
|
|
79
79
|
# Verify elements
|
|
80
80
|
for el in elements:
|
|
81
81
|
print(el.__class__)
|
|
82
|
-
assert isinstance(el,
|
|
82
|
+
assert isinstance(el, block_classes)
|
|
83
83
|
el._tracking = False
|
|
84
84
|
|
|
85
85
|
# Get positions
|
|
@@ -239,7 +239,7 @@ class XcollCollimatorAPI:
|
|
|
239
239
|
twiss = tw
|
|
240
240
|
if not self.line._has_valid_tracker():
|
|
241
241
|
raise Exception("Please build tracker before setting the openings!")
|
|
242
|
-
names = self.line.get_elements_of_type(
|
|
242
|
+
names = self.line.get_elements_of_type(collimator_classes)[1]
|
|
243
243
|
tw_upstream, tw_downstream = self.get_optics_at(names, twiss=twiss)
|
|
244
244
|
beta_gamma_rel = self.line.particle_ref._xobject.gamma0[0]*self.line.particle_ref._xobject.beta0[0]
|
|
245
245
|
for coll in names:
|
|
@@ -248,7 +248,7 @@ class XcollCollimatorAPI:
|
|
|
248
248
|
|
|
249
249
|
def open(self, names=None):
|
|
250
250
|
if names is None:
|
|
251
|
-
names = self.line.get_elements_of_type(
|
|
251
|
+
names = self.line.get_elements_of_type(collimator_classes)[1]
|
|
252
252
|
if len(names) == 0:
|
|
253
253
|
print("No collimators found in line.")
|
|
254
254
|
else:
|
|
@@ -258,7 +258,7 @@ class XcollCollimatorAPI:
|
|
|
258
258
|
|
|
259
259
|
def to_parking(self, names=None):
|
|
260
260
|
if names is None:
|
|
261
|
-
names = self.line.get_elements_of_type(
|
|
261
|
+
names = self.line.get_elements_of_type(collimator_classes)[1]
|
|
262
262
|
if len(names) == 0:
|
|
263
263
|
print("No collimators found in line.")
|
|
264
264
|
else:
|
xcoll/lossmap.py
CHANGED
|
@@ -12,7 +12,7 @@ import xtrack as xt
|
|
|
12
12
|
import xpart as xp
|
|
13
13
|
import xobjects as xo
|
|
14
14
|
|
|
15
|
-
from .beam_elements import
|
|
15
|
+
from .beam_elements import collimator_classes, crystal_classes
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class LossMap:
|
|
@@ -114,7 +114,7 @@ class LossMap:
|
|
|
114
114
|
def _correct_absorbed(self, verbose=True):
|
|
115
115
|
# Correct particles that are at an aperture directly after a collimator
|
|
116
116
|
part = self._part
|
|
117
|
-
coll_classes = list(set(
|
|
117
|
+
coll_classes = list(set(collimator_classes) - set(crystal_classes))
|
|
118
118
|
coll_elements = self._line.get_elements_of_type(coll_classes)[1]
|
|
119
119
|
for idx, elem in enumerate(part.at_element):
|
|
120
120
|
if part.state[idx] == 0:
|
|
@@ -156,7 +156,7 @@ class LossMap:
|
|
|
156
156
|
|
|
157
157
|
|
|
158
158
|
def _make_coll_summary(self):
|
|
159
|
-
collimator_names = self._line.get_elements_of_type(
|
|
159
|
+
collimator_names = self._line.get_elements_of_type(collimator_classes)[1]
|
|
160
160
|
coll_mask = (self._part.state <= -330) & (self._part.state >= -340)
|
|
161
161
|
coll_losses = np.array([self._line.element_names[i]
|
|
162
162
|
for i in self._part.at_element[coll_mask]])
|
|
@@ -2,9 +2,9 @@ LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
|
2
2
|
NOTICE,sha256=6DO_E7WCdRKc42vUoVVBPGttvQi4mRt9fAcxj9u8zy8,74
|
|
3
3
|
xcoll/__init__.py,sha256=b_61vh5irhf5fPmqTFJlyhNSt4rmftXg9uXPIEpgVB4,1612
|
|
4
4
|
xcoll/_manager.py,sha256=9NQKaNxZR2I1ChMVBeKQc0A8h6W8gVgRRg72a5NgbXU,808
|
|
5
|
-
xcoll/beam_elements/__init__.py,sha256=
|
|
5
|
+
xcoll/beam_elements/__init__.py,sha256=06bU8rzvlUPhcvwpaUippddm5IChpcCHBvpmvXJQU74,1122
|
|
6
6
|
xcoll/beam_elements/absorber.py,sha256=efK6gyUgD4x_FnBLpMR7-5_HCdp_753nkYikcdn6ulw,2502
|
|
7
|
-
xcoll/beam_elements/base.py,sha256=
|
|
7
|
+
xcoll/beam_elements/base.py,sha256=6scwhofls5AHPJcUyEbTJOJ8U86EQU4S7BB7NGoE_j0,52728
|
|
8
8
|
xcoll/beam_elements/blowup.py,sha256=gBXdlISvoDiMjXVpA77ls5QdAU3H9krwvFt2bSW_NII,8029
|
|
9
9
|
xcoll/beam_elements/elements_src/black_absorber.h,sha256=jCyQoaZ7VsIu8coQ99J1dDtAGqZpFIxxFLBlfhO6Drw,5027
|
|
10
10
|
xcoll/beam_elements/elements_src/black_crystal.h,sha256=x7oUwsrkUwUrFvhFsq8vtPkJJTSi1hYAhSt6fjzkJQo,4622
|
|
@@ -12,21 +12,21 @@ xcoll/beam_elements/elements_src/blowup.h,sha256=YlTt7YxswLM0ZjPuEjuE7xzjQ3hMt6F
|
|
|
12
12
|
xcoll/beam_elements/elements_src/emittance_monitor.h,sha256=vlHzQFoUjKQHWBmzpaSzRbILtxSWqEasMtxHC-FFoAc,7078
|
|
13
13
|
xcoll/beam_elements/elements_src/everest_block.h,sha256=iQ5_fyCil9Y4FJqccJdlqSVOHDtQNISQ_nTAJdGhqIs,6032
|
|
14
14
|
xcoll/beam_elements/elements_src/everest_collimator.h,sha256=DlWkb5RORnp5VwI7E31Q7NLXRYDjXO1yPhTcSEMQgPg,9765
|
|
15
|
-
xcoll/beam_elements/elements_src/everest_crystal.h,sha256=
|
|
15
|
+
xcoll/beam_elements/elements_src/everest_crystal.h,sha256=WwwNF6it7TuOimhpSXJa7UXqp_i3wVZ_fXlTStn4db0,12193
|
|
16
16
|
xcoll/beam_elements/everest.py,sha256=PA_VWpnPrIuO1xN__eKyT_ejbGZK7p93QHDVi3re7cM,8541
|
|
17
17
|
xcoll/beam_elements/monitor.py,sha256=zzMdN3JMFSAs-30_ntRvd5qZGdsXfGtColhiFDuMcIk,16928
|
|
18
|
-
xcoll/colldb.py,sha256=
|
|
19
|
-
xcoll/general.py,sha256=
|
|
18
|
+
xcoll/colldb.py,sha256=lEpkDRAT54szT9i7-jbTMRvkuW_0W2piZCdDaungcIs,30983
|
|
19
|
+
xcoll/general.py,sha256=tYbVvHS7A8CxAZYyCBXWq0RaD9mPy8wBP8aLcV17TKU,534
|
|
20
20
|
xcoll/headers/checks.h,sha256=qdXsOTBOK1MwW6bdFF93j4yE648mcDtEv5rGN1w9sfk,1582
|
|
21
21
|
xcoll/headers/particle_states.h,sha256=DZa_ZSaJrjnA8aHFriZKfRCkArQ8nK1t445MRwevDtA,840
|
|
22
|
-
xcoll/initial_distribution.py,sha256=
|
|
22
|
+
xcoll/initial_distribution.py,sha256=x5G4LTXn4boEg5jBFrQCk_l759h91XiAUhDTdcUvLkc,8779
|
|
23
23
|
xcoll/install.py,sha256=SxEFQnhWXlsXyPBIo847q6wPgId_f5ZtFRR1awGbkjc,2108
|
|
24
24
|
xcoll/interaction_record/__init__.py,sha256=UFoLiKa-z2oX7YoszP-7Vgdt1nM6kT382v1CaIu8_u0,50
|
|
25
|
-
xcoll/interaction_record/interaction_record.py,sha256=
|
|
25
|
+
xcoll/interaction_record/interaction_record.py,sha256=ixsQtVZn71vVEuTAA27a2NWcZZZ8iAcWFOa58bcWEQU,13271
|
|
26
26
|
xcoll/interaction_record/interaction_record_src/interaction_record.h,sha256=0rNagnfSGc2i1jauOMIcDbj9QFic9dV_MOyqVx1kw5Q,6067
|
|
27
27
|
xcoll/interaction_record/interaction_types.py,sha256=Vh6oFYKdRNOx9hc_E0iT8auNZVKC0qYVp_p7oyClZ8o,2894
|
|
28
|
-
xcoll/line_tools.py,sha256=
|
|
29
|
-
xcoll/lossmap.py,sha256=
|
|
28
|
+
xcoll/line_tools.py,sha256=UtRVlwX1T-wzocFzgb3VoJuBavvggNnYONjvP2WigKM,14326
|
|
29
|
+
xcoll/lossmap.py,sha256=W2EzOe4aKmJFd8kEpebeQaAn1818QF3ih_nhA_br-2I,8062
|
|
30
30
|
xcoll/rf_sweep.py,sha256=P2X1S9pGi4OpNYnzYfQVyblFt2p8aw9EWHsKDkAuYt0,8936
|
|
31
31
|
xcoll/scattering_routines/everest/__init__.py,sha256=7lkkeZ1liBjXVHCuRpgzZI6ohzHVMj5uJBO792147XY,286
|
|
32
32
|
xcoll/scattering_routines/everest/amorphous.h,sha256=0eSV8F7yb2xrhrEGPZGWu_Lgr3gjtU8RddaJElsZ-Tk,10362
|
|
@@ -406,8 +406,8 @@ xcoll/scattering_routines/geometry/objects.h,sha256=A5ktGvVlSkC4hUsI_PQFsE80CuDw
|
|
|
406
406
|
xcoll/scattering_routines/geometry/rotation.h,sha256=lO3RaQBys9r0ROMjR8T8Rr7UsIEm-H9_C_70Nwz4MXY,701
|
|
407
407
|
xcoll/scattering_routines/geometry/segments.h,sha256=7nKnnin2ByxkKyaYwGvFaqgLQg5uBba4CdLHL7L3iQs,7667
|
|
408
408
|
xcoll/scattering_routines/geometry/sort.h,sha256=b1MkFO2ddzv1fWGeQzsLuz46qo2pKyRSXHjoAEVU7Ts,5763
|
|
409
|
-
xcoll-0.5.
|
|
410
|
-
xcoll-0.5.
|
|
411
|
-
xcoll-0.5.
|
|
412
|
-
xcoll-0.5.
|
|
413
|
-
xcoll-0.5.
|
|
409
|
+
xcoll-0.5.8.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
410
|
+
xcoll-0.5.8.dist-info/METADATA,sha256=ikWtL-ecHne0cta39XCx61xI5-P_DwuJY2jmHTPLmSo,2709
|
|
411
|
+
xcoll-0.5.8.dist-info/NOTICE,sha256=6DO_E7WCdRKc42vUoVVBPGttvQi4mRt9fAcxj9u8zy8,74
|
|
412
|
+
xcoll-0.5.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
413
|
+
xcoll-0.5.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|