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
1dfb64b6
Commit
1dfb64b6
authored
Feb 22, 2017
by
Marius Isken
Browse files
Integrating SatelliteTarget
parent
b55c490a
Changes
4
Hide whitespace changes
Inline
Side-by-side
apps/grond
View file @
1dfb64b6
...
...
@@ -3,6 +3,7 @@
import
math
import
sys
import
logging
import
os.path
as
op
from
optparse
import
OptionParser
from
pyrocko
import
util
...
...
@@ -132,43 +133,81 @@ def help_and_die(parser, message):
def
command_init
(
args
):
dataset_config
=
grond
.
DatasetConfig
(
stations_path
=
'stations.txt'
,
events_path
=
'events.txt'
,
waveform_paths
=
[
'data'
])
target_configs
=
[
grond
.
TargetConfig
(
distance_min
=
10
*
km
,
distance_max
=
1000
*
km
,
channels
=
[
'Z'
,
'R'
,
'T'
],
interpolation
=
'multilinear'
,
store_id
=
'global_2s'
,
inner_misfit_config
=
grond
.
InnerMisfitConfig
(
fmin
=
0.01
,
fmax
=
0.1
))]
s2
=
math
.
sqrt
(
2.0
)
problem_config
=
grond
.
CMTProblemConfig
(
name_template
=
'cmt_%(event_name)s'
,
distance_min
=
2.
*
km
,
nbootstrap
=
100
,
mt_type
=
'deviatoric'
,
ranges
=
dict
(
time
=
Range
(
0
,
10.0
,
relative
=
'add'
),
north_shift
=
Range
(
-
16
*
km
,
16
*
km
),
east_shift
=
Range
(
-
16
*
km
,
16
*
km
),
depth
=
Range
(
1
*
km
,
11
*
km
),
magnitude
=
Range
(
4.0
,
6.0
),
rmnn
=
Range
(
-
s2
,
s2
),
rmee
=
Range
(
-
s2
,
s2
),
rmdd
=
Range
(
-
s2
,
s2
),
rmne
=
Range
(
-
1.0
,
1.0
),
rmnd
=
Range
(
-
1.0
,
1.0
),
rmed
=
Range
(
-
1.0
,
1.0
),
duration
=
Range
(
1.0
,
15.0
)))
def
setup
(
parser
):
parser
.
add_option
(
'--waveform'
,
dest
=
'waveform'
,
action
=
'store_true'
,
default
=
True
,
help
=
'Create an example configuration for waveform inversion.'
)
parser
.
add_option
(
'--static'
,
dest
=
'static'
,
action
=
'store_true'
,
help
=
'Create an example configuration for static displacement'
' targets using kite scene containers.'
)
parser
,
options
,
args
=
cl_parse
(
'init'
,
args
,
setup
)
if
options
.
waveform
and
not
options
.
static
:
dataset_config
=
grond
.
DatasetConfig
(
stations_path
=
'stations.txt'
,
events_path
=
'events.txt'
,
waveform_paths
=
[
'data'
])
target_configs
=
[
grond
.
TargetConfig
(
distance_min
=
10
*
km
,
distance_max
=
1000
*
km
,
channels
=
[
'Z'
,
'R'
,
'T'
],
interpolation
=
'multilinear'
,
store_id
=
'global_2s'
,
inner_misfit_config
=
grond
.
InnerMisfitConfig
(
fmin
=
0.01
,
fmax
=
0.1
))]
s2
=
math
.
sqrt
(
2.0
)
problem_config
=
grond
.
CMTProblemConfig
(
name_template
=
'cmt_%(event_name)s'
,
distance_min
=
2.
*
km
,
nbootstrap
=
100
,
mt_type
=
'deviatoric'
,
ranges
=
dict
(
time
=
Range
(
0
,
10.0
,
relative
=
'add'
),
north_shift
=
Range
(
-
16
*
km
,
16
*
km
),
east_shift
=
Range
(
-
16
*
km
,
16
*
km
),
depth
=
Range
(
1
*
km
,
11
*
km
),
magnitude
=
Range
(
4.0
,
6.0
),
rmnn
=
Range
(
-
s2
,
s2
),
rmee
=
Range
(
-
s2
,
s2
),
rmdd
=
Range
(
-
s2
,
s2
),
rmne
=
Range
(
-
1.0
,
1.0
),
rmnd
=
Range
(
-
1.0
,
1.0
),
rmed
=
Range
(
-
1.0
,
1.0
),
duration
=
Range
(
1.0
,
15.0
))
)
elif
options
.
static
:
dataset_config
=
grond
.
DatasetConfig
(
kite_scene_paths
=
[
'scenes'
]
)
target_configs
=
[
grond
.
TargetConfig
(
interpolation
=
'multilinear'
,
store_id
=
'global_2s'
,
inner_satellite_misfit_config
=
grond
.
InnerSatelliteMisfitConfig
(
use_kite_covariance
=
True
))]
problem_config
=
grond
.
RectangularProblemConfig
(
name_template
=
'rect_source'
,
ranges
=
dict
(
north_shift
=
Range
(
-
20
*
km
,
20
*
km
),
east_shift
=
Range
(
-
20
*
km
,
20
*
km
),
depth
=
Range
(
0
*
km
,
10
*
km
),
length
=
Range
(
20
*
km
,
40
*
km
),
width
=
Range
(
5
*
km
,
12
*
km
),
dip
=
Range
(
20
,
70
),
strike
=
Range
(
0
,
180
),
rake
=
Range
(
0
,
90
),
slip
=
Range
(
1
,
3
))
)
config
=
grond
.
Config
(
rundir_template
=
op
.
abspath
(
op
.
curdir
),
dataset_config
=
dataset_config
,
target_configs
=
target_configs
,
problem_config
=
problem_config
)
...
...
setup.py
View file @
1dfb64b6
...
...
@@ -8,7 +8,7 @@ setup(
version
=
'0.1'
,
author
=
'Sebastian Heimann'
,
author_email
=
'sebastian.heimann@gfz-potsdam.de'
,
packages
=
[
'grond'
],
packages
=
[
'grond'
,
'grond.problems'
],
package_dir
=
{
'grond'
:
'src'
},
scripts
=
[
'apps/grond'
],
package_data
=
{
'grond'
:
[]},
...
...
src/core.py
View file @
1dfb64b6
...
...
@@ -266,8 +266,10 @@ class InnerMisfitConfig(Object):
fmax
=
Float
.
T
()
ffactor
=
Float
.
T
(
default
=
1.5
)
tmin
=
gf
.
Timing
.
T
(
optional
=
True
,
help
=
'Start of main time window used for waveform fitting.'
)
tmax
=
gf
.
Timing
.
T
(
optional
=
True
,
help
=
'End of main time window used for waveform fitting.'
)
tfade
=
Float
.
T
(
optional
=
True
,
...
...
@@ -301,6 +303,10 @@ class InnerMisfitConfig(Object):
return
self
.
fmin
/
self
.
ffactor
,
self
.
fmax
*
self
.
ffactor
class
InnerSatelliteMisfitConfig
(
Object
):
use_kite_covariance
=
Bool
.
T
(
default
=
True
)
class
TargetAnalysisResult
(
Object
):
balancing_weight
=
Float
.
T
()
...
...
@@ -620,6 +626,7 @@ tautoshift**2 / tautoshift_max**2``
class
MisfitSatelliteTarget
(
gf
.
SatelliteTarget
):
scene_id
=
guts
.
String
.
T
()
super_group
=
gf
.
StringID
.
T
()
inner_misfit_config
=
InnerSatelliteMisfitConfig
.
T
()
group
=
gf
.
StringID
.
T
()
def
__init__
(
self
,
*
args
,
**
kwargs
):
...
...
@@ -898,15 +905,17 @@ class SyntheticTest(Object):
class
DatasetConfig
(
HasPaths
):
stations_path
=
Path
.
T
(
optional
=
True
)
stations_stationxml_paths
=
List
.
T
(
Path
.
T
())
events_path
=
Path
.
T
()
waveform_paths
=
List
.
T
(
Path
.
T
())
stations_stationxml_paths
=
List
.
T
(
Path
.
T
()
,
optional
=
True
)
events_path
=
Path
.
T
(
optional
=
True
)
waveform_paths
=
List
.
T
(
Path
.
T
()
,
optional
=
True
)
clippings_path
=
Path
.
T
(
optional
=
True
)
responses_sacpz_path
=
Path
.
T
(
optional
=
True
)
responses_stationxml_paths
=
List
.
T
(
Path
.
T
())
responses_stationxml_paths
=
List
.
T
(
Path
.
T
()
,
optional
=
True
)
station_corrections_path
=
Path
.
T
(
optional
=
True
)
apply_correction_factors
=
Bool
.
T
(
default
=
True
)
apply_correction_delays
=
Bool
.
T
(
default
=
True
)
apply_correction_factors
=
Bool
.
T
(
optional
=
True
,
default
=
True
)
apply_correction_delays
=
Bool
.
T
(
optional
=
True
,
default
=
True
)
picks_paths
=
List
.
T
(
Path
.
T
())
blacklist_paths
=
List
.
T
(
Path
.
T
())
blacklist
=
List
.
T
(
...
...
@@ -922,7 +931,7 @@ class DatasetConfig(HasPaths):
'Note: ''when whitelisting on channel level, both, the raw and '
'the processed channel codes have to be listed.'
)
synthetic_test
=
SyntheticTest
.
T
(
optional
=
True
)
kite_
displacement
_paths
=
List
.
T
(
Path
.
T
,
optional
=
True
)
kite_
scene
_paths
=
List
.
T
(
Path
.
T
()
,
optional
=
True
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
HasPaths
.
__init__
(
self
,
*
args
,
**
kwargs
)
...
...
@@ -960,9 +969,9 @@ class DatasetConfig(HasPaths):
ds
.
add_events
(
filename
=
fp
(
self
.
events_path
))
ds
.
add_waveforms
(
paths
=
fp
(
self
.
waveform_paths
))
if
self
.
kite_
displacement
_paths
:
if
self
.
kite_
scene
_paths
:
ds
.
add_kite_displacement
(
filenames
=
fp
(
self
.
kite_
displacement
_paths
))
filenames
=
fp
(
self
.
kite_
scene
_paths
))
if
self
.
clippings_path
:
ds
.
add_clippings
(
markers_filename
=
fp
(
self
.
clippings_path
))
...
...
@@ -1030,8 +1039,10 @@ class TargetConfig(Object):
depth_min
=
Float
.
T
(
optional
=
True
)
depth_max
=
Float
.
T
(
optional
=
True
)
limit
=
Int
.
T
(
optional
=
True
)
channels
=
List
.
T
(
String
.
T
())
inner_misfit_config
=
InnerMisfitConfig
.
T
()
channels
=
List
.
T
(
String
.
T
(),
optional
=
True
)
inner_misfit_config
=
InnerMisfitConfig
.
T
(
optional
=
True
)
inner_satellite_misfit_config
=
InnerSatelliteMisfitConfig
.
T
(
optional
=
True
)
interpolation
=
gf
.
InterpolationMethod
.
T
()
store_id
=
gf
.
StringID
.
T
()
weight
=
Float
.
T
(
default
=
1.0
)
...
...
@@ -1066,7 +1077,8 @@ class TargetConfig(Object):
interpolation
=
self
.
interpolation
,
store_id
=
self
.
store_id
,
super_group
=
self
.
super_group
,
group
=
self
.
group
or
default_group
)
group
=
self
.
group
or
default_group
,
inner_misfit_config
=
self
.
inner_satellite_misfit_config
)
for
st
in
ds
.
get_stations
():
for
cha
in
self
.
channels
:
...
...
@@ -1130,16 +1142,6 @@ class TargetConfig(Object):
return
targets
class
SatelliteTargetConfig
(
Object
):
super_group
=
gf
.
StringID
.
T
(
default
=
''
,
optional
=
True
)
group
=
gf
.
StringID
.
T
(
optional
=
True
)
limit
=
Int
.
T
(
optional
=
True
)
inner_misfit_config
=
InnerMisfitConfig
.
T
()
interpolation
=
gf
.
InterpolationMethod
.
T
()
store_id
=
gf
.
StringID
.
T
()
weight
=
Float
.
T
(
default
=
1.0
)
class
AnalyserConfig
(
Object
):
niter
=
Int
.
T
(
default
=
1000
)
...
...
@@ -2340,9 +2342,11 @@ __all__ = '''
Problem
ProblemConfig
MisfitTarget
MisfitSatelliteTarget
MisfitResult
Forbidden
InnerMisfitConfig
InnerSatelliteMisfitConfig
DatasetConfig
TargetConfig
SamplerDistributionChoice
...
...
src/problems/rectangular.py
View file @
1dfb64b6
...
...
@@ -33,10 +33,9 @@ class RectangularProblem(core.Problem):
dependants
=
[]
targets
=
List
.
T
(
gf
.
Target
.
T
())
ranges
=
Dict
.
T
(
String
.
T
(),
gf
.
Range
.
T
())
distance_min
=
Float
.
T
(
default
=
0.0
)
nbootstrap
=
Int
.
T
(
default
=
10
)
nbootstrap
=
0
def
pack
(
self
,
source
):
return
self
.
parameter_array
(
source
)
...
...
@@ -219,22 +218,17 @@ class RectangularProblem(core.Problem):
class
RectangularProblemConfig
(
core
.
ProblemConfig
):
ranges
=
Dict
.
T
(
String
.
T
(),
gf
.
Range
.
T
())
name
=
String
.
T
()
distance_min
=
Float
.
T
(
default
=
0.0
)
nbootstrap
=
Int
.
T
(
default
=
0
)
apply_balancing_weights
=
False
def
get_problem
(
self
,
rect_source
,
targets
):
base_source
=
gf
.
RecangularSource
.
load
(
rect_source
)
problem
=
RectangularProblem
(
name
=
core
.
expand_template
(
self
.
name_template
,
self
.
name
),
name
=
core
.
expand_template
(
self
.
name_template
),
apply_balancing_weights
=
self
.
apply_balancing_weights
,
base_source
=
base_source
,
targets
=
targets
,
ranges
=
self
.
ranges
,
distance_min
=
self
.
distance_min
,
nbootstrap
=
self
.
nbootstrap
,
mt_type
=
self
.
mt_type
)
return
problem
...
...
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