Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97009385
check.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jan 1, 14:28
Size
1003 B
Mime Type
text/x-python
Expires
Fri, Jan 3, 14:28 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23311672
Attached To
rLIBMULTISCALE LibMultiScale
check.py
View Options
import
numpy
as
np
import
scipy.optimize
as
opt
values
=
[]
def
compute
(
step
=
None
,
position0
=
None
,
disp
=
None
,
**
kwargs
):
disp
=
disp
[
"displacement"
]
position0
=
position0
[
"position0"
]
index
=
np
.
argmax
(
disp
[:,
0
])
position0
=
position0
[
index
,
0
]
pmax
=
np
.
abs
(
np
.
array
([
position0
]))
global
values
values
.
append
(
pmax
)
if
step
==
5000
:
values
=
np
.
array
(
values
)
values
=
values
.
reshape
(
values
.
shape
[
0
])
steps
=
np
.
arange
(
values
.
shape
[
0
],
dtype
=
float
)
*
100.
def
f
(
x
,
a
,
b
):
return
a
*
x
+
b
popt
,
pcov
=
opt
.
curve_fit
(
f
,
steps
,
values
)
# print(popt)
# import matplotlib.pyplot as plt
# plt.plot(steps, values)
# plt.plot(steps, f(steps, *p))
# plt.show()
error
=
np
.
abs
(
popt
[
0
]
-
0.0364484912035075
)
if
error
>
1e-3
:
raise
RuntimeError
(
"push wave speed is not the one expected: error = "
+
str
(
error
))
return
pmax
Event Timeline
Log In to Comment