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
Admin message
Gitlab has been updated. More info
here
and
there
.
Show more breadcrumbs
LISA Simulation
LISA Instrument
Commits
f2caf57e
Commit
f2caf57e
authored
4 weeks ago
by
Wolfgang Kastaun
Browse files
Options
Downloads
Patches
Plain Diff
Improved docstring for dynamic_delay_numpy module
parent
c0c18080
No related branches found
No related tags found
No related merge requests found
Pipeline
#393298
passed
4 weeks ago
Stage: test
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lisainstrument/dynamic_delay_numpy.py
+43
-1
43 additions, 1 deletion
lisainstrument/dynamic_delay_numpy.py
with
43 additions
and
1 deletion
lisainstrument/dynamic_delay_numpy.py
+
43
−
1
View file @
f2caf57e
"""
Functions for applying dynamic real-valued shifts to numpy arrays using Lagrange interpolation
"""
Functions for applying dynamic real-valued shifts to numpy arrays using Lagrange interpolation
Use make_dynamic_shift_lagrange_numpy to create a Lagrange interpolator for numpy arrays.
The main class in this module is DynamicShiftNumpy. It allows to perform a time-shifting
opration on a numpy array, with time-dependent time shift. The main purpose of this
class is for testing another class lisainstrument.dynamic_delay_dask.DynamicShiftDask,
which is equivalent but based on dask arrays instead numpy arrays. Both are supposed to
yield exactly identical results.
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 both by DynamicShiftNumpy and DynamicShiftDask for the main work.
The RegularInterpolator protocol is not responsible for setting up boundary conditions,
which is the responsability of DynamicShiftNumpy (and DynamicShiftDask).
The other parameters that determine the DynamicShiftNumpy behavior are collected
in a class DynShiftCfg. It contains the left and right boundary conditions. The available
options are defined by the ShiftBC enum class. DynShiftCfg also contains 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 in DynamicShiftDask and DynamicShiftNumpy
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.
Example use:
>>>
op
=
make_dynamic_shift_lagrange_numpy
(
order
=
31
,
min_delay
=-
2.
,
max_delay
=
21.
,
left_bound
=
ShiftBC
.
FLAT
,
right_bound
=
ShiftBC
.
EXCEPTION
)
>>>
delay
=
np
.
linspace
(
-
1.2
,
20.4
,
100
)
>>>
data
=
np
.
linspace
(
0
,
1
,
len
(
delay
)
>>>
shifted_data
=
op
(
data
,
-
delay
)
Internally, the module works as follows. DynamicShiftNumpy contains a
user-provided RegularInterpolator. The latter can interpolate to points
within the given data, minus a margin size defined by RegularInterpolator
implementations. Before calling RegularInterpolator, DynamicShiftNumpy
extends the data by suitable margins filled according to the selected
boundary conditions. The margin size is computed from the margins needed
by the interpolator as well as the fixed limits specified for the timeshift.
"""
"""
from
__future__
import
annotations
from
__future__
import
annotations
...
...
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