diff --git a/climate_health/datatypes.py b/climate_health/datatypes.py index 50d58c87..e937497f 100644 --- a/climate_health/datatypes.py +++ b/climate_health/datatypes.py @@ -1,7 +1,7 @@ import bionumpy as bnp -@bnp.bnpdataclass +@bnp.bnpdataclass.bnpdataclass class ClimateHealthTimeSeries: time_period: str rainfall: float @@ -9,7 +9,7 @@ class ClimateHealthTimeSeries: disease_cases: int -@bnp.bnpdataclass +@bnp.bnpdataclass.bnpdataclass class LocatedClimateHealthTimeSeries(ClimateHealthTimeSeries): time_period: str rainfall: float diff --git a/climate_health/simulation/random_noise_simulator.py b/climate_health/simulation/random_noise_simulator.py index 4bdd8a5d..25343a2c 100644 --- a/climate_health/simulation/random_noise_simulator.py +++ b/climate_health/simulation/random_noise_simulator.py @@ -1,5 +1,6 @@ from climate_health.datatypes import ClimateHealthTimeSeries import numpy as np +from climate_health.simulation.simulator import Simulator class RandomNoiseSimulator(Simulator): @@ -13,7 +14,8 @@ def __init__(self, n_time_points: int): def simulate(self) -> ClimateHealthTimeSeries: """Simulate the model for the given parameters.""" return ClimateHealthTimeSeries( - time_period=[], + time_period=[str(i) for i in range(self.n_time_points)], rainfall=np.random.randn(self.n_time_points), - mean_temperature=[] + mean_temperature=np.random.randn(self.n_time_points), + disease_cases=np.random.poisson(10, self.n_time_points) ) \ No newline at end of file diff --git a/climate_health/simulation/simulator.py b/climate_health/simulation/simulator.py index 323dc7ed..bc360b58 100644 --- a/climate_health/simulation/simulator.py +++ b/climate_health/simulation/simulator.py @@ -11,5 +11,5 @@ def simulate(self) -> ClimateHealthTimeSeries: """Simulate the model for the given parameters.""" ... -class RandomNoise + diff --git a/tests/simulation/test_random_noise_simulator.py b/tests/simulation/test_random_noise_simulator.py new file mode 100644 index 00000000..84d73f58 --- /dev/null +++ b/tests/simulation/test_random_noise_simulator.py @@ -0,0 +1,9 @@ +from climate_health.datatypes import ClimateHealthTimeSeries +from climate_health.simulation.random_noise_simulator import RandomNoiseSimulator + + +def test_random_noise_simulator(): + my_simulator = RandomNoiseSimulator(10) + data = my_simulator.simulate() + assert len(data.time_period) == 10 + assert isinstance(data, ClimateHealthTimeSeries)