Skip to content

Commit 7db7dce

Browse files
remove ll_representation argument
1 parent 11615e0 commit 7db7dce

File tree

2 files changed

+10
-54
lines changed

2 files changed

+10
-54
lines changed

msprime/demography.py

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3002,9 +3002,7 @@ def __post_init__(self):
30023002
raise ValueError("Cannot have a population size < 0")
30033003
self.population = -1 if self.population is None else self.population
30043004

3005-
def get_ll_representation(self, num_populations=None):
3006-
# We need to keep the num_populations argument until stdpopsim 0.2 is out
3007-
# https://github.com/tskit-dev/msprime/issues/1037
3005+
def get_ll_representation(self):
30083006
ret = {
30093007
"type": "population_parameters_change",
30103008
"time": self.time,
@@ -3082,9 +3080,7 @@ def __post_init__(self):
30823080
self.source = self.matrix_index[0]
30833081
self.dest = self.matrix_index[1]
30843082

3085-
def get_ll_representation(self, num_populations=None):
3086-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3087-
# https://github.com/tskit-dev/msprime/issues/1037
3083+
def get_ll_representation(self):
30883084
return {
30893085
"type": "migration_rate_change",
30903086
"time": self.time,
@@ -3123,9 +3119,7 @@ class SymmetricMigrationRateChange(ParameterChangeEvent):
31233119
default="Symmetric migration rate change", repr=False
31243120
)
31253121

3126-
def get_ll_representation(self, num_populations=None):
3127-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3128-
# https://github.com/tskit-dev/msprime/issues/1037
3122+
def get_ll_representation(self):
31293123
return {
31303124
"type": "symmetric_migration_rate_change",
31313125
"time": self.time,
@@ -3217,9 +3211,7 @@ def __post_init__(self):
32173211
if self.destination is not None:
32183212
self.dest = self.destination
32193213

3220-
def get_ll_representation(self, num_populations=None):
3221-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3222-
# https://github.com/tskit-dev/msprime/issues/1037
3214+
def get_ll_representation(self):
32233215
return {
32243216
"type": "mass_migration",
32253217
"time": self.time,
@@ -3276,9 +3268,7 @@ class ActivatePopulationEvent(DemographicEvent):
32763268
default="Activate population event", repr=False
32773269
)
32783270

3279-
def get_ll_representation(self, num_populations=None):
3280-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3281-
# https://github.com/tskit-dev/msprime/issues/1037
3271+
def get_ll_representation(self):
32823272
return {
32833273
"type": "activate_population_event",
32843274
"time": self.time,
@@ -3307,9 +3297,7 @@ class PopulationSplit(LineageMovementEvent):
33073297

33083298
_type_str: ClassVar[str] = dataclasses.field(default="Population Split", repr=False)
33093299

3310-
def get_ll_representation(self, num_populations=None):
3311-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3312-
# https://github.com/tskit-dev/msprime/issues/1037
3300+
def get_ll_representation(self):
33133301
return {
33143302
"type": "population_split",
33153303
"time": self.time,
@@ -3369,9 +3357,7 @@ class Admixture(LineageMovementEvent):
33693357
def num_ancestral(self):
33703358
return len(self.ancestral)
33713359

3372-
def get_ll_representation(self, num_populations=None):
3373-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3374-
# https://github.com/tskit-dev/msprime/issues/1037
3360+
def get_ll_representation(self):
33753361
return {
33763362
"type": "admixture",
33773363
"time": self.time,
@@ -3424,9 +3410,7 @@ class SimpleBottleneck(StateChangeEvent):
34243410
population: int
34253411
proportion: float = 1.0
34263412

3427-
def get_ll_representation(self, num_populations=None):
3428-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3429-
# https://github.com/tskit-dev/msprime/issues/1037
3413+
def get_ll_representation(self):
34303414
return {
34313415
"type": "simple_bottleneck",
34323416
"time": self.time,
@@ -3454,9 +3438,7 @@ class InstantaneousBottleneck(StateChangeEvent):
34543438
population: int
34553439
strength: float = 1.0
34563440

3457-
def get_ll_representation(self, num_populations=None):
3458-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3459-
# https://github.com/tskit-dev/msprime/issues/1037
3441+
def get_ll_representation(self):
34603442
return {
34613443
"type": "instantaneous_bottleneck",
34623444
"time": self.time,
@@ -3497,9 +3479,7 @@ class CensusEvent(DemographicEvent):
34973479

34983480
_type_str: ClassVar[str] = dataclasses.field(default="Census", repr=False)
34993481

3500-
def get_ll_representation(self, num_populations=None):
3501-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3502-
# https://github.com/tskit-dev/msprime/issues/1037
3482+
def get_ll_representation(self):
35033483
return {
35043484
"type": "census_event",
35053485
"time": self.time,

tests/test_demography.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -315,30 +315,6 @@ def test_census(self):
315315
assert str(event) == repr_s
316316

317317

318-
class TestDemographicEventsHaveExtraLLParameter:
319-
"""
320-
For legacy reasons the DemographicEvent.get_ll_representation took
321-
a "num_populations" argument. In versions of stdpopsim using
322-
msprime < 1.0, this parameter was specified when testing for
323-
model equality (even though it did nothing). To ensure we're not
324-
breaking older versions of stdpopsim, we keep this extra parameter
325-
and test it here to make sure it works.
326-
327-
Since the functionality is only really used as a developer tool
328-
in stdpopsim, we can get rid of the extra parameters once
329-
stdpopsim 0.2 (which won't use this API) has been released.
330-
331-
See https://github.com/tskit-dev/msprime/issues/1037
332-
"""
333-
334-
def test_demographic_events_have_param(self):
335-
demography = all_events_example_demography()
336-
for event in demography.events:
337-
ll_config1 = event.get_ll_representation()
338-
ll_config2 = event.get_ll_representation(None)
339-
assert ll_config1 == ll_config2
340-
341-
342318
class TestTimeTravelErrors:
343319
"""
344320
It is possible to specify models in msprime that result in malformed

0 commit comments

Comments
 (0)