1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
Description: Replace _fromnumpy by .fromnumpy in Python code
The fact that array_double_fromnumpy1 used to work was probably a bug.
Author: Thibaut Paumard <thibaut.paumard@obspm.fr>
Origin: upstream
Forwarded: not-needed
Last-Update: 2022-11-27
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/python/example-patterndisk.py
+++ b/python/example-patterndisk.py
@@ -19,15 +19,15 @@
# Get pointers in a format that Gyoto undestands.
# Warning: here we assume that size_t is the same as uint64.
gridshape=numpy.asarray( (1, 3, 11) , numpy.uint64)
-pgridshape=gyoto.core.array_size_t_fromnumpy1(gridshape)
+pgridshape=gyoto.core.array_size_t.fromnumpy1(gridshape)
opacity=numpy.zeros(gridshape)
-popacity=gyoto.core.array_double_fromnumpy3(opacity)
+popacity=gyoto.core.array_double.fromnumpy3(opacity)
opacity[:, 0::2, 0::2]=100.
opacity[:, 1::2, 1::2]=100.
intensity=opacity*0.+1.;
-pintensity=gyoto.core.array_double_fromnumpy3(intensity)
+pintensity=gyoto.core.array_double.fromnumpy3(intensity)
# Create PatternDisk, attach grids, set some parameters
pd=gyoto.std.PatternDisk()
@@ -94,7 +94,7 @@
grid=gyoto.core.Grid(ii, jj)
aop=gyoto.core.AstrobjProperties()
frame=numpy.zeros((screen.resolution(), screen.resolution()))
-pframe=gyoto.core.array_double_fromnumpy2(frame)
+pframe=gyoto.core.array_double.fromnumpy2(frame)
aop.intensity=pframe
sc.rayTrace(grid, aop)
plt.imshow(frame, origin='lower')
--- a/python/gyoto/animate.py
+++ b/python/gyoto/animate.py
@@ -424,7 +424,7 @@
The raytraced intensity as a NumPy array
'''
intensity=numpy.zeros((height, width))
- pintensity=core.array_double_fromnumpy2(intensity)
+ pintensity=core.array_double.fromnumpy2(intensity)
func(sc, k, nframes)
res=max(width, height)
sc.screen().resolution(res)
@@ -449,13 +449,13 @@
metric = core.Metric("KerrBL")
metric.mass(4e6, "sunmass");
gridshape=numpy.asarray( (1, 3, 11) , numpy.uint64)
- pgridshape=core.array_size_t_fromnumpy1(gridshape)
+ pgridshape=core.array_size_t.fromnumpy1(gridshape)
opacity=numpy.zeros(gridshape)
- popacity=core.array_double_fromnumpy3(opacity)
+ popacity=core.array_double.fromnumpy3(opacity)
opacity[:, 0::2, 0::2]=100.
opacity[:, 1::2, 1::2]=100.
intensity=opacity*0.+1.;
- pintensity=core.array_double_fromnumpy3(intensity)
+ pintensity=core.array_double.fromnumpy3(intensity)
pd=std.PatternDisk()
pd.velocityKind('ZAMO')
pd.copyIntensity(pintensity, pgridshape)
--- a/python/gyoto/util.py
+++ b/python/gyoto/util.py
@@ -169,12 +169,12 @@
if isinstance(coord2dset, core.Grid) and scalars is 0 :
dims=(ny, nx)
- array_double_fromnumpy1or2=core.array_double_fromnumpy2
- array_double_fromnumpy2or3=core.array_double_fromnumpy3
+ array_double_fromnumpy1or2=core.array_double.fromnumpy2
+ array_double_fromnumpy2or3=core.array_double.fromnumpy3
else:
dims=(ntot,)
- array_double_fromnumpy1or2=core.array_double_fromnumpy1
- array_double_fromnumpy2or3=core.array_double_fromnumpy2
+ array_double_fromnumpy1or2=core.array_double.fromnumpy1
+ array_double_fromnumpy2or3=core.array_double.fromnumpy2
# Prepare arrays to store results
res = dict()
@@ -322,9 +322,9 @@
raise ValueError('all arrays must be the same size')
core._core.Worldline_getCartesian(
self,
- core.array_double_fromnumpy1(t),
+ core.array_double.fromnumpy1(t),
t.size,
- *[core.array_double_fromnumpy1(v) for v in arrays]
+ *[core.array_double.fromnumpy1(v) for v in arrays]
)
# Same for getCoord
@@ -337,7 +337,7 @@
raise ValueError('all arrays must be the same size')
core._core.Worldline_getCoord(
self,
- core.array_double_fromnumpy1(t),
+ core.array_double.fromnumpy1(t),
t.size,
- *[core.array_double_fromnumpy1(v) for v in arrays]
+ *[core.array_double.fromnumpy1(v) for v in arrays]
)
|