Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
madarrays
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
skmad-suite
madarrays
Commits
9d3c57af
Commit
9d3c57af
authored
7 years ago
by
Ronan Hamon
Browse files
Options
Downloads
Patches
Plain Diff
Update ufunc in MadArray and Waveform
parent
f4cba663
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
madarrays/mad_array.py
+5
-1
5 additions, 1 deletion
madarrays/mad_array.py
madarrays/waveform.py
+2
-14
2 additions, 14 deletions
madarrays/waveform.py
with
7 additions
and
15 deletions
madarrays/mad_array.py
+
5
−
1
View file @
9d3c57af
...
...
@@ -98,6 +98,10 @@ def _complex_masking_only(f):
return
decorated
UFUNC_RETURNING_MADARRAYS
=
[
'
add
'
,
'
subtract
'
,
'
multiply
'
,
'
true_divide
'
,
'
floor_divide
'
,
'
floor
'
,
'
ceil
'
,
'
absolute
'
]
class
MadArray
(
np
.
ndarray
):
"""
Subclass of numpy.ndarray to handle data with missing elements.
...
...
@@ -351,7 +355,7 @@ class MadArray(np.ndarray):
new_results
=
[]
for
result
,
output
in
zip
(
results
,
outputs
):
if
output
is
None
:
if
not
ufunc
.
__name__
.
startswith
(
'
is
'
)
:
if
ufunc
.
__name__
in
UFUNC_RETURNING_MADARRAYS
:
new_results
.
append
(
np
.
asarray
(
result
).
view
(
MadArray
))
new_results
[
-
1
].
_mask
=
mask
new_results
[
-
1
].
_complex_masking
=
complex_masking
...
...
This diff is collapsed.
Click to expand it.
madarrays/waveform.py
+
2
−
14
View file @
9d3c57af
...
...
@@ -772,21 +772,9 @@ class Waveform(MadArray):
def
copy
(
self
):
return
Waveform
(
self
)
def
__add__
(
self
,
other
):
if
isinstance
(
other
,
Waveform
)
and
self
.
fs
!=
other
.
fs
:
errmsg
=
'
Waveforms do not have the same fs: {} and {}
'
raise
ValueError
(
errmsg
.
format
(
self
.
fs
,
other
.
fs
))
return
Waveform
(
super
().
__add__
(
other
),
fs
=
self
.
fs
)
def
__sub__
(
self
,
ma
):
return
self
.
__add__
(
-
ma
)
def
__eq__
(
self
,
other
):
if
isinstance
(
other
,
Waveform
)
and
self
.
fs
!=
other
.
fs
:
errmsg
=
'
Waveforms do not have the same fs: {} and {}
'
raise
ValueError
(
errmsg
.
format
(
self
.
fs
,
other
.
fs
))
# Test the compatability between Waveform
_
=
self
+
other
return
super
().
__eq__
(
other
)
def
is_equal
(
self
,
other
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment