kazewong / jim

Gravitational-wave data analysis tools in Jax
MIT License
59 stars 19 forks source link

Added some inverses of pre-made transforms #130

Closed ThibeauWouters closed 3 months ago

ThibeauWouters commented 3 months ago

There are a few "pre-made" transforms regarding masses, but it would be good to have them in the other direction as well. Adding a few of those now.

kazewong commented 3 months ago

I think instead of defining a separate class for each of these transforms, we should just introduce an inverse operator that swap in the forward and the inverse

ThibeauWouters commented 3 months ago

I thought about something like that already, but I wasn't sure if that approach would perhaps be more confusing than just defining a separate class for this, especially since it comes down to a few lines of code...

kazewong commented 3 months ago

The function signature can be something instead of using SomeTransform, we just have InvertTransform(SomeTransform), where Inverse is a function that takes the instance and creates a corresponding inverse instance. I think this should be much more clear and ergonomic.

So basically, in the top level prior.py, there should be a function like

def InvertTransform(t: Transform) -> Transform
   core code...
ThibeauWouters commented 3 months ago

Going to discard this and start from scratch to incorporate the comments above