biosimulators / Biosimulators_COPASI

COPASI biochemical network simulation program via BioSimulators-compliant command-line interface and Docker container
https://docs.biosimulators.org/Biosimulators_COPASI
MIT License
2 stars 3 forks source link

Incorrectly raised Exception regarding number of time points #66

Closed leon9812 closed 1 year ago

leon9812 commented 1 year ago

The NotImplementedError (Time course must specify an integer number of time points) in core.py#L197 is raised for specific integer numbers of steps in combination with certain time values.

Example (core.py#L191):

# sim.number_of_points = 500
# sim.initial_time = 0.0
# sim.output_start_time = 0.0
# sim.output_end_time = 1.1
step_number = (
    sim.number_of_points
    * (sim.output_end_time - sim.initial_time)
    / (sim.output_end_time - sim.output_start_time)
)

Even though the number of points is an integer, the step_number now has a value of 499.99999999999994, which raises the exception.

One way to fix this would be to add more parentheses:

step_number = (
    sim.number_of_points
    * (
        (sim.output_end_time - sim.initial_time)
        / (sim.output_end_time - sim.output_start_time)
    )
)
AlexPatrie commented 1 year ago

I can confirm that this works. Fix to come!