xcoll 0.5.9__py3-none-any.whl → 0.5.10__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/base.py +18 -5
- xcoll/colldb.py +164 -176
- xcoll/general.py +1 -1
- {xcoll-0.5.9.dist-info → xcoll-0.5.10.dist-info}/METADATA +2 -2
- {xcoll-0.5.9.dist-info → xcoll-0.5.10.dist-info}/RECORD +8 -11
- xcoll/beam_elements/__init__.py.orig +0 -32
- xcoll/colldb.py.orig +0 -654
- xcoll/initial_distribution.py.orig +0 -224
- {xcoll-0.5.9.dist-info → xcoll-0.5.10.dist-info}/LICENSE +0 -0
- {xcoll-0.5.9.dist-info → xcoll-0.5.10.dist-info}/NOTICE +0 -0
- {xcoll-0.5.9.dist-info → xcoll-0.5.10.dist-info}/WHEEL +0 -0
xcoll/beam_elements/base.py
CHANGED
|
@@ -198,6 +198,10 @@ class BaseCollimator(BaseBlock):
|
|
|
198
198
|
to_assign['angle_L'] = kwargs.pop('angle_L', 0)
|
|
199
199
|
to_assign['angle_R'] = kwargs.pop('angle_R', 0)
|
|
200
200
|
|
|
201
|
+
# We do not allow any combination of jaw_ and gap_ attributes
|
|
202
|
+
# (except when jaw=..., gap=None or jaw=None, gap=... is used, as this is how the colldb installs it)
|
|
203
|
+
kwargs = {kk: vv for kk, vv in kwargs.items() if not vv is None}
|
|
204
|
+
|
|
201
205
|
# Set jaw
|
|
202
206
|
if 'jaw' in kwargs:
|
|
203
207
|
for key in ['jaw_L', 'jaw_R', 'jaw_LU', 'jaw_LD', 'jaw_RU', 'jaw_RD', 'gap', 'gap_L', 'gap_R']:
|
|
@@ -333,7 +337,7 @@ class BaseCollimator(BaseBlock):
|
|
|
333
337
|
or (self.tilt_L == 0 and self.tilt_R == 0):
|
|
334
338
|
return [self.jaw_L, self.jaw_R]
|
|
335
339
|
else:
|
|
336
|
-
return [[self.jaw_LU, self.
|
|
340
|
+
return [[self.jaw_LU, self.jaw_LD], [self.jaw_RU, self.jaw_RD]]
|
|
337
341
|
|
|
338
342
|
@jaw.setter # Keeps the tilts unless all 4 corners are specified
|
|
339
343
|
def jaw(self, val):
|
|
@@ -352,8 +356,8 @@ class BaseCollimator(BaseBlock):
|
|
|
352
356
|
if hasattr(val[0], '__iter__'):
|
|
353
357
|
if hasattr(val[1], '__iter__') and len(val[0]) == 2 and len(val[1]) == 2:
|
|
354
358
|
self.jaw_LU = val[0][0]
|
|
355
|
-
self.
|
|
356
|
-
self.
|
|
359
|
+
self.jaw_LD = val[0][1]
|
|
360
|
+
self.jaw_RU = val[1][0]
|
|
357
361
|
self.jaw_RD = val[1][1]
|
|
358
362
|
return
|
|
359
363
|
else:
|
|
@@ -556,6 +560,8 @@ class BaseCollimator(BaseBlock):
|
|
|
556
560
|
print("Warning: Setting a tilt does not preserve the hierarchy, as there "
|
|
557
561
|
+ "will always be one corner that tightens (the tilt is applied at "
|
|
558
562
|
+ "the centre of the jaw).")
|
|
563
|
+
if val > np.pi/2 or val < -np.pi/2:
|
|
564
|
+
raise ValueError("Tilts larger than 90 degrees are not supported.")
|
|
559
565
|
self._sin_yL = np.sin(val)
|
|
560
566
|
self._cos_yL = np.cos(val)
|
|
561
567
|
self._tan_yL = np.tan(val)
|
|
@@ -577,6 +583,8 @@ class BaseCollimator(BaseBlock):
|
|
|
577
583
|
print("Warning: Setting a tilt does not preserve the hierarchy, as there "
|
|
578
584
|
+ "will always be one corner that tightens (the tilt is applied at "
|
|
579
585
|
+ "the centre of the jaw).")
|
|
586
|
+
if val > np.pi/2 or val < -np.pi/2:
|
|
587
|
+
raise ValueError("Tilts larger than 90 degrees are not supported.")
|
|
580
588
|
self._sin_yR = np.sin(val)
|
|
581
589
|
self._cos_yR = np.cos(val)
|
|
582
590
|
self._tan_yR = np.tan(val)
|
|
@@ -965,8 +973,6 @@ class BaseCollimator(BaseBlock):
|
|
|
965
973
|
assert self._jaws_parallel == False
|
|
966
974
|
assert np.isclose(self._sin_zDiff, self._cos_zL*self._sin_zR - self._sin_zL*self._cos_zR)
|
|
967
975
|
assert np.isclose(self._cos_zDiff, self._cos_zL*self._cos_zR + self._sin_zL*self._sin_zR)
|
|
968
|
-
if self.side == 'both' and abs(self.tilt_L - self.tilt_R) >= 90.:
|
|
969
|
-
raise ValueError("Tilts of both jaws differ more than 90 degrees!")
|
|
970
976
|
if self.side != 'right':
|
|
971
977
|
ang = abs(np.arccos(self._cos_yL))
|
|
972
978
|
ang = np.pi - ang if ang > np.pi/2 else ang
|
|
@@ -1058,6 +1064,11 @@ class BaseCrystal(BaseBlock):
|
|
|
1058
1064
|
# Set angle
|
|
1059
1065
|
to_assign['angle'] = kwargs.pop('angle', 0)
|
|
1060
1066
|
|
|
1067
|
+
# We do not allow any combination of jaw_ and gap_ attributes
|
|
1068
|
+
# (except when jaw=..., gap=None or jaw=None, gap=... is used, as this is how the colldb installs it)
|
|
1069
|
+
kwargs = {kk: vv for kk, vv in kwargs.items() if not vv is None}
|
|
1070
|
+
|
|
1071
|
+
|
|
1061
1072
|
# Set jaw
|
|
1062
1073
|
if 'jaw' in kwargs:
|
|
1063
1074
|
for key in ['jaw_U', 'jaw_D', 'gap']:
|
|
@@ -1214,6 +1225,8 @@ class BaseCrystal(BaseBlock):
|
|
|
1214
1225
|
if val > min(0, -self.bending_angle/2):
|
|
1215
1226
|
print("Warning: Setting a positive tilt does not preserve the hierarchy, as the "
|
|
1216
1227
|
+ "crystal tightens towards the beam.")
|
|
1228
|
+
if val > np.pi/2 or val < -np.pi/2:
|
|
1229
|
+
raise ValueError("Tilts larger than 90 degrees are not supported.")
|
|
1217
1230
|
self._sin_y = np.sin(val)
|
|
1218
1231
|
self._cos_y = np.cos(val)
|
|
1219
1232
|
self._tan_y = np.tan(val)
|
xcoll/colldb.py
CHANGED
|
@@ -358,156 +358,158 @@ class CollimatorDatabase:
|
|
|
358
358
|
return pd.DataFrame(self._collimator_dict).transpose()
|
|
359
359
|
|
|
360
360
|
def to_yaml(self, out, lhc_style=True):
|
|
361
|
-
""
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
#
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
#
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
361
|
+
raise NotImplementedError("This functionality needs to be updated to be compatible with tilts and read "
|
|
362
|
+
+ "the families from the colldb instead of hard-coding them!")
|
|
363
|
+
# """
|
|
364
|
+
# Writes a colldb in memory to disk in the yaml format.
|
|
365
|
+
|
|
366
|
+
# > colldb_object.write_to_yaml(<path+name>, lhc_style=Bool)
|
|
367
|
+
|
|
368
|
+
# if lhc_style == True, it will add comments assuming that the collimators are named
|
|
369
|
+
# as in the lhc.
|
|
370
|
+
|
|
371
|
+
# The function can dump b1, b2 and a general bx, however multi-beam functionality is not yet
|
|
372
|
+
# added to the collmanager. TODO
|
|
373
|
+
|
|
374
|
+
# If any of the dumped keys contains capital letters (e.g. gap_L), it will not be possible
|
|
375
|
+
# to load it back into xcoll, since all keys are set to lowercase when importing TODO
|
|
376
|
+
# """
|
|
377
|
+
# # Dumps collimator database to a YAML file with optional LHC style formatting
|
|
378
|
+
# import re
|
|
379
|
+
|
|
380
|
+
# # Local helper functions
|
|
381
|
+
# def _format_dict_entry(key, value, spacing='', mapping=False, key_width=15):
|
|
382
|
+
# # Formats a dictionary entry into a string for YAML output
|
|
383
|
+
# formatted_values = ', '.join(f"{k}: {v}" for k, v in value.items())
|
|
384
|
+
# formatted_values = re.sub(r'none', 'null', formatted_values, flags=re.IGNORECASE)
|
|
385
|
+
# # Ensure key has a fixed width for alignment
|
|
386
|
+
# if mapping:
|
|
387
|
+
# formatted_key = f'{key}'.ljust(key_width)
|
|
388
|
+
# else:
|
|
389
|
+
# formatted_key = f'{key}:'.ljust(key_width)
|
|
390
|
+
# #formatted_values = formatted_values.ljust(key_width)
|
|
391
|
+
# return f"{spacing}{formatted_key} {{ {formatted_values} }}\n"
|
|
392
|
+
|
|
393
|
+
# def _print_values(keys, dct, file, spacing='', mapping=False):
|
|
394
|
+
# # Writes formatted dictionary entries to a file
|
|
395
|
+
# for key in keys:
|
|
396
|
+
# file.write(_format_dict_entry(key, dct[key], spacing=spacing, mapping=mapping))
|
|
397
|
+
|
|
398
|
+
# def _print_colls(colls, dcts, beam, file):
|
|
399
|
+
# # Filters and formats collimator data, then writes to a file
|
|
400
|
+
# coll_items_to_print = ['<<','gap','angle','material','active','length','side']
|
|
401
|
+
# file.write(f' {beam}:\n')
|
|
402
|
+
# for coll in colls:
|
|
403
|
+
# coll_dict = dcts.to_pandas().transpose().to_dict()[coll]
|
|
404
|
+
# fam = coll_dict['family']
|
|
405
|
+
# fam_keys = []
|
|
406
|
+
# if fam is not None:
|
|
407
|
+
# fam_keys = dcts._family_dict[fam].keys()
|
|
408
|
+
# coll_dict = {**{'<<': '*'+fam}, **coll_dict}
|
|
409
|
+
# temp_items_to_print = []
|
|
410
|
+
# if coll_dict['crystal'] and str(coll_dict['crystal'])!='nan':
|
|
411
|
+
# temp_items_to_print = ['bending_radius','width','height','miscut','crystal']
|
|
412
|
+
# # if 'angle_L' in coll_dict and coll_dict['angle_L'] == coll_dict['angle_R']:
|
|
413
|
+
# # coll_dict.update({'angle': coll_dict['angle_L']})
|
|
414
|
+
# # else:
|
|
415
|
+
# # temp_items_to_print = temp_items_to_print + ['angle_L','angle_R']
|
|
416
|
+
# # if coll_dict['gap_L'] == coll_dict['gap_R']:
|
|
417
|
+
# # coll_dict.update({'gap': coll_dict['gap_L']})
|
|
418
|
+
# # elif coll_dict['gap_L'] is None and coll_dict['gap_R'] is not None:
|
|
419
|
+
# # coll_dict.update({'gap': coll_dict['gap_R']})
|
|
420
|
+
# # elif coll_dict['gap_L'] is not None and coll_dict['gap_R'] is None:
|
|
421
|
+
# # coll_dict.update({'gap': coll_dict['gap_L']})
|
|
422
|
+
# # else:
|
|
423
|
+
# # temp_items_to_print = temp_items_to_print + ['gap_L','gap_R']
|
|
424
|
+
# value = {}
|
|
425
|
+
# overwritten_keys = coll_dict['overwritten_keys']
|
|
426
|
+
# for key, val in coll_dict.items():
|
|
427
|
+
# if key == 'active_length':
|
|
428
|
+
# key = 'length'
|
|
429
|
+
# if (key in coll_items_to_print+temp_items_to_print) and (key not in (set(fam_keys)-set(overwritten_keys))) and (val != 'both'):
|
|
430
|
+
# value.update({key: val})
|
|
431
|
+
# file.write(_format_dict_entry(coll, value, spacing=' '))
|
|
432
|
+
# file.write('\n')
|
|
433
|
+
|
|
434
|
+
# LHC_families = ['tcp3', 'tcsg3', 'tcsm3', 'tcla3', 'tcp7', 'tcsg7', 'tcsm7', 'tcla7', 'tcli', 'tdi', 'tcdq', 'tcstcdq', 'tcth1', 'tcth2', 'tcth5', 'tcth8', 'tctv1', 'tctv2', 'tctv5', 'tctv8', 'tclp', 'tcxrp', 'tcryo', 'tcl4', 'tcl5', 'tcl6', 'tct15', 'tct2', 'tct8', 'tcsp', 'tcld']
|
|
435
|
+
# with open(f'{out}.yaml', 'w') as file:
|
|
436
|
+
# if '_family_dict' in self.__dict__.keys():
|
|
437
|
+
# file.write('families:\n')
|
|
438
|
+
# if lhc_style:
|
|
439
|
+
# printed_families = []
|
|
440
|
+
# fams_in_dict = self._family_dict.keys()
|
|
441
|
+
|
|
442
|
+
# # Momentum cleaning
|
|
443
|
+
# file.write(' # Momentum cleaning\n')
|
|
444
|
+
# sel_fam = [fam for fam in LHC_families if re.match('.*3', fam) and (fam in fams_in_dict)]
|
|
445
|
+
# printed_families += sel_fam
|
|
446
|
+
# _print_values(sel_fam, self._family_dict, file, spacing=' - &', mapping=True)
|
|
447
|
+
|
|
448
|
+
# # Betatron cleaning
|
|
449
|
+
# file.write(' # Betatron cleaning\n')
|
|
450
|
+
# sel_fam = [fam for fam in LHC_families if re.match('.*7', fam) and (fam in fams_in_dict)]
|
|
451
|
+
# printed_families += sel_fam
|
|
452
|
+
# _print_values(sel_fam, self._family_dict, file, spacing=' - &', mapping=True)
|
|
453
|
+
|
|
454
|
+
# # Injection protection
|
|
455
|
+
# file.write(' # Injection protection\n')
|
|
456
|
+
# sel_fam = [fam for fam in LHC_families if (fam in ['tcli', 'tdi']) and (fam in fams_in_dict)]
|
|
457
|
+
# printed_families += sel_fam
|
|
458
|
+
# _print_values(sel_fam, self._family_dict, file, spacing=' - &', mapping=True)
|
|
459
|
+
|
|
460
|
+
# # Dump protection
|
|
461
|
+
# file.write(' # Dump protection\n')
|
|
462
|
+
# sel_fam = [fam for fam in LHC_families if (fam in ['tcdq', 'tcsp', 'tcstcdq']) and (fam in fams_in_dict)]
|
|
463
|
+
# printed_families += sel_fam
|
|
464
|
+
# _print_values(sel_fam, self._family_dict, file, spacing=' - &', mapping=True)
|
|
465
|
+
|
|
466
|
+
# # Physics background / debris
|
|
467
|
+
# file.write(' # Physics background / debris\n')
|
|
468
|
+
# sel_fam = [fam for fam in LHC_families if ((re.match('tc[lt][0-9dp].*', fam)) or (fam in ['tcryo', 'tcxrp'])) and (fam in fams_in_dict)]
|
|
469
|
+
# printed_families += sel_fam
|
|
470
|
+
# _print_values(sel_fam, self._family_dict, file, spacing=' - &', mapping=True)
|
|
471
|
+
|
|
472
|
+
# # Other families
|
|
473
|
+
# if set(printed_families) != set(fams_in_dict):
|
|
474
|
+
# file.write(' # Other families\n')
|
|
475
|
+
# _print_values(set(fams_in_dict) - set(printed_families), self._family_dict, file, spacing=' - &', mapping=True)
|
|
476
|
+
# else:
|
|
477
|
+
# file.write(' # Families\n')
|
|
478
|
+
# _print_values(self._family_dict.keys(), self._family_dict, file, spacing=' - &', mapping=True)
|
|
479
|
+
|
|
480
|
+
# # Emittance section
|
|
481
|
+
# ex = self.nemitt_x
|
|
482
|
+
# ey = self.nemitt_y
|
|
483
|
+
# file.write(f'\nemittance:\n x: {ex}\n y: {ey}\n')
|
|
484
|
+
|
|
485
|
+
# # Collimators section
|
|
486
|
+
# file.write('\ncollimators:\n')
|
|
487
|
+
# b1_colls, b2_colls, bx_colls = [], [], []
|
|
488
|
+
# for coll in self.to_pandas().index:
|
|
489
|
+
# if coll == 'tclia.4r2' or coll == 'tclia.4l8': # TODO: hardcoded!!!
|
|
490
|
+
# b1_colls.append(coll)
|
|
491
|
+
# b2_colls.append(coll)
|
|
492
|
+
# elif coll[-2:] == 'b1':
|
|
493
|
+
# b1_colls.append(coll)
|
|
494
|
+
# elif coll[-2:] == 'b2':
|
|
495
|
+
# b2_colls.append(coll)
|
|
496
|
+
# else:
|
|
497
|
+
# bx_colls.append(coll)
|
|
498
|
+
|
|
499
|
+
# # Handle special cases for collimators
|
|
500
|
+
# if (('tclia.4r2' in b1_colls) or ('tclia.4l8' in b1_colls)) and (len(b1_colls) <= 2):
|
|
501
|
+
# b1_colls = []
|
|
502
|
+
# if (('tclia.4r2' in b2_colls) or ('tclia.4l8' in b2_colls)) and (len(b2_colls) <= 2):
|
|
503
|
+
# b2_colls = []
|
|
504
|
+
|
|
505
|
+
# # Print collimators for each beam
|
|
506
|
+
# if len(b1_colls) > 0:
|
|
507
|
+
# _print_colls(b1_colls, self, 'b1', file)
|
|
508
|
+
# if len(b2_colls) > 0:
|
|
509
|
+
# _print_colls(b2_colls, self, 'b2', file)
|
|
510
|
+
# if len(bx_colls) > 0:
|
|
511
|
+
# _print_colls(bx_colls, self, 'bx', file)
|
|
512
|
+
# print('WARNING -- some collimators could not be assigned to b1 or b2. Tracking might not work with those collimators. Please manually change the output file if necessary.')
|
|
511
513
|
|
|
512
514
|
|
|
513
515
|
# ====================================
|
|
@@ -539,27 +541,14 @@ class CollimatorDatabase:
|
|
|
539
541
|
+ f"(or xtrack.Drift)!\nPlease check the name, or correct the "
|
|
540
542
|
+ f"element.")
|
|
541
543
|
|
|
542
|
-
def _create_collimator(self,
|
|
543
|
-
|
|
544
|
-
self._check_installed(line, name, collimator_class)
|
|
544
|
+
def _create_collimator(self, cls, line, name, **kwargs):
|
|
545
|
+
self._check_installed(line, name, cls)
|
|
545
546
|
if kwargs.pop('verbose', False):
|
|
546
|
-
print(f"Installing {name:20} as {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
el
|
|
551
|
-
self._elements[name] = el
|
|
552
|
-
|
|
553
|
-
def _create_crystal(self, line, crystal_class, name, **kwargs):
|
|
554
|
-
assert issubclass(crystal_class, BaseCrystal)
|
|
555
|
-
self._check_installed(line, name, crystal_class)
|
|
556
|
-
if kwargs.pop('verbose', False):
|
|
557
|
-
print(f"Installing {name:20} as {crystal_class.__name__}")
|
|
558
|
-
el = crystal_class(gap=self[name]['gap'], angle=self[name]['angle'],
|
|
559
|
-
length=self[name]['length'], side=self[name]['side'],
|
|
560
|
-
bending_radius=self[name]['bending_radius'],
|
|
561
|
-
width=self[name]['width'], height=self[name]['height'],
|
|
562
|
-
_tracking=False, **kwargs)
|
|
547
|
+
print(f"Installing {name:20} as {cls.__name__}")
|
|
548
|
+
prop_dict = {kk: vv for kk, vv in self[name].items() \
|
|
549
|
+
if kk in cls._xofields or kk in cls._store_in_to_dict}
|
|
550
|
+
prop_dict.update(kwargs)
|
|
551
|
+
el = cls(**prop_dict)
|
|
563
552
|
el.emittance = [self.nemitt_x, self.nemitt_y]
|
|
564
553
|
self._elements[name] = el
|
|
565
554
|
|
|
@@ -567,9 +556,9 @@ class CollimatorDatabase:
|
|
|
567
556
|
names = self._get_names_from_line(line, names, families)
|
|
568
557
|
for name in names:
|
|
569
558
|
if self[name]['bending_radius'] is None:
|
|
570
|
-
self._create_collimator(
|
|
559
|
+
self._create_collimator(BlackAbsorber, line, name, verbose=verbose)
|
|
571
560
|
else:
|
|
572
|
-
self.
|
|
561
|
+
self._create_collimator(BlackCrystal, line, name, verbose=verbose)
|
|
573
562
|
elements = [self._elements[name] for name in names]
|
|
574
563
|
line.collimators.install(names, elements, need_apertures=need_apertures)
|
|
575
564
|
|
|
@@ -578,12 +567,11 @@ class CollimatorDatabase:
|
|
|
578
567
|
for name in names:
|
|
579
568
|
mat = SixTrack_to_xcoll(self[name]['material'])
|
|
580
569
|
if self[name]['bending_radius'] is None:
|
|
581
|
-
self._create_collimator(
|
|
570
|
+
self._create_collimator(EverestCollimator, line, name, material=mat[0],
|
|
582
571
|
verbose=verbose)
|
|
583
572
|
else:
|
|
584
|
-
self.
|
|
585
|
-
|
|
586
|
-
miscut=self[name]['miscut'])
|
|
573
|
+
self._create_collimator(EverestCrystal, line, name, material=mat[1],
|
|
574
|
+
verbose=verbose)
|
|
587
575
|
elements = [self._elements[name] for name in names]
|
|
588
576
|
line.collimators.install(names, elements, need_apertures=need_apertures)
|
|
589
577
|
|
xcoll/general.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: xcoll
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.10
|
|
4
4
|
Summary: Xsuite collimation package
|
|
5
5
|
Home-page: https://github.com/xsuite/xcoll
|
|
6
6
|
License: Apache 2.0
|
|
@@ -18,7 +18,7 @@ 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.
|
|
21
|
+
Requires-Dist: xdeps (>=0.7.4)
|
|
22
22
|
Requires-Dist: xobjects (>=0.4.5)
|
|
23
23
|
Requires-Dist: xpart (>=0.19.1)
|
|
24
24
|
Requires-Dist: xtrack (>=0.69.7)
|
|
@@ -3,9 +3,8 @@ NOTICE,sha256=6DO_E7WCdRKc42vUoVVBPGttvQi4mRt9fAcxj9u8zy8,74
|
|
|
3
3
|
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
|
-
xcoll/beam_elements/__init__.py.orig,sha256=XZMbC-0IzLmKN4LXXT5zm2zOXzRWvkpuElCBGE3VWtw,1507
|
|
7
6
|
xcoll/beam_elements/absorber.py,sha256=efK6gyUgD4x_FnBLpMR7-5_HCdp_753nkYikcdn6ulw,2502
|
|
8
|
-
xcoll/beam_elements/base.py,sha256=
|
|
7
|
+
xcoll/beam_elements/base.py,sha256=5k4ngEXNgvoiJWu7dx2bwHlv73tfaxn-4JlCdLwHdYo,53495
|
|
9
8
|
xcoll/beam_elements/blowup.py,sha256=gBXdlISvoDiMjXVpA77ls5QdAU3H9krwvFt2bSW_NII,8029
|
|
10
9
|
xcoll/beam_elements/elements_src/black_absorber.h,sha256=jCyQoaZ7VsIu8coQ99J1dDtAGqZpFIxxFLBlfhO6Drw,5027
|
|
11
10
|
xcoll/beam_elements/elements_src/black_crystal.h,sha256=x7oUwsrkUwUrFvhFsq8vtPkJJTSi1hYAhSt6fjzkJQo,4622
|
|
@@ -16,13 +15,11 @@ xcoll/beam_elements/elements_src/everest_collimator.h,sha256=DlWkb5RORnp5VwI7E31
|
|
|
16
15
|
xcoll/beam_elements/elements_src/everest_crystal.h,sha256=WwwNF6it7TuOimhpSXJa7UXqp_i3wVZ_fXlTStn4db0,12193
|
|
17
16
|
xcoll/beam_elements/everest.py,sha256=PA_VWpnPrIuO1xN__eKyT_ejbGZK7p93QHDVi3re7cM,8541
|
|
18
17
|
xcoll/beam_elements/monitor.py,sha256=zzMdN3JMFSAs-30_ntRvd5qZGdsXfGtColhiFDuMcIk,16928
|
|
19
|
-
xcoll/colldb.py,sha256=
|
|
20
|
-
xcoll/
|
|
21
|
-
xcoll/general.py,sha256=-xLa-F2jd_1I3hIhlntMYsz_B-DZw_bj0qqh1SR1Cno,534
|
|
18
|
+
xcoll/colldb.py,sha256=hGScl4lU93KDemHrgHOKfu2OqVAufP1BtgKKHJ_THDc,30501
|
|
19
|
+
xcoll/general.py,sha256=wIlggzlMxO2sa0ntCbJyJatOL4CSQ7ndh3Ff9SNuOsc,535
|
|
22
20
|
xcoll/headers/checks.h,sha256=qdXsOTBOK1MwW6bdFF93j4yE648mcDtEv5rGN1w9sfk,1582
|
|
23
21
|
xcoll/headers/particle_states.h,sha256=DZa_ZSaJrjnA8aHFriZKfRCkArQ8nK1t445MRwevDtA,840
|
|
24
22
|
xcoll/initial_distribution.py,sha256=x5G4LTXn4boEg5jBFrQCk_l759h91XiAUhDTdcUvLkc,8779
|
|
25
|
-
xcoll/initial_distribution.py.orig,sha256=NOtDtAoNYx8p5l-hUO9ueafl3jtbIzGU0z8-xHtTX_E,9026
|
|
26
23
|
xcoll/install.py,sha256=SxEFQnhWXlsXyPBIo847q6wPgId_f5ZtFRR1awGbkjc,2108
|
|
27
24
|
xcoll/interaction_record/__init__.py,sha256=UFoLiKa-z2oX7YoszP-7Vgdt1nM6kT382v1CaIu8_u0,50
|
|
28
25
|
xcoll/interaction_record/interaction_record.py,sha256=ixsQtVZn71vVEuTAA27a2NWcZZZ8iAcWFOa58bcWEQU,13271
|
|
@@ -409,8 +406,8 @@ xcoll/scattering_routines/geometry/objects.h,sha256=A5ktGvVlSkC4hUsI_PQFsE80CuDw
|
|
|
409
406
|
xcoll/scattering_routines/geometry/rotation.h,sha256=lO3RaQBys9r0ROMjR8T8Rr7UsIEm-H9_C_70Nwz4MXY,701
|
|
410
407
|
xcoll/scattering_routines/geometry/segments.h,sha256=7nKnnin2ByxkKyaYwGvFaqgLQg5uBba4CdLHL7L3iQs,7667
|
|
411
408
|
xcoll/scattering_routines/geometry/sort.h,sha256=b1MkFO2ddzv1fWGeQzsLuz46qo2pKyRSXHjoAEVU7Ts,5763
|
|
412
|
-
xcoll-0.5.
|
|
413
|
-
xcoll-0.5.
|
|
414
|
-
xcoll-0.5.
|
|
415
|
-
xcoll-0.5.
|
|
416
|
-
xcoll-0.5.
|
|
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,,
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# copyright ############################### #
|
|
2
|
-
# This file is part of the Xcoll package. #
|
|
3
|
-
# Copyright (c) CERN, 2024. #
|
|
4
|
-
# ######################################### #
|
|
5
|
-
|
|
6
|
-
from .base import BaseBlock, BaseCollimator, BaseCrystal
|
|
7
|
-
from .absorber import BlackAbsorber, BlackCrystal
|
|
8
|
-
from .everest import EverestBlock, EverestCollimator, EverestCrystal
|
|
9
|
-
from .blowup import BlowUp
|
|
10
|
-
from .monitor import EmittanceMonitor
|
|
11
|
-
|
|
12
|
-
block_classes = tuple(v for v in globals().values()
|
|
13
|
-
if isinstance(v, type) and issubclass(v, BaseBlock) and v != BaseBlock
|
|
14
|
-
and v != BaseCollimator and v != BaseCrystal)
|
|
15
|
-
# Includes crystals
|
|
16
|
-
collimator_classes = tuple(v for v in globals().values()
|
|
17
|
-
if isinstance(v, type) and (issubclass(v, BaseCollimator) or issubclass(v, BaseCrystal))
|
|
18
|
-
and v != BaseCollimator and v != BaseCrystal)
|
|
19
|
-
crystal_classes = tuple(v for v in globals().values()
|
|
20
|
-
if isinstance(v, type) and issubclass(v, BaseCrystal) and v != BaseCrystal)
|
|
21
|
-
|
|
22
|
-
element_classes = block_classes + (BlowUp, EmittanceMonitor)
|
|
23
|
-
<<<<<<< HEAD
|
|
24
|
-
|
|
25
|
-
# These should not go into any of the classes lists
|
|
26
|
-
# but are added for compatibility with _K2
|
|
27
|
-
from .k2 import _K2Collimator, _K2Crystal
|
|
28
|
-
_all_block_classes = block_classes + (_K2Collimator, _K2Crystal)
|
|
29
|
-
_all_collimator_classes = collimator_classes + (_K2Collimator, _K2Crystal)
|
|
30
|
-
_all_crystal_classes = crystal_classes + (_K2Crystal,)
|
|
31
|
-
=======
|
|
32
|
-
>>>>>>> release/v0.6.0
|