PEtab icon indicating copy to clipboard operation
PEtab copied to clipboard

v2: add clarification sentence about simulation start time and end times

Open matthiaskoenig opened this issue 9 months ago • 4 comments

We should add a clarification sentence about what are the start time and end time for simulations. This is important for time triggered events and be more explicit.

  • simulations should start from the first time given in the experiments table or time of the first measurement for that experiment in the measurements table (i.e. what is earlier)
  • and run until the last time given in the experiments table or the time of the last measurement for that experiment in the measurements table (i.e. what is later)
  • If no experiment is specified, the model simulation is assumed to start at time 0, unless the model specifies a different initial time and runs until the last measurement for that experiment.

Personally I would prefer that we enforce that the first time given in the experiments table must be <= the time of the first measurement and the last time must be >= the time of the last measurement. Than the start and end time of the simulation would be clearly defined.

matthiaskoenig avatar May 07 '25 16:05 matthiaskoenig

We should add a clarification sentence about what are the start time and end time for simulations. This is important for time triggered events and be more explicit.

I think it's rarely needed, but I agree that specifying an end time different from the last measurement could be relevant sometimes. E.g., situations where one needs to track some max value across a certain period extending beyond the last measurement.

  • simulations should start from the first time given in the experiments table or time of the first measurement for that experiment in the measurements table (i.e. what is earlier)

I would consider a measurement time before the start of the experiment an error, see also below.

  • If no experiment is specified, the model simulation is assumed to start at time 0, unless the model specifies a different initial time and runs until the last measurement for that experiment.

Start is already specified:

https://github.com/PEtab-dev/PEtab/blob/4298e15aa9d03e46d7dc6706ebbdf12ddc5a1030/doc/v2/documentation_data_format.rst?plain=1#L486-L488

Personally I would prefer that we enforce that the first time given in the experiments table must be <= the time of the first measurement

Agreed. I think this was everybody's assumption, but I can't find it written anywhere.

  • and run until the last time given in the experiments table or the time of the last measurement for that experiment in the measurements table (i.e. what is later)

and the last time must be >= the time of the last measurement. Than the start and end time of the simulation would be clearly defined.

For any given experiment, the simulation must be run until (including) the timepoint of the last measurement or the beginning of the last period, whichever comes later (no shorter, no longer). Works for me.

dweindl avatar May 08 '25 05:05 dweindl

I think it's rarely needed, but I agree that specifying an end time different from the last measurement could be relevant sometimes.

No, I think I confused myself. I don't think there can ever be a case where the objective function depends on anything that happens after the last measurement. Do you have an example where it matters? (Except visualization and the like.)

dweindl avatar May 09 '25 11:05 dweindl

I think it's rarely needed, but I agree that specifying an end time different from the last measurement could be relevant sometimes.

No, I think I confused myself. I don't think there can ever be a case where the objective function depends on anything that happens after the last measurement. Do you have an example where it matters? (Except visualization and the like.)

It would be relevant for event-based outputs/time-to-event data, but as that's currently not supported by PEtab, I think it's fine to stick to final measurement time.

FFroehlich avatar May 09 '25 17:05 FFroehlich

Personally I use this for derived quantities from the timecourse in optimization (not supported by PETab at the moment, but hopefully at some point.) Specifically for AUC interpolated to infinity where you have measurements for 24 hours or 48 hours, but to numerically reliably calculate the AUCinf you have to let the simulation run ~ 5 halflifes. So for slowly eliminated substances the integration has to run longer then the data. So basically just writing that the integration has to run to the last timepoint specified in the experiments table would allow to handle this. Start time would be important for events firing before measurements and models with delays which should probably start integration at least > tau of the largest delay. So also having a clear statement that integration has to run at least from the first time in the experiments to the last time in the experiments would make things clearer without doing any harm.

matthiaskoenig avatar May 12 '25 10:05 matthiaskoenig