Skip to content

Commit

Permalink
Deploying to gh-pages from @ bdf5841 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
CoastEgo committed Jan 15, 2025
1 parent d09c6f8 commit 4ae295e
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 27 deletions.
20 changes: 12 additions & 8 deletions api/model/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -693,15 +693,19 @@ <h2 id="microlux.contour_integral" class="doc doc-heading">
is hard to determine before the code runs which the basic requirement for JIT compilation. If the array length is too small, the adaptive contour integration will stop
early and the error will be larger than the tolerance. If the array length is too large, it will cause the waste of memory and time. This waste is linear with the array length.
So we use this pre-define shaped array to solve this problem.</p>
<p><strong>Parameters</strong>
- For other parameters: please see at <a class="autorefs autorefs-internal" href="#microlux.binary_mag"><code>microlux.binary_mag</code></a>
- <code>default_strategy</code>: The default strategy for the contour integration. The array length will be added gradually according to this strategy.
For example, if the default_strategy is (60, 80, 150), the array length in each layer will be 60, 140, 290, respectively.
- <code>analytic</code>: Whether to use the analytic chain rule to simplify the computation graph. Set this to True will accelerate
<p><strong>Parameters</strong></p>
<ul>
<li>For other parameters: please see at <a class="autorefs autorefs-internal" href="#microlux.binary_mag"><code>microlux.binary_mag</code></a></li>
<li><code>default_strategy</code>: The default strategy for the contour integration. The array length will be added gradually according to this strategy.
For example, if the default_strategy is (60, 80, 150), the array length in each layer will be 60, 140, 290, respectively.</li>
<li><code>analytic</code>: Whether to use the analytic chain rule to simplify the computation graph. Set this to True will accelerate
the computation of the gradient and will support the reverse mode differentiation containing the while loop. But set this to True
will slow down if only calculate the model without differentiation. Defaults to True.</p>
<p><strong>Returns</strong>
- result: A tuple containing the magnitude and the result of the contour integration.</p>
will slow down if only calculate the model without differentiation. Defaults to True.</li>
</ul>
<p><strong>Returns</strong></p>
<ul>
<li><code>result</code>: A tuple containing the magnitude and the result of the contour integration.</li>
</ul>

</div>

Expand Down
47 changes: 34 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,18 @@
</li>

<li class="md-nav__item">
<a href="#reference" class="md-nav__link">
<a href="#quick-start" class="md-nav__link">
<span class="md-ellipsis">
Reference
Quick Start
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#quick-start" class="md-nav__link">
<a href="#citation" class="md-nav__link">
<span class="md-ellipsis">
Quick Start
Citation
</span>
</a>

Expand Down Expand Up @@ -542,20 +542,41 @@


<h1 id="welcome-to-microlux">Welcome to microlux<a class="headerlink" href="#welcome-to-microlux" title="Permanent link">¤</a></h1>
<p>microlux is a Jax-based package that is used to calculate the binary lensing light curve with the finite source effect using the contour integration method. We inherit the novel features in <a href='https://github.com/valboz/VBBinaryLensing'>VBBinaryLensing</a> including parabolic correction and optimal sampling to maximize the performance. This is built on the <a href='https://github.com/google/jax'>JAX</a> library which provides a NumPy-like interface with GPU and automatic differentiation support for high-performance machine learning research. Through automatic differentiation and our package, we get access to the accurate gradient for exploring more advanced algorithms.</p>
<p><code>microlux</code> is a <a href='https://github.com/jax-ml/jax'>Jax</a>-based package that can calculate the binary lensing light curve and its derivatives both efficiently and accurately. We use the modified adaptive contour integratoin in <a href='https://github.com/valboz/VBBinaryLensing'><code>VBBinaryLensing</code></a> to maximize the performance.
With the access to the gradient, we can use more advanced algorithms for microlensing modeling, such as Hamiltonian Monte Carlo (HMC) in <a href='https://num.pyro.ai/en/latest/mcmc.html#numpyro.infer.hmc.NUTS'><code>numpyro</code></a>.</p>
<h2 id="features">Features<a class="headerlink" href="#features" title="Permanent link">¤</a></h2>
<ul>
<li>Optimal sampling and contour integration with error control to calculate the binary lens microlensing light curve with finite source effect.</li>
<li>Robust and accurate calculation: Widely test over the broad parameter space compared with VBBinaryLensing</li>
<li>Adaptive contour integration with error control to calculate the binary lens microlensing light curve with finite source effect.</li>
<li>Robust and accurate calculation: Widely test over the broad parameter space compared with <code>VBBinaryLensing</code>.</li>
<li>Fast speed: Fully compatible with JIT compilation to speed up calculation. </li>
<li>Accurate gradient: Automatic differentiation with novel error estimator to ensure the convergence of gradient. </li>
<li>Aberth–Ehrlich method to find the roots of the polynomial and liner sum assignment algorithm to match the images</li>
<li>Application on real events modeling using NUTS in Numpyro</li>
<li>Accurate gradient: Automatic differentiation with specially designed error estimator to ensure the convergence of gradient.</li>
<li><a href='https://en.wikipedia.org/wiki/Aberth_method'>Aberth–Ehrlich</a> method to find the roots of the polynomial and <a href='https://docs.scipy.org/doc/scipy-1.15.0/reference/generated/scipy.optimize.linear_sum_assignment.html'>Liner sum assignment </a> algorithm to match the images.</li>
<li><a href="example/KB0371/">Application</a> on the real event modeling.</li>
</ul>
<h2 id="reference">Reference<a class="headerlink" href="#reference" title="Permanent link">¤</a></h2>
<p>Under development and Paper is coming soon.</p>
<h2 id="quick-start">Quick Start<a class="headerlink" href="#quick-start" title="Permanent link">¤</a></h2>
<p>Under development</p>
<p>Please make sure that you have known the basic usage of <code>Jax</code>. Check the <a href="https://jax.readthedocs.io/en/latest/quickstart.html">Jax documentation</a> for more details.
<div class="highlight"><pre><span></span><code><span class="kn">import</span><span class="w"> </span><span class="nn">jax.numpy</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">jnp</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">microlux</span><span class="w"> </span><span class="kn">import</span> <span class="n">binary_mag</span>

<span class="n">b</span> <span class="o">=</span> <span class="mf">0.1</span>
<span class="n">t_0</span> <span class="o">=</span> <span class="mf">0.</span>
<span class="n">t_E</span> <span class="o">=</span> <span class="mf">1.</span>
<span class="n">alphadeg</span> <span class="o">=</span> <span class="mf">270.</span>
<span class="n">q</span> <span class="o">=</span> <span class="mf">0.2</span>
<span class="n">s</span> <span class="o">=</span> <span class="mf">0.9</span>
<span class="n">rho</span> <span class="o">=</span> <span class="mi">10</span> <span class="o">**</span> <span class="p">(</span><span class="o">-</span><span class="mi">2</span><span class="p">)</span>
<span class="n">trajectory_n</span> <span class="o">=</span> <span class="mi">1000</span>
<span class="n">times</span> <span class="o">=</span> <span class="n">jnp</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="n">t_0</span> <span class="o">-</span> <span class="mf">1.0</span> <span class="o">*</span> <span class="n">t_E</span><span class="p">,</span> <span class="n">t_0</span> <span class="o">+</span> <span class="mf">1.0</span> <span class="o">*</span> <span class="n">t_E</span><span class="p">,</span> <span class="n">trajectory_n</span><span class="p">)</span>
<span class="c1">#calculate the binary lensing magnification</span>
<span class="n">mag</span> <span class="o">=</span> <span class="n">binary_mag</span><span class="p">(</span><span class="n">t_0</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">t_E</span><span class="p">,</span> <span class="n">rho</span><span class="p">,</span> <span class="n">q</span><span class="p">,</span> <span class="n">s</span><span class="p">,</span> <span class="n">alphadeg</span><span class="p">,</span> <span class="n">times</span><span class="p">,</span> <span class="n">tol</span><span class="o">=</span><span class="mf">1e-3</span><span class="p">,</span> <span class="n">retol</span><span class="o">=</span><span class="mf">1e-3</span><span class="p">)</span>
</code></pre></div></p>
<p>More examples can be found in the <a href="https://github.com/CoastEgo/microlux/tree/master/test"><code>test</code></a> folder.</p>
<h2 id="citation">Citation<a class="headerlink" href="#citation" title="Permanent link">¤</a></h2>
<p>If you use this package for your research, please cite our paper:</p>
<ul>
<li>A differentiable binary microlensing model using adaptive contour integration method: <a href='https://arxiv.org/abs/2501.07268'>in arXiv</a></li>
</ul>
<p>and consider starrring this repository on <a href='https://github.com/CoastEgo/microlux'>Github</a>:</p>



Expand Down
2 changes: 1 addition & 1 deletion search/search_index.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://coastego.github.io/microlux/</loc>
<lastmod>2025-01-12</lastmod>
<lastmod>2025-01-15</lastmod>
</url>
<url>
<loc>https://coastego.github.io/microlux/api/model/</loc>
<lastmod>2025-01-12</lastmod>
<lastmod>2025-01-15</lastmod>
</url>
<url>
<loc>https://coastego.github.io/microlux/api/solver/</loc>
<lastmod>2025-01-12</lastmod>
<lastmod>2025-01-15</lastmod>
</url>
<url>
<loc>https://coastego.github.io/microlux/api/utils/</loc>
<lastmod>2025-01-12</lastmod>
<lastmod>2025-01-15</lastmod>
</url>
<url>
<loc>https://coastego.github.io/microlux/example/KB0371/</loc>
<lastmod>2025-01-12</lastmod>
<lastmod>2025-01-15</lastmod>
</url>
</urlset>
Binary file modified sitemap.xml.gz
Binary file not shown.

0 comments on commit 4ae295e

Please sign in to comment.