@@ -84,21 +84,21 @@ def test_zero_bounded(petab_problem):
8484 (positive if index in pos_indices else np .nan )
8585 for index in range (n_measurements )
8686 ]
87- synthetic_data_df = simulator .simulate ().assign (** {
87+ synthetic_data_df = simulator .simulate (as_measurement = True ).assign (** {
8888 petab .C .MEASUREMENT : measurements
8989 })
9090 # All measurements are non-zero
91- assert (synthetic_data_df ['measurement' ] != 0 ).all ()
91+ assert (synthetic_data_df [MEASUREMENT ] != 0 ).all ()
9292 # No measurements are NaN
93- assert not (np .isnan (synthetic_data_df ['measurement' ])).any ()
93+ assert not (np .isnan (synthetic_data_df [MEASUREMENT ])).any ()
9494
9595 synthetic_data_df_with_noise = simulator .add_noise (
9696 synthetic_data_df ,
9797 )
9898 # Both negative and positive values are returned by default.
9999 assert all ([
100- (synthetic_data_df_with_noise ['measurement' ] <= 0 ).any (),
101- (synthetic_data_df_with_noise ['measurement' ] >= 0 ).any (),
100+ (synthetic_data_df_with_noise [MEASUREMENT ] <= 0 ).any (),
101+ (synthetic_data_df_with_noise [MEASUREMENT ] >= 0 ).any (),
102102 ])
103103
104104 synthetic_data_df_with_noise = simulator .add_noise (
@@ -108,12 +108,12 @@ def test_zero_bounded(petab_problem):
108108 # Values with noise that are different in sign to values without noise are
109109 # zeroed.
110110 assert all ([
111- (synthetic_data_df_with_noise ['measurement' ][neg_indices ] <= 0 ).all (),
112- (synthetic_data_df_with_noise ['measurement' ][pos_indices ] >= 0 ).all (),
113- (synthetic_data_df_with_noise ['measurement' ][neg_indices ] == 0 ).any (),
114- (synthetic_data_df_with_noise ['measurement' ][pos_indices ] == 0 ).any (),
115- (synthetic_data_df_with_noise ['measurement' ][neg_indices ] < 0 ).any (),
116- (synthetic_data_df_with_noise ['measurement' ][pos_indices ] > 0 ).any (),
111+ (synthetic_data_df_with_noise [MEASUREMENT ][neg_indices ] <= 0 ).all (),
112+ (synthetic_data_df_with_noise [MEASUREMENT ][pos_indices ] >= 0 ).all (),
113+ (synthetic_data_df_with_noise [MEASUREMENT ][neg_indices ] == 0 ).any (),
114+ (synthetic_data_df_with_noise [MEASUREMENT ][pos_indices ] == 0 ).any (),
115+ (synthetic_data_df_with_noise [MEASUREMENT ][neg_indices ] < 0 ).any (),
116+ (synthetic_data_df_with_noise [MEASUREMENT ][pos_indices ] > 0 ).any (),
117117 ])
118118
119119
@@ -148,7 +148,7 @@ def _test_add_noise(petab_problem) -> None:
148148 simulator = TestSimulator (petab_problem )
149149 # Set the random seed to ensure predictable tests.
150150 simulator .rng = np .random .default_rng (seed = 0 )
151- synthetic_data_df = simulator .simulate ()
151+ synthetic_data_df = simulator .simulate (as_measurement = True )
152152
153153 # Generate samples of noisy data
154154 samples = []
0 commit comments