Skip to content

Commit

Permalink
bugfixess
Browse files Browse the repository at this point in the history
  • Loading branch information
rodluger committed May 4, 2021
1 parent 5f0602e commit ff7e7c1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
8 changes: 4 additions & 4 deletions notebooks/EclipsingBinary_FullSolution_Painful.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
],
"source": [
"with model:\n",
" map_soln = pmx.optimize()(\n",
" map_soln = pmx.optimize(\n",
" vars=[A_inc, A_r, A_m, A_prot, B_inc, B_r, B_m, B_prot, B_porb, B_t0],\n",
" start=model.test_point,\n",
" )"
Expand All @@ -323,7 +323,7 @@
],
"source": [
"with model:\n",
" map_soln = pmx.optimize()(\n",
" map_soln = pmx.optimize(\n",
" vars=[A_amp, pri.map[1:, :], B_amp, sec.map[1:, :]], start=map_soln\n",
" )"
]
Expand All @@ -346,7 +346,7 @@
],
"source": [
"with model:\n",
" map_soln = pmx.optimize()(\n",
" map_soln = pmx.optimize(\n",
" vars=[A_inc, A_r, A_m, A_prot, B_inc, B_r, B_m, B_prot, B_porb, B_t0],\n",
" start=map_soln,\n",
" )"
Expand All @@ -370,7 +370,7 @@
],
"source": [
"with model:\n",
" map_soln = pmx.optimize()(start=map_soln)"
" map_soln = pmx.optimize(start=map_soln)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/SpotSolve.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
"outputs": [],
"source": [
"with model:\n",
" map_soln = pmx.optimize()(start=model.test_point)"
" map_soln = pmx.optimize(start=model.test_point)"
]
},
{
Expand Down
16 changes: 9 additions & 7 deletions tests/greedy/test_show_greedy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
import pytest


# TODO: MP4s are raising segfaults on GitHub Actions. Investigate.
TEST_MP4 = False
# TODO: Several tests segfault on CI. Investigate.
STARRY_TEST_MP4 = False
STARRY_ON_CI = os.getenv("CI", "false") == "true"


def test_show(mp4=False):
Expand All @@ -22,7 +23,7 @@ def test_show(mp4=False):
os.remove("tmp.pdf")
map.show(file="tmp.pdf", projection="rect")
os.remove("tmp.pdf")
if TEST_MP4:
if STARRY_TEST_MP4:
map.show(theta=np.linspace(0, 360, 10), file="tmp.mp4")
os.remove("tmp.mp4")

Expand Down Expand Up @@ -52,7 +53,7 @@ def test_show_reflected():
os.remove("tmp.pdf")
map.show(file="tmp.pdf", projection="rect")
os.remove("tmp.pdf")
if TEST_MP4:
if STARRY_TEST_MP4:
map.show(theta=np.linspace(0, 360, 10), file="tmp.mp4")
os.remove("tmp.mp4")

Expand All @@ -63,7 +64,7 @@ def test_show_rv():
os.remove("tmp.pdf")
map.show(rv=True, file="tmp.pdf", projection="rect")
os.remove("tmp.pdf")
if TEST_MP4:
if STARRY_TEST_MP4:
map.show(rv=True, theta=np.linspace(0, 360, 10), file="tmp.mp4")
os.remove("tmp.mp4")

Expand All @@ -80,19 +81,20 @@ def test_system_show():
sys = starry.System(pri, sec)
sys.show(0.1, file="tmp.pdf")
os.remove("tmp.pdf")
if TEST_MP4:
if STARRY_TEST_MP4:
sys.show([0.1, 0.2], file="tmp.mp4")
os.remove("tmp.mp4")
sys.show([0.1, 0.2], file="tmp.gif")
os.remove("tmp.gif")


@pytest.mark.skipif(STARRY_ON_CI, reason="Segfaults on CI")
def test_system_rv_show():
pri = starry.Primary(starry.Map(rv=True))
sec = starry.Secondary(starry.Map(rv=True), porb=1.0)
sys = starry.System(pri, sec)
sys.show(0.1, file="tmp.pdf")
os.remove("tmp.pdf")
if TEST_MP4:
if STARRY_TEST_MP4:
sys.show([0.1, 0.2], file="tmp.mp4")
os.remove("tmp.mp4")
20 changes: 12 additions & 8 deletions tests/lazy/test_show_lazy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
theano_config = dict(theano_config=dict(compute_test_value="ignore"))


# TODO: MP4s are raising segfaults on GitHub Actions. Investigate.
TEST_MP4 = False
# TODO: Several tests segfault on CI. Investigate.
STARRY_TEST_MP4 = False
STARRY_ON_CI = os.getenv("CI", "false") == "true"


def test_show():
Expand All @@ -28,7 +29,7 @@ def test_show():
os.remove("tmp.pdf")
map.show(file="tmp.pdf", projection="rect")
os.remove("tmp.pdf")
if TEST_MP4:
if STARRY_TEST_MP4:
map.show(theta=np.linspace(0, 360, 10), file="tmp.mp4")
os.remove("tmp.mp4")

Expand All @@ -39,18 +40,19 @@ def test_show_reflected():
os.remove("tmp.pdf")
map.show(file="tmp.pdf", projection="rect")
os.remove("tmp.pdf")
if TEST_MP4:
if STARRY_TEST_MP4:
map.show(theta=np.linspace(0, 360, 10), file="tmp.mp4")
os.remove("tmp.mp4")


@pytest.mark.skipif(STARRY_ON_CI, reason="Segfaults on CI")
def test_show_rv():
map = starry.Map(ydeg=1, udeg=1, rv=True)
map.show(rv=True, file="tmp.pdf", projection="ortho")
os.remove("tmp.pdf")
map.show(rv=True, file="tmp.pdf", projection="rect")
os.remove("tmp.pdf")
if TEST_MP4:
if STARRY_TEST_MP4:
map.show(rv=True, theta=np.linspace(0, 360, 10), file="tmp.mp4")
os.remove("tmp.mp4")

Expand All @@ -69,19 +71,19 @@ def test_system_show():
os.remove("tmp.pdf")
sys.show([0.1, 0.2], file="tmp.gif")
os.remove("tmp.gif")
if TEST_MP4:
if STARRY_TEST_MP4:
sys.show([0.1, 0.2], file="tmp.mp4")
os.remove("tmp.mp4")


@pytest.mark.skip(reason="Segfaults on CI")
@pytest.mark.skipif(STARRY_ON_CI, reason="Segfaults on CI")
def test_system_rv_show():
pri = starry.Primary(starry.Map(rv=True))
sec = starry.Secondary(starry.Map(rv=True), porb=1.0)
sys = starry.System(pri, sec)
sys.show(0.1, file="tmp.pdf")
os.remove("tmp.pdf")
if TEST_MP4:
if STARRY_TEST_MP4:
sys.show([0.1, 0.2], file="tmp.mp4")
os.remove("tmp.mp4")

Expand All @@ -108,6 +110,7 @@ def test_show_reflected_pymc3():
os.remove("tmp.pdf")


@pytest.mark.skipif(STARRY_ON_CI, reason="Segfaults on CI")
def test_show_rv_pymc3():
with pm.Model(**theano_config) as model:
map = starry.Map(ydeg=1, udeg=1, rv=True)
Expand Down Expand Up @@ -139,6 +142,7 @@ def test_system_show_pymc3():
os.remove("tmp.gif")


@pytest.mark.skipif(STARRY_ON_CI, reason="Segfaults on CI")
def test_system_rv_show_pymc3():
with pm.Model(**theano_config) as model:
pri = starry.Primary(starry.Map(rv=True))
Expand Down

0 comments on commit ff7e7c1

Please sign in to comment.