-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1230 time offset #1232
1230 time offset #1232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another question: is it guaranteed that the time point of the offset is included in the list of the output time points?
E.g. if my initial output raster is 0h, 1h, 2h, ... and my time offset is 30 min: will 30min be included in the output time points?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We currently do not update the output schema. So, the output time points won't necessarily include the offset
@pchelle Btw, it is indeed possible to add single time points to the simulation output schema via https://www.open-systems-pharmacology.org/OSPSuite-R/dev/reference/OutputSchema.html#method-addtimepoints- |
R/simulation-set.R
Outdated
endTime <- ospsuite::toUnit( | ||
quantityOrDimension = "Time", | ||
values = simulation$outputSchema$endTime, | ||
targetUnit = timeUnit | ||
) | ||
validateVectorRange(timeOffset, type = "numeric", valueRange = c(0, endTime)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: if the minimumSimulationEndTime
is passed: is the simulation end time adjusted before or after this check? Because if it's done after the range bound should be max(simulation$outputSchema$endTime, minimumSimulationEndTime)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oups, before.
Also, I noticed I forced minimumSimulationEndTime
to be within 0 and outputSchema$endTime
...
What would be the expected range for this argument actually ? >0
, [0, endTime]
, or [endTime, Inf]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be >0
Also if minimumSimulationEndTime <= endTime
I actually would not change the simulation end time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question not related to the current PR: in the lines 132 and 136, minimumSimulationEndTime
is assumed to be in minutes
OSPSuite.ReportingEngine/R/utilities-simulation-set.R
Lines 132 to 136 in d8efa07
if (simulationSet$minimumSimulationEndTime > simulation$outputSchema$endTime) { | |
maximalIntervalIndex <- which(sapply(simulation$outputSchema$intervals, function(x) { | |
x$endTime$value | |
}) == simulation$outputSchema$endTime)[1] | |
simulation$outputSchema$intervals[[maximalIntervalIndex]]$endTime$setValue(value = simulationSet$minimumSimulationEndTime, unit = ospUnits$Time$min) |
However when passed to the simulation set constructor, minimumSimulationEndTime
is assumed to be in the user defined unit timeUnit
(which is also [h] as per default).
OSPSuite.ReportingEngine/R/simulation-set.R
Lines 16 to 28 in d8efa07
SimulationSet <- R6::R6Class( | |
"SimulationSet", | |
public = list( | |
simulationSetName = NULL, | |
simulationFile = NULL, | |
outputs = NULL, | |
dataSource = NULL, | |
dataSelection = NULL, | |
timeUnit = NULL, | |
applicationRanges = NULL, | |
minimumSimulationEndTime = NULL, | |
timeOffset = NULL, | |
massBalanceSettings = NULL, |
As long as there is no unit conversion when setting minimumSimulationEndTime
it seems to be a bug?
@pchelle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. minimumSimulationEndTime
should be defined by user in timeUnit
, and be converted in baseUnit
in this function.
I created issue #1238 to fix this
e8a9cca
into
Open-Systems-Pharmacology:develop
No description provided.