-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from LaurentRDC/develop
scikit-ued version 0.4.1
- Loading branch information
Showing
122 changed files
with
366 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
numpy>=1.11 | ||
nose==1.3.7 | ||
coverage==4.3.1 | ||
codecov==2.0.5 | ||
Sphinx>=1.5.1 | ||
Sphinx>=1.5.5 | ||
cython>=0.25 | ||
matplotlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
""" | ||
Array utility functions | ||
""" | ||
|
||
from itertools import repeat | ||
from numpy import concatenate | ||
|
||
def repeated_array(arr, num, axes = -1): | ||
""" | ||
Create a composite array from repeated copies of an array | ||
Parameters | ||
---------- | ||
arr : ndarray | ||
num : int or iterable of ints | ||
Number of copies per axis. If provided as tuple, must be the same length | ||
as 'axes' parameter. In case of `num` being 0 or an empty iterable, | ||
the inpur `arr` is returned. | ||
axes : int or iterable of ints | ||
Axis/axes over which to copy. | ||
Returns | ||
------- | ||
out : ndarray | ||
Raises | ||
------ | ||
ValueError | ||
If num and axes are tuples of different lengths. | ||
""" | ||
if not num: | ||
return arr | ||
|
||
if isinstance(num, int): num = (num,) | ||
if isinstance(axes, int): axes = (axes,) | ||
|
||
if len(num) != len(axes): | ||
raise ValueError('num and axes must have the same length') | ||
|
||
composite = concatenate(tuple(repeat(arr, times = num[0])), axis = axes[0]) | ||
|
||
if len(num) > 1: | ||
for n, ax in zip(num[1:], axes[1:]): | ||
composite = concatenate(tuple(repeat(composite, times = n)), axis = ax) | ||
|
||
return composite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.