File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -246,6 +246,29 @@ def test_form_matrix(simple_chain):
246246 assert new_mat [r , c ] == mat [r , c ]
247247
248248
249+ def test_decay_matrix (simple_chain ):
250+ """Test that decay_matrix contains only radioactive decay terms."""
251+ # Nuclide order: H1(0), A(1), B(2), C(3)
252+ decay_A = log (2 ) / 2.36520E+04
253+ decay_B = log (2 ) / 3.29040E+04
254+
255+ expected = np .zeros ((4 , 4 ))
256+ expected [1 , 1 ] = - decay_A # Loss: A decays
257+ expected [2 , 1 ] = decay_A * 0.6 # A -> B (branching ratio 0.6)
258+ expected [3 , 1 ] = decay_A * 0.4 # A -> C (branching ratio 0.4)
259+ expected [1 , 2 ] = decay_B # B -> A (branching ratio 1.0)
260+ expected [2 , 2 ] = - decay_B # Loss: B decays
261+
262+ assert np .allclose (expected , simple_chain .decay_matrix .toarray ())
263+
264+
265+ def test_decay_matrix_cached (simple_chain ):
266+ """Test that decay_matrix is lazily computed and returns the same object."""
267+ m1 = simple_chain .decay_matrix
268+ m2 = simple_chain .decay_matrix
269+ assert m1 is m2
270+
271+
249272def test_getitem ():
250273 """Test nuc_by_ind converter function."""
251274 chain = Chain ()
You can’t perform that action at this time.
0 commit comments