Skip to content
This repository was archived by the owner on Aug 8, 2024. It is now read-only.

Commit 1773aff

Browse files
committed
start plot tests
Signed-off-by: Nathaniel Starkman (@nstarman) <[email protected]>
1 parent fe39275 commit 1773aff

File tree

4 files changed

+286
-22
lines changed

4 files changed

+286
-22
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ force_grid_wrap = 0
1515
use_parentheses = "True"
1616
ensure_newline_before_comments = "True"
1717
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
18-
known_third_party = ["astropy", "extension_helpers", "galpy", "numpy", "pytest", "scipy", "setuptools"]
18+
known_third_party = ["astropy", "extension_helpers", "galpy", "matplotlib", "numpy", "pytest", "scipy", "setuptools"]
1919
known_localfolder = "sample_scf"
2020

2121
import_heading_stdlib = "BUILT-IN"

sample_scf/conftest.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
# THIRD PARTY
1717
import numpy as np
1818
import pytest
19-
from galpy.potential import SCFPotential
19+
from galpy.df import isotropicHernquistdf
20+
from galpy.potential import HernquistPotential, SCFPotential
2021

2122
try:
2223
# THIRD PARTY
@@ -74,17 +75,18 @@ def pytest_configure(config):
7475
# ============================================================================
7576
# Fixtures
7677

78+
# Hernquist
79+
_Acos = np.zeros((5, 6, 6))
80+
_Acos_hern = _Acos.copy()
81+
_Acos_hern[0, 0, 0] = 1
82+
_hernquist_potential = SCFPotential(Acos=_Acos_hern)
83+
hernquist_df = isotropicHernquistdf(HernquistPotential())
84+
7785

7886
@pytest.fixture(autouse=True, scope="session")
7987
def hernquist_scf_potential():
8088
"""Make a SCF of a Hernquist potential."""
81-
Acos = np.zeros((5, 6, 6))
82-
83-
Acos_hern = Acos.copy()
84-
Acos_hern[0, 0, 0] = 1
85-
86-
hernpot = SCFPotential(Acos=Acos_hern)
87-
return hernpot
89+
return _hernquist_potential
8890

8991

9092
# /def
@@ -109,9 +111,6 @@ def hernquist_scf_potential():
109111
)
110112
def potentials(request):
111113
if request.param in ("hernquist_scf_potential", "other_hernquist_scf_potential"):
112-
Acos = np.zeros((5, 6, 6))
113-
Acos_hern = Acos.copy()
114-
Acos_hern[0, 0, 0] = 1
115-
potential = SCFPotential(Acos=Acos_hern)
114+
potential = _hernquist_potential
116115

117116
yield potential

sample_scf/tests/test_base.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ def setup_class(self):
5454
self.cls = rvtestsampler
5555
self.cls_args = ()
5656

57+
self.cdf_args = (0,)
58+
self.cdf_kwargs = {}
59+
5760
self.cdf_time_scale = 3e-6
5861
self.rvs_time_scale = 1e-4
5962

@@ -71,6 +74,13 @@ def sampler(self, potentials):
7174
# ===============================================================
7275
# Method Tests
7376

77+
@pytest.mark.skip("TODO")
78+
def test_cdf(self, sampler, expected):
79+
"""Test :meth:`sample_scf.base.rv_potential.cdf`."""
80+
assert False
81+
82+
# /def
83+
7484
@pytest.mark.parametrize(
7585
"size, random, expected",
7686
[
@@ -119,9 +129,6 @@ def test_rvs_time_scaling(self, sampler, size):
119129

120130
# /def
121131

122-
# ===============================================================
123-
# Image tests
124-
125132

126133
# /class
127134

@@ -162,6 +169,7 @@ def sampler(self, potentials):
162169
# /def
163170

164171
# ===============================================================
172+
# Method Tests
165173

166174
def test_rsampler(self, sampler):
167175
"""Test :meth:`sample_scf.base.SCFSamplerBase.rsampler`."""

0 commit comments

Comments
 (0)