xcoll 0.5.10__py3-none-any.whl → 0.5.11__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.

@@ -12,8 +12,8 @@ from ..interaction_record import InteractionRecord
12
12
  from ..general import _pkg_root
13
13
 
14
14
 
15
- OPEN_JAW = 3.
16
- OPEN_GAP = 999.
15
+ OPEN_JAW = 3
16
+ OPEN_GAP = 999
17
17
 
18
18
 
19
19
  class InvalidXcoll(xt.BeamElement):
@@ -659,6 +659,11 @@ class BaseCollimator(BaseBlock):
659
659
  self._nemitt_x = val
660
660
  self._apply_optics()
661
661
 
662
+ @property
663
+ def gemitt_x(self):
664
+ if self.nemitt_x is not None and self.optics_ready():
665
+ return self.nemitt_x / self.optics['beta_gamma_rel']
666
+
662
667
  @property
663
668
  def nemitt_y(self):
664
669
  if self._nemitt_y == 0:
@@ -674,6 +679,11 @@ class BaseCollimator(BaseBlock):
674
679
  self._nemitt_y = val
675
680
  self._apply_optics()
676
681
 
682
+ @property
683
+ def gemitt_y(self):
684
+ if self.nemitt_y is not None and self.optics_ready():
685
+ return self.nemitt_y / self.optics['beta_gamma_rel']
686
+
677
687
  @property
678
688
  def emittance(self):
679
689
  if self.nemitt_x is not None and self.nemitt_y is not None:
@@ -734,8 +744,8 @@ class BaseCollimator(BaseBlock):
734
744
  alfy = self.optics[self.align]['alfy'][0]
735
745
  betx = self.optics[self.align]['betx'][0]
736
746
  bety = self.optics[self.align]['bety'][0]
737
- divx = -np.sqrt(self.nemitt_x/self.optics['beta_gamma_rel']/betx)*alfx
738
- divy = -np.sqrt(self.nemitt_y/self.optics['beta_gamma_rel']/bety)*alfy
747
+ divx = -np.sqrt(self.gemitt_x/betx)*alfx
748
+ divy = -np.sqrt(self.gemitt_y/bety)*alfy
739
749
  if hasattr(self, '_cos_zL'):
740
750
  if self.side != 'right':
741
751
  return divx if abs(self.angle_L) < 1e-6 else divy
@@ -1256,6 +1266,10 @@ class BaseCrystal(BaseBlock):
1256
1266
  def nemitt_x(self, val):
1257
1267
  BaseCollimator.nemitt_x.fset(self, val)
1258
1268
 
1269
+ @property
1270
+ def gemitt_x(self):
1271
+ return BaseCollimator.gemitt_x.fget(self)
1272
+
1259
1273
  @property
1260
1274
  def nemitt_y(self):
1261
1275
  return BaseCollimator.nemitt_y.fget(self)
@@ -1264,6 +1278,10 @@ class BaseCrystal(BaseBlock):
1264
1278
  def nemitt_y(self, val):
1265
1279
  BaseCollimator.nemitt_y.fset(self, val)
1266
1280
 
1281
+ @property
1282
+ def gemitt_y(self):
1283
+ return BaseCollimator.gemitt_y.fget(self)
1284
+
1267
1285
  @property
1268
1286
  def emittance(self):
1269
1287
  return BaseCollimator.emittance.fget(self)
xcoll/general.py CHANGED
@@ -12,5 +12,5 @@ citation = "F.F. Van der Veken, et al.: Recent Developments with the New Tools f
12
12
  # ======================
13
13
  # Do not change
14
14
  # ======================
15
- __version__ = '0.5.10'
15
+ __version__ = '0.5.11'
16
16
  # ======================
@@ -57,8 +57,14 @@ def generate_pencil_on_collimator(line, name, num_particles, *, side='+-', penci
57
57
  if twiss is None:
58
58
  twiss = line.twiss()
59
59
 
60
- # Is it converging or diverging? # TODO: This might change with a tilt!!!!!!
61
- is_converging = twiss[f'alf{plane}', name] > 0
60
+ # Is it converging or diverging?
61
+ # TODO: dispersion might change this
62
+ # TODO: this should be checked jaw by jaw (we are currently checking the left jaw - watch out for sign of tilt of right jaw)
63
+ # TODO: skew collimators
64
+ tilt = coll.tilt[0] if isinstance(coll.tilt, list) else coll.tilt
65
+ betatron_angle = coll.gap * coll.divergence
66
+ tolerance_tilt = 1e-12 # 0.1 urad tolerance on jaw tilt => we prioritise converging
67
+ is_converging = tilt + tolerance_tilt >= betatron_angle
62
68
  print(f"Collimator {name} is {'con' if is_converging else 'di'}verging.")
63
69
 
64
70
  beam_sizes = twiss.get_beam_covariance(nemitt_x=coll.nemitt_x, nemitt_y=coll.nemitt_y)
xcoll/line_tools.py CHANGED
@@ -33,7 +33,7 @@ class XcollScatteringAPI:
33
33
  if nemitt_y is None:
34
34
  nemitt_y = el.nemitt_y
35
35
  if not np.isclose(el.nemitt_x, nemitt_x) \
36
- or not np.isclose(el.nemitt_x, nemitt_x):
36
+ or not np.isclose(el.nemitt_y, nemitt_y):
37
37
  raise ValueError("Not all collimators have the same "
38
38
  + "emittance. This is not supported.")
39
39
  if hasattr(el, 'enable_scattering'):
@@ -243,7 +243,7 @@ class XcollCollimatorAPI:
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:
246
- self.line[coll].assign_optics(name=coll, nemitt_x=nemitt_x, nemitt_y=nemitt_x, twiss_upstream=tw_upstream,
246
+ self.line[coll].assign_optics(name=coll, nemitt_x=nemitt_x, nemitt_y=nemitt_y, twiss_upstream=tw_upstream,
247
247
  twiss_downstream=tw_downstream, beta_gamma_rel=beta_gamma_rel)
248
248
 
249
249
  def open(self, names=None):
@@ -282,22 +282,22 @@ class XcollCollimatorAPI:
282
282
 
283
283
  def assign_optics_to_collimators(line, nemitt_x=None, nemitt_y=None, twiss=None):
284
284
  warn("The function xcoll.assign_optics_to_collimators() is deprecated and will be "
285
- + "removed in the future. Please use line.scattering.assign_optics() instead.", FutureWarning)
285
+ + "removed in the future. Please use line.collimators.assign_optics() instead.", FutureWarning)
286
286
  line.collimators.assign_optics(nemitt_x=nemitt_x, nemitt_y=nemitt_y, twiss=twiss)
287
287
 
288
288
  def get_optics_at(names, *, twiss=None, line=None):
289
289
  warn("The function xcoll.get_optics_at() is deprecated and will be "
290
- + "removed in the future. Please use line.scattering.get_optics_at() instead.", FutureWarning)
290
+ + "removed in the future. Please use line.collimators.get_optics_at() instead.", FutureWarning)
291
291
  return line.collimators.get_optics_at(names=names, twiss=twiss)
292
292
 
293
293
  def open_collimators(line, names=None):
294
294
  warn("The function xcoll.open_collimators() is deprecated and will be "
295
- + "removed in the future. Please use line.scattering.open_collimators() instead.", FutureWarning)
295
+ + "removed in the future. Please use line.collimators.open_collimators() instead.", FutureWarning)
296
296
  line.collimators.open(names=names)
297
297
 
298
298
  def send_to_parking(line, names=None):
299
299
  warn("The function xcoll.send_to_parking() is deprecated and will be "
300
- + "removed in the future. Please use line.scattering.send_to_parking() instead.", FutureWarning)
300
+ + "removed in the future. Please use line.collimators.send_to_parking() instead.", FutureWarning)
301
301
  line.collimators.to_parking(names=names)
302
302
 
303
303
  def enable_scattering(line):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xcoll
3
- Version: 0.5.10
3
+ Version: 0.5.11
4
4
  Summary: Xsuite collimation package
5
5
  Home-page: https://github.com/xsuite/xcoll
6
6
  License: Apache 2.0
@@ -18,10 +18,10 @@ Provides-Extra: tests
18
18
  Requires-Dist: numpy (>=1.0)
19
19
  Requires-Dist: pandas (>=1.4)
20
20
  Requires-Dist: ruamel-yaml (>=0.17.31,<0.18.0) ; extra == "tests"
21
- Requires-Dist: xdeps (>=0.7.4)
21
+ Requires-Dist: xdeps (>=0.8.1)
22
22
  Requires-Dist: xobjects (>=0.4.5)
23
- Requires-Dist: xpart (>=0.19.1)
24
- Requires-Dist: xtrack (>=0.69.7)
23
+ Requires-Dist: xpart (>=0.19.3)
24
+ Requires-Dist: xtrack (>=0.70.3)
25
25
  Project-URL: Repository, https://github.com/xsuite/xcoll
26
26
  Description-Content-Type: text/markdown
27
27
 
@@ -4,7 +4,7 @@ xcoll/__init__.py,sha256=b_61vh5irhf5fPmqTFJlyhNSt4rmftXg9uXPIEpgVB4,1612
4
4
  xcoll/_manager.py,sha256=9NQKaNxZR2I1ChMVBeKQc0A8h6W8gVgRRg72a5NgbXU,808
5
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=5k4ngEXNgvoiJWu7dx2bwHlv73tfaxn-4JlCdLwHdYo,53495
7
+ xcoll/beam_elements/base.py,sha256=J69dwAILHGwGthaQK3D9f2Etibv6fe11oczcKftTEac,53943
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
@@ -16,16 +16,16 @@ xcoll/beam_elements/elements_src/everest_crystal.h,sha256=WwwNF6it7TuOimhpSXJa7U
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
18
  xcoll/colldb.py,sha256=hGScl4lU93KDemHrgHOKfu2OqVAufP1BtgKKHJ_THDc,30501
19
- xcoll/general.py,sha256=wIlggzlMxO2sa0ntCbJyJatOL4CSQ7ndh3Ff9SNuOsc,535
19
+ xcoll/general.py,sha256=H2J2KyTTt9XNt9y4_fugX7x8iem6oBuXkNvN2kUrh1c,535
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=x5G4LTXn4boEg5jBFrQCk_l759h91XiAUhDTdcUvLkc,8779
22
+ xcoll/initial_distribution.py,sha256=lHKKO0jA2_KkAamZAjM7lI4Z4tijnG2xHWw8Jw3y3ys,9147
23
23
  xcoll/install.py,sha256=SxEFQnhWXlsXyPBIo847q6wPgId_f5ZtFRR1awGbkjc,2108
24
24
  xcoll/interaction_record/__init__.py,sha256=UFoLiKa-z2oX7YoszP-7Vgdt1nM6kT382v1CaIu8_u0,50
25
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=UtRVlwX1T-wzocFzgb3VoJuBavvggNnYONjvP2WigKM,14326
28
+ xcoll/line_tools.py,sha256=UFgQwU6sO5PDS_AJDg0sbQ1Tt_-HakOpgdlud4vK6uk,14330
29
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
@@ -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.10.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
410
- xcoll-0.5.10.dist-info/METADATA,sha256=QjZzi_xm9l64o5NVMUqkX5E0Tn5RrbW4pJbGMdqyrPI,2676
411
- xcoll-0.5.10.dist-info/NOTICE,sha256=6DO_E7WCdRKc42vUoVVBPGttvQi4mRt9fAcxj9u8zy8,74
412
- xcoll-0.5.10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
413
- xcoll-0.5.10.dist-info/RECORD,,
409
+ xcoll-0.5.11.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
410
+ xcoll-0.5.11.dist-info/METADATA,sha256=ghK22ioLEwuzKOuR_ODqox2CjujH-TS1epZL668PePg,2676
411
+ xcoll-0.5.11.dist-info/NOTICE,sha256=6DO_E7WCdRKc42vUoVVBPGttvQi4mRt9fAcxj9u8zy8,74
412
+ xcoll-0.5.11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
413
+ xcoll-0.5.11.dist-info/RECORD,,
File without changes