ethraid 2.5.2__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.
Files changed (98) hide show
  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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
  23. 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
  24. {ethraid-2.5.2/ethraid.egg-info → ethraid-3.2.0}/PKG-INFO +28 -7
  25. {ethraid-2.5.2 → ethraid-3.2.0}/README.md +9 -5
  26. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/__init__.py +1 -1
  27. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/cli.py +6 -0
  28. ethraid-3.2.0/ethraid/compiled/_kepler.cpython-312-darwin.so +0 -0
  29. ethraid-3.2.0/ethraid/compiled/_kepler.cpython-314-darwin.so +0 -0
  30. ethraid-3.2.0/ethraid/compiled/_kepler.cpython-37m-darwin.so +0 -0
  31. ethraid-3.2.0/ethraid/compiled/ethraid/c_kepler/_kepler.c +30666 -0
  32. ethraid-3.2.0/ethraid/compiled/ethraid/helper_functions_astro.c +36322 -0
  33. ethraid-3.2.0/ethraid/compiled/ethraid/helper_functions_general.c +41777 -0
  34. ethraid-3.2.0/ethraid/compiled/ethraid/helper_functions_imaging.c +36751 -0
  35. ethraid-3.2.0/ethraid/compiled/ethraid/helper_functions_rv.c +31569 -0
  36. ethraid-3.2.0/ethraid/compiled/helper_functions_astro.cpython-312-darwin.so +0 -0
  37. ethraid-3.2.0/ethraid/compiled/helper_functions_astro.cpython-314-darwin.so +0 -0
  38. ethraid-3.2.0/ethraid/compiled/helper_functions_astro.cpython-37m-darwin.so +0 -0
  39. ethraid-3.2.0/ethraid/compiled/helper_functions_general.cpython-312-darwin.so +0 -0
  40. ethraid-3.2.0/ethraid/compiled/helper_functions_general.cpython-314-darwin.so +0 -0
  41. ethraid-3.2.0/ethraid/compiled/helper_functions_general.cpython-37m-darwin.so +0 -0
  42. ethraid-3.2.0/ethraid/compiled/helper_functions_imaging.cpython-312-darwin.so +0 -0
  43. ethraid-3.2.0/ethraid/compiled/helper_functions_imaging.cpython-314-darwin.so +0 -0
  44. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/compiled/helper_functions_imaging.cpython-37m-darwin.so +0 -0
  45. ethraid-3.2.0/ethraid/compiled/helper_functions_rv.cpython-312-darwin.so +0 -0
  46. ethraid-3.2.0/ethraid/compiled/helper_functions_rv.cpython-314-darwin.so +0 -0
  47. ethraid-3.2.0/ethraid/compiled/helper_functions_rv.cpython-37m-darwin.so +0 -0
  48. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/driver.py +41 -23
  49. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/helper_functions_astro.pyx +33 -11
  50. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/helper_functions_general.pyx +244 -43
  51. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/helper_functions_imaging.pyx +2 -2
  52. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/helper_functions_plotting.py +0 -2
  53. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/load_save.py +36 -28
  54. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/plotter.py +30 -38
  55. {ethraid-2.5.2 → ethraid-3.2.0/ethraid.egg-info}/PKG-INFO +28 -7
  56. ethraid-3.2.0/ethraid.egg-info/SOURCES.txt +84 -0
  57. ethraid-3.2.0/ethraid.egg-info/requires.txt +10 -0
  58. ethraid-3.2.0/pyproject.toml +8 -0
  59. ethraid-3.2.0/requirements.txt +10 -0
  60. {ethraid-2.5.2 → ethraid-3.2.0}/setup.py +2 -11
  61. ethraid-2.5.2/ethraid/compiled/_kepler.cpython-37m-darwin.so +0 -0
  62. ethraid-2.5.2/ethraid/compiled/ethraid/c_kepler/_kepler.c +0 -23772
  63. ethraid-2.5.2/ethraid/compiled/ethraid/helper_functions_astro.c +0 -29015
  64. ethraid-2.5.2/ethraid/compiled/ethraid/helper_functions_general.c +0 -33517
  65. ethraid-2.5.2/ethraid/compiled/ethraid/helper_functions_imaging.c +0 -30093
  66. ethraid-2.5.2/ethraid/compiled/ethraid/helper_functions_rv.c +0 -24856
  67. ethraid-2.5.2/ethraid/compiled/helper_functions_astro.cpython-37m-darwin.so +0 -0
  68. ethraid-2.5.2/ethraid/compiled/helper_functions_general.cpython-37m-darwin.so +0 -0
  69. ethraid-2.5.2/ethraid/compiled/helper_functions_rv.cpython-37m-darwin.so +0 -0
  70. ethraid-2.5.2/ethraid.egg-info/SOURCES.txt +0 -50
  71. ethraid-2.5.2/ethraid.egg-info/requires.txt +0 -10
  72. ethraid-2.5.2/requirements.txt +0 -10
  73. {ethraid-2.5.2 → ethraid-3.2.0}/LICENSE +0 -0
  74. {ethraid-2.5.2 → ethraid-3.2.0}/MANIFEST.in +0 -0
  75. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/c_kepler/__init__.py +0 -0
  76. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/c_kepler/_kepler.c +0 -0
  77. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/c_kepler/_kepler.pyx +0 -0
  78. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/c_kepler/kepler.c +0 -0
  79. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/c_kepler/radvel_requirements.txt +0 -0
  80. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/c_kepler/radvel_setup.py +0 -0
  81. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/compiled/ethraid/c_kepler/kepler.c +0 -0
  82. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/data/.DS_Store +0 -0
  83. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/data/TOI1694_832.csv +0 -0
  84. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/data/bands.csv +0 -0
  85. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/data/baraffe_table1.csv +0 -0
  86. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/data/baraffe_table2.csv +0 -0
  87. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/data/baraffe_table3.csv +0 -0
  88. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/data/baraffe_table4.csv +0 -0
  89. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/data/baraffe_table5.csv +0 -0
  90. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/data/mamajek.csv +0 -0
  91. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/data/test_K_band.csv +0 -0
  92. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/data/test_K_band_altered.csv +0 -0
  93. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/helper_functions_rv.pyx +0 -0
  94. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid/kern_profiler_dummy.py +0 -0
  95. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid.egg-info/dependency_links.txt +0 -0
  96. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid.egg-info/entry_points.txt +0 -0
  97. {ethraid-2.5.2 → ethraid-3.2.0}/ethraid.egg-info/top_level.txt +0 -0
  98. {ethraid-2.5.2 → ethraid-3.2.0}/setup.cfg +0 -0
@@ -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
@@ -0,0 +1,11 @@
1
+ #cython: language_level=3
2
+
3
+ """
4
+ Make sure cython can compile in limited API mode (see meson.build)
5
+ """
6
+
7
+ cdef extern from "numpy/arrayobject.h":
8
+ pass
9
+ cdef extern from "numpy/arrayscalars.h":
10
+ pass
11
+
@@ -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
+
@@ -1,35 +1,56 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: ethraid
3
- Version: 2.5.2
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, Accepted) and the following DOI if you make use of this software in your research.
36
+ Please cite Van Zandt \& Petigura (2024) and the following DOI if you make use of this software in your research.
16
37
  [![DOI](https://zenodo.org/badge/355760029.svg)](https://zenodo.org/doi/10.5281/zenodo.10841606)
17
38
 
18
39
  ## Environment
19
- ### Create new environment with python 3.7
20
- - *\$ conda create --name ethraid_env python=3.7*
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
24
45
  - *\$ pip install ethraid*
25
46
  - If the installation fails, try upgrading pip: *\$ curl https://bootstrap.pypa.io/get-pip.py | python*
26
47
 
27
- ## Download repo from Github
48
+ ## OR Download repo from Github
28
49
  ### Install dependencies using requirements.txt
29
50
  - *\$ pip install -r requirements.txt*
30
51
 
31
52
  ### Build code from top level of repo
32
- - *\$ cd trends/*
53
+ - *\$ cd ethraid/*
33
54
  - *\$ python setup.py build_ext --inplace*
34
55
 
35
56
  ### Run 3 simple test configuration files to ensure all API and CLI functions are working correctly
@@ -1,25 +1,29 @@
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, Accepted) and the following DOI if you make use of this software in your research.
9
+ Please cite Van Zandt \& Petigura (2024) and the following DOI if you make use of this software in your research.
6
10
  [![DOI](https://zenodo.org/badge/355760029.svg)](https://zenodo.org/doi/10.5281/zenodo.10841606)
7
11
 
8
12
  ## Environment
9
- ### Create new environment with python 3.7
10
- - *\$ conda create --name ethraid_env python=3.7*
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
14
18
  - *\$ pip install ethraid*
15
19
  - If the installation fails, try upgrading pip: *\$ curl https://bootstrap.pypa.io/get-pip.py | python*
16
20
 
17
- ## Download repo from Github
21
+ ## OR Download repo from Github
18
22
  ### Install dependencies using requirements.txt
19
23
  - *\$ pip install -r requirements.txt*
20
24
 
21
25
  ### Build code from top level of repo
22
- - *\$ cd trends/*
26
+ - *\$ cd ethraid/*
23
27
  - *\$ python setup.py build_ext --inplace*
24
28
 
25
29
  ### Run 3 simple test configuration files to ensure all API and CLI functions are working correctly
@@ -1,7 +1,7 @@
1
1
  import os
2
2
  from astropy.time import Time
3
3
 
4
- __version__='2.5.2' # Remember to remove random seed
4
+ __version__='3.2.0' # Remember to remove random seed
5
5
 
6
6
  _ROOT = os.path.abspath(os.path.dirname(__file__))
7
7
 
@@ -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()