Skip to content

Commit

Permalink
fix mean irradiance, add test for it
Browse files Browse the repository at this point in the history
  • Loading branch information
ojdf committed Mar 20, 2024
1 parent c7c464c commit 71ea9a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fast/fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,8 @@ def compute_mean_irradiance(self, onaxis=True):
'''
logger.info("Computing mean irradiance/coupled flux")

pupil = self.pupil * self.pupil_mode
pupil = numpy.zeros(self.powerspec.shape)
pupil[:self.pupil.shape[0], :self.pupil.shape[1]] = self.pupil * self.pupil_mode

phs_otf = fouriertransform.ift2(self.powerspec, self.freq.df)
phs_sf = phs_otf[phs_otf.shape[0]//2, phs_otf.shape[1]//2] - phs_otf
Expand Down
5 changes: 5 additions & 0 deletions test/tests_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ def test_sim_default():
assert numpy.isfinite(sim.result.dB_rel).all()
assert numpy.isfinite(sim.result.dB_abs).all()

def test_sim_mean_irradiance():
sim = fast.Fast("test/test_params.py")
psf = sim.compute_mean_irradiance()
assert numpy.isfinite(psf.all())

@pytest.mark.skipif(not fast.fast._pyfftw, reason="No pyfftw installed")
def test_sim_fftw():
ptmp = p.copy()
Expand Down

0 comments on commit 71ea9a8

Please sign in to comment.