Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support one-to-many reparameterisations #418

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions nessai/proposal/flowproposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,11 @@ def verify_rescaling(self):
raise RuntimeError(
"Rescaling must be set before it can be verified"
)
if not self._reparameterisation.one_to_one:
logger.warning(
"Could not check if reparameterisation is invertible"
johnveitch marked this conversation as resolved.
Show resolved Hide resolved
)
return
logger.info("Verifying rescaling functions")
x = self.model.new_point(N=1000)
for inversion in ["lower", "upper", False, None]:
Expand Down
1 change: 1 addition & 0 deletions nessai/reparameterisations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Reparameterisation:
requires_bounded_prior = False
prior_bounds = None
prime_prior_bounds = None
one_to_one = True

def __init__(self, parameters=None, prior_bounds=None):
if not isinstance(parameters, (str, list)):
Expand Down
4 changes: 4 additions & 0 deletions nessai/reparameterisations/combined.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def requires_prime_prior(self):
"""Boolean to check if any of the priors require the prime space"""
return any(r.requires_prime_prior for r in self.values())

@property
def one_to_one(self):
return all(r.one_to_one for r in self.values())

@property
def to_prime_order(self):
"""Order when converting to the prime space"""
Expand Down
Loading