Skip to content

Commit 5867d7d

Browse files
pre-commit-ci[bot]ybillchen
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 711e952 commit 5867d7d

File tree

2 files changed

+35
-19
lines changed

2 files changed

+35
-19
lines changed

tests/test_quantity.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -17503,7 +17503,7 @@ def test_streamgapdf_sample():
1750317503

1750417504
def test_streamspraydf_setup_paramsAsQuantity():
1750517505
# Imports
17506-
from galpy.df import fardal15spraydf, chen24spraydf
17506+
from galpy.df import chen24spraydf, fardal15spraydf
1750717507
from galpy.orbit import Orbit
1750817508
from galpy.potential import LogarithmicHaloPotential
1750917509
from galpy.util import conversion # for unit conversions
@@ -17535,14 +17535,15 @@ def test_streamspraydf_setup_paramsAsQuantity():
1753517535
numpy.fabs(sam.r(use_physical=False) - sam_nou.r(use_physical=False)) < 1e-8
1753617536
), "Sample returned by streamspraydf.sample with with unit output is inconsistenty with the same sample sampled without unit output"
1753717537
assert numpy.all(
17538-
numpy.fabs(sam.vr(use_physical=False) - sam_nou.vr(use_physical=False)) < 1e-8
17538+
numpy.fabs(sam.vr(use_physical=False) - sam_nou.vr(use_physical=False))
17539+
< 1e-8
1753917540
), "Sample returned by streamspraydf.sample with with unit output is inconsistenty with the same sample sampled without unit output"
1754017541
return None
1754117542

1754217543

1754317544
def test_streamspraydf_sample_orbit():
1754417545
from galpy import potential
17545-
from galpy.df import fardal15spraydf, chen24spraydf
17546+
from galpy.df import chen24spraydf, fardal15spraydf
1754617547
from galpy.orbit import Orbit
1754717548
from galpy.util import conversion
1754817549

@@ -17576,14 +17577,15 @@ def test_streamspraydf_sample_orbit():
1757617577
numpy.fabs(sam.r(use_physical=False) - sam_nou.r(use_physical=False)) < 1e-8
1757717578
), "Sample returned by streamspraydf.sample with with unit output is inconsistenty with the same sample sampled without unit output"
1757817579
assert numpy.all(
17579-
numpy.fabs(sam.vr(use_physical=False) - sam_nou.vr(use_physical=False)) < 1e-8
17580+
numpy.fabs(sam.vr(use_physical=False) - sam_nou.vr(use_physical=False))
17581+
< 1e-8
1758017582
), "Sample returned by streamspraydf.sample with with unit output is inconsistenty with the same sample sampled without unit output"
1758117583
return None
1758217584

1758317585

1758417586
def test_streamspraydf_sample_RvR():
1758517587
from galpy import potential
17586-
from galpy.df import fardal15spraydf, chen24spraydf
17588+
from galpy.df import chen24spraydf, fardal15spraydf
1758717589
from galpy.orbit import Orbit
1758817590
from galpy.util import conversion
1758917591

tests/test_streamspraydf.py

+28-14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55

66
from galpy.actionAngle import actionAngleIsochroneApprox
7-
from galpy.df import streamdf, fardal15spraydf, chen24spraydf, streamspraydf
7+
from galpy.df import chen24spraydf, fardal15spraydf, streamdf, streamspraydf
88
from galpy.orbit import Orbit
99
from galpy.potential import (
1010
ChandrasekharDynamicalFrictionForce,
@@ -35,6 +35,7 @@ def test_streamspraydf_deprecation():
3535
tdisrupt=4.5 / conversion.time_in_Gyr(vo, ro),
3636
)
3737

38+
3839
# Setup both DFs
3940
@pytest.fixture(scope="module")
4041
def setup_testStreamsprayAgainstStreamdf():
@@ -83,37 +84,47 @@ def test_sample_bovy14(setup_testStreamsprayAgainstStreamdf):
8384
indx = (RvR_sdf[3] > 4.0 / 8.0) * (RvR_sdf[3] < 5.0 / 8.0)
8485
# mean
8586
assert (
86-
numpy.fabs(numpy.mean(RvR_sdf[0][indx]) - numpy.mean(RvR_spdf[0][indx])) < 6e-2
87+
numpy.fabs(numpy.mean(RvR_sdf[0][indx]) - numpy.mean(RvR_spdf[0][indx]))
88+
< 6e-2
8789
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
8890
assert (
89-
numpy.fabs(numpy.mean(RvR_sdf[1][indx]) - numpy.mean(RvR_spdf[1][indx])) < 5e-2
91+
numpy.fabs(numpy.mean(RvR_sdf[1][indx]) - numpy.mean(RvR_spdf[1][indx]))
92+
< 5e-2
9093
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
9194
assert (
92-
numpy.fabs(numpy.mean(RvR_sdf[2][indx]) - numpy.mean(RvR_spdf[2][indx])) < 5e-2
95+
numpy.fabs(numpy.mean(RvR_sdf[2][indx]) - numpy.mean(RvR_spdf[2][indx]))
96+
< 5e-2
9397
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
9498
assert (
95-
numpy.fabs(numpy.mean(RvR_sdf[4][indx]) - numpy.mean(RvR_spdf[4][indx])) < 5e-2
99+
numpy.fabs(numpy.mean(RvR_sdf[4][indx]) - numpy.mean(RvR_spdf[4][indx]))
100+
< 5e-2
96101
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
97102
assert (
98-
numpy.fabs(numpy.mean(RvR_sdf[5][indx]) - numpy.mean(RvR_spdf[5][indx])) < 1e-1
103+
numpy.fabs(numpy.mean(RvR_sdf[5][indx]) - numpy.mean(RvR_spdf[5][indx]))
104+
< 1e-1
99105
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
100106
# Another range in Z
101107
indx = (RvR_sdf[3] > 5.0 / 8.0) * (RvR_sdf[3] < 6.0 / 8.0)
102108
# mean
103109
assert (
104-
numpy.fabs(numpy.mean(RvR_sdf[0][indx]) - numpy.mean(RvR_spdf[0][indx])) < 1e-1
110+
numpy.fabs(numpy.mean(RvR_sdf[0][indx]) - numpy.mean(RvR_spdf[0][indx]))
111+
< 1e-1
105112
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
106113
assert (
107-
numpy.fabs(numpy.mean(RvR_sdf[1][indx]) - numpy.mean(RvR_spdf[1][indx])) < 3e-2
114+
numpy.fabs(numpy.mean(RvR_sdf[1][indx]) - numpy.mean(RvR_spdf[1][indx]))
115+
< 3e-2
108116
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
109117
assert (
110-
numpy.fabs(numpy.mean(RvR_sdf[2][indx]) - numpy.mean(RvR_spdf[2][indx])) < 4e-2
118+
numpy.fabs(numpy.mean(RvR_sdf[2][indx]) - numpy.mean(RvR_spdf[2][indx]))
119+
< 4e-2
111120
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
112121
assert (
113-
numpy.fabs(numpy.mean(RvR_sdf[4][indx]) - numpy.mean(RvR_spdf[4][indx])) < 3e-2
122+
numpy.fabs(numpy.mean(RvR_sdf[4][indx]) - numpy.mean(RvR_spdf[4][indx]))
123+
< 3e-2
114124
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
115125
assert (
116-
numpy.fabs(numpy.mean(RvR_sdf[5][indx]) - numpy.mean(RvR_spdf[5][indx])) < 1e-1
126+
numpy.fabs(numpy.mean(RvR_sdf[5][indx]) - numpy.mean(RvR_spdf[5][indx]))
127+
< 1e-1
117128
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
118129
return None
119130

@@ -132,13 +143,16 @@ def test_bovy14_sampleorbit(setup_testStreamsprayAgainstStreamdf):
132143
indx = (XvX_sdf[2] > 4.0 / 8.0) * (XvX_sdf[2] < 5.0 / 8.0)
133144
# mean
134145
assert (
135-
numpy.fabs(numpy.mean(XvX_sdf[0][indx]) - numpy.mean(XvX_spdf.x()[indx])) < 6e-2
146+
numpy.fabs(numpy.mean(XvX_sdf[0][indx]) - numpy.mean(XvX_spdf.x()[indx]))
147+
< 6e-2
136148
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean, xy)"
137149
assert (
138-
numpy.fabs(numpy.mean(XvX_sdf[1][indx]) - numpy.mean(XvX_spdf.y()[indx])) < 2e-1
150+
numpy.fabs(numpy.mean(XvX_sdf[1][indx]) - numpy.mean(XvX_spdf.y()[indx]))
151+
< 2e-1
139152
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean, xy)"
140153
assert (
141-
numpy.fabs(numpy.mean(XvX_sdf[4][indx]) - numpy.mean(XvX_spdf.vy()[indx])) < 3e-2
154+
numpy.fabs(numpy.mean(XvX_sdf[4][indx]) - numpy.mean(XvX_spdf.vy()[indx]))
155+
< 3e-2
142156
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean, xy)"
143157
return None
144158

0 commit comments

Comments
 (0)