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
a0237c3a
Commit
a0237c3a
authored
3 months ago
by
Wolfgang Kastaun
Browse files
Options
Downloads
Patches
Plain Diff
minor updates in unit test
parent
e6ae24cf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_dynamic_delay_dask.py
+16
-11
16 additions, 11 deletions
tests/test_dynamic_delay_dask.py
with
16 additions
and
11 deletions
tests/test_dynamic_delay_dask.py
+
16
−
11
View file @
a0237c3a
...
...
@@ -4,16 +4,16 @@ import pytest
from
lisainstrument.dynamic_delay_dask
import
(
make_dynamic_shift_lagrange_dask
,
make_dynamic_shift_linear_dask
,
numpyfy_dask_
bivariate
,
numpyfy_dask_
multi
,
)
from
lisainstrument.dynamic_delay_numpy
import
(
DynShiftBC
,
make_dynamic_shift_lagrange_numpy
,
make_lagrange_polynomials
,
)
from
lisainstrument.regular_interpolators
import
make_lagrange_polynomials
def
test_dynamic_shift_linear_dask
():
def
test_dynamic_shift_linear_dask
()
->
None
:
t
,
dt
=
np
.
linspace
(
-
5.345
,
10.345
,
103
,
retstep
=
True
)
def
g
(
x
):
...
...
@@ -28,7 +28,7 @@ def test_dynamic_shift_linear_dask():
op_da
=
make_dynamic_shift_linear_dask
(
d
.
min
(),
d
.
max
(),
DynShiftBC
.
FLAT
,
DynShiftBC
.
EXCEPTION
)
op_np
=
numpyfy_dask_
bivariate
(
op_da
,
chunks
=
19
)
op_np
=
numpyfy_dask_
multi
(
op_da
,
chunks
=
19
)
s_da
=
op_np
(
y
,
d
)
s_ex
=
g
(
np
.
maximum
(
t
[
0
],
t
-
d
*
dt
))
...
...
@@ -36,28 +36,32 @@ def test_dynamic_shift_linear_dask():
assert
s_ex
==
pytest
.
approx
(
s_da
,
abs
=
1e-15
,
rel
=
1e-14
)
def
test_dynamic_shift_lagrange_dask
():
def
test_dynamic_shift_lagrange_dask
()
->
None
:
order
=
5
length
=
order
+
1
t
,
dt
=
np
.
linspace
(
-
5.345
,
10.345
,
1003
,
retstep
=
True
)
def
g
(
x
):
n
=
x
/
10.0
return
4.32546
+
3.34324
*
x
+
4.342
*
x
**
2
+
0.46
*
x
**
3
+
1.43598
*
x
**
4
+
3.3456
*
x
**
5
return
(
4.32546
+
3.34324
*
x
+
4.342
*
x
**
2
+
0.46
*
x
**
3
+
1.43598
*
x
**
4
+
3.3456
*
x
**
5
)
y
=
g
(
t
)
d
=
(
0.93456456
+
0.0235345
*
np
.
cos
(
4.3354
*
t
))
/
dt
# ~ print(y[0], t[0], d[0])
op_da
=
make_dynamic_shift_lagrange_dask
(
length
,
d
.
min
(),
d
.
max
(),
DynShiftBC
.
FLAT
,
DynShiftBC
.
EXCEPTION
)
op_na
=
numpyfy_dask_
bivariate
(
op_da
,
chunks
=
19
)
op_na
=
numpyfy_dask_
multi
(
op_da
,
chunks
=
19
)
s_da
=
op_na
(
y
,
d
)
s_da
:
np
.
ndarray
=
op_na
(
y
,
d
)
s_ex
=
g
(
np
.
maximum
(
t
[
0
],
t
-
d
*
dt
))
assert
s_ex
[
op_da
.
margin_left
:]
==
pytest
.
approx
(
...
...
@@ -73,6 +77,7 @@ def test_dynamic_shift_lagrange_dask():
assert
np
.
all
(
s_np
==
s_da
)
def
test_lagrange_polynomials
():
length
=
11
d
=
-
(
length
//
2
)
...
...
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