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
6b586dce
Commit
6b586dce
authored
3 months ago
by
Wolfgang Kastaun
Browse files
Options
Downloads
Patches
Plain Diff
Added some static exhaustiveness checks for boundary handling enums
parent
d7ee03d8
No related branches found
Branches containing commit
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
+7
-2
7 additions, 2 deletions
lisainstrument/dynamic_delay_dask.py
lisainstrument/dynamic_delay_numpy.py
+7
-2
7 additions, 2 deletions
lisainstrument/dynamic_delay_numpy.py
with
14 additions
and
4 deletions
lisainstrument/dynamic_delay_dask.py
+
7
−
2
View file @
6b586dce
...
...
@@ -10,6 +10,7 @@ from typing import Callable, Final
import
dask
import
dask.array
as
da
import
numpy
as
np
from
typing_extensions
import
assert_never
from
lisainstrument.dynamic_delay_numpy
import
(
DynShiftBC
,
...
...
@@ -121,12 +122,14 @@ class DynamicShiftDask:
case
DynShiftBC
.
FLAT
:
npad_left
=
self
.
margin_left
samples
=
da
.
concatenate
([
da
.
ones
(
npad_left
)
*
samples
[
0
],
samples
])
case
_
:
case
DynShiftBC
.
EXCEPTION
:
msg
=
(
f
"
DynamicShiftDask: left edge handling
{
self
.
_left_bound
.
name
}
not
"
f
"
possible for given max delay
{
self
.
_max_delay
}
.
"
)
raise
RuntimeError
(
msg
)
case
_
as
unreachable
:
assert_never
(
unreachable
)
if
self
.
margin_right
>
0
:
match
self
.
_right_bound
:
...
...
@@ -136,12 +139,14 @@ class DynamicShiftDask:
samples
=
da
.
concatenate
(
[
samples
,
da
.
ones
(
self
.
margin_right
)
*
samples
[
-
1
]]
)
case
_
:
case
DynShiftBC
.
EXCEPTION
:
msg
=
(
f
"
DynamicShiftDask: right edge handling
{
self
.
_right_bound
.
name
}
not
"
f
"
possible for given min delay
{
self
.
_min_delay
=
}
.
"
)
raise
RuntimeError
(
msg
)
case
_
as
unreachable
:
assert_never
(
unreachable
)
chunks
=
shift
.
to_delayed
()
delayed_op
=
dask
.
delayed
(
self
.
_op_interp
)
...
...
This diff is collapsed.
Click to expand it.
lisainstrument/dynamic_delay_numpy.py
+
7
−
2
View file @
6b586dce
...
...
@@ -12,6 +12,7 @@ from typing import Final, Protocol
import
numpy
as
np
from
numpy.polynomial
import
Polynomial
from
typing_extensions
import
assert_never
from
lisainstrument.fir_filters_numpy
import
(
DefFilterFIR
,
...
...
@@ -398,12 +399,14 @@ class DynamicShiftNumpy:
case
DynShiftBC
.
FLAT
:
npad_left
=
self
.
margin_left
samples
=
np
.
concatenate
([
np
.
ones
(
npad_left
)
*
samples
[
0
],
samples
])
case
_
:
case
DynShiftBC
.
EXCEPTION
:
msg
=
(
f
"
DynamicShiftNumpy: left edge handling
{
self
.
_left_bound
.
name
}
not
"
f
"
possible for given max delay
{
self
.
_max_delay
}
.
"
)
raise
RuntimeError
(
msg
)
case
_
as
unreachable
:
assert_never
(
unreachable
)
if
self
.
margin_right
>
0
:
match
self
.
_right_bound
:
...
...
@@ -413,12 +416,14 @@ class DynamicShiftNumpy:
samples
=
np
.
concatenate
(
[
samples
,
np
.
ones
(
self
.
margin_right
)
*
samples
[
-
1
]]
)
case
_
:
case
DynShiftBC
.
EXCEPTION
:
msg
=
(
f
"
DynamicShiftNumpy: right edge handling
{
self
.
_right_bound
.
name
}
not
"
f
"
possible for given min delay
{
self
.
_min_delay
=
}
.
"
)
raise
RuntimeError
(
msg
)
case
_
as
unreachable
:
assert_never
(
unreachable
)
pos
=
0
shift_shape
=
len
(
shift
)
...
...
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