ethraid 3.0__tar.gz → 3.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/_core/_multiarray_tests.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/_core/_multiarray_umath.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/_core/_operand_flag_tests.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/_core/_rational_tests.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/_core/_simd.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/_core/_struct_ufunc_tests.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/_core/_umath_tests.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/_core/tests/examples/cython/checks.pyx +274 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/_core/tests/examples/limited_api/limited_api2.pyx +11 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/fft/_pocketfft_umath.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/linalg/_umath_linalg.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/linalg/lapack_lite.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/random/_bounded_integers.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/random/_common.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/random/_examples/cython/extending.pyx +77 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/random/_examples/cython/extending_distributions.pyx +116 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/random/_generator.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/random/_mt19937.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/random/_pcg64.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/random/_philox.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/random/_sfc64.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/random/bit_generator.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/.eggs/numpy-2.2.2-py3.12-macosx-10.15-x86_64.egg/numpy/random/mtrand.cpython-312-darwin.so +0 -0
- {ethraid-3.0/ethraid.egg-info → ethraid-3.2.0}/PKG-INFO +26 -5
- {ethraid-3.0 → ethraid-3.2.0}/README.md +7 -3
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/__init__.py +1 -1
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/cli.py +6 -0
- ethraid-3.2.0/ethraid/compiled/_kepler.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/ethraid/compiled/_kepler.cpython-314-darwin.so +0 -0
- ethraid-3.2.0/ethraid/compiled/_kepler.cpython-37m-darwin.so +0 -0
- ethraid-3.2.0/ethraid/compiled/ethraid/c_kepler/_kepler.c +30666 -0
- ethraid-3.2.0/ethraid/compiled/ethraid/helper_functions_astro.c +36322 -0
- ethraid-3.2.0/ethraid/compiled/ethraid/helper_functions_general.c +41777 -0
- ethraid-3.2.0/ethraid/compiled/ethraid/helper_functions_imaging.c +36751 -0
- ethraid-3.2.0/ethraid/compiled/ethraid/helper_functions_rv.c +31569 -0
- ethraid-3.2.0/ethraid/compiled/helper_functions_astro.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/ethraid/compiled/helper_functions_astro.cpython-314-darwin.so +0 -0
- ethraid-3.2.0/ethraid/compiled/helper_functions_astro.cpython-37m-darwin.so +0 -0
- ethraid-3.2.0/ethraid/compiled/helper_functions_general.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/ethraid/compiled/helper_functions_general.cpython-314-darwin.so +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/compiled/helper_functions_general.cpython-37m-darwin.so +0 -0
- ethraid-3.2.0/ethraid/compiled/helper_functions_imaging.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/ethraid/compiled/helper_functions_imaging.cpython-314-darwin.so +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/compiled/helper_functions_imaging.cpython-37m-darwin.so +0 -0
- ethraid-3.2.0/ethraid/compiled/helper_functions_rv.cpython-312-darwin.so +0 -0
- ethraid-3.2.0/ethraid/compiled/helper_functions_rv.cpython-314-darwin.so +0 -0
- ethraid-3.2.0/ethraid/compiled/helper_functions_rv.cpython-37m-darwin.so +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/driver.py +2 -2
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/helper_functions_astro.pyx +33 -11
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/helper_functions_general.pyx +11 -3
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/helper_functions_imaging.pyx +1 -1
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/plotter.py +19 -14
- {ethraid-3.0 → ethraid-3.2.0/ethraid.egg-info}/PKG-INFO +26 -5
- ethraid-3.2.0/ethraid.egg-info/SOURCES.txt +84 -0
- ethraid-3.2.0/ethraid.egg-info/requires.txt +10 -0
- ethraid-3.2.0/pyproject.toml +8 -0
- ethraid-3.2.0/requirements.txt +10 -0
- {ethraid-3.0 → ethraid-3.2.0}/setup.py +2 -11
- ethraid-3.0/ethraid/compiled/_kepler.cpython-37m-darwin.so +0 -0
- ethraid-3.0/ethraid/compiled/ethraid/c_kepler/_kepler.c +0 -23772
- ethraid-3.0/ethraid/compiled/ethraid/helper_functions_astro.c +0 -29015
- ethraid-3.0/ethraid/compiled/ethraid/helper_functions_general.c +0 -34626
- ethraid-3.0/ethraid/compiled/ethraid/helper_functions_imaging.c +0 -30093
- ethraid-3.0/ethraid/compiled/ethraid/helper_functions_rv.c +0 -24856
- ethraid-3.0/ethraid/compiled/helper_functions_astro.cpython-37m-darwin.so +0 -0
- ethraid-3.0/ethraid/compiled/helper_functions_rv.cpython-37m-darwin.so +0 -0
- ethraid-3.0/ethraid.egg-info/SOURCES.txt +0 -50
- ethraid-3.0/ethraid.egg-info/requires.txt +0 -10
- ethraid-3.0/requirements.txt +0 -10
- {ethraid-3.0 → ethraid-3.2.0}/LICENSE +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/MANIFEST.in +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/c_kepler/__init__.py +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/c_kepler/_kepler.c +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/c_kepler/_kepler.pyx +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/c_kepler/kepler.c +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/c_kepler/radvel_requirements.txt +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/c_kepler/radvel_setup.py +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/compiled/ethraid/c_kepler/kepler.c +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/data/.DS_Store +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/data/TOI1694_832.csv +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/data/bands.csv +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/data/baraffe_table1.csv +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/data/baraffe_table2.csv +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/data/baraffe_table3.csv +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/data/baraffe_table4.csv +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/data/baraffe_table5.csv +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/data/mamajek.csv +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/data/test_K_band.csv +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/data/test_K_band_altered.csv +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/helper_functions_plotting.py +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/helper_functions_rv.pyx +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/kern_profiler_dummy.py +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid/load_save.py +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid.egg-info/dependency_links.txt +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid.egg-info/entry_points.txt +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/ethraid.egg-info/top_level.txt +0 -0
- {ethraid-3.0 → ethraid-3.2.0}/setup.cfg +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
#cython: language_level=3
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Functions in this module give python-space wrappers for cython functions
|
|
5
|
+
exposed in numpy/__init__.pxd, so they can be tested in test_cython.py
|
|
6
|
+
"""
|
|
7
|
+
cimport numpy as cnp
|
|
8
|
+
cnp.import_array()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def is_td64(obj):
|
|
12
|
+
return cnp.is_timedelta64_object(obj)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def is_dt64(obj):
|
|
16
|
+
return cnp.is_datetime64_object(obj)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_dt64_value(obj):
|
|
20
|
+
return cnp.get_datetime64_value(obj)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def get_td64_value(obj):
|
|
24
|
+
return cnp.get_timedelta64_value(obj)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def get_dt64_unit(obj):
|
|
28
|
+
return cnp.get_datetime64_unit(obj)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def is_integer(obj):
|
|
32
|
+
return isinstance(obj, (cnp.integer, int))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def get_datetime_iso_8601_strlen():
|
|
36
|
+
return cnp.get_datetime_iso_8601_strlen(0, cnp.NPY_FR_ns)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def convert_datetime64_to_datetimestruct():
|
|
40
|
+
cdef:
|
|
41
|
+
cnp.npy_datetimestruct dts
|
|
42
|
+
cnp.PyArray_DatetimeMetaData meta
|
|
43
|
+
cnp.int64_t value = 1647374515260292
|
|
44
|
+
# i.e. (time.time() * 10**6) at 2022-03-15 20:01:55.260292 UTC
|
|
45
|
+
|
|
46
|
+
meta.base = cnp.NPY_FR_us
|
|
47
|
+
meta.num = 1
|
|
48
|
+
cnp.convert_datetime64_to_datetimestruct(&meta, value, &dts)
|
|
49
|
+
return dts
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def make_iso_8601_datetime(dt: "datetime"):
|
|
53
|
+
cdef:
|
|
54
|
+
cnp.npy_datetimestruct dts
|
|
55
|
+
char result[36] # 36 corresponds to NPY_FR_s passed below
|
|
56
|
+
int local = 0
|
|
57
|
+
int utc = 0
|
|
58
|
+
int tzoffset = 0
|
|
59
|
+
|
|
60
|
+
dts.year = dt.year
|
|
61
|
+
dts.month = dt.month
|
|
62
|
+
dts.day = dt.day
|
|
63
|
+
dts.hour = dt.hour
|
|
64
|
+
dts.min = dt.minute
|
|
65
|
+
dts.sec = dt.second
|
|
66
|
+
dts.us = dt.microsecond
|
|
67
|
+
dts.ps = dts.as = 0
|
|
68
|
+
|
|
69
|
+
cnp.make_iso_8601_datetime(
|
|
70
|
+
&dts,
|
|
71
|
+
result,
|
|
72
|
+
sizeof(result),
|
|
73
|
+
local,
|
|
74
|
+
utc,
|
|
75
|
+
cnp.NPY_FR_s,
|
|
76
|
+
tzoffset,
|
|
77
|
+
cnp.NPY_NO_CASTING,
|
|
78
|
+
)
|
|
79
|
+
return result
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
cdef cnp.broadcast multiiter_from_broadcast_obj(object bcast):
|
|
83
|
+
cdef dict iter_map = {
|
|
84
|
+
1: cnp.PyArray_MultiIterNew1,
|
|
85
|
+
2: cnp.PyArray_MultiIterNew2,
|
|
86
|
+
3: cnp.PyArray_MultiIterNew3,
|
|
87
|
+
4: cnp.PyArray_MultiIterNew4,
|
|
88
|
+
5: cnp.PyArray_MultiIterNew5,
|
|
89
|
+
}
|
|
90
|
+
arrays = [x.base for x in bcast.iters]
|
|
91
|
+
cdef cnp.broadcast result = iter_map[len(arrays)](*arrays)
|
|
92
|
+
return result
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def get_multiiter_size(bcast: "broadcast"):
|
|
96
|
+
cdef cnp.broadcast multi = multiiter_from_broadcast_obj(bcast)
|
|
97
|
+
return multi.size
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def get_multiiter_number_of_dims(bcast: "broadcast"):
|
|
101
|
+
cdef cnp.broadcast multi = multiiter_from_broadcast_obj(bcast)
|
|
102
|
+
return multi.nd
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def get_multiiter_current_index(bcast: "broadcast"):
|
|
106
|
+
cdef cnp.broadcast multi = multiiter_from_broadcast_obj(bcast)
|
|
107
|
+
return multi.index
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def get_multiiter_num_of_iterators(bcast: "broadcast"):
|
|
111
|
+
cdef cnp.broadcast multi = multiiter_from_broadcast_obj(bcast)
|
|
112
|
+
return multi.numiter
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def get_multiiter_shape(bcast: "broadcast"):
|
|
116
|
+
cdef cnp.broadcast multi = multiiter_from_broadcast_obj(bcast)
|
|
117
|
+
return tuple([multi.dimensions[i] for i in range(bcast.nd)])
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def get_multiiter_iters(bcast: "broadcast"):
|
|
121
|
+
cdef cnp.broadcast multi = multiiter_from_broadcast_obj(bcast)
|
|
122
|
+
return tuple([<cnp.flatiter>multi.iters[i] for i in range(bcast.numiter)])
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def get_default_integer():
|
|
126
|
+
if cnp.NPY_DEFAULT_INT == cnp.NPY_LONG:
|
|
127
|
+
return cnp.dtype("long")
|
|
128
|
+
if cnp.NPY_DEFAULT_INT == cnp.NPY_INTP:
|
|
129
|
+
return cnp.dtype("intp")
|
|
130
|
+
return None
|
|
131
|
+
|
|
132
|
+
def get_ravel_axis():
|
|
133
|
+
return cnp.NPY_RAVEL_AXIS
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def conv_intp(cnp.intp_t val):
|
|
137
|
+
return val
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def get_dtype_flags(cnp.dtype dtype):
|
|
141
|
+
return dtype.flags
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
cdef cnp.NpyIter* npyiter_from_nditer_obj(object it):
|
|
145
|
+
"""A function to create a NpyIter struct from a nditer object.
|
|
146
|
+
|
|
147
|
+
This function is only meant for testing purposes and only extracts the
|
|
148
|
+
necessary info from nditer to test the functionality of NpyIter methods
|
|
149
|
+
"""
|
|
150
|
+
cdef:
|
|
151
|
+
cnp.NpyIter* cit
|
|
152
|
+
cnp.PyArray_Descr* op_dtypes[3]
|
|
153
|
+
cnp.npy_uint32 op_flags[3]
|
|
154
|
+
cnp.PyArrayObject* ops[3]
|
|
155
|
+
cnp.npy_uint32 flags = 0
|
|
156
|
+
|
|
157
|
+
if it.has_index:
|
|
158
|
+
flags |= cnp.NPY_ITER_C_INDEX
|
|
159
|
+
if it.has_delayed_bufalloc:
|
|
160
|
+
flags |= cnp.NPY_ITER_BUFFERED | cnp.NPY_ITER_DELAY_BUFALLOC
|
|
161
|
+
if it.has_multi_index:
|
|
162
|
+
flags |= cnp.NPY_ITER_MULTI_INDEX
|
|
163
|
+
|
|
164
|
+
# one of READWRITE, READONLY and WRTIEONLY at the minimum must be specified for op_flags
|
|
165
|
+
for i in range(it.nop):
|
|
166
|
+
op_flags[i] = cnp.NPY_ITER_READONLY
|
|
167
|
+
|
|
168
|
+
for i in range(it.nop):
|
|
169
|
+
op_dtypes[i] = cnp.PyArray_DESCR(it.operands[i])
|
|
170
|
+
ops[i] = <cnp.PyArrayObject*>it.operands[i]
|
|
171
|
+
|
|
172
|
+
cit = cnp.NpyIter_MultiNew(it.nop, &ops[0], flags, cnp.NPY_KEEPORDER,
|
|
173
|
+
cnp.NPY_NO_CASTING, &op_flags[0],
|
|
174
|
+
<cnp.PyArray_Descr**>NULL)
|
|
175
|
+
return cit
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def get_npyiter_size(it: "nditer"):
|
|
179
|
+
cdef cnp.NpyIter* cit = npyiter_from_nditer_obj(it)
|
|
180
|
+
result = cnp.NpyIter_GetIterSize(cit)
|
|
181
|
+
cnp.NpyIter_Deallocate(cit)
|
|
182
|
+
return result
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def get_npyiter_ndim(it: "nditer"):
|
|
186
|
+
cdef cnp.NpyIter* cit = npyiter_from_nditer_obj(it)
|
|
187
|
+
result = cnp.NpyIter_GetNDim(cit)
|
|
188
|
+
cnp.NpyIter_Deallocate(cit)
|
|
189
|
+
return result
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def get_npyiter_nop(it: "nditer"):
|
|
193
|
+
cdef cnp.NpyIter* cit = npyiter_from_nditer_obj(it)
|
|
194
|
+
result = cnp.NpyIter_GetNOp(cit)
|
|
195
|
+
cnp.NpyIter_Deallocate(cit)
|
|
196
|
+
return result
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def get_npyiter_operands(it: "nditer"):
|
|
200
|
+
cdef cnp.NpyIter* cit = npyiter_from_nditer_obj(it)
|
|
201
|
+
try:
|
|
202
|
+
arr = cnp.NpyIter_GetOperandArray(cit)
|
|
203
|
+
return tuple([<cnp.ndarray>arr[i] for i in range(it.nop)])
|
|
204
|
+
finally:
|
|
205
|
+
cnp.NpyIter_Deallocate(cit)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def get_npyiter_itviews(it: "nditer"):
|
|
209
|
+
cdef cnp.NpyIter* cit = npyiter_from_nditer_obj(it)
|
|
210
|
+
result = tuple([cnp.NpyIter_GetIterView(cit, i) for i in range(it.nop)])
|
|
211
|
+
cnp.NpyIter_Deallocate(cit)
|
|
212
|
+
return result
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def get_npyiter_dtypes(it: "nditer"):
|
|
216
|
+
cdef cnp.NpyIter* cit = npyiter_from_nditer_obj(it)
|
|
217
|
+
try:
|
|
218
|
+
arr = cnp.NpyIter_GetDescrArray(cit)
|
|
219
|
+
return tuple([<cnp.dtype>arr[i] for i in range(it.nop)])
|
|
220
|
+
finally:
|
|
221
|
+
cnp.NpyIter_Deallocate(cit)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def npyiter_has_delayed_bufalloc(it: "nditer"):
|
|
225
|
+
cdef cnp.NpyIter* cit = npyiter_from_nditer_obj(it)
|
|
226
|
+
result = cnp.NpyIter_HasDelayedBufAlloc(cit)
|
|
227
|
+
cnp.NpyIter_Deallocate(cit)
|
|
228
|
+
return result
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def npyiter_has_index(it: "nditer"):
|
|
232
|
+
cdef cnp.NpyIter* cit = npyiter_from_nditer_obj(it)
|
|
233
|
+
result = cnp.NpyIter_HasIndex(cit)
|
|
234
|
+
cnp.NpyIter_Deallocate(cit)
|
|
235
|
+
return result
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def npyiter_has_multi_index(it: "nditer"):
|
|
239
|
+
cdef cnp.NpyIter* cit = npyiter_from_nditer_obj(it)
|
|
240
|
+
result = cnp.NpyIter_HasMultiIndex(cit)
|
|
241
|
+
cnp.NpyIter_Deallocate(cit)
|
|
242
|
+
return result
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def npyiter_has_finished(it: "nditer"):
|
|
246
|
+
cdef cnp.NpyIter* cit
|
|
247
|
+
try:
|
|
248
|
+
cit = npyiter_from_nditer_obj(it)
|
|
249
|
+
cnp.NpyIter_GotoIterIndex(cit, it.index)
|
|
250
|
+
return not (cnp.NpyIter_GetIterIndex(cit) < cnp.NpyIter_GetIterSize(cit))
|
|
251
|
+
finally:
|
|
252
|
+
cnp.NpyIter_Deallocate(cit)
|
|
253
|
+
|
|
254
|
+
def compile_fillwithbyte():
|
|
255
|
+
# Regression test for gh-25878, mostly checks it compiles.
|
|
256
|
+
cdef cnp.npy_intp dims[2]
|
|
257
|
+
dims = (1, 2)
|
|
258
|
+
pos = cnp.PyArray_ZEROS(2, dims, cnp.NPY_UINT8, 0)
|
|
259
|
+
cnp.PyArray_FILLWBYTE(pos, 1)
|
|
260
|
+
return pos
|
|
261
|
+
|
|
262
|
+
def inc2_cfloat_struct(cnp.ndarray[cnp.cfloat_t] arr):
|
|
263
|
+
# This works since we compile in C mode, it will fail in cpp mode
|
|
264
|
+
arr[1].real += 1
|
|
265
|
+
arr[1].imag += 1
|
|
266
|
+
# This works in both modes
|
|
267
|
+
arr[1].real = arr[1].real + 1
|
|
268
|
+
arr[1].imag = arr[1].imag + 1
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
def check_npy_uintp_type_enum():
|
|
272
|
+
# Regression test for gh-27890: cnp.NPY_UINTP was not defined.
|
|
273
|
+
# Cython would fail to compile this before gh-27890 was fixed.
|
|
274
|
+
return cnp.NPY_UINTP > 0
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#cython: language_level=3
|
|
2
|
+
|
|
3
|
+
from libc.stdint cimport uint32_t
|
|
4
|
+
from cpython.pycapsule cimport PyCapsule_IsValid, PyCapsule_GetPointer
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
cimport numpy as np
|
|
8
|
+
cimport cython
|
|
9
|
+
|
|
10
|
+
from numpy.random cimport bitgen_t
|
|
11
|
+
from numpy.random import PCG64
|
|
12
|
+
|
|
13
|
+
np.import_array()
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@cython.boundscheck(False)
|
|
17
|
+
@cython.wraparound(False)
|
|
18
|
+
def uniform_mean(Py_ssize_t n):
|
|
19
|
+
cdef Py_ssize_t i
|
|
20
|
+
cdef bitgen_t *rng
|
|
21
|
+
cdef const char *capsule_name = "BitGenerator"
|
|
22
|
+
cdef double[::1] random_values
|
|
23
|
+
cdef np.ndarray randoms
|
|
24
|
+
|
|
25
|
+
x = PCG64()
|
|
26
|
+
capsule = x.capsule
|
|
27
|
+
if not PyCapsule_IsValid(capsule, capsule_name):
|
|
28
|
+
raise ValueError("Invalid pointer to anon_func_state")
|
|
29
|
+
rng = <bitgen_t *> PyCapsule_GetPointer(capsule, capsule_name)
|
|
30
|
+
random_values = np.empty(n)
|
|
31
|
+
# Best practice is to acquire the lock whenever generating random values.
|
|
32
|
+
# This prevents other threads from modifying the state. Acquiring the lock
|
|
33
|
+
# is only necessary if the GIL is also released, as in this example.
|
|
34
|
+
with x.lock, nogil:
|
|
35
|
+
for i in range(n):
|
|
36
|
+
random_values[i] = rng.next_double(rng.state)
|
|
37
|
+
randoms = np.asarray(random_values)
|
|
38
|
+
return randoms.mean()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# This function is declared nogil so it can be used without the GIL below
|
|
42
|
+
cdef uint32_t bounded_uint(uint32_t lb, uint32_t ub, bitgen_t *rng) nogil:
|
|
43
|
+
cdef uint32_t mask, delta, val
|
|
44
|
+
mask = delta = ub - lb
|
|
45
|
+
mask |= mask >> 1
|
|
46
|
+
mask |= mask >> 2
|
|
47
|
+
mask |= mask >> 4
|
|
48
|
+
mask |= mask >> 8
|
|
49
|
+
mask |= mask >> 16
|
|
50
|
+
|
|
51
|
+
val = rng.next_uint32(rng.state) & mask
|
|
52
|
+
while val > delta:
|
|
53
|
+
val = rng.next_uint32(rng.state) & mask
|
|
54
|
+
|
|
55
|
+
return lb + val
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@cython.boundscheck(False)
|
|
59
|
+
@cython.wraparound(False)
|
|
60
|
+
def bounded_uints(uint32_t lb, uint32_t ub, Py_ssize_t n):
|
|
61
|
+
cdef Py_ssize_t i
|
|
62
|
+
cdef bitgen_t *rng
|
|
63
|
+
cdef uint32_t[::1] out
|
|
64
|
+
cdef const char *capsule_name = "BitGenerator"
|
|
65
|
+
|
|
66
|
+
x = PCG64()
|
|
67
|
+
out = np.empty(n, dtype=np.uint32)
|
|
68
|
+
capsule = x.capsule
|
|
69
|
+
|
|
70
|
+
if not PyCapsule_IsValid(capsule, capsule_name):
|
|
71
|
+
raise ValueError("Invalid pointer to anon_func_state")
|
|
72
|
+
rng = <bitgen_t *>PyCapsule_GetPointer(capsule, capsule_name)
|
|
73
|
+
|
|
74
|
+
with x.lock, nogil:
|
|
75
|
+
for i in range(n):
|
|
76
|
+
out[i] = bounded_uint(lb, ub, rng)
|
|
77
|
+
return np.asarray(out)
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#cython: language_level=3
|
|
2
|
+
"""
|
|
3
|
+
This file shows how the to use a BitGenerator to create a distribution.
|
|
4
|
+
"""
|
|
5
|
+
import numpy as np
|
|
6
|
+
cimport numpy as np
|
|
7
|
+
cimport cython
|
|
8
|
+
from cpython.pycapsule cimport PyCapsule_IsValid, PyCapsule_GetPointer
|
|
9
|
+
from libc.stdint cimport uint16_t, uint64_t
|
|
10
|
+
from numpy.random cimport bitgen_t
|
|
11
|
+
from numpy.random import PCG64
|
|
12
|
+
from numpy.random.c_distributions cimport (
|
|
13
|
+
random_standard_uniform_fill, random_standard_uniform_fill_f)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@cython.boundscheck(False)
|
|
17
|
+
@cython.wraparound(False)
|
|
18
|
+
def uniforms(Py_ssize_t n):
|
|
19
|
+
"""
|
|
20
|
+
Create an array of `n` uniformly distributed doubles.
|
|
21
|
+
A 'real' distribution would want to process the values into
|
|
22
|
+
some non-uniform distribution
|
|
23
|
+
"""
|
|
24
|
+
cdef Py_ssize_t i
|
|
25
|
+
cdef bitgen_t *rng
|
|
26
|
+
cdef const char *capsule_name = "BitGenerator"
|
|
27
|
+
cdef double[::1] random_values
|
|
28
|
+
|
|
29
|
+
x = PCG64()
|
|
30
|
+
capsule = x.capsule
|
|
31
|
+
# Optional check that the capsule if from a BitGenerator
|
|
32
|
+
if not PyCapsule_IsValid(capsule, capsule_name):
|
|
33
|
+
raise ValueError("Invalid pointer to anon_func_state")
|
|
34
|
+
# Cast the pointer
|
|
35
|
+
rng = <bitgen_t *> PyCapsule_GetPointer(capsule, capsule_name)
|
|
36
|
+
random_values = np.empty(n, dtype='float64')
|
|
37
|
+
with x.lock, nogil:
|
|
38
|
+
for i in range(n):
|
|
39
|
+
# Call the function
|
|
40
|
+
random_values[i] = rng.next_double(rng.state)
|
|
41
|
+
randoms = np.asarray(random_values)
|
|
42
|
+
|
|
43
|
+
return randoms
|
|
44
|
+
|
|
45
|
+
# cython example 2
|
|
46
|
+
@cython.boundscheck(False)
|
|
47
|
+
@cython.wraparound(False)
|
|
48
|
+
def uint10_uniforms(Py_ssize_t n):
|
|
49
|
+
"""Uniform 10 bit integers stored as 16-bit unsigned integers"""
|
|
50
|
+
cdef Py_ssize_t i
|
|
51
|
+
cdef bitgen_t *rng
|
|
52
|
+
cdef const char *capsule_name = "BitGenerator"
|
|
53
|
+
cdef uint16_t[::1] random_values
|
|
54
|
+
cdef int bits_remaining
|
|
55
|
+
cdef int width = 10
|
|
56
|
+
cdef uint64_t buff, mask = 0x3FF
|
|
57
|
+
|
|
58
|
+
x = PCG64()
|
|
59
|
+
capsule = x.capsule
|
|
60
|
+
if not PyCapsule_IsValid(capsule, capsule_name):
|
|
61
|
+
raise ValueError("Invalid pointer to anon_func_state")
|
|
62
|
+
rng = <bitgen_t *> PyCapsule_GetPointer(capsule, capsule_name)
|
|
63
|
+
random_values = np.empty(n, dtype='uint16')
|
|
64
|
+
# Best practice is to release GIL and acquire the lock
|
|
65
|
+
bits_remaining = 0
|
|
66
|
+
with x.lock, nogil:
|
|
67
|
+
for i in range(n):
|
|
68
|
+
if bits_remaining < width:
|
|
69
|
+
buff = rng.next_uint64(rng.state)
|
|
70
|
+
random_values[i] = buff & mask
|
|
71
|
+
buff >>= width
|
|
72
|
+
|
|
73
|
+
randoms = np.asarray(random_values)
|
|
74
|
+
return randoms
|
|
75
|
+
|
|
76
|
+
# cython example 3
|
|
77
|
+
def uniforms_ex(bit_generator, Py_ssize_t n, dtype=np.float64):
|
|
78
|
+
"""
|
|
79
|
+
Create an array of `n` uniformly distributed doubles via a "fill" function.
|
|
80
|
+
|
|
81
|
+
A 'real' distribution would want to process the values into
|
|
82
|
+
some non-uniform distribution
|
|
83
|
+
|
|
84
|
+
Parameters
|
|
85
|
+
----------
|
|
86
|
+
bit_generator: BitGenerator instance
|
|
87
|
+
n: int
|
|
88
|
+
Output vector length
|
|
89
|
+
dtype: {str, dtype}, optional
|
|
90
|
+
Desired dtype, either 'd' (or 'float64') or 'f' (or 'float32'). The
|
|
91
|
+
default dtype value is 'd'
|
|
92
|
+
"""
|
|
93
|
+
cdef Py_ssize_t i
|
|
94
|
+
cdef bitgen_t *rng
|
|
95
|
+
cdef const char *capsule_name = "BitGenerator"
|
|
96
|
+
cdef np.ndarray randoms
|
|
97
|
+
|
|
98
|
+
capsule = bit_generator.capsule
|
|
99
|
+
# Optional check that the capsule if from a BitGenerator
|
|
100
|
+
if not PyCapsule_IsValid(capsule, capsule_name):
|
|
101
|
+
raise ValueError("Invalid pointer to anon_func_state")
|
|
102
|
+
# Cast the pointer
|
|
103
|
+
rng = <bitgen_t *> PyCapsule_GetPointer(capsule, capsule_name)
|
|
104
|
+
|
|
105
|
+
_dtype = np.dtype(dtype)
|
|
106
|
+
randoms = np.empty(n, dtype=_dtype)
|
|
107
|
+
if _dtype == np.float32:
|
|
108
|
+
with bit_generator.lock:
|
|
109
|
+
random_standard_uniform_fill_f(rng, n, <float*>np.PyArray_DATA(randoms))
|
|
110
|
+
elif _dtype == np.float64:
|
|
111
|
+
with bit_generator.lock:
|
|
112
|
+
random_standard_uniform_fill(rng, n, <double*>np.PyArray_DATA(randoms))
|
|
113
|
+
else:
|
|
114
|
+
raise TypeError('Unsupported dtype %r for random' % _dtype)
|
|
115
|
+
return randoms
|
|
116
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,23 +1,44 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: ethraid
|
|
3
|
-
Version: 3.0
|
|
3
|
+
Version: 3.2.0
|
|
4
4
|
Summary: Characterize long-period companions using RV trends, astrometric accelerations, and direct imaging
|
|
5
5
|
Home-page:
|
|
6
6
|
Author: Judah Van Zandt
|
|
7
7
|
Author-email: judahvz@astro.ucla.edu
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
9
|
License-File: LICENSE
|
|
10
|
+
Requires-Dist: astropy>=6.0
|
|
11
|
+
Requires-Dist: Cython>=3.0
|
|
12
|
+
Requires-Dist: h5py>=3.10
|
|
13
|
+
Requires-Dist: matplotlib>=3.8
|
|
14
|
+
Requires-Dist: numpy>=1.26
|
|
15
|
+
Requires-Dist: pandas>=2.0
|
|
16
|
+
Requires-Dist: scipy>=1.11
|
|
17
|
+
Requires-Dist: tqdm>=4.64.0
|
|
18
|
+
Requires-Dist: astroquery>=0.4.7
|
|
19
|
+
Requires-Dist: setuptools>=65.6.3
|
|
20
|
+
Dynamic: author
|
|
21
|
+
Dynamic: author-email
|
|
22
|
+
Dynamic: description
|
|
23
|
+
Dynamic: description-content-type
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
Dynamic: requires-dist
|
|
26
|
+
Dynamic: summary
|
|
27
|
+
|
|
28
|
+
<div align="center">
|
|
29
|
+
<img src="ethraid/example/ethraid.jpg" width="168" height="150">
|
|
30
|
+
</div>
|
|
10
31
|
|
|
11
32
|
# Ethraid
|
|
12
33
|
|
|
13
34
|
Characterize long-period companions with partial orbits.
|
|
14
35
|
|
|
15
|
-
Please cite Van Zandt \& Petigura (2024
|
|
36
|
+
Please cite Van Zandt \& Petigura (2024) and the following DOI if you make use of this software in your research.
|
|
16
37
|
[](https://zenodo.org/doi/10.5281/zenodo.10841606)
|
|
17
38
|
|
|
18
39
|
## Environment
|
|
19
|
-
### Create new environment with python 3.
|
|
20
|
-
- *\$ conda create --name ethraid_env python=3.
|
|
40
|
+
### Create new environment with python 3.14
|
|
41
|
+
- *\$ conda create --name ethraid_env python=3.14*
|
|
21
42
|
- *\$ conda activate ethraid_env*
|
|
22
43
|
|
|
23
44
|
## Download using pip
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="ethraid/example/ethraid.jpg" width="168" height="150">
|
|
3
|
+
</div>
|
|
4
|
+
|
|
1
5
|
# Ethraid
|
|
2
6
|
|
|
3
7
|
Characterize long-period companions with partial orbits.
|
|
4
8
|
|
|
5
|
-
Please cite Van Zandt \& Petigura (2024
|
|
9
|
+
Please cite Van Zandt \& Petigura (2024) and the following DOI if you make use of this software in your research.
|
|
6
10
|
[](https://zenodo.org/doi/10.5281/zenodo.10841606)
|
|
7
11
|
|
|
8
12
|
## Environment
|
|
9
|
-
### Create new environment with python 3.
|
|
10
|
-
- *\$ conda create --name ethraid_env python=3.
|
|
13
|
+
### Create new environment with python 3.14
|
|
14
|
+
- *\$ conda create --name ethraid_env python=3.14*
|
|
11
15
|
- *\$ conda activate ethraid_env*
|
|
12
16
|
|
|
13
17
|
## Download using pip
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Command Line Interface
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
import sys
|
|
5
6
|
from argparse import ArgumentParser
|
|
6
7
|
import ethraid.driver
|
|
7
8
|
|
|
@@ -137,6 +138,11 @@ def main():
|
|
|
137
138
|
# help='Dimension of binned probability arrays. Required for raw input arrays.'
|
|
138
139
|
# )
|
|
139
140
|
psr_all.set_defaults(func=ethraid.driver.all)
|
|
141
|
+
|
|
142
|
+
# If no arguments are provided, print help message and exit
|
|
143
|
+
if len(sys.argv)==1:
|
|
144
|
+
psr.print_help(sys.stderr)
|
|
145
|
+
sys.exit(1)
|
|
140
146
|
|
|
141
147
|
|
|
142
148
|
args = psr.parse_args()
|
|
Binary file
|
|
Binary file
|
|
Binary file
|