Skip to content

Commit d6a6392

Browse files
committed
Add wrap option for legacy
1 parent 637c12e commit d6a6392

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ibllib/atlas/atlas.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ def x2i(self, x, round=True, mode='raise'):
118118
i[i >= self.nx] = self.nx - 1
119119
elif mode == 'raise':
120120
raise ValueError("At least one x value lies outside of the atlas volume.")
121+
elif mode == 'wrap':
122+
pass
121123
return i
122124

123125
def y2i(self, y, round=True, mode='raise'):
@@ -128,6 +130,8 @@ def y2i(self, y, round=True, mode='raise'):
128130
i[i >= self.ny] = self.ny - 1
129131
elif mode == 'raise':
130132
raise ValueError("At least one y value lies outside of the atlas volume.")
133+
elif mode == 'wrap':
134+
pass
131135
return i
132136

133137
def z2i(self, z, round=True, mode='raise'):
@@ -138,13 +142,16 @@ def z2i(self, z, round=True, mode='raise'):
138142
i[i >= self.nz] = self.nz - 1
139143
elif mode == 'raise':
140144
raise ValueError("At least one z value lies outside of the atlas volume.")
145+
elif mode == 'wrap':
146+
pass
141147
return i
142148

143149
def xyz2i(self, xyz, round=True, mode='raise'):
144150
"""
145-
:param mode: {‘raise’} determines what to do when determined index lies outside the atlas volume
151+
:param mode: {‘raise’, 'clip', 'wrap'} determines what to do when determined index lies outside the atlas volume
146152
'raise' will raise a ValueError
147153
'clip' will replace the index with the closest index inside the volume
154+
'wrap' will wrap around to the other side of the volume. This is only here for legacy reasons
148155
"""
149156
xyz = np.array(xyz)
150157
dt = int if round else float

0 commit comments

Comments
 (0)