You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently allow things that are permissible in a coalescent framework, but makes no sense for individual-based and/or discrete-time simulators. E.g.
0 < N < 1, and
epoch and migration time spans less than 1 generation in length (either directly, or indirectly when using time_units!="generations").
One way for an individual-based simulator to check this, is to convert the relevant numbers to integers, then rebuild the graph. This will be (or should be) a fairly common operation, so it seems reasonable that we should provide such functionality as part of demes.
What if we had something like this?
classGraph:
...
deffrob_time_and_size(self, func):
""" Return a copy of the graph with times and sizes modified by func. """b=Builder.fromdict(self.asdict())
fordemeinb.get("demes", []):
deme["start_time"] =func(deme["start_time"])
forepochindeme.get("epochs", []):
epoch["start_time"] =func(epoch["start_time"])
epoch["end_time"] =func(epoch["end_time"])
epoch["start_size"] =func(epoch["start_size"])
epoch["end_size"] =func(epoch["end_size"])
formigrationinb.get("migrations", []):
migration["start_time"] =func(migration["start_time"])
migration["end_time"] =func(migration["end_time"])
forpulseinb.get("pulse", []):
pulse["time"] =func(pulse["time"])
returnb.resolve()
And then a simulator would call graph.frob_time_and_size(int). Or to scale the simulation by a factor Q: graph.frob_time_and_size(lambda x: int(x / Q)).
The text was updated successfully, but these errors were encountered:
I'm starting to dust the cobwebs off here and will be thinking about this soon. @apragsdale has some prototype code that'll be the basis for the next fwdpy11 release. I'm sure we will come across what's necessary to check while working on that.
We currently allow things that are permissible in a coalescent framework, but makes no sense for individual-based and/or discrete-time simulators. E.g.
0 < N < 1
, andOne way for an individual-based simulator to check this, is to convert the relevant numbers to integers, then rebuild the graph. This will be (or should be) a fairly common operation, so it seems reasonable that we should provide such functionality as part of
demes
.What if we had something like this?
And then a simulator would call
graph.frob_time_and_size(int)
. Or to scale the simulation by a factorQ
:graph.frob_time_and_size(lambda x: int(x / Q))
.The text was updated successfully, but these errors were encountered: