Refactoring Magnification Calculations #49
jenniferyee
started this conversation in
Ideas
Replies: 1 comment
-
I suggest somebody (e.g., @jenniferyee) implements this idea in a new branch and then we can think about it in detail. In general, I like the idea. Minor comment: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@rpoleski @alpv95 : (C) is the real solution, but I include my intermediate thinking (B), so you can see why it doesn't work.
Use MagnificationCurve to link Data to model calculations:
A) Currently, data magnification is calculated from
Model.get_magnification(data.times, **magnification_kwargs)
which passes loads of stuff to MagnificationCurve
which then creates a Trajectory object and proceeds to calculation the
magnification.
B) Instead, data_magnification could be calculated by
create a Trajectory object from the data and the model parameters
pass the Trajectory to MagnificationCurve
calculate the magnification from MagnificationCurve.get_magnification()
There are two advantages to this approach:
It eliminates most of the **magnification_kwargs (except gamma/bandpass) by
making them part of Trajectory.
It creates an object (MagnificationCurve) that can preserve all kinds of
information that can be used to calculate derivatives.
C) One problem with the (B) approach is there is no clear way to include binary
source models. This could be solved by
create a MagnificationCurve object from the data and the model parameters
the MagnificationCurve then creates the Trajectory object(s).
calculate the magnification from MagnificationCurve.get_magnification()
This retains the advantages of (B) while also making it straightforward to
handle both gamma/bandpass information AND binary sources.
So then, FitData._calculate_magnifications() becomes
And, the following properties could be preserved:
self.mag_curve.trajectory
self.mag_curve.a_pspl
self.mag_curve.B_0, B_1, B_0_prime, B_1_prime
etc.
Beta Was this translation helpful? Give feedback.
All reactions