Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit f8825b1

Browse files
committed
fix some integer and float definitions
1 parent 278d02b commit f8825b1

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

shesha/config/config_setter_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939

4040

4141
def enforce_int(n):
42-
if not isinstance(n, int):
42+
if not (isinstance(n, int) or isinstance(n, np.int32) or isinstance(n,
43+
np.int64)):
4344
raise TypeError("Value should be integer.")
4445
return n
4546

shesha/init/dm_init.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ def init_custom_dm(p_dm: conf.Param_dm, p_geom: conf.Param_geom, diam: float):
627627

628628
# Allocate influence function maps and other arrays
629629
p_dm._ntotact = ntotact
630-
p_dm._influsize = np.int(smallsize)
630+
p_dm._influsize = np.int32(smallsize)
631631
p_dm._i1 = np.zeros(ntotact, dtype=np.int32)
632632
p_dm._j1 = np.zeros(ntotact, dtype=np.int32)
633633
p_dm._xpos = np.zeros(ntotact, dtype=np.float32)
@@ -736,11 +736,11 @@ def make_kl_dm(p_dm: conf.Param_dm, patchDiam: int, p_geom: conf.Param_geom,
736736
print("KL type: ", p_dm.type_kl)
737737

738738
if (p_dm.nkl < 13):
739-
nr = np.long(5.0 * np.sqrt(52)) # one point per degree
740-
npp = np.long(10.0 * nr)
739+
nr = np.int64(5.0 * np.sqrt(52)) # one point per degree
740+
npp = np.int64(10.0 * nr)
741741
else:
742-
nr = np.long(5.0 * np.sqrt(p_dm.nkl))
743-
npp = np.long(10.0 * nr)
742+
nr = np.int64(5.0 * np.sqrt(p_dm.nkl))
743+
npp = np.int64(10.0 * nr)
744744

745745
radp = kl_util.make_radii(cobs, nr)
746746

shesha/util/kl_util.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## @package shesha.util.kl_util
1+
# @package shesha.util.kl_util
22
## @brief Functions for DM KL initialization
33
## @author COMPASS Team <https://github.com/ANR-COMPASS>
44
## @version 5.4.3
@@ -186,7 +186,7 @@ def radii(nr: int, npp: int, cobs: float) -> np.ndarray:
186186
r
187187
"""
188188

189-
r2 = cobs**2 + (np.arange(nr, dtype=np.float) + 0.) / nr * (1.0 - cobs**2)
189+
r2 = cobs**2 + (np.arange(nr, dtype=np.float32) + 0.) / nr * (1.0 - cobs**2)
190190
rs = np.sqrt(r2)
191191
r = np.transpose(np.tile(rs, (npp, 1)))
192192

@@ -215,7 +215,7 @@ def polang(r: np.ndarray) -> np.ndarray:
215215
s = r.shape
216216
nr = s[0]
217217
np1 = s[1]
218-
phi1 = np.arange(np1, dtype=np.float) / float(np1) * 2. * np.pi
218+
phi1 = np.arange(np1, dtype=np.float32) / float(np1) * 2. * np.pi
219219
p1, p2 = np.meshgrid(np.ones(nr), phi1)
220220
p = np.transpose(p2)
221221

@@ -348,7 +348,7 @@ def pcgeom(nr, npp, cobs, ncp, ncmar):
348348
"""
349349
nused = ncp - 2 * ncmar
350350
ff = 0.5 * nused
351-
hw = np.float(ncp - 1) / 2.
351+
hw = np.float32(ncp - 1) / 2.
352352

353353
r = radii(nr, npp, cobs)
354354
p = polang(r)
@@ -358,7 +358,7 @@ def pcgeom(nr, npp, cobs, ncp, ncmar):
358358
px = ff * px0 + hw
359359
py = ff * py0 + hw
360360
ax = np.reshape(
361-
np.arange(int(ncp)**2, dtype=np.float) + 1, (int(ncp), int(ncp)), order='F')
361+
np.arange(int(ncp)**2, dtype=np.float32) + 1, (int(ncp), int(ncp)), order='F')
362362
ax = np.float32(ax - 1) % ncp - 0.5 * (ncp - 1)
363363
ax = ax / (0.5 * nused)
364364
ay = np.transpose(ax)

shesha/util/make_pupil.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,8 +692,8 @@ def fillPolygon(x, y, i0, j0, scale, gap, N, index=0):
692692
# Last triangle has a special treatment because it crosses the axis
693693
# with theta=0=2pi
694694
n = x.shape[0] # number of corners of polygon
695-
indx, indy = (np.array([], dtype=np.int), np.array([], dtype=np.int))
696-
distedge = np.array([], dtype=np.float)
695+
indx, indy = (np.array([], dtype=np.int32), np.array([], dtype=np.int32))
696+
distedge = np.array([], dtype=np.float32)
697697
for i in range(n):
698698
j = i + 1 # j=element next i except when i==n : then j=0 (cycling)
699699
if j == n:

0 commit comments

Comments
 (0)