Skip to content

Commit 3c0fc62

Browse files
committed
Capitalizing the class names for Seq, Index, ParallelRange and Cell
1 parent 71b0955 commit 3c0fc62

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

arrayfire/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
#do not export internal classes
3535
del BaseArray
3636
del uidx
37-
del seq
38-
del index
39-
del cell
37+
del Seq
38+
del Index
39+
del Cell
4040
del bcast
4141

4242
#do not export internal functions

arrayfire/features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from .array import *
1111
import numbers
1212

13-
class features(object):
13+
class Features(object):
1414

1515
def __init__(self, num=None):
1616
self.feat = ct.c_void_p(0)

arrayfire/graphics.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from .library import *
1111
from .array import *
1212

13-
class cell(ct.Structure):
13+
class Cell(ct.Structure):
1414
_fields_ = [("row", ct.c_int),
1515
("col", ct.c_int),
1616
("title", ct.c_char_p),
@@ -52,15 +52,15 @@ def set_colormap(self, cmap):
5252
self._cmap = cmap
5353

5454
def image(self, img, title=None):
55-
_cell = cell(self._r, self._c, title, self._cmap)
55+
_cell = Cell(self._r, self._c, title, self._cmap)
5656
safe_call(clib.af_draw_image(self._wnd, img.arr, ct.pointer(_cell)))
5757

5858
def plot(self, X, Y, title=None):
59-
_cell = cell(self._r, self._c, title, self._cmap)
59+
_cell = Cell(self._r, self._c, title, self._cmap)
6060
safe_call(clib.af_draw_plot(self._wnd, X.arr, Y.arr, ct.pointer(_cell)))
6161

6262
def hist(self, X, min_val, max_val, title=None):
63-
_cell = cell(self._r, self._c, title, self._cmap)
63+
_cell = Cell(self._r, self._c, title, self._cmap)
6464
safe_call(clib.af_draw_hist(self._wnd, X.arr, \
6565
ct.c_double(max_val), ct.c_double(min_val),\
6666
ct.pointer(_cell)))

arrayfire/index.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from .base import *
1212
from .broadcast import *
1313

14-
class seq(ct.Structure):
14+
class Seq(ct.Structure):
1515
_fields_ = [("begin", ct.c_double),
1616
("end" , ct.c_double),
1717
("step" , ct.c_double)]
@@ -36,7 +36,7 @@ def __init__ (self, S):
3636
else:
3737
raise IndexError("Invalid type while indexing arrayfire.array")
3838

39-
class parallel_range(seq):
39+
class ParallelRange(Seq):
4040

4141
def __init__(self, start, stop=None, step=None):
4242

@@ -45,7 +45,7 @@ def __init__(self, start, stop=None, step=None):
4545
start = 0
4646

4747
self.S = slice(start, stop, step)
48-
super(parallel_range, self).__init__(self.S)
48+
super(ParallelRange, self).__init__(self.S)
4949

5050
def __iter__(self):
5151
return self
@@ -81,9 +81,9 @@ def slice_to_length(key, dim):
8181

8282
class uidx(ct.Union):
8383
_fields_ = [("arr", ct.c_void_p),
84-
("seq", seq)]
84+
("seq", Seq)]
8585

86-
class index(ct.Structure):
86+
class Index(ct.Structure):
8787
_fields_ = [("idx", uidx),
8888
("isSeq", ct.c_bool),
8989
("isBatch", ct.c_bool)]
@@ -97,26 +97,26 @@ def __init__ (self, idx):
9797
if isinstance(idx, BaseArray):
9898
self.idx.arr = idx.arr
9999
self.isSeq = False
100-
elif isinstance(idx, parallel_range):
100+
elif isinstance(idx, ParallelRange):
101101
self.idx.seq = idx
102102
self.isBatch = True
103103
else:
104-
self.idx.seq = seq(idx)
104+
self.idx.seq = Seq(idx)
105105

106106
def get_indices(key, n_dims):
107107

108-
index_vec = index * n_dims
108+
index_vec = Index * n_dims
109109
inds = index_vec()
110110

111111
for n in range(n_dims):
112-
inds[n] = index(slice(None))
112+
inds[n] = Index(slice(None))
113113

114114
if isinstance(key, tuple):
115115
n_idx = len(key)
116116
for n in range(n_idx):
117-
inds[n] = index(key[n])
117+
inds[n] = Index(key[n])
118118
else:
119-
inds[0] = index(key)
119+
inds[0] = Index(key)
120120

121121
return inds
122122

@@ -133,7 +133,7 @@ def get_assign_dims(key, idims):
133133
elif isinstance(key, slice):
134134
dims[0] = slice_to_length(key, idims[0])
135135
return dims
136-
elif isinstance(key, parallel_range):
136+
elif isinstance(key, ParallelRange):
137137
dims[0] = slice_to_length(key.S, idims[0])
138138
return dims
139139
elif isinstance(key, BaseArray):
@@ -152,7 +152,7 @@ def get_assign_dims(key, idims):
152152
dims[n] = key[n].elements()
153153
elif (isinstance(key[n], slice)):
154154
dims[n] = slice_to_length(key[n], idims[n])
155-
elif (isinstance(key[n], parallel_range)):
155+
elif (isinstance(key[n], ParallelRange)):
156156
dims[n] = slice_to_length(key[n].S, idims[n])
157157
else:
158158
raise IndexError("Invalid type while assigning to arrayfire.array")

arrayfire/vision.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
from .features import *
1212

1313
def fast(image, threshold=20.0, arc_length=9, non_max=True, feature_ratio=0.05, edge=3):
14-
out = features()
14+
out = Features()
1515
safe_call(clib.af_fast(ct.pointer(out.feat),\
1616
image.arr, ct.c_float(threshold), ct.c_uint(arc_length), non_max, \
1717
ct.c_float(feature_ratio), ct.c_uint(edge)))
1818
return out
1919

2020
def orb(image, threshold=20.0, max_features=400, scale = 1.5, num_levels = 4, blur_image = False):
21-
feat = features()
21+
feat = Features()
2222
desc = Array()
2323
safe_call(clib.af_orb(ct.pointer(feat.feat), ct.pointer(desc.arr),\
2424
ct.c_float(threshold), ct.c_uint(max_features),\

tests/simple_index.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# http://arrayfire.com/licenses/BSD-3-Clause
99
########################################################
1010
import arrayfire as af
11-
from arrayfire import parallel_range
11+
from arrayfire import ParallelRange
1212
import array as host
1313

1414
a = af.randu(5, 5)
@@ -50,11 +50,11 @@
5050
b = af.randu(5,1)
5151
af.display(a)
5252
af.display(b)
53-
for ii in parallel_range(1,3):
53+
for ii in ParallelRange(1,3):
5454
a[ii] = b[ii]
5555

5656
af.display(a)
5757

58-
for ii in parallel_range(2,5):
58+
for ii in ParallelRange(2,5):
5959
b[ii] = 2
6060
af.display(b)

0 commit comments

Comments
 (0)