@@ -212,29 +212,74 @@ def test_exec_sed_task_correct_time_course_attrs(self):
212
212
task .simulation .output_end_time = 20.
213
213
task .simulation .number_of_points = 20
214
214
full_variable_results , _ = exec_sed_task (task , variables )
215
+ numpy .testing .assert_allclose (
216
+ full_variable_results ['time' ],
217
+ numpy .linspace (task .simulation .output_start_time , task .simulation .output_end_time , task .simulation .number_of_points + 1 ),
218
+ rtol = 1e-4 )
215
219
216
220
task .simulation .initial_time = 0.
217
221
task .simulation .output_start_time = 10.
218
222
task .simulation .output_end_time = 20.
219
223
task .simulation .number_of_points = 10
220
224
second_half_variable_results , _ = exec_sed_task (task , variables )
225
+ numpy .testing .assert_allclose (
226
+ second_half_variable_results ['time' ],
227
+ numpy .linspace (task .simulation .output_start_time , task .simulation .output_end_time , task .simulation .number_of_points + 1 ),
228
+ rtol = 1e-4 )
221
229
numpy .testing .assert_allclose (second_half_variable_results ['A' ], full_variable_results ['A' ][10 :], rtol = 1e-4 )
222
230
223
231
task .simulation .initial_time = 5.
224
232
task .simulation .output_start_time = 5.
225
233
task .simulation .output_end_time = 25.
226
234
task .simulation .number_of_points = 20
227
235
offset_full_variable_results , _ = exec_sed_task (task , variables )
236
+ numpy .testing .assert_allclose (
237
+ offset_full_variable_results ['time' ],
238
+ numpy .linspace (task .simulation .output_start_time , task .simulation .output_end_time , task .simulation .number_of_points + 1 ),
239
+ rtol = 1e-4 )
228
240
numpy .testing .assert_allclose (offset_full_variable_results ['A' ], full_variable_results ['A' ], rtol = 1e-4 )
229
241
230
242
task .simulation .initial_time = 5.
231
243
task .simulation .output_start_time = 15.
232
244
task .simulation .output_end_time = 25.
233
245
task .simulation .number_of_points = 10
234
246
offset_second_half_variable_results , _ = exec_sed_task (task , variables )
247
+ numpy .testing .assert_allclose (
248
+ offset_second_half_variable_results ['time' ],
249
+ numpy .linspace (task .simulation .output_start_time , task .simulation .output_end_time , task .simulation .number_of_points + 1 ),
250
+ rtol = 1e-4 )
235
251
numpy .testing .assert_allclose (offset_second_half_variable_results ['A' ], offset_full_variable_results ['A' ][10 :], rtol = 1e-4 )
236
252
numpy .testing .assert_allclose (offset_second_half_variable_results ['A' ], second_half_variable_results ['A' ], rtol = 1e-4 )
237
253
254
+ def test_exec_sed_task_correct_time_course_attrs_2 (self ):
255
+ # test that initial time, output start time, output end time, number of points are correctly interpreted
256
+ task = sedml_data_model .Task (
257
+ model = sedml_data_model .Model (
258
+ source = os .path .join ('tests' , 'fixtures' , 'model.xml' ),
259
+ language = sedml_data_model .ModelLanguage .SBML .value ,
260
+ ),
261
+ simulation = sedml_data_model .UniformTimeCourseSimulation (
262
+ algorithm = sedml_data_model .Algorithm (
263
+ kisao_id = 'KISAO_0000560' ,
264
+ ),
265
+ initial_time = 0.4 ,
266
+ output_start_time = 0.4 ,
267
+ output_end_time = 0.8 ,
268
+ number_of_points = 5 ,
269
+ ),
270
+ )
271
+
272
+ variables = [
273
+ sedml_data_model .Variable (
274
+ id = 'time' ,
275
+ symbol = sedml_data_model .Symbol .time ,
276
+ task = task ),
277
+ ]
278
+
279
+ results , _ = exec_sed_task (task , variables )
280
+
281
+ numpy .testing .assert_allclose (results ['time' ], numpy .linspace (0.4 , 0.8 , 5 + 1 ))
282
+
238
283
def test_hybrid_rk45_partitioning (self ):
239
284
task = sedml_data_model .Task (
240
285
model = sedml_data_model .Model (
0 commit comments