hippke / pandora Goto Github PK
View Code? Open in Web Editor NEWA fast transit-fitting algorithm to search for transits of exomoons
License: GNU General Public License v3.0
A fast transit-fitting algorithm to search for transits of exomoons
License: GNU General Public License v3.0
Fixed: Bug was here:
Planetary transit duration at b=0 equals the width of the star
Formally correct would be: (R_star+r_planet) for the transit duration T1-T4
Here, however, we need T2-T3 (points where center of planet is on stellar limb)
https://www.paulanthonywilson.com/exoplanets/exoplanet-detection-techniques/the-exoplanet-transit-method/
New:
tdur_p = per_planet / pi * arcsin(sqrt(R_star ** 2) / a_planet)
Verification with compare_to_batman.py
at very high time resolution. All differences are <1e-7 now.
Difficult but possible due to post-processing with Pumkin occultations
should give 10% speed gain
Make animation of transit a function of the main class
Use matplotlib ffmpeg directly, instead of writing PNGs and calling imagemagick afterwards
e.g. Lightkurve quantity is converted automatically, but then performance is 10x slower
Speed
Accuracy vs. double precision
Currently we use a flat prior [0,1] of 10^24 to 10^28 kg for the planetary mass.
Example: 0.01 ==> 0.01 * 10^28 = 10^26 kg
Example: 0.5 ==> 0.5*10^28 kg
Should it be logg'ed instead? So that 0.5 --> 10^26 kg?
Näherungsverfahren? Welcher Fehler?
Exakte Lösung? Wie Koordinatensystemtransformation?
About 30% of the entire Pandora runtime goes into calculating an arctan and a tan:
def ellipse_pos(a, per, tau, Omega, i, time):
"""2D x-y Kepler solver WITHOUT eccentricity, WITHOUT mass"""
Q = 2 * arctan(tan((pi * (time - tau * per) / per))) # <== This is the offender
V = sin(Q) * cos((i / 180 * pi))
x = (cos(Omega / 180 * pi) * cos(Q) - sin(Omega / 180 * pi) * V) * a
y = (sin(Omega / 180 * pi) * cos(Q) + cos(Omega / 180 * pi) * V) * a
return x, y
Currently stellar mass is not in the model
planetary semimajor axis and planetary period are free parameters
better to have a mass (density?) prior?
When plotting the planet-only model in the tutorial, it says
# Convert limb darkening back from q to u type:
u1, u2 = ld_invert(mll_planet_only_q1, mll_planet_only_q2)
This is the wrong way round and makes for an ugly result plot.
The correct way to transform LDs in q form to the usual (for plotting) u form is:
u1, u2 = ld_convert(mll_planet_only_q1, mll_planet_only_q2)
Priors are fixed parameter ranges
Some combinations of these are unphysical
Currently, no check is made and the model is always calculated
We can introduce sensible boundaries of moons e.g. outside of Hill sphere (like TLS: not search for things that can't exist)
Then, Pandora can return a model for those unphysical situations so that their LogLikelihood is very bad (e.g., np.ones for the moon)
range (iterable (ndim,))
customizable (e.g., full range 0..180deg, not just the peak) see documentationNestle has best speed (efficient samples per time) in some online comparisons
At the moment: Numerical estimate
In Luger Appendix C an analytical version is mentioned
Current implementation:
transit_threshold_x = 3 * (a_moon / R_star) + 2 * r_planet + 2 * r_moon
if transit_threshold_x < 2:
transit_threshold_x = 2
OK for 90° inclination through testing.
Too loose for other configurations --> Can be made faster
Toshio Fukushima, "Fast computation of a general complete elliptic integral of third kind by half and double argument transformations" (Journal of Computational and Applied Mathematics, Volume 253, 2013).
https://www.sciencedirect.com/science/article/pii/S037704271300201X#!
Currently many units in [km]. Change to R_P/R_{\odot}?
Take care of constant values like 2*
@jit(nopython=True, error_model='numpy')
def frac_diff3(x, y):
out = np.empty_like(x)
dt = x.dtype # Cast the constant using the dtype of the input
for i in range(x.shape[0]):
# Could also use np.float32(2) to always use same type, regardless of input
out[i] = dt.type(2) * (x[i] - y[i]) / (x[i] + y[i])
return out
https://nbviewer.org/github/numba/numba-examples/blob/master/notebooks/simd.ipynb
Hi,
Thanks for this fun and useful software!
I was testing the example.py
and got the following error simply copying the code into a ipython shell:
In [5]: model = pandora.moon_model(params)
---------------------------------------------------------------------------
TypingError Traceback (most recent call last)
Input In [5], in <cell line: 1>()
----> 1 model = pandora.moon_model(params)
File ~/.cache/pypoetry/virtualenvs/platonium-nqdyOqtx-py3.8/lib/python3.8/site-packages/pandoramoon/pandora.py:114, in moon_model.__init__(self, params)
112 self.numerical_grid = params.numerical_grid
113 self.time = params.time
--> 114 self.cache = create_occult_cache(self.u1, self.u2, dim=300)
File ~/.cache/pypoetry/virtualenvs/platonium-nqdyOqtx-py3.8/lib/python3.8/site-packages/numba/core/dispatcher.py:415, in _DispatcherBase._compile_for_args(self, *args, **kws)
409 msg = str(e).rstrip() + (
410 "\n\nThis error may have been caused by the following argument(s):\n%s\n"
411 % "\n".join("- argument %d: %s" % (i, err)
412 for i, err in failed_args))
413 e.patch_message(msg)
--> 415 error_rewrite(e, 'typing')
416 except errors.UnsupportedError as e:
417 # Something unsupported is present in the user code, add help info
418 error_rewrite(e, 'unsupported_error')
File ~/.cache/pypoetry/virtualenvs/platonium-nqdyOqtx-py3.8/lib/python3.8/site-packages/numba/core/dispatcher.py:358, in _DispatcherBase._compile_for_args.<locals>.error_rewrite(e, issue_type)
356 raise e
357 else:
--> 358 reraise(type(e), e, None)
File ~/.cache/pypoetry/virtualenvs/platonium-nqdyOqtx-py3.8/lib/python3.8/site-packages/numba/core/utils.py:80, in reraise(tp, value, tb)
78 value = tp()
79 if value.__traceback__ is not tb:
---> 80 raise value.with_traceback(tb)
81 raise value
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<built-in function empty>) found for signature:
>>> empty(UniTuple(int64 x 2), dtype=Literal[str](float32))
There are 2 candidate implementations:
- Of which 2 did not match due to:
Overload of function 'empty': File: numba/core/typing/npydecl.py: Line 504.
With argument(s): '(UniTuple(int64 x 2), dtype=unicode_type)':
No match.
During: resolving callee type: Function(<built-in function empty>)
During: typing of call at /lhome/nicholas/.cache/pypoetry/virtualenvs/platonium-nqdyOqtx-py3.8/lib/python3.8/site-packages/pandoramoon/occult.py (15)
File "../../.cache/pypoetry/virtualenvs/platonium-nqdyOqtx-py3.8/lib/python3.8/site-packages/pandoramoon/occult.py", line 15:
def create_occult_cache(u1, u2, dim):
<source elided>
ks = np.linspace(0.001, k_max, dim)
fs = np.empty((dim, dim), dtype="float32")
^
I'm using numba 0.51.2
and pandoramoon 1.0
.
Cheers,
Nicholas
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.