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

Commit 390b104

Browse files
committed
run commit black and isort
Signed-off-by: Nathaniel Starkman (@nstarman) <[email protected]>
1 parent d7b5025 commit 390b104

11 files changed

+64
-23
lines changed

docs/conf.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@
3333

3434
try:
3535
# THIRD PARTY
36-
from sphinx_astropy.conf.v1 import * # noqa
36+
from sphinx_astropy.conf.v1 import * # noqa: F401
3737
except ImportError:
38-
print("ERROR: the documentation requires the sphinx-astropy package to be installed")
38+
print(
39+
"ERROR: the documentation requires the sphinx-astropy package to be installed",
40+
)
3941
sys.exit(1)
4042

4143
# BUILT-IN
@@ -146,7 +148,9 @@
146148

147149
# Grouping the document tree into LaTeX files. List of tuples
148150
# (source start file, target name, title, author, documentclass [howto/manual]).
149-
latex_documents = [("index", project + ".tex", project + u" Documentation", author, "manual")]
151+
latex_documents = [
152+
("index", project + ".tex", project + u" Documentation", author, "manual"),
153+
]
150154

151155

152156
# -- Options for manual page output -------------------------------------------

sample_scf/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
# -*- coding: utf-8 -*-
12
# Licensed under a 3-clause BSD style license - see LICENSE.rst
23

3-
# LOCAL
4+
# FIRST PARTY
45
from sample_scf._astropy_init import * # isort: +split # noqa: F401, F403
56
from sample_scf.core import SCFSampler
67
from sample_scf.sample_exact import SCFSampler as SCFSamplerExact

sample_scf/_astropy_init.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
# Licensed under a 3-clause BSD style license - see LICENSE.rst
23
# BUILT-IN
34
import os

sample_scf/_typing.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
# Licensed under a 3-clause BSD style license - see LICENSE.rst
23
# BUILT-IN
34
import typing as T

sample_scf/base.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,12 @@ def phisampler(self) -> rv_continuous_modrvs:
109109

110110
# /def
111111

112-
def cdf(self, r: npt.ArrayLike, theta: npt.ArrayLike, phi: npt.ArrayLike) -> NDArray64:
112+
def cdf(
113+
self,
114+
r: npt.ArrayLike,
115+
theta: npt.ArrayLike,
116+
phi: npt.ArrayLike,
117+
) -> NDArray64:
113118
"""
114119
Cumulative Distribution Functions in r, theta(r), phi(r, theta)
115120
@@ -156,7 +161,9 @@ def rvs(
156161
phis = self.phisampler.rvs(rs, thetas, size=size, random_state=random_state)
157162

158163
crd = PhysicsSphericalRepresentation(
159-
r=rs, theta=(np.pi / 2 - thetas) * u.rad, phi=phis * u.rad
164+
r=rs,
165+
theta=(np.pi / 2 - thetas) * u.rad,
166+
phi=phis * u.rad,
160167
)
161168
return crd
162169

sample_scf/conftest.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818

1919
try:
2020
# THIRD PARTY
21-
from pytest_astropy_header.display import (
22-
PYTEST_HEADER_MODULES,
23-
TESTED_VERSIONS,
24-
)
21+
from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
2522

2623
ASTROPY_HEADER = True
2724
except ImportError:
@@ -62,5 +59,5 @@ def pytest_configure(config):
6259
# To ignore some specific deprecation warning messages for Python version
6360
# MAJOR.MINOR or later, add:
6461
# warnings_to_ignore_by_pyver={(MAJOR, MINOR): ['Message to ignore']}
65-
# from astropy.tests.helper import enable_deprecations_as_exceptions # noqa
62+
# from astropy.tests.helper import enable_deprecations_as_exceptions # noqa: F403
6663
# enable_deprecations_as_exceptions()

sample_scf/sample_exact.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
# LOCAL
2525
from ._typing import NDArray64, RandomLike
26-
27-
# PROJECT-SPECIFIC
2826
from .base import SCFSamplerBase, rv_continuous_modrvs
2927
from .utils import _x_of_theta, difPls, phiRSms, thetaQls, x_of_theta
3028

@@ -332,7 +330,7 @@ def _cdf(self, phi: NDArray64, *args: T.Any, **kw: T.Any) -> NDArray64:
332330
factor = 1 / Rm[0] # R0
333331
ms = np.arange(1, Rm.shape[1])
334332
term1p = np.sum(
335-
(Rm[1:] * np.sin(ms * phi) + Sm[1:] * (1 - np.cos(ms * phi))) / (2 * np.pi * ms)
333+
(Rm[1:] * np.sin(ms * phi) + Sm[1:] * (1 - np.cos(ms * phi))) / (2 * np.pi * ms),
336334
)
337335

338336
cdf: NDArray64 = term0 + factor * term1p

sample_scf/sample_intrp.py

+34-7
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ def __init__(
122122
) -> None:
123123
# compute the r-dependent coefficient matrix $\tilde{\rho}$
124124
nmax, lmax = pot._Acos.shape[:2]
125-
rhoTilde = np.array([pot._rhoTilde(r, N=nmax, L=lmax) for r in rgrid]) # (R, N, L)
125+
rhoTilde = np.array(
126+
[pot._rhoTilde(r, N=nmax, L=lmax) for r in rgrid],
127+
) # (R, N, L)
126128

127129
# ----------
128130
# theta Qls
@@ -134,7 +136,13 @@ def __init__(
134136
# phi Rm, Sm
135137
# radial and inclination sums
136138

137-
Rm, Sm = _phiRSms(rhoTilde, Acos=pot._Acos, Asin=pot._Asin, r=rgrid, theta=thetagrid)
139+
Rm, Sm = _phiRSms(
140+
rhoTilde,
141+
Acos=pot._Acos,
142+
Asin=pot._Asin,
143+
r=rgrid,
144+
theta=thetagrid,
145+
)
138146

139147
# ----------
140148
# make samplers
@@ -184,8 +192,18 @@ def __init__(self, pot: SCFPotential, rgrid: NDArray64, **kw: T.Any) -> None:
184192
# work in zeta, not r, since it is more numerically stable
185193
zeta = zeta_of_r(rgrid)
186194
# make splines for fast calculation
187-
self._spl_cdf = InterpolatedUnivariateSpline(zeta, mgrid, ext="raise", bbox=[-1, 1])
188-
self._spl_ppf = InterpolatedUnivariateSpline(mgrid, zeta, ext="raise", bbox=[0, 1])
195+
self._spl_cdf = InterpolatedUnivariateSpline(
196+
zeta,
197+
mgrid,
198+
ext="raise",
199+
bbox=[-1, 1],
200+
)
201+
self._spl_ppf = InterpolatedUnivariateSpline(
202+
mgrid,
203+
zeta,
204+
ext="raise",
205+
bbox=[0, 1],
206+
)
189207

190208
# TODO! make sure
191209
# # store endpoint values to ensure CDF normalized to [0, 1]
@@ -479,7 +497,9 @@ def __init__(
479497
# start by supersampling
480498
Zetas, Xs, Phis = np.meshgrid(zetas, xs, self._phi_interpolant, indexing="ij")
481499
_cdfs = self._spl_cdf((Zetas.ravel(), Xs.ravel(), Phis.ravel())).reshape(
482-
lR, lT, len(self._phi_interpolant)
500+
lR,
501+
lT,
502+
len(self._phi_interpolant),
483503
)
484504
# build reverse spline
485505
ppfs = np.empty((lR, lT, self._ninterpolant), dtype=np.float64)
@@ -488,7 +508,9 @@ def __init__(
488508
ppfs[i, j, :] = splev(qarr, spl, ext=0)
489509
# interpolate
490510
self._spl_ppf = RegularGridInterpolator(
491-
(zetas, xs, self._q_interpolant), ppfs, bounds_error=False
511+
(zetas, xs, self._q_interpolant),
512+
ppfs,
513+
bounds_error=False,
492514
)
493515

494516
# /def
@@ -505,7 +527,12 @@ def _cdf(
505527

506528
# /def
507529

508-
def cdf(self, phi: npt.ArrayLike, r: npt.ArrayLike, theta: npt.ArrayLike) -> NDArray64:
530+
def cdf(
531+
self,
532+
phi: npt.ArrayLike,
533+
r: npt.ArrayLike,
534+
theta: npt.ArrayLike,
535+
) -> NDArray64:
509536
# TODO! make sure r, theta in right domain
510537
cdf = self._cdf(
511538
phi,

sample_scf/tests/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
# Licensed under a 3-clause BSD style license - see LICENSE.rst
23
"""
34
This module contains package tests.

sample_scf/utils.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ def zeta_of_r(r: T.Union[u.Quantity, NDArray64]) -> NDArray64:
9696

9797

9898
def r_of_zeta(
99-
zeta: npt.ArrayLike, unit: T.Optional[u.UnitBase] = None
99+
zeta: npt.ArrayLike,
100+
unit: T.Optional[u.UnitBase] = None,
100101
) -> T.Union[u.Quantity, NDArray64]:
101102
r""":math:`r = \frac{1 + \zeta}{1 - \zeta}`
102103
@@ -258,7 +259,9 @@ def _phiRSms(
258259

259260

260261
def phiRSms(
261-
pot: SCFPotential, r: npt.ArrayLike, theta: npt.ArrayLike
262+
pot: SCFPotential,
263+
r: npt.ArrayLike,
264+
theta: npt.ArrayLike,
262265
) -> T.Tuple[NDArray64, NDArray64]:
263266
r"""Radial and inclination sums for azimuthal weighting factors.
264267

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
23
# Licensed under a 3-clause BSD style license - see LICENSE.rst
34

45
# NOTE: The configuration for the package, including the name, version, and

0 commit comments

Comments
 (0)