If simulation is initialized with networks=[ss.PrenatalNet()] (i.e. without also ss.PostnatalNet()) the prenatal links are not removed at delivery. That would seem to be a valid scenario where one would expect the prenatal links not to persist indefinitely.
I suspect it would be more appropriate to refactor most of the logic in that block (including prenatalnet.end_pairs()) to just be inside an if self.n_births block.
And then to have the following lines inside a block that does the for lkey, layer in self.sim.networks.items() if layer.postnatal loop + check:
If simulation is initialized with
networks=[ss.PrenatalNet()]
(i.e. without alsoss.PostnatalNet()
) the prenatal links are not removed at delivery. That would seem to be a valid scenario where one would expect the prenatal links not to persist indefinitely.https://github.com/starsimhub/starsim/blob/main/starsim/demographics.py#L412
I suspect it would be more appropriate to refactor most of the logic in that block (including
prenatalnet.end_pairs()
) to just be inside anif self.n_births
block.And then to have the following lines inside a block that does the
for lkey, layer in self.sim.networks.items() if layer.postnatal
loop + check: