Skip to content

Commit 5697065

Browse files
authored
Merge pull request #168 from xsuite/release/v0.7.2
Release 0.7.2
2 parents 2b77060 + 92017a3 commit 5697065

File tree

22 files changed

+270
-217
lines changed

22 files changed

+270
-217
lines changed

examples/geant4_init.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
import xcoll as xc
33

44
print(xc.geant4.environment)
5-
xc.geant4.environment.compile()
5+
print()
6+
xc.geant4.environment.compile(verbose=True, verbose_compile_output=True)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "xcoll"
3-
version = "0.7.1"
3+
version = "0.7.2"
44
description = "Xsuite collimation package"
55
authors = [
66
{name="Frederik F. Van der Veken", email="[email protected]"},

tests/test_constants.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,20 @@ def test_class():
8484
assert isinstance(tt._T5, type) and issubclass(tt._T5, Constants)
8585
assert isinstance(tt._T6, type) and issubclass(tt._T6, Constants)
8686
assert isinstance(tt._TO, type) and issubclass(tt._TO, Constants)
87-
assert tt._T1.__category__ == "type"
88-
assert tt._T2.__category__ == "unique_type"
89-
assert tt._T3.__category__ == "multi_type"
90-
assert tt._T4.__category__ == "unique_type"
91-
assert tt._T5.__category__ == "multi_type"
92-
assert tt._T6.__category__ == "multi_type"
93-
assert tt._TO.__category__ == "other_type"
94-
assert tt._T1.__reverse__ is None
95-
assert tt._T2.__reverse__ == "unique"
96-
assert tt._T3.__reverse__ == "multi"
97-
assert tt._T4.__reverse__ == "unique"
98-
assert tt._T5.__reverse__ == "multi"
99-
assert tt._T6.__reverse__ == "multi"
100-
assert tt._TO.__reverse__ == "unique"
87+
assert tt._T1._category_ == "type"
88+
assert tt._T2._category_ == "unique_type"
89+
assert tt._T3._category_ == "multi_type"
90+
assert tt._T4._category_ == "unique_type"
91+
assert tt._T5._category_ == "multi_type"
92+
assert tt._T6._category_ == "multi_type"
93+
assert tt._TO._category_ == "other_type"
94+
assert tt._T1._reverse_ is None
95+
assert tt._T2._reverse_ == "unique"
96+
assert tt._T3._reverse_ == "multi"
97+
assert tt._T4._reverse_ == "unique"
98+
assert tt._T5._reverse_ == "multi"
99+
assert tt._T6._reverse_ == "multi"
100+
assert tt._TO._reverse_ == "unique"
101101

102102

103103
def test_class_constants():
@@ -670,56 +670,56 @@ def test_consistency_and_name_clash():
670670
with pytest.raises(TypeError, match="FailThingType1 must inherit from Constants directly; "
671671
"no further subclassing allowed."):
672672
class FailThingType1(tt._T1):
673-
__category__ = "type"
674-
__reverse__ = "unique"
673+
_category_ = "type"
674+
_reverse_ = "unique"
675675

676676
with pytest.raises(ValueError, match="Category 'type' already defined with reverse None "
677-
"by test_constants_pkg.type1.TestType1. Please make __reverse__ consistent."):
677+
"by test_constants_pkg.type1.TestType1. Please make _reverse_ consistent."):
678678
class FailThingType2(Constants):
679-
__category__ = "type"
680-
__reverse__ = "unique"
679+
_category_ = "type"
680+
_reverse_ = "unique"
681681

682682
with pytest.raises(ValueError, match="Category 'type' already defined with plural 'types' "
683-
"by test_constants_pkg.type1.TestType1. Please make __plural__ consistent."):
683+
"by test_constants_pkg.type1.TestType1. Please make _plural_ consistent."):
684684
class FailThingType3(Constants):
685-
__category__ = "type"
686-
__reverse__ = None
687-
__plural__ = "yikes"
685+
_category_ = "type"
686+
_reverse_ = None
687+
_plural_ = "yikes"
688688

689689
with pytest.raises(ValueError, match="Constant name 'MASS' already defined in module "
690690
"test_constants_pkg.type1; global uniqueness required."):
691691
class FailThingType4(Constants):
692-
__category__ = "type"
693-
__reverse__ = None
694-
__c_prefix__ = "XF"
692+
_category_ = "type"
693+
_reverse_ = None
694+
_c_prefix_ = "XF"
695695

696696
VAL1 = constant(5, "Feature enabled")
697697
VAL2 = constant(2**64 - 1, "Big int")
698698
MASS = constant(0.938, "GeV/c^2") # Double definition in other table
699699

700700
with pytest.raises(ValueError, match="Value 2 for 'VAL17' in test_constants already used by 'VAR1' "
701-
"in test_constants_pkg.type1; values must be globally unique when __reverse__ == 'unique'."):
701+
"in test_constants_pkg.type1; values must be globally unique when _reverse_ == 'unique'."):
702702
class FailThingType5(Constants):
703-
__category__ = "unique_type"
704-
__reverse__ = "unique"
705-
__c_prefix__ = "XF"
703+
_category_ = "unique_type"
704+
_reverse_ = "unique"
705+
_c_prefix_ = "XF"
706706

707707
VAL17 = constant(2, "Feature enabled") # Val 2 taken by TestType2
708708

709-
with pytest.raises(TypeError, match="Mixed int/float values are not allowed when __reverse__ == 'unique'."):
709+
with pytest.raises(TypeError, match="Mixed int/float values are not allowed when _reverse_ == 'unique'."):
710710
class FailThingType6(Constants):
711-
__category__ = "unique_type_bis"
712-
__reverse__ = "unique"
713-
__c_prefix__ = "BB"
711+
_category_ = "unique_type_bis"
712+
_reverse_ = "unique"
713+
_c_prefix_ = "BB"
714714

715715
VAL18 = constant(2, "Int")
716716
VAL19 = constant(3.14, "Float")
717717

718718
with pytest.raises(KeyError, match=f"Group 'GR5' references unknown constant 'VAL22'"):
719719
class FailThingType7(Constants):
720-
__category__ = "unique_type_tris"
721-
__reverse__ = "unique"
722-
__c_prefix__ = "BB"
720+
_category_ = "unique_type_tris"
721+
_reverse_ = "unique"
722+
_c_prefix_ = "BB"
723723

724724
VAL20 = constant(2., "Int")
725725
VAL21 = constant(3.14, "Float")

tests/test_constants_pkg/other_type.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111

1212
class TestOtherType(Constants):
13-
__category__ = "other_type"
14-
__reverse__ = "unique"
15-
__c_prefix__ = "XFREOO"
13+
_category_ = "other_type"
14+
_reverse_ = "unique"
15+
_c_prefix_ = "XFREOO"
1616

1717
VAS1 = constant(2, "Vas 1")
1818
VAS2 = constant(-3, "Vas 2")

tests/test_constants_pkg/type1.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88

99
class TestType1(Constants):
10-
__category__ = "type"
11-
__reverse__ = None
12-
__c_prefix__ = "XF"
10+
_category_ = "type"
11+
_reverse_ = None
12+
_c_prefix_ = "XF"
1313

1414
ENABLED = constant(True, 'Important info', c_name='OLA_ENABLED')
1515
BIG = constant(2**64 - 1, "Big int")
@@ -18,9 +18,9 @@ class TestType1(Constants):
1818

1919

2020
class TestType2(Constants):
21-
__category__ = "unique_type"
22-
__reverse__ = "unique"
23-
__c_prefix__ = "UU"
21+
_category_ = "unique_type"
22+
_reverse_ = "unique"
23+
_c_prefix_ = "UU"
2424

2525
VAR1 = constant(2, "Var 1")
2626
VAR2 = constant(-3, "Var 2")
@@ -29,9 +29,9 @@ class TestType2(Constants):
2929

3030

3131
class TestType3(Constants):
32-
__category__ = "multi_type"
33-
__reverse__ = "multi"
34-
__c_prefix__ = "XF"
32+
_category_ = "multi_type"
33+
_reverse_ = "multi"
34+
_c_prefix_ = "XF"
3535

3636
VAR4 = constant(4, "Var 4")
3737
VAR5 = constant(-5, "Var 5")

tests/test_constants_pkg/type4.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010

1111
class TestType4(Constants):
12-
__category__ = "unique_type" # auto-plural -> "states"
13-
__reverse__ = "unique" # builds particle_state_names
14-
__c_prefix__ = "UU"
12+
_category_ = "unique_type" # auto-plural -> "states"
13+
_reverse_ = "unique" # builds particle_state_names
14+
_c_prefix_ = "UU"
1515

1616
THING_SOME_VAL = constant(0.734, "Type4 thing with some value.")
1717
THING_OTHER = constant(1.23, "Another type4 thing.")
@@ -22,19 +22,19 @@ class TestType4(Constants):
2222
GR2 = group(THING_SOME_VAL, YAY_NO_META, YAY_NO_META_2)
2323

2424
class TestType5(Constants):
25-
__category__ = "multi_type"
26-
__reverse__ = "multi"
27-
__c_prefix__ = "RR"
25+
_category_ = "multi_type"
26+
_reverse_ = "multi"
27+
_c_prefix_ = "RR"
2828

2929
VAR7 = constant(4, "Var 7")
3030
VAR8 = constant(-5, "Var 8")
3131
VAR9 = constant(10, "Var 9")
3232

3333

3434
class TestType6(Constants):
35-
__category__ = "multi_type"
36-
__reverse__ = "multi"
37-
__c_prefix__ = "RR"
35+
_category_ = "multi_type"
36+
_reverse_ = "multi"
37+
_c_prefix_ = "RR"
3838

3939
VAR10 = constant(4, "Var 10")
4040
VAR11 = constant(88, "Var 11")

tests/test_geant4.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
excluding=('ContextCupy', 'ContextPyopencl') # Geant4 only on CPU
2828
)
2929
@pytest.mark.skipif(rpyc is None, reason="rpyc not installed")
30-
@pytest.mark.skipif(not xc.geant4.environment.compiled, reason="BDSIM+Geant4 installation not found")
30+
@pytest.mark.skipif(not xc.geant4.environment.ready, reason="BDSIM+Geant4 installation not found")
3131
def test_reload_bdsim(test_context):
3232
num_part = 1000
3333
_capacity = num_part*4
@@ -95,7 +95,7 @@ def test_reload_bdsim(test_context):
9595
excluding=('ContextCupy', 'ContextPyopencl') # Geant4 only on CPU
9696
)
9797
@pytest.mark.skipif(rpyc is None, reason="rpyc not installed")
98-
@pytest.mark.skipif(not xc.geant4.environment.compiled, reason="BDSIM+Geant4 installation not found")
98+
@pytest.mark.skipif(not xc.geant4.environment.ready, reason="BDSIM+Geant4 installation not found")
9999
def test_black_absorbers(test_context):
100100
n_part = 10_000
101101
_capacity = n_part*4

tests/test_geant4_serial_bdsim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
particle_ref = xt.Particles('proton', p0c=6.8e12)
2424

2525

26-
@pytest.mark.skipif(not xc.geant4.environment.compiled, reason="BDSIM+Geant4 installation not found")
26+
@pytest.mark.skipif(not xc.geant4.environment.ready, reason="BDSIM+Geant4 installation not found")
2727
def test_serial_bdsim(pytestconfig):
2828
# Skip if Geant4Engine has already been started
2929
if xc.geant4.engine._already_started:

tests/test_ions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
excluding=('ContextCupy', 'ContextPyopencl') # Geant4 only on CPU
3030
)
3131
@pytest.mark.skipif(rpyc is None, reason="rpyc not installed")
32-
@pytest.mark.skipif(not xc.geant4.environment.compiled, reason="BDSIM+Geant4 installation not found")
32+
@pytest.mark.skipif(not xc.geant4.environment.ready, reason="BDSIM+Geant4 installation not found")
3333
def test_bdsim_ions(test_context):
3434
num_part = 500
3535
coll = xc.Geant4Collimator(length=0.01, jaw=0.001, material='Ti', _context=test_context)

tests/test_jaw_position.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def test_everest(jaw, angle, tilt):
5353
@pytest.mark.parametrize('angle', angles)
5454
@pytest.mark.parametrize('jaw', jaws[:2], ids=jaw_ids[:2]) # BDSIM cannot handle fully positive or negative jaws
5555
@pytest.mark.skipif(rpyc is None, reason="rpyc not installed")
56-
@pytest.mark.skipif(not xc.geant4.environment.compiled, reason="BDSIM+Geant4 installation not found")
56+
@pytest.mark.skipif(not xc.geant4.environment.ready, reason="BDSIM+Geant4 installation not found")
5757
def test_geant4(jaw, angle, tilt):
5858
num_part = 50_000
5959
length = 0.873

0 commit comments

Comments
 (0)