Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LISA Instrument
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LISA Simulation
LISA Instrument
Commits
d7ee03d8
Commit
d7ee03d8
authored
4 months ago
by
Wolfgang Kastaun
Browse files
Options
Downloads
Patches
Plain Diff
fix faulty type annotations and improve others
parent
25815707
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lisainstrument/dynamic_delay_dask.py
+13
-17
13 additions, 17 deletions
lisainstrument/dynamic_delay_dask.py
lisainstrument/dynamic_delay_numpy.py
+15
-13
15 additions, 13 deletions
lisainstrument/dynamic_delay_numpy.py
with
28 additions
and
30 deletions
lisainstrument/dynamic_delay_dask.py
+
13
−
17
View file @
d7ee03d8
...
@@ -5,7 +5,7 @@ Use make_dynamic_shift_lagrange_dask to create a Lagrange interpolator for dask
...
@@ -5,7 +5,7 @@ Use make_dynamic_shift_lagrange_dask to create a Lagrange interpolator for dask
from
__future__
import
annotations
from
__future__
import
annotations
from
typing
import
Callable
from
typing
import
Callable
,
Final
import
dask
import
dask
import
dask.array
as
da
import
dask.array
as
da
...
@@ -18,11 +18,7 @@ from lisainstrument.dynamic_delay_numpy import (
...
@@ -18,11 +18,7 @@ from lisainstrument.dynamic_delay_numpy import (
RegularInterpMethod
,
RegularInterpMethod
,
)
)
from
lisainstrument.fir_filters_dask
import
DaskArray1D
,
make_dask_array_1d
from
lisainstrument.fir_filters_dask
import
DaskArray1D
,
make_dask_array_1d
from
lisainstrument.fir_filters_numpy
import
(
from
lisainstrument.fir_filters_numpy
import
NumpyArray1D
,
make_numpy_array_1d
EdgeHandling
,
NumpyArray1D
,
make_numpy_array_1d
,
)
class
DynamicShiftDask
:
class
DynamicShiftDask
:
...
@@ -48,8 +44,8 @@ class DynamicShiftDask:
...
@@ -48,8 +44,8 @@ class DynamicShiftDask:
self
,
self
,
min_delay
:
float
,
min_delay
:
float
,
max_delay
:
float
,
max_delay
:
float
,
left_bound
:
EdgeHandling
,
left_bound
:
DynShiftBC
,
right_bound
:
EdgeHandling
,
right_bound
:
DynShiftBC
,
interp
:
RegularInterpMethod
,
interp
:
RegularInterpMethod
,
):
):
"""
Set up interpolation parameters
"""
Set up interpolation parameters
...
@@ -66,12 +62,12 @@ class DynamicShiftDask:
...
@@ -66,12 +62,12 @@ class DynamicShiftDask:
msg
=
f
"
dynamic_shift_dask: invalid delay range
{
min_delay
=
}
,
{
max_delay
=
}
"
msg
=
f
"
dynamic_shift_dask: invalid delay range
{
min_delay
=
}
,
{
max_delay
=
}
"
raise
ValueError
(
msg
)
raise
ValueError
(
msg
)
self
.
_min_delay
=
int
(
np
.
floor
(
min_delay
))
self
.
_min_delay
:
Final
[
int
]
=
int
(
np
.
floor
(
min_delay
))
self
.
_max_delay
=
int
(
np
.
ceil
(
max_delay
))
self
.
_max_delay
:
Final
[
int
]
=
int
(
np
.
ceil
(
max_delay
))
self
.
_left_bound
=
left_bound
self
.
_left_bound
:
Final
=
left_bound
self
.
_right_bound
=
right_bound
self
.
_right_bound
:
Final
=
right_bound
self
.
_interp_np
=
interp
self
.
_interp_np
:
Final
=
interp
def
_op_interp
(
def
_op_interp
(
self
,
samp
:
np
.
ndarray
,
loc
:
np
.
ndarray
,
ofs
:
np
.
ndarray
self
,
samp
:
np
.
ndarray
,
loc
:
np
.
ndarray
,
ofs
:
np
.
ndarray
...
@@ -171,8 +167,8 @@ class DynamicShiftDask:
...
@@ -171,8 +167,8 @@ class DynamicShiftDask:
def
make_dynamic_shift_linear_dask
(
def
make_dynamic_shift_linear_dask
(
min_delay
:
float
,
min_delay
:
float
,
max_delay
:
float
,
max_delay
:
float
,
left_bound
:
EdgeHandling
,
left_bound
:
DynShiftBC
,
right_bound
:
EdgeHandling
,
right_bound
:
DynShiftBC
,
)
->
DynamicShiftDask
:
)
->
DynamicShiftDask
:
"""
Set up DynamicShiftDask instance with linear interpolation method.
"""
Set up DynamicShiftDask instance with linear interpolation method.
...
@@ -193,8 +189,8 @@ def make_dynamic_shift_lagrange_dask(
...
@@ -193,8 +189,8 @@ def make_dynamic_shift_lagrange_dask(
length
:
int
,
length
:
int
,
min_delay
:
float
,
min_delay
:
float
,
max_delay
:
float
,
max_delay
:
float
,
left_bound
:
EdgeHandling
,
left_bound
:
DynShiftBC
,
right_bound
:
EdgeHandling
,
right_bound
:
DynShiftBC
,
)
->
DynamicShiftDask
:
)
->
DynamicShiftDask
:
"""
Set up DynamicShiftDask instance with Lagrange interpolation method.
"""
Set up DynamicShiftDask instance with Lagrange interpolation method.
...
...
This diff is collapsed.
Click to expand it.
lisainstrument/dynamic_delay_numpy.py
+
15
−
13
View file @
d7ee03d8
...
@@ -8,7 +8,7 @@ from __future__ import annotations
...
@@ -8,7 +8,7 @@ from __future__ import annotations
import
functools
import
functools
import
operator
import
operator
from
enum
import
Enum
from
enum
import
Enum
from
typing
import
Callable
,
Protocol
from
typing
import
Final
,
Protocol
import
numpy
as
np
import
numpy
as
np
from
numpy.polynomial
import
Polynomial
from
numpy.polynomial
import
Polynomial
...
@@ -181,9 +181,11 @@ class RegularInterpLagrange(RegularInterpMethod):
...
@@ -181,9 +181,11 @@ class RegularInterpLagrange(RegularInterpMethod):
raise
ValueError
(
msg
)
raise
ValueError
(
msg
)
offset
=
-
((
length
-
1
)
//
2
)
offset
=
-
((
length
-
1
)
//
2
)
self
.
_length
:
int
=
length
self
.
_length
:
Final
[
int
]
=
length
self
.
_offset
:
int
=
offset
self
.
_offset
:
Final
[
int
]
=
offset
self
.
_fir_filt
=
self
.
_make_firs
(
length
,
offset
)
self
.
_fir_filt
:
Final
[
list
[
FilterFirNumpyType
]]
=
self
.
_make_firs
(
length
,
offset
)
@property
@property
def
margin_left
(
self
)
->
int
:
def
margin_left
(
self
)
->
int
:
...
@@ -328,8 +330,8 @@ class DynamicShiftNumpy:
...
@@ -328,8 +330,8 @@ class DynamicShiftNumpy:
self
,
self
,
min_delay
:
float
,
min_delay
:
float
,
max_delay
:
float
,
max_delay
:
float
,
left_bound
:
EdgeHandling
,
left_bound
:
DynShiftBC
,
right_bound
:
EdgeHandling
,
right_bound
:
DynShiftBC
,
interp
:
RegularInterpMethod
,
interp
:
RegularInterpMethod
,
):
):
...
@@ -337,12 +339,12 @@ class DynamicShiftNumpy:
...
@@ -337,12 +339,12 @@ class DynamicShiftNumpy:
msg
=
f
"
dynamic_shift_dask: invalid delay range
{
min_delay
=
}
,
{
max_delay
=
}
"
msg
=
f
"
dynamic_shift_dask: invalid delay range
{
min_delay
=
}
,
{
max_delay
=
}
"
raise
ValueError
(
msg
)
raise
ValueError
(
msg
)
self
.
_min_delay
=
int
(
np
.
floor
(
min_delay
))
self
.
_min_delay
:
Final
[
int
]
=
int
(
np
.
floor
(
min_delay
))
self
.
_max_delay
=
int
(
np
.
ceil
(
max_delay
))
self
.
_max_delay
:
Final
[
int
]
=
int
(
np
.
ceil
(
max_delay
))
self
.
_left_bound
=
left_bound
self
.
_left_bound
:
Final
=
left_bound
self
.
_right_bound
=
right_bound
self
.
_right_bound
:
Final
=
right_bound
self
.
_interp_np
=
interp
self
.
_interp_np
:
Final
=
interp
def
_op_interp
(
def
_op_interp
(
self
,
samp
:
np
.
ndarray
,
loc
:
np
.
ndarray
,
ofs
:
np
.
ndarray
self
,
samp
:
np
.
ndarray
,
loc
:
np
.
ndarray
,
ofs
:
np
.
ndarray
...
@@ -436,8 +438,8 @@ def make_dynamic_shift_lagrange_numpy(
...
@@ -436,8 +438,8 @@ def make_dynamic_shift_lagrange_numpy(
length
:
int
,
length
:
int
,
min_delay
:
float
,
min_delay
:
float
,
max_delay
:
float
,
max_delay
:
float
,
left_bound
:
EdgeHandling
,
left_bound
:
DynShiftBC
,
right_bound
:
EdgeHandling
,
right_bound
:
DynShiftBC
,
)
->
DynamicShiftNumpy
:
)
->
DynamicShiftNumpy
:
"""
Set up DynamicShiftNumpy instance with Lagrange interpolation method.
"""
Set up DynamicShiftNumpy instance with Lagrange interpolation method.
...
...
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