interesting times to be proportional to the simulation time
This commit is contained in:
parent
edb0b2370c
commit
e4636e5fe6
1 changed files with 6 additions and 3 deletions
|
|
@ -80,10 +80,11 @@ def non_temp_transition_times(model: models.ExposureModel):
|
|||
return sorted(time for time in change_times if (t_start <= time <= t_end))
|
||||
|
||||
|
||||
def interesting_times(model: models.ExposureModel, approx_n_pts=100) -> typing.List[float]:
|
||||
def interesting_times(model: models.ExposureModel, approx_n_pts: typing.Optional[int] = None) -> typing.List[float]:
|
||||
"""
|
||||
Pick approximately ``approx_n_pts`` time points which are interesting for the
|
||||
given model.
|
||||
given model. If not provided by argument, ``approx_n_pts`` is set to be 25 times
|
||||
the number of hours of the simulation.
|
||||
|
||||
Initially the times are seeded by important state change times (excluding
|
||||
outside temperature), and the times are then subsequently expanded to ensure
|
||||
|
|
@ -91,10 +92,12 @@ def interesting_times(model: models.ExposureModel, approx_n_pts=100) -> typing.L
|
|||
|
||||
"""
|
||||
times = non_temp_transition_times(model)
|
||||
sim_duration = max(times) - min(times)
|
||||
if not approx_n_pts: approx_n_pts = sim_duration * 25
|
||||
|
||||
# Expand the times list to ensure that we have a maximum gap size between
|
||||
# the key times.
|
||||
nice_times = fill_big_gaps(times, gap_size=(max(times) - min(times)) / approx_n_pts)
|
||||
nice_times = fill_big_gaps(times, gap_size=(sim_duration) / approx_n_pts)
|
||||
return nice_times
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue