Skip to content

Commit

Permalink
Merge branch 'interactive_plots' of github.com:mjmroz/MulensModel int…
Browse files Browse the repository at this point in the history
…o mjmroz_interactive_plots
  • Loading branch information
rpoleski committed Dec 13, 2024
2 parents 69429d8 + c7434ec commit 9c6ae43
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 94 deletions.
34 changes: 21 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: wheelhouse
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_source:
Expand All @@ -69,8 +69,8 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: sdist
path: ./dist/*.tar.gz
name: cibw-sdist
path: dist/*.tar.gz

publish:
name: Publish to PyPI
Expand All @@ -81,17 +81,25 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Download sdist artifacts to dist/
uses: actions/download-artifact@v4.1.7
- name: Download sdist and wheelhouse artifacts to dist/
uses: actions/download-artifact@v4
with:
name: sdist
path: dist/

- name: Download wheelhouse artifacts to dist/
uses: actions/[email protected]
with:
name: wheelhouse
path: dist/
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true

# - name: Download sdist artifacts to dist/
# uses: actions/download-artifact@v4
# with:
# name: sdist
# path: dist/

# - name: Download wheelhouse artifacts to dist/
# uses: actions/download-artifact@v4
# with:
# name: wheelhouse
# path: dist/

- name: Publish package to PyPI
# All files in dist/ are published
Expand Down
52 changes: 17 additions & 35 deletions documents/00_MMv3_changes.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
# MulensModel V3

There were two major goals for MulensModel V3:
- Allow for N sources (However, xallarap can only be used with binary source
models)
- Allow the user direct access to derivatives relative to the point lens model
(in addition to derivatives relative to chi2)
- Allow for N sources (However, xallarap can only be used with binary source models)
- Allow the user a direct access to partial derivatives of the magnification relative to the point lens model parameters (in addition to chi2 derivatives)

Implementing these changes involved some major updates to the internal
architecture, but these should mostly be invisible to the user (although they
add new functionality).

We have also cleaned up some problems/bugs/features that will impact the user
experience:
- Shifted the convention of `alpha` by 180 deg to make MM compatible with
convention of Skowron et al. 2011.
We have also cleaned up some problems/bugs/features that will impact the user experience:
- Shifted the convention of `alpha` by 180 deg to make MM compatible with convention of Skowron et al. 2011.
- Removing `astropy` units from microlensing parameters.
- Generally improving consistency in naming conventions.
- Deprecated functions and properties removed.
Expand All @@ -35,21 +31,16 @@ Use `fix_blend_flux` instead.

### Model Class

- ADDED `get_magnification_curve()` and `get_magnification_curves()`
(for multi-source models).
- `get_lc()`: updated documentation to reflect that this returns MAGNITUDES
(not magnifications)
- ADDED `get_magnification_curve()` and `get_magnification_curves()` (for multi-source models).
- `get_lc()`: updated documentation to reflect that this returns MAGNITUDES (not magnifications)
- `get_magnification()`:
- REMOVED keyword `flux_ratio_constraint`
- default value of `separate` changed to None (which defaults to `True` if
`source_flux_ratio` is provided and to `False` otherwise).
- default value of `separate` changed to None (which defaults to `True` if `source_flux_ratio` is provided and to `False` otherwise).
- REMOVED deprecated functions and attributes:
- `plot_magnification()`: REMOVED keyword `flux_ratio_constraint`.
- `plot_lc()`: REMOVED keywords `data_ref`, `flux_ratio_constraint`,
`fit_blending`, `f_source`, and `f_blend`.
- `plot_lc()`: REMOVED keywords `data_ref`, `flux_ratio_constraint`, `fit_blending`, `f_source`, and `f_blend`.
- `plot_trajectory()`: REMOVED keyword `show_data`.
- `set_default_magnification_method()`. Use
`Model.default_magnification_method = XXX`, instead.
- `set_default_magnification_method()`. Use `Model.default_magnification_method = XXX`, instead.
- `magnification()` replaced by `get_magnification()`.
- `reset_plot_properties()`

Expand All @@ -60,21 +51,14 @@ immediately converted into a `ModelParameters` object, so many of these changes
could affect the user experience, even if they had not been interacting directly
with the `ModelParameters` class.

- `Astropy` units REMOVED (i.e., now everything is a `float`) from properties:
`t_star`, `t_eff`, `t_E`, `alpha`, `ds_dt`, `dalpha_dt`, `t_star_1`, `t_star_2`,
`gamma_parallel`, `gamma_perp`, and `gamma`. Also REMOVED from function
`get_alpha()`.
- `Astropy` units REMOVED (i.e., now everything is a `float`) from properties: `t_star`, `t_eff`, `t_E`, `alpha`, `ds_dt`, `dalpha_dt`, `t_star_1`, `t_star_2`, `gamma_parallel`, `gamma_perp`, and `gamma`. Also REMOVED from function `get_alpha()`.

- Property `pi_E` REMOVED. Properties `pi_E_E` and `pi_E_N` are still there.
- Properties that are not defined now raise `AttributeError` (previously `rho`
was returning None, and some other ones raised `KeyError`).
- Warnings for unexpected values of angles (e.g., 1000 deg) are not raised
anymore.
- Properties that are not defined now raise `AttributeError` (previously `rho` was returning None, and some other ones raised `KeyError`).
- Warnings for unexpected values of angles (e.g., 1000 deg) are not raised anymore.
- Changes in default values for `t_0_par` and `t_0_kep`:
- If `t_0_par` is not defined, then it defaults to `t_0_kep`, `t_0`, `t_0_1`
in that order.
- If `t_0_kep` is not defined, then it defaults to `t_0_par`, `t_0`, `t_0_1`
in that order.
- If `t_0_par` is not defined, then it defaults to `t_0_kep`, `t_0`, `t_0_1` in that order.
- If `t_0_kep` is not defined, then it defaults to `t_0_par`, `t_0`, `t_0_1` in that order.

Also, REMOVED `which_parameters()` from modelparameters.py because it not very
useful and it was very complicated.
Expand All @@ -99,8 +83,7 @@ instead of the `times` argument.
- ADDED:
- `get_d_A_d_rho()`
- `magnification_curve` and `magnification_curves`
- DEPRECATED subclass `FSPL_Derivatives`. Most its methods are replaced by
`PointLens` class(es)
- DEPRECATED subclass `FSPL_Derivatives`. Most its methods are replaced by `PointLens` class(es)

- DEPRECATED:
- `get_d_A_d_u_for_PSPL_model()`
Expand All @@ -118,8 +101,7 @@ could be accessed instead through `FitData.magnification_curve.XXX()`.
The PointLens and BinaryLens classes were subdivided into separate classes for
each magnification method.

- Function `get_pspl_magnification()` from `pointlens.py` was removed. Use
classes listed in next point instead.
- Function `get_pspl_magnification()` from `pointlens.py` was removed. Use classes listed in next point instead.
- Point Lens classes ADDED:
- `PointSourcePointLensMagnification`
- `FiniteSourceUniformGould94Magnification`
Expand Down Expand Up @@ -150,4 +132,4 @@ classes listed in next point instead.
- ADDED `EllipUtils`.
- `MagnificationCurve`:
- ADDED methods `get_d_A_d_params()` and `get_d_A_d_rho()`.
- ADDED property `methods_indices`.
- ADDED property `methods_indices`.
14 changes: 2 additions & 12 deletions documents/MM_v3.md → documents/MM_v4.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
# What we want to change when going from v2.X.Y to v3.0.0?
# What we want to change when going from v3.X.Y to v4.0.0?

Once the changes are accepted to be made, **mark them in the code using warnings.warn("XXX", FutureWarning)** and note it here. Also release a version that differs from previous one only in these warnings - this will allow users to correct their codes. Also give **suggested changes in warnings**.

### Major changes:

* search for all "deprecated" are remove it
* rename Caustics -> CausticsBinary and CausticsWithShear -> CausticsBinaryWithShear (and files) so that they're consistent with CausticsPointWithShear

???

### Minor changes:
* Delete ModelParameters.pi\_E and leave pi\_E\_N and pi\_E\_E - it is not really used and just complicates the code inside
* Remove ModelParameters.as\_dict() because it is the same as ModelParameters.parameters
* `ModelParameters.is_static` -> `is_lens_static`
* ephemerides\_file -> ephemeris\_file - maybe
* Model.get\_residuals should have keyword phot\_fmt, not type to be consistent with other functions
* test\_MulensData.py - in test\_copy() remove warnings.catch\_warnings() because you remove coords, ra, and dec from init

### Yet unsorted/undecided:
* shift alpha by 180 deg if large update is made to follow Skowron et al. (2011) convention
* remove MulensData.bad - see https://github.com/rpoleski/MulensModel/issues/40
* `Model.set\_times()` - `n\_epochs` should be None as default, so that we can check if both dt and `n\_epochs` were set
* Caustics.get\_caustics() should return np.arrays, not lists
* check all NotImplementedError and maybe remove some functions/options
* somehow change which\_parameters() in modelparameters.py - maybe remove
* new class for a collection of datasets to make looping over datasets easier; also there will be data\_ref defined
* the same order of arguments in plotting functions (if possible)
* ModelParameters - all parameters should be float, not astropy.Quantity objects
* see (this comment by Jen)[https://github.com/rpoleski/MulensModel/pull/15#issuecomment-1080879537] on how magnification methods are named and called in different parts of the code

### Version 4:
* Add an Observatory class.
* Add an Observatory class - for terresital parallax
1 change: 1 addition & 0 deletions examples/example_16/ob03235_2_full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ plots:
best model:
# You can skip the line below - the light curve will be plotted on screen.
file: ob03235_2_model.png
# In case you want an interactive plot made using plotly:
interactive : ob03235_2_model.html
time range: 2452820 2452855
magnitude range: 19.3 16.9
Expand Down
Loading

0 comments on commit 9c6ae43

Please sign in to comment.