(self)
| 7 | class TestDistribution: |
| 8 | |
| 9 | def test_sample_range(self): |
| 10 | x = np.linspace(400, 1010, 2000) |
| 11 | abs_spec = np.column_stack((x, bandgap(x, 600, 1000))) |
| 12 | ems_spec = thermodynamic_emission(abs_spec, T=300, mu=0.1) |
| 13 | dist = Distribution(ems_spec[:, 0], ems_spec[:, 1]) |
| 14 | xmin = dist.sample(0) |
| 15 | assert np.isclose(xmin, x.min()) |
| 16 | xmax = dist.sample(1) |
| 17 | assert np.isclose(xmax, x.max()) |
| 18 | y_at_xmin = dist.lookup(xmin) |
| 19 | assert np.isclose(y_at_xmin, 0.0) |
| 20 | y_at_xmax = dist.lookup(xmax) |
| 21 | assert np.isclose(y_at_xmin, 0.0) |
| 22 | |
| 23 | def test_step_sample(self): |
| 24 | """ Sampling a step function should only return two value. |
nothing calls this directly
no test coverage detected