Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qutil
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
qutech
qutil
Commits
a90c054b
Verified
Commit
a90c054b
authored
1 month ago
by
Tobias Hangleiter
Browse files
Options
Downloads
Patches
Plain Diff
Rename deriv_order -> order
parent
bb920dd4
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!175
Add missing imaginary unit in fourier_space.derivative
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
qutil/signal_processing/fourier_space.py
+8
-6
8 additions, 6 deletions
qutil/signal_processing/fourier_space.py
with
8 additions
and
6 deletions
qutil/signal_processing/fourier_space.py
+
8
−
6
View file @
a90c054b
...
...
@@ -46,6 +46,7 @@ import numpy as np
from
qutil
import
math
from
qutil.caching
import
cache
from
qutil.functools
import
wraps
from
qutil.misc
import
deprecate_kwarg
from
qutil.signal_processing._common
import
_parse_filter_edges
from
qutil.typecheck
import
check_literals
from
scipy
import
integrate
...
...
@@ -113,7 +114,8 @@ def Id(x: _S, f: _T, *_, **__) -> Tuple[_S, _T]:
return
x
,
f
def
derivative
(
x
,
f
,
deriv_order
:
int
=
0
,
overwrite_x
:
bool
=
False
,
@deprecate_kwarg
(
'
deriv_order
'
,
'
order
'
)
def
derivative
(
x
,
f
,
order
:
int
=
0
,
overwrite_x
:
bool
=
False
,
**
_
)
->
Tuple
[
np
.
ndarray
,
np
.
ndarray
]:
r
"""
Compute the (anti-)derivative.
...
...
@@ -127,8 +129,8 @@ def derivative(x, f, deriv_order: int = 0, overwrite_x: bool = False,
e^{i\omega t} \hat{f}(\omega)
.. note::
For negative ``
deriv_
order`` (antiderivatives), the
zero-frequency
component is set to zero (due to zero-division).
For negative ``order`` (antiderivatives), the
zero-frequency
component is set to zero (due to zero-division).
Parameters
----------
...
...
@@ -136,7 +138,7 @@ def derivative(x, f, deriv_order: int = 0, overwrite_x: bool = False,
Target data.
f : array_like
Frequencies corresponding to the last axis of `x`.
deriv_
order : int
order : int
The order of the derivative. If negative, the antiderivative is
computed (indefinite integral). Default: 0.
overwrite_x : bool, default False
...
...
@@ -145,8 +147,8 @@ def derivative(x, f, deriv_order: int = 0, overwrite_x: bool = False,
x
=
np
.
array
(
x
,
copy
=
not
overwrite_x
)
f
=
np
.
asanyarray
(
f
)
with
np
.
errstate
(
invalid
=
'
ignore
'
,
divide
=
'
ignore
'
):
x
*=
(
2j
*
np
.
pi
*
f
)
**
deriv_
order
if
deriv_
order
<
0
:
x
*=
(
2j
*
np
.
pi
*
f
)
**
order
if
order
<
0
:
x
[...,
(
f
==
0
).
nonzero
()]
=
0
return
x
,
f
...
...
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