-
Notifications
You must be signed in to change notification settings - Fork 19
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
98 moving naming tracking into jim class from prior class #108
98 moving naming tracking into jim class from prior class #108
Conversation
Also isort some import in prior.py
Also rename prior
Also add prior test
Inverse limts the type of transform one can use, And it doesn't seem to have case that will require log_prob on target space
This reverts commit 4978cb1.
…ss' into sphere_prior
src/jimgw/single_event/transforms.py
Outdated
|
||
def __init__( | ||
self, | ||
name_mapping: tuple[list[str], list[str]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the, let's call them "pre-made" transformations such as the masses transforms for which the transforms are already in the source code, the name_mapping
argument is not needed and could be removed from the __init__
altogether. This would also avoid having to check the assertions, which could reduce the number of errors made in the code and make the code less confusing. Practically speaking, I think this would imply that name_mapping
should become an optional argument of transform or we change the __init__
of the "pre-made" transformations to something like
super.__init__(name_mapping = (["m_1", "m_2"], ["M_c", "q"]))
self.transform_func = ...
although that is in conflict with the signature of the init function...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ThibeauWouters Sorry for the late reply. I also thought of the implementation you mentioned. Maybe we can discuss this in the Monday call and see which implementation people like more. I think the benefit of the current implementation is that user can keep track of the naming when they are setting the sample_transforms
.
sample_transforms = [
ComponentMassesToChirpMassMassRatioTransform(name_mapping=[["m_1", "m_2"], ["M_c", "q"]]),
BoundToUnbound(name_mapping = [["M_c"], ["M_c_unbounded"]], original_lower_bound=M_c_min, original_upper_bound=M_c_max),
BoundToUnbound(name_mapping = [["q"], ["q_unbounded"]], original_lower_bound=q_min, original_upper_bound=q_max),
...
Users can see that m_1
and m_2
are transformed to M_c_unbounded
and q_unbounded
in this case.
I also thought of another way that is to make __init__
taking four arguments, each specifying a name. Users can keep the freedom to set any name in that case.
def __init__(m1_name, m2_name, Mc_name, q_name):
...
…m-class-from-prior-class 98 moving naming tracking into jim class from prior class
Taking the absolute value of the Jacobian determinant
…-into-jim-class-from-prior-class Added code to reverse transforms for more flexibility
…ming-tracking-into-jim-class-from-prior-class
…cause of bilby import
This PR is a rework of the naming system in Jim, such that transformations between variables are more flexible and composable. Here are some of the key features of this PR:
SequentialTransform
andCombine
to compose priors and transform them to make more complex priors. Ultimately, the base of the prior should be a logistics distribution whenever possible.