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
9e89b62d
Commit
9e89b62d
authored
Mar 23, 2017
by
Marius Isken
Browse files
Preparing joint opt // Informative messages
parent
8387245a
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/core.py
View file @
9e89b62d
...
...
@@ -258,8 +258,6 @@ def analyse(problem, niter=1000, show_progress=False):
wtarget
.
weight
=
1.0
wtargets
.
append
(
wtarget
)
groups
,
ngroups
=
problem
.
get_group_mask
()
wproblem
=
problem
.
copy
()
wproblem
.
targets
=
wtargets
...
...
@@ -302,15 +300,16 @@ def analyse(problem, niter=1000, show_progress=False):
if
show_progress
:
pbar
.
finish
()
# mean_ms = num.mean(mss, axis=0)
# weights = 1.0 / mean_ms
weights
=
num
.
ones
(
wproblem
.
ntargets
)
mean_ms
=
num
.
mean
(
mss
,
axis
=
0
)
weights
=
1.
/
mean_ms
groups
,
ngroups
=
wproblem
.
get_group_mask
()
for
igroup
in
xrange
(
ngroups
):
weights
[
groups
==
igroup
]
/=
(
num
.
nansum
(
weights
[
groups
==
igroup
])
/
num
.
nansum
(
num
.
isfinite
(
weights
[
groups
==
igroup
])))
for
weight
,
target
in
zip
(
weights
,
problem
.
targets
):
for
weight
,
target
in
zip
(
weights
,
problem
.
waveform_
targets
):
target
.
analysis_result
=
TargetAnalysisResult
(
balancing_weight
=
float
(
weight
))
...
...
src/dataset.py
View file @
9e89b62d
...
...
@@ -826,9 +826,13 @@ class DatasetConfig(HasPaths):
ds
.
add_waveforms
(
paths
=
fp
(
self
.
waveform_paths
))
if
self
.
kite_scene_paths
:
logger
.
info
(
'Loading kite scenes...'
)
for
path
in
self
.
kite_scene_paths
:
for
fn
in
glob
.
glob
(
xjoin
(
fp
(
path
),
'*.npz'
)):
ds
.
add_kite_scene
(
filename
=
fn
)
if
not
ds
.
kite_scenes
:
logger
.
warning
(
'Could not find any kite scenes at %s'
%
self
.
kite_scene_paths
)
if
self
.
clippings_path
:
ds
.
add_clippings
(
markers_filename
=
fp
(
self
.
clippings_path
))
...
...
src/problems.py
View file @
9e89b62d
...
...
@@ -796,7 +796,6 @@ class RectangularProblem(Problem):
if
isinstance
(
result
,
gf
.
SeismosizerError
):
logger
.
debug
(
'%s.%s.%s.%s: %s'
%
(
target
.
codes
+
(
str
(
result
),)))
data
.
append
((
None
,
None
))
else
:
data
.
append
((
result
.
misfit_value
,
result
.
misfit_norm
))
...
...
src/targets.py
View file @
9e89b62d
...
...
@@ -7,7 +7,6 @@ from pyrocko import gf, trace, weeding
from
pyrocko.guts
import
(
Object
,
String
,
Float
,
Bool
,
Int
,
List
,
Dict
,
StringChoice
,
Timestamp
)
from
pyrocko.guts_array
import
Array
from
pyrocko.orthodrome
import
latlon_to_ne_numpy
from
.dataset
import
NotFound
from
.meta
import
Parameter
...
...
@@ -526,8 +525,11 @@ class MisfitSatelliteTarget(gf.SatelliteTarget, GrondTarget):
scene_id
=
String
.
T
()
super_group
=
gf
.
StringID
.
T
()
inner_misfit_config
=
InnerSatelliteMisfitConfig
.
T
()
manual_weight
=
Float
.
T
(
default
=
1.0
)
group
=
gf
.
StringID
.
T
()
manual_weight
=
Float
.
T
(
default
=
1.0
,
help
=
'Relative weight of this target'
)
group
=
gf
.
StringID
.
T
(
help
=
'Group'
)
parameters
=
[
Parameter
(
'offset'
,
'm'
),
...
...
@@ -586,7 +588,7 @@ class MisfitSatelliteTarget(gf.SatelliteTarget, GrondTarget):
return
result
def
get_combined_weight
(
self
,
apply_balancing_weights
=
False
):
return
1.
return
self
.
manual_weight
class
TargetConfig
(
Object
):
...
...
@@ -610,15 +612,10 @@ class TargetConfig(Object):
def
get_targets
(
self
,
ds
,
event
,
default_group
):
origin
=
event
targets
=
[]
def
get_satellite_targets
():
scene_reference_frame
=
None
for
scene
in
ds
.
get_kite_scenes
():
if
not
self
.
kite_scenes
:
continue
if
scene
.
meta
.
scene_id
not
in
self
.
kite_scenes
and
\
'*all'
not
in
self
.
kite_scenes
:
continue
...
...
@@ -630,29 +627,14 @@ class TargetConfig(Object):
qt
=
scene
.
quadtree
lats
=
num
.
empty
(
qt
.
nleafs
)
lons
=
num
.
empty
(
qt
.
nleafs
)
lats
=
num
.
empty
(
qt
.
nleaves
)
lons
=
num
.
empty
(
qt
.
nleaves
)
lats
.
fill
(
qt
.
frame
.
llLat
)
lons
.
fill
(
qt
.
frame
.
llLon
)
north_shifts
=
qt
.
leaf_focal_points
[:,
1
]
east_shifts
=
qt
.
leaf_focal_points
[:,
0
]
if
scene_reference_frame
is
None
:
scene_reference_frame
=
scene
.
frame
lats
.
fill
(
qt
.
frame
.
llLat
)
lons
.
fill
(
qt
.
frame
.
llLon
)
else
:
lats
.
fill
(
scene_reference_frame
.
llLat
)
lons
.
fill
(
scene_reference_frame
.
llLon
)
north_offset
,
east_offset
=
latlon_to_ne_numpy
(
scene_reference_frame
.
llLat
,
scene_reference_frame
.
llLon
,
qt
.
frame
.
llLat
,
qt
.
frame
.
llLon
)
north_shifts
+=
north_offset
east_shifts
+=
east_offset
sat_target
=
MisfitSatelliteTarget
(
quantity
=
'displacement'
,
scene_id
=
scene
.
meta
.
scene_id
,
...
...
@@ -735,10 +717,10 @@ class TargetConfig(Object):
targets
.
append
(
target
)
if
self
.
kite_scenes
is
not
None
:
logger
.
info
(
'Selecting satellite targets...'
)
logger
.
debug
(
'Selecting satellite targets...'
)
get_satellite_targets
()
else
:
logger
.
info
(
'Selecting dynamic targets...'
)
logger
.
debug
(
'Selecting dynamic targets...'
)
get_dynamic_targets
()
if
self
.
limit
:
...
...
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