Skip to content

Commit f2c87dd

Browse files
GertjanBisschopjeromekelleher
authored andcommitted
remove ll_representation argument
1 parent ac39f94 commit f2c87dd

2 files changed

Lines changed: 10 additions & 54 deletions

File tree

msprime/demography.py

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

3025-
def get_ll_representation(self, num_populations=None):
3026-
# We need to keep the num_populations argument until stdpopsim 0.2 is out
3027-
# https://github.com/tskit-dev/msprime/issues/1037
3025+
def get_ll_representation(self):
30283026
ret = {
30293027
"type": "population_parameters_change",
30303028
"time": self.time,
@@ -3102,9 +3100,7 @@ def __post_init__(self):
31023100
self.source = self.matrix_index[0]
31033101
self.dest = self.matrix_index[1]
31043102

3105-
def get_ll_representation(self, num_populations=None):
3106-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3107-
# https://github.com/tskit-dev/msprime/issues/1037
3103+
def get_ll_representation(self):
31083104
return {
31093105
"type": "migration_rate_change",
31103106
"time": self.time,
@@ -3143,9 +3139,7 @@ class SymmetricMigrationRateChange(ParameterChangeEvent):
31433139
default="Symmetric migration rate change", repr=False
31443140
)
31453141

3146-
def get_ll_representation(self, num_populations=None):
3147-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3148-
# https://github.com/tskit-dev/msprime/issues/1037
3142+
def get_ll_representation(self):
31493143
return {
31503144
"type": "symmetric_migration_rate_change",
31513145
"time": self.time,
@@ -3237,9 +3231,7 @@ def __post_init__(self):
32373231
if self.destination is not None:
32383232
self.dest = self.destination
32393233

3240-
def get_ll_representation(self, num_populations=None):
3241-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3242-
# https://github.com/tskit-dev/msprime/issues/1037
3234+
def get_ll_representation(self):
32433235
return {
32443236
"type": "mass_migration",
32453237
"time": self.time,
@@ -3296,9 +3288,7 @@ class ActivatePopulationEvent(DemographicEvent):
32963288
default="Activate population event", repr=False
32973289
)
32983290

3299-
def get_ll_representation(self, num_populations=None):
3300-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3301-
# https://github.com/tskit-dev/msprime/issues/1037
3291+
def get_ll_representation(self):
33023292
return {
33033293
"type": "activate_population_event",
33043294
"time": self.time,
@@ -3327,9 +3317,7 @@ class PopulationSplit(LineageMovementEvent):
33273317

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

3330-
def get_ll_representation(self, num_populations=None):
3331-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3332-
# https://github.com/tskit-dev/msprime/issues/1037
3320+
def get_ll_representation(self):
33333321
return {
33343322
"type": "population_split",
33353323
"time": self.time,
@@ -3389,9 +3377,7 @@ class Admixture(LineageMovementEvent):
33893377
def num_ancestral(self):
33903378
return len(self.ancestral)
33913379

3392-
def get_ll_representation(self, num_populations=None):
3393-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3394-
# https://github.com/tskit-dev/msprime/issues/1037
3380+
def get_ll_representation(self):
33953381
return {
33963382
"type": "admixture",
33973383
"time": self.time,
@@ -3444,9 +3430,7 @@ class SimpleBottleneck(StateChangeEvent):
34443430
population: int
34453431
proportion: float = 1.0
34463432

3447-
def get_ll_representation(self, num_populations=None):
3448-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3449-
# https://github.com/tskit-dev/msprime/issues/1037
3433+
def get_ll_representation(self):
34503434
return {
34513435
"type": "simple_bottleneck",
34523436
"time": self.time,
@@ -3474,9 +3458,7 @@ class InstantaneousBottleneck(StateChangeEvent):
34743458
population: int
34753459
strength: float = 1.0
34763460

3477-
def get_ll_representation(self, num_populations=None):
3478-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3479-
# https://github.com/tskit-dev/msprime/issues/1037
3461+
def get_ll_representation(self):
34803462
return {
34813463
"type": "instantaneous_bottleneck",
34823464
"time": self.time,
@@ -3517,9 +3499,7 @@ class CensusEvent(DemographicEvent):
35173499

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

3520-
def get_ll_representation(self, num_populations=None):
3521-
# We need to keep the num_populations argument until stdpopsim 0.1 is out
3522-
# https://github.com/tskit-dev/msprime/issues/1037
3502+
def get_ll_representation(self):
35233503
return {
35243504
"type": "census_event",
35253505
"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)