Skip to content

Commit

Permalink
Add dydz and pupil_v to propagation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rmjarvis committed Aug 31, 2023
1 parent 399f727 commit a71c71d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/test_photon_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,18 +350,26 @@ def test_convolve():

# Check propagation of dxdz, dydz, wavelength, pupil_u, pupil_v
for attr, checkFn in zip(
['dxdz', 'wavelength', 'pupil_u', 'time'],
['hasAllocatedAngles', 'hasAllocatedWavelengths', 'hasAllocatedPupil',
['dxdz', 'dydz', 'wavelength', 'pupil_u', 'pupil_v', 'time'],
['hasAllocatedAngles', 'hasAllocatedAngles',
'hasAllocatedWavelengths', 'hasAllocatedPupil', 'hasAllocatedPupil',
'hasAllocatedTimes']
):
pa1 = obj.shoot(nphotons, rng)
pa2 = obj.shoot(nphotons, rng)
assert not getattr(pa1, checkFn)()
assert not getattr(pa1, checkFn)()
data = np.linspace(-0.1, 0.1, nphotons)
setattr(pa1, attr, data)
assert getattr(pa1, checkFn)()
assert not getattr(pa2, checkFn)()
pa1.convolve(pa2)
np.testing.assert_array_equal(getattr(pa1, attr), data)
assert getattr(pa1, checkFn)()
assert not getattr(pa2, checkFn)()
np.testing.assert_array_equal(getattr(pa1, attr), data)
pa2.convolve(pa1)
assert getattr(pa1, checkFn)()
assert getattr(pa2, checkFn)()
np.testing.assert_array_equal(getattr(pa2, attr), data)

# both have data now...
Expand Down

0 comments on commit a71c71d

Please sign in to comment.