Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transits across oblate stars #289

Merged
merged 82 commits into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
708d0bd
added incomplete elliptic integral of second kind
rodluger Mar 9, 2021
c9fd132
mpmath
rodluger Mar 9, 2021
c949698
fixed domain for E
rodluger Mar 9, 2021
5776542
porting oblate code over to c++
rodluger Mar 11, 2021
f6c8629
add comment
rodluger Mar 12, 2021
8d4c5b4
merge master
rodluger Mar 18, 2021
04047cc
add V
rodluger Mar 18, 2021
b05fbc9
Merge branch 'master' of https://github.com/rodluger/starry into oblate
rodluger Mar 19, 2021
5055920
slowly implementing oblate integrals
rodluger Mar 19, 2021
b45d1b4
implemented sT for oblate; no tests yet
rodluger Mar 22, 2021
d069177
sT working
rodluger Mar 23, 2021
1b85427
fixed oblate, add unit tests
rodluger Mar 23, 2021
18a0c85
test w/o derivs
rodluger Mar 23, 2021
0ffcccc
add setup
rodluger Mar 23, 2021
1cd48e0
implemented p2 derivs; not yet tested
rodluger Mar 23, 2021
bb4fffd
test commit
rodluger Mar 30, 2021
a83e4d7
implemented angle solvers; untested; tests borken
rodluger Apr 7, 2021
95f8899
bugfix
rodluger Apr 7, 2021
ec32a2f
working but with nans
rodluger Apr 7, 2021
8dd912c
broken; issues with how we define phi I think
rodluger Apr 7, 2021
fe476e9
clean up, add tests, fix bugs
rodluger Apr 8, 2021
d7fb998
more flexible macros
rodluger Apr 8, 2021
c4c3c1a
fixed tests to be run all at once
rodluger Apr 8, 2021
0215692
working out analytic continuation
rodluger Apr 8, 2021
874c994
fix issue with k2 < 1
rodluger Apr 9, 2021
2509a69
fix test
rodluger Apr 9, 2021
bb2abae
unit test fix
rodluger Apr 9, 2021
019f849
fix hyp2f1
rodluger Apr 9, 2021
f0e1fa4
better unit tests
rodluger Apr 12, 2021
1ec58bc
add checks for known singular points
rodluger Apr 12, 2021
da9d3f7
derivs
rodluger Apr 12, 2021
6f27f46
special cases
rodluger Apr 12, 2021
b35b7a7
begin integration with starry
rodluger Apr 13, 2021
a7de15a
better map structure, fix tests
rodluger Apr 14, 2021
527953e
fixed complex-valued integrals
rodluger Apr 14, 2021
ebcc33e
better hyp2f1 evaluation
rodluger Apr 15, 2021
97c8a3c
debugging
rodluger Apr 15, 2021
9a20e53
hunting bugs
rodluger Apr 16, 2021
a8bc948
fixing nans
rodluger Apr 16, 2021
b037095
working on quartic solver
rodluger Apr 19, 2021
9633d51
remove isnan
rodluger Apr 19, 2021
097e992
more stability improvements to oblate
rodluger Apr 20, 2021
ce03564
better root polishing
rodluger Apr 20, 2021
578f7d4
minf = 1e-6
rodluger Apr 20, 2021
ceeb4da
normalize oblate maps to unit baseline
rodluger Apr 21, 2021
aeb5106
user can choose whether or not to normalized
rodluger Apr 21, 2021
ff32962
fixed nans
rodluger Apr 21, 2021
efd1ba2
better brute solver
rodluger Apr 21, 2021
020d530
integrating over complement; much more accurate for small ro
rodluger Apr 21, 2021
3171b91
add option to compute exact integrals
rodluger Apr 25, 2021
84b167e
better structure
rodluger Apr 25, 2021
f7290dd
numerical is fast
rodluger Apr 25, 2021
53d9ca3
better derivs
rodluger Apr 26, 2021
321ced6
infinitely better derivs
rodluger Apr 26, 2021
2880c1e
oblate working
rodluger Apr 26, 2021
60b2740
oblate tests
rodluger Apr 27, 2021
57ec715
deps fix
rodluger Apr 27, 2021
62fba6b
add wavelength attribute
rodluger Apr 28, 2021
2c6f088
add gravity darkening filter
rodluger Apr 28, 2021
80dc774
better filter logic; inc and obl not yet implemented
rodluger Apr 28, 2021
11a6f94
ops working-ish for single-band maps
rodluger Apr 29, 2021
667e4eb
Merge branch 'nexsci-patch' of https://github.com/rodluger/starry int…
rodluger May 4, 2021
5f794b5
multi-wav
rodluger May 4, 2021
f9f5253
Merge branch 'nexsci-patch' of https://github.com/rodluger/starry int…
rodluger May 4, 2021
d6adc1b
merge test fixes
rodluger May 4, 2021
7df04c4
merge patch
rodluger May 4, 2021
0298297
fix segfaults
rodluger May 5, 2021
4805305
fix rotations for oblate case
rodluger May 5, 2021
03a0a82
implement multiwav flux
rodluger May 5, 2021
9f50b40
Merge branch 'master' of https://github.com/rodluger/starry into oblate
rodluger May 5, 2021
1994f32
fix oblate gradient
rodluger Jul 20, 2021
0bab521
Fixes gradients
Jul 21, 2021
7a2428d
Merge pull request #287 from shashankdholakia/oblate
rodluger Jul 22, 2021
515973c
[skip ci] tweaks
rodluger Aug 16, 2021
c8248bd
implement oblate in core
rodluger Sep 1, 2021
dac6287
implement oblate in core
rodluger Sep 1, 2021
b2090c4
fixed issues with multi-wavelength maps
rodluger Sep 1, 2021
a2685c0
fix for aesara
rodluger Sep 1, 2021
4305075
bugfixes
rodluger Sep 1, 2021
241d93a
disable pymc3 dev
rodluger Sep 1, 2021
1f9010c
debug tutorials
rodluger Sep 2, 2021
6200a99
Merge branch 'master' into oblate
rodluger Sep 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 8 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ jobs:
- python-version: "3.9"
pymc-version: "pymc3==3.11"
arviz-version: ""
- python-version: "3.8"
pymc-version: "https://github.com/pymc-devs/pymc3/archive/main.zip"
arviz-version: ""
# TODO:
# - python-version: "3.8"
# pymc-version: "https://github.com/pymc-devs/pymc3/archive/main.zip"
# arviz-version: ""

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -61,27 +62,12 @@ jobs:
run: |
python -m pip install -U pip
python -m pip install ${{ matrix.pymc-version }} ${{ matrix.arviz-version }}
python -m pip install -e ".[tests]"

- name: Run tests (greedy)
if: steps.install.outcome == 'success'
shell: bash -l {0}
run: python -m pytest -v tests/greedy --junitxml=junit/test-results-greedy.xml --cov=starry --cov-append

- name: Run tests (lazy)
if: steps.install.outcome == 'success'
shell: bash -l {0}
run: python -m pytest -v tests/lazy --junitxml=junit/test-results-lazy.xml --cov=starry --cov-append

- name: Run extension tests (greedy)
if: steps.install.outcome == 'success'
shell: bash -l {0}
run: python -m pytest -v starry/extensions/tests/greedy --junitxml=junit/test-results-extensions-greedy.xml --cov=starry --cov-append
STARRY_UNIT_TESTS=1 python -m pip install -e ".[tests]"

- name: Run extension tests (lazy)
- name: Run tests
if: steps.install.outcome == 'success'
shell: bash -l {0}
run: python -m pytest -v starry/extensions/tests/lazy --junitxml=junit/test-results-extensions-lazy.xml --cov=starry --cov-append
run: python -m pytest -v --junitxml=junit/test-results.xml --cov=starry

- name: Get unique id
id: unique-id
Expand All @@ -97,7 +83,7 @@ jobs:
if: always()
with:
files: junit/test-*.xml
comment_on_pr: false
comment_mode: off

- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
Expand Down
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ repos:
rev: 19.3b0
hooks:
- id: black
language_version: python3.7
exclude: lib

- repo: https://github.com/dfm/black_nbconvert
rev: stable
rev: v0.3.0
hooks:
- id: black_nbconvert
exclude: lib
1 change: 1 addition & 0 deletions docs/MapFactory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ arguments passed to it.
LimbDarkenedMap
RadialVelocityMap
ReflectedLightMap
OblateMap
7 changes: 7 additions & 0 deletions docs/OblateMap.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Oblate Maps
===========

.. autoclass:: starry._OblateMap()
:noindex:
:members:
:inherited-members:
7 changes: 6 additions & 1 deletion docs/hacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,22 @@ class _RadialVelocityMap(CustomBase, starry.maps.RVBase, starry.maps.MapBase):
__doc__ = starry.maps.RVBase.__doc__


class _OblateMap(CustomBase, starry.maps.OblateBase, starry.maps.MapBase):
__doc__ = starry.maps.OblateBase.__doc__


starry._SphericalHarmonicMap = _SphericalHarmonicMap
starry._LimbDarkenedMap = _LimbDarkenedMap
starry._ReflectedLightMap = _ReflectedLightMap
starry._RadialVelocityMap = _RadialVelocityMap

starry._OblateMap = _OblateMap

replace = {
"_SphericalHarmonicMap": "Map",
"_LimbDarkenedMap": "Map",
"_ReflectedLightMap": "Map",
"_RadialVelocityMap": "Map",
"_OblateMap": "Map",
}


Expand Down
203 changes: 203 additions & 0 deletions notebooks/todo/EasySampling.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%run ../notebook_setup.py"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import starry\n",
"import pymc3 as pm\n",
"import pymc3_ext as pmx"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Generate"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"map = starry.Map(oblate=True, lazy=False)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"truths = {\n",
" \"f\": 0.3,\n",
" \"omega\": 0.5,\n",
" \"inc\": 60,\n",
" \"obl\": 30,\n",
" \"b0\": 0.5,\n",
" \"ro\": 0.1\n",
"}\n",
"\n",
"ferr = 3e-4"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"map.f = truths[\"f\"]\n",
"map.omega = truths[\"omega\"]\n",
"map.inc = truths[\"inc\"]\n",
"map.obl = truths[\"obl\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"xo = np.linspace(-1, 1, 300)\n",
"yo = truths[\"b0\"] * np.ones_like(xo)\n",
"ro = truths[\"ro\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fig, ax = plt.subplots(1)\n",
"ax.plot(xo, yo, \"k-\")\n",
"ax.plot(xo, yo - ro, \"k--\")\n",
"ax.plot(xo, yo + ro, \"k--\")\n",
"map.show(ax=ax)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"flux0 = map.flux(xo=xo, yo=yo, ro=ro)\n",
"flux = flux0 + ferr * np.random.randn(len(flux0))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.plot(flux0);\n",
"plt.plot(flux, \"k.\", ms=3, alpha=0.75);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Infer"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"with pm.Model() as model:\n",
" f = pm.Uniform(\"f\", lower=0.0, upper=0.9, testval=truths[\"f\"])\n",
" omega = pm.Uniform(\"omega\", lower=0.0, upper=0.9, testval=truths[\"omega\"])\n",
" inc = pm.Uniform(\"inc\", lower=0.0, upper=90.0, testval=truths[\"inc\"])\n",
" obl = pm.Uniform(\"obl\", lower=-90, upper=90.0, testval=truths[\"obl\"])\n",
" b0 = pm.Uniform(\"b0\", lower=-1.0, upper=1.0, testval=truths[\"b0\"])\n",
" ro = pm.Uniform(\"ro\", lower=1e-5, upper=0.5, testval=truths[\"ro\"])\n",
" map = starry.Map(oblate=True)\n",
" map.f = f\n",
" map.omega = omega\n",
" map.inc = inc\n",
" map.obl = obl\n",
" yo = b0 * np.ones_like(xo)\n",
" flux_model = map.flux(xo=xo, yo=yo, ro=ro)\n",
" pm.Normal(\"obs\", mu=flux_model, sd=ferr, observed=flux)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"np.random.seed(42)\n",
"with model:\n",
" trace = pmx.sample(\n",
" tune=1000,\n",
" draws=1000,\n",
" chains=2,\n",
" cores=1,\n",
" target_accept=0.9,\n",
" return_inferencedata=True,\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"pm.summary(trace)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"pm.plot_trace(trace);"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading