Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sebastian Heimann
grond
Commits
9f9aee18
Commit
9f9aee18
authored
Dec 14, 2017
by
Sebastian Heimann
Browse files
py3 + cleanup
parent
d1363d8d
Changes
5
Show whitespace changes
Inline
Side-by-side
src/dataset.py
View file @
9f9aee18
...
@@ -387,11 +387,11 @@ class Dataset(object):
...
@@ -387,11 +387,11 @@ class Dataset(object):
elif
quantity
==
'velocity'
:
elif
quantity
==
'velocity'
:
candidates
.
append
(
trace
.
MultiplyResponse
([
candidates
.
append
(
trace
.
MultiplyResponse
([
x
.
response
,
x
.
response
,
t
a
rce
.
DifferentiationResponse
()]))
tr
a
ce
.
DifferentiationResponse
()]))
elif
quantity
==
'acceleration'
:
elif
quantity
==
'acceleration'
:
candidates
.
append
(
trace
.
MultiplyResponse
([
candidates
.
append
(
trace
.
MultiplyResponse
([
x
.
response
,
x
.
response
,
t
a
rce
.
DifferentiationResponse
(
2
)]))
tr
a
ce
.
DifferentiationResponse
(
2
)]))
else
:
else
:
assert
False
assert
False
...
...
src/optimizers/highscore/optimizer.py
View file @
9f9aee18
...
@@ -251,10 +251,9 @@ class Chains(object):
...
@@ -251,10 +251,9 @@ class Chains(object):
self
,
problem
,
history
,
nchains
,
nlinks_cap
,
self
,
problem
,
history
,
nchains
,
nlinks_cap
,
bootstrap_weights
):
bootstrap_weights
):
self
.
optimizer
=
optimizer
self
.
problem
=
problem
self
.
problem
=
problem
self
.
history
=
history
self
.
history
=
history
self
.
nchains
=
optimizer
.
nbootstrap
+
1
self
.
nchains
=
nchains
self
.
nlinks_cap
=
nlinks_cap
self
.
nlinks_cap
=
nlinks_cap
self
.
chains_m
=
num
.
zeros
(
self
.
chains_m
=
num
.
zeros
(
(
self
.
nchains
,
nlinks_cap
),
num
.
float
)
(
self
.
nchains
,
nlinks_cap
),
num
.
float
)
...
@@ -262,6 +261,7 @@ class Chains(object):
...
@@ -262,6 +261,7 @@ class Chains(object):
(
self
.
nchains
,
nlinks_cap
),
num
.
int
)
(
self
.
nchains
,
nlinks_cap
),
num
.
int
)
self
.
nlinks
=
0
self
.
nlinks
=
0
self
.
accept_sum
=
num
.
zeros
(
self
.
nchains
,
dtype
=
num
.
int
)
self
.
accept_sum
=
num
.
zeros
(
self
.
nchains
,
dtype
=
num
.
int
)
self
.
extend
(
0
,
history
.
nmodels
,
history
.
models
)
history
.
add_listener
(
self
)
history
.
add_listener
(
self
)
self
.
bootstrap_weights
=
num
.
vstack
((
self
.
bootstrap_weights
=
num
.
vstack
((
...
...
src/optimizers/highscore/plot.py
View file @
9f9aee18
...
@@ -4,7 +4,7 @@ import numpy as num
...
@@ -4,7 +4,7 @@ import numpy as num
from
matplotlib
import
pyplot
as
plt
from
matplotlib
import
pyplot
as
plt
from
pyrocko.plot
import
mpl_init
,
mpl_margins
from
pyrocko.plot
import
mpl_init
,
mpl_margins
from
grond
import
plot
from
grond
import
plot
,
core
class
HighScoreOptimizerPlot
(
object
):
class
HighScoreOptimizerPlot
(
object
):
...
@@ -99,9 +99,9 @@ class HighScoreOptimizerPlot(object):
...
@@ -99,9 +99,9 @@ class HighScoreOptimizerPlot(object):
self
.
writer
.
setup
(
self
.
fig
,
self
.
movie_filename
,
dpi
=
200
)
self
.
writer
.
setup
(
self
.
fig
,
self
.
movie_filename
,
dpi
=
200
)
#if self.show:
#
if self.show:
#
plt.ion()
#
plt.ion()
#
plt.show()
#
plt.show()
def
set_limits
(
self
):
def
set_limits
(
self
):
self
.
axes
.
set_xlim
(
*
self
.
xlim
)
self
.
axes
.
set_xlim
(
*
self
.
xlim
)
...
@@ -248,8 +248,7 @@ class HighScoreOptimizerPlot(object):
...
@@ -248,8 +248,7 @@ class HighScoreOptimizerPlot(object):
if
self
.
show
:
if
self
.
show
:
plt
.
show
()
plt
.
show
()
#plt.ioff()
# plt.ioff()
def
render
(
self
):
def
render
(
self
):
self
.
start
()
self
.
start
()
...
...
src/problems/base.py
View file @
9f9aee18
...
@@ -188,7 +188,7 @@ class Problem(Object):
...
@@ -188,7 +188,7 @@ class Problem(Object):
def
random_uniform
(
self
,
xbounds
):
def
random_uniform
(
self
,
xbounds
):
x
=
[]
x
=
[]
for
i
in
x
range
(
self
.
nparameters
):
for
i
in
range
(
self
.
nparameters
):
x
.
append
(
num
.
random
.
uniform
(
xbounds
[
i
,
0
],
xbounds
[
i
,
1
]))
x
.
append
(
num
.
random
.
uniform
(
xbounds
[
i
,
0
],
xbounds
[
i
,
1
]))
return
num
.
array
(
x
,
dtype
=
num
.
float
)
return
num
.
array
(
x
,
dtype
=
num
.
float
)
...
...
src/toy.py
View file @
9f9aee18
...
@@ -137,7 +137,7 @@ def scenario(station_setup, noise_setup):
...
@@ -137,7 +137,7 @@ def scenario(station_setup, noise_setup):
east
=
float
(
easts
[
i
]),
east
=
float
(
easts
[
i
]),
depth
=
float
(
depths
[
i
]),
depth
=
float
(
depths
[
i
]),
obs_distance
=
float
(
measured_distances
[
i
]))
obs_distance
=
float
(
measured_distances
[
i
]))
for
i
in
x
range
(
n
)]
for
i
in
range
(
n
)]
return
source
,
targets
return
source
,
targets
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment