4
4
import pytest
5
5
6
6
from galpy .actionAngle import actionAngleIsochroneApprox
7
- from galpy .df import streamdf , fardal15spraydf , chen24spraydf , streamspraydf
7
+ from galpy .df import chen24spraydf , fardal15spraydf , streamdf , streamspraydf
8
8
from galpy .orbit import Orbit
9
9
from galpy .potential import (
10
10
ChandrasekharDynamicalFrictionForce ,
@@ -35,6 +35,7 @@ def test_streamspraydf_deprecation():
35
35
tdisrupt = 4.5 / conversion .time_in_Gyr (vo , ro ),
36
36
)
37
37
38
+
38
39
# Setup both DFs
39
40
@pytest .fixture (scope = "module" )
40
41
def setup_testStreamsprayAgainstStreamdf ():
@@ -83,37 +84,47 @@ def test_sample_bovy14(setup_testStreamsprayAgainstStreamdf):
83
84
indx = (RvR_sdf [3 ] > 4.0 / 8.0 ) * (RvR_sdf [3 ] < 5.0 / 8.0 )
84
85
# mean
85
86
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
87
89
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
88
90
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
90
93
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
91
94
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
93
97
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
94
98
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
96
101
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
97
102
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
99
105
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
100
106
# Another range in Z
101
107
indx = (RvR_sdf [3 ] > 5.0 / 8.0 ) * (RvR_sdf [3 ] < 6.0 / 8.0 )
102
108
# mean
103
109
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
105
112
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
106
113
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
108
116
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
109
117
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
111
120
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
112
121
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
114
124
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
115
125
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
117
128
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean)"
118
129
return None
119
130
@@ -132,13 +143,16 @@ def test_bovy14_sampleorbit(setup_testStreamsprayAgainstStreamdf):
132
143
indx = (XvX_sdf [2 ] > 4.0 / 8.0 ) * (XvX_sdf [2 ] < 5.0 / 8.0 )
133
144
# mean
134
145
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
136
148
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean, xy)"
137
149
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
139
152
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean, xy)"
140
153
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
142
156
), "streamdf and streamspraydf do not generate similar samples for the Bovy (2014) stream (mean, xy)"
143
157
return None
144
158
0 commit comments