Commit d48bbe9 1 parent 2b2b882 commit d48bbe9 Copy full SHA for d48bbe9
File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,27 @@ def test_enormous_through_ares():
172
172
assert outgoing .total_charge .shape == (100_000 ,)
173
173
174
174
175
+ def test_before_after_broadcast_tracking_equal ():
176
+ """
177
+ Test that when tracking through a segment after broadcasting, the resulting beam is
178
+ the same as in the segment before broadcasting.
179
+ """
180
+ segment = cheetah .Segment .from_ocelot (ares .cell ).subcell ("AREASOLA1" , "AREABSCR1" )
181
+ incoming = cheetah .ParameterBeam .from_astra (
182
+ "tests/resources/ACHIP_EA1_2021.1351.001"
183
+ )
184
+ segment .AREAMQZM1 .k1 = torch .tensor ([4.2 ])
185
+ outgoing = segment .track (incoming )
186
+
187
+ broadcast_segment = segment .broadcast ((10 ,))
188
+ broadcast_incoming = incoming .broadcast ((10 ,))
189
+ broadcast_outgoing = broadcast_segment .track (broadcast_incoming )
190
+
191
+ for i in range (10 ):
192
+ assert torch .all (broadcast_outgoing ._mu [i ] == outgoing ._mu [0 ])
193
+ assert torch .all (broadcast_outgoing ._cov [i ] == outgoing ._cov [0 ])
194
+
195
+
175
196
def test_broadcast_customtransfermap ():
176
197
"""Test that broadcasting a `CustomTransferMap` element gives the correct result."""
177
198
tm = torch .tensor (
You can’t perform that action at this time.
0 commit comments