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
1dd5f89f
Commit
1dd5f89f
authored
3 weeks ago
by
Wolfgang Kastaun
Browse files
Options
Downloads
Patches
Plain Diff
Improve docstrings for dynamic time shift modules
parent
f2caf57e
No related branches found
No related tags found
No related merge requests found
Pipeline
#393328
passed
3 weeks ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lisainstrument/dynamic_delay_dask.py
+51
-1
51 additions, 1 deletion
lisainstrument/dynamic_delay_dask.py
lisainstrument/dynamic_delay_numpy.py
+4
-1
4 additions, 1 deletion
lisainstrument/dynamic_delay_numpy.py
with
55 additions
and
2 deletions
lisainstrument/dynamic_delay_dask.py
+
51
−
1
View file @
1dd5f89f
"""
Functions for applying dynamic real-valued shifts to dask arrays using Lagrange interpolation
Use make_dynamic_shift_lagrange_dask to create a Lagrange interpolator for dask arrays.
The main class in this module is DynamicShiftDask. It allows to perform a time-shifting
opration on a dask array, with time-dependent time shift. This class is used in
lisainstrument.Instrument for applying all non-const delays. For the special case of fixed
time shifts, see module fixed_shift_dask.
The interpolation method to be used is provided by the user in form of an object
implementing the RegularInterpolator protocol defined in the module
lisainstrument.regular_interpolators. This interpolation engine is based on numpy
arrays. It is used for the main work of time-shifting each chunk of data. The
RegularInterpolator protocol is not responsible for setting up boundary conditions.
Internal and external boundaries are handled by DynamicShiftDask itself.
The other parameters that determine the DynamicShiftDask behavior are collected
in a class DynShiftCfg (see module dynamic_delay_numpy). DynShiftCfg includes limits
for the allowable minimum and maximum time shift. Those have to be supplied by the user
because they cannot be determined from the data as this would require evaluating the
whole timeshift dask array before doing the interpolation.
The convenience functions make_dynamic_shift_lagrange_dask() and
make_dynamic_shift_linear_dask() return a DynamicShiftDask instance
employing Lagrange or linear interpolation, respectively. For testing,
there is another Lagrange interpolator based on the legacy dsp.timeshift
code. Use lisainstrument.dynamic_delay_dsp.make_dynamic_shift_dsp_dask()
to obtain a corresponding DynamicShiftDask instance.
For testing, there is a function numpyfy_dask_multi() which turns a dask-based
time-shift operator into one operating on numpy arrays, using dask only internally.
Example use:
>>>
op
=
make_dynamic_shift_lagrange_dask
(
order
=
31
,
min_delay
=-
2.
,
max_delay
=
21.
,
left_bound
=
ShiftBC
.
FLAT
,
right_bound
=
ShiftBC
.
EXCEPTION
)
>>>
delay_dask
=
da
.
linspace
(
-
1.2
,
20.4
,
100
)
>>>
data_dask
=
da
.
linspace
(
0
,
1
,
len
(
delay
)
>>>
shifted_data_dask
=
op
(
data_dask
,
-
delay_dask
)
Internally, the module works as follows. DynamicShiftDask contains a
user-provided RegularInterpolator. The latter can interpolate to points
within the given data, minus a margin size defined by RegularInterpolator
implementations. For each chunk of the timeshift, DynamicShiftNumpy
interpolates the required region of data using RegularInterpolator.
The size of the required region for a give chunk depends on the margins needed
by the interpolator as well as the fixed limits specified for the timeshift.
Further, the outer boundaries of the dask array are padded with margins
filled according to the selected boundary conditions.
"""
from
__future__
import
annotations
...
...
This diff is collapsed.
Click to expand it.
lisainstrument/dynamic_delay_numpy.py
+
4
−
1
View file @
1dd5f89f
...
...
@@ -22,7 +22,10 @@ is required to behave exactly like DynamicShiftDask.
The convenience functions make_dynamic_shift_lagrange_numpy() and
make_dynamic_shift_linear_numpy() return a DynamicShiftNumpy instance
employing Lagrange or linear interpolation, respectively.
employing Lagrange or linear interpolation, respectively. For testing,
there is another Lagrange interpolator based on the legacy dsp.timeshift
code. Use lisainstrument.dynamic_delay_dsp.make_dynamic_shift_dsp_numpy()
to obtain a corresponding DynamicShiftNumpy instance.
Example use:
...
...
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