Skip to content

Commit

Permalink
Merge pull request #321 from mj-will/fix-reparam-regex-bug
Browse files Browse the repository at this point in the history
Fix reparam regex bug
  • Loading branch information
mj-will authored Aug 1, 2023
2 parents 5c39e04 + da02c61 commit dac5165
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion nessai/proposal/flowproposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,9 @@ def configure_reparameterisations(self, reparameterisations):
matches = []
for pattern in patterns:
r = re.compile(pattern)
matches += list(filter(r.match, self.model.names))
matches += list(
filter(r.fullmatch, self.model.names)
)
default_config["parameters"] = matches
else:
logger.warning(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_default_reparameterisations(caplog, tmpdir):
"""Assert that by default the reparameterisation is RescaleToBounds"""
caplog.set_level("INFO")
model = MagicMock()
model.names = ["x", "y"]
model.names = ["x1", "x10", "x11"]
model.bounds = {p: [-1, 1] for p in model.names}
model.reparameterisations = None
proposal = FlowProposal(
Expand All @@ -97,4 +97,5 @@ def test_default_reparameterisations(caplog, tmpdir):
proposal.initialise()
reparams = list(proposal._reparameterisation.values())
assert len(reparams) == 1
assert reparams[0].parameters == ["x", "y"]
assert reparams[0].parameters == ["x1", "x10", "x11"]
assert proposal.rescale_parameters == ["x1", "x10", "x11"]

0 comments on commit dac5165

Please sign in to comment.