hvasbath / beat

Bayesian Earthquake Analysis Tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when running beat import Laquila

emiliaxin opened this issue · comments

Hi,
I meet this error when I running the BEAT tutorial Example 4:TypeError: get_result_point() takes from 1 to 2 positional arguments but 3 were given.
Before I ran beat import Laquila --results=Laquila --mode='ffi' --datatypes=geodetic --import_from_mode=geometry, I ran: beat init Laquila --mode='ffi' --datatypes=geodetic.
The error message is:
(beat) a@a-virtual-machine:~$ beat import Laquila --results=Laquila --mode='ffi' --datatypes=geodetic --import_from_mode=geometry
beat - INFO Attempting to load results with mode geometry to config_ffi.yaml from directory: Laquila
config - INFO All hierarchicals ok!
config - INFO All hyperparameters ok!
config - INFO All priors ok!
config - INFO All hierarchicals ok!
config - INFO All hyperparameters ok!
config - INFO All priors ok!
models - INFO ... Initialising Geometry Optimizer ...

models - INFO Analysing problem ...
models - INFO ---------------------

geodetic - INFO Number of geodetic datasets: 2
geodetic - INFO Number of geodetic data points: 419
geodetic - WARNING Covariance estimation not implemented (yet)! Using imported covariances!
geodetic - INFO Initialising corrections ...
heart - INFO Setting up Ramps correction for Laquila_dscxn
heart - INFO Not correcting Laquila_dscxn for Euler Pole
heart - INFO Not correcting Laquila_dscxn for Strain Rate
heart - INFO Setting up Ramps correction for Laquila_ascxn
heart - INFO Not correcting Laquila_ascxn for Euler Pole
heart - INFO Not correcting Laquila_ascxn for Strain Rate
seismic - INFO Loading seismic data for event 0 from: /home/a/Laquila/seismic_data.pkl
heart - INFO Consistent number of datasets and targets in any_P_0 wavemap!
heart - INFO Number of seismic datasets for wavemap: any_P_0: 35
backend - INFO Loading multitrace from /home/a/Laquila/geometry/stage_-1
Traceback (most recent call last):
File "/home/a/anaconda3/envs/beat/bin/beat", line 33, in
sys.exit(load_entry_point('beat==1.1', 'console_scripts', 'beat')())
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/apps/beat.py", line 2127, in main
globals()'command_' + command
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/apps/beat.py", line 506, in command_import
point = plotting.get_result_point(stage, problem.config, 'max')
TypeError: get_result_point() takes from 1 to 2 positional arguments but 3 were given
Here is the log.
config_ffi.yaml.txt
config_geometry.yaml.txt

Could you please give me some suggestions?
Thank you

Dear @emiliaxin ,

thanks a lot for reporting. I was recently working on many improvements regarding plotting functionality here: d868a11

This included a fix for your reported problem.
Can you please update your beat master installation as described here https://pyrocko.org/beat/docs/current/updating.html
if you have been using anaconda for installation please ignore the sudo!
Then please try again?

If the problem persists please let me know!
Hannes

Hi @hvasbath
The import command works well. Thank you very much!
However, unfortunately, I meet a new error when I ran the command "beat import Laquila_kinematic --results=Laquila --mode=ffi --datatypes=geodetic,seismic --import_from_mode=ffi" in the BEAT tutorial Example 5.
The error message is:
(beat) a@a-virtual-machine:~$ beat import Laquila_kinematic --results=Laquila --mode=ffi --datatypes=geodetic,seismic --import_from_mode=ffi
beat - INFO Attempting to load results with mode ffi to config_ffi.yaml from directory: Laquila
config - INFO All hierarchicals ok!
config - INFO All hyperparameters ok!
config - INFO All priors ok!
config - INFO All hierarchicals ok!
config - INFO All hyperparameters ok!
config - INFO All priors ok!
models - INFO ... Initialising Distribution Optimizer ...

models - INFO Analysing problem ...
models - INFO ---------------------

geodetic - INFO Number of geodetic datasets: 2
geodetic - INFO Number of geodetic data points: 419
geodetic - WARNING Covariance estimation not implemented (yet)! Using imported covariances!
geodetic - INFO Initialising corrections ...
heart - INFO Setting up Ramps correction for Laquila_dscxn
heart - INFO Not correcting Laquila_dscxn for Euler Pole
heart - INFO Not correcting Laquila_dscxn for Strain Rate
heart - INFO Setting up Ramps correction for Laquila_ascxn
heart - INFO Not correcting Laquila_ascxn for Euler Pole
heart - INFO Not correcting Laquila_ascxn for Strain Rate
config - INFO not solving for utens, got fixed at 0.0
backend - INFO Loading multitrace from /home/a/Laquila/ffi/stage_-1
beat - INFO Importing hierarchicals for datatypes: geodetic, seismic
beat - INFO ---------------------------------------------

beat - INFO Geodetic datatype listed-importing ...
beat - INFO Importing correction parameters ...
beat - INFO Importing correction for Laquila_dscxn_azimuth_ramp
beat - INFO Importing correction for Laquila_ascxn_offset
beat - INFO Importing correction for Laquila_ascxn_range_ramp
beat - INFO Importing correction for Laquila_dscxn_offset
beat - INFO Importing correction for Laquila_dscxn_range_ramp
beat - INFO Importing correction for Laquila_ascxn_azimuth_ramp
beat - INFO seismic datatype listed-importing ...
Traceback (most recent call last):
File "/home/a/anaconda3/envs/beat/bin/beat", line 33, in
sys.exit(load_entry_point('beat==1.1', 'console_scripts', 'beat')())
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/apps/beat.py", line 2127, in main
globals()'command_' + command
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/apps/beat.py", line 567, in command_import
sc = problem.composites['seismic']
KeyError: 'seismic'
Here is the log.
config_ffi.yaml.txt
Did I forget to set something?
Thanks

Uh thats an error in the documentation. Now it tries to import seismic inversion results from the static slip distribution estimation. Of course this cannot work. I will change that command-line in the docs. It must be:

beat import Laquila_kinematic --results=Laquila --mode=ffi --datatypes=geodetic --import_from_mode=ffi

Thanks again for reporting!

Sorry for disturbing you again.
I have tried this import command. However, I have encountered a new error:

(beat) a@a-virtual-machine:~$ beat import Laquila_kinematic --results=Laquila --mode=ffi --datatypes=geodetic --import_from_mode=ffi
beat - INFO Attempting to load results with mode ffi to config_ffi.yaml from directory: Laquila
config - INFO All hierarchicals ok!
config - INFO All hyperparameters ok!
config - INFO All priors ok!
config - INFO All hierarchicals ok!
config - INFO All hyperparameters ok!
config - INFO All priors ok!
models - INFO ... Initialising Distribution Optimizer ...

models - INFO Analysing problem ...
models - INFO ---------------------

geodetic - INFO Number of geodetic datasets: 2
geodetic - INFO Number of geodetic data points: 419
geodetic - WARNING Covariance estimation not implemented (yet)! Using imported covariances!
geodetic - INFO Initialising corrections ...
heart - INFO Setting up Ramps correction for Laquila_dscxn
heart - INFO Not correcting Laquila_dscxn for Euler Pole
heart - INFO Not correcting Laquila_dscxn for Strain Rate
heart - INFO Setting up Ramps correction for Laquila_ascxn
heart - INFO Not correcting Laquila_ascxn for Euler Pole
heart - INFO Not correcting Laquila_ascxn for Strain Rate
config - INFO not solving for utens, got fixed at 0.0
backend - INFO Loading multitrace from /home/a/Laquila/ffi/stage_-1
beat - INFO Importing hierarchicals for datatypes: geodetic
beat - INFO ---------------------------------------------

beat - INFO Geodetic datatype listed-importing ...
beat - INFO Importing correction parameters ...
beat - INFO Importing correction for Laquila_dscxn_azimuth_ramp
beat - INFO Importing correction for Laquila_ascxn_offset
beat - INFO Importing correction for Laquila_ascxn_range_ramp
beat - INFO Importing correction for Laquila_ascxn_azimuth_ramp
beat - INFO Importing correction for Laquila_dscxn_range_ramp
beat - INFO Importing correction for Laquila_dscxn_offset
beat - INFO seismic datatype not listed-not importing ...
beat - INFO Importing distributed slip results!
Traceback (most recent call last):
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 4381, in get_value
return libindex.get_value_box(s, key)
File "pandas/_libs/index.pyx", line 52, in pandas._libs.index.get_value_box
File "pandas/_libs/index.pyx", line 48, in pandas._libs.index.get_value_at
File "pandas/_libs/util.pxd", line 113, in pandas._libs.util.get_value_at
File "pandas/_libs/util.pxd", line 98, in pandas._libs.util.validate_indexer
TypeError: 'str' object cannot be interpreted as an integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/a/anaconda3/envs/beat/bin/beat", line 33, in
sys.exit(load_entry_point('beat==1.1', 'console_scripts', 'beat')())
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/apps/beat.py", line 2127, in main
globals()'command_' + command
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/apps/beat.py", line 636, in command_import
summarydf, varname=param, shape=shape, roundto=1)
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/backend.py", line 1283, in extract_bounds_from_summary
values[i] = operation(summary[quant][idx] * adjust) / adjust
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/pandas/core/series.py", line 868, in getitem
result = self.index.get_value(self, key)
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 4389, in get_value
raise e1
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 4375, in get_value
tz=getattr(series.dtype, 'tz', None))
File "pandas/_libs/index.pyx", line 81, in pandas._libs.index.IndexEngine.get_value
File "pandas/_libs/index.pyx", line 89, in pandas._libs.index.IndexEngine.get_value
File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 1601, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 1608, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'utens__0'

I made another update to the master branch. Can you please update and try again? I am sorry, I should run these tutorials again myself.

Hi @hvasbath
I have updated the beat and tried the command again. However, it still shows the same error:

(beat) a@a-virtual-machine:~$ beat import Laquila_kinematic --results=Laquila --mode=ffi --datatypes=geodetic --import_from_mode=ffi
beat - INFO Attempting to load results with mode ffi to config_ffi.yaml from directory: Laquila
config - INFO All hierarchicals ok!
config - INFO All hyperparameters ok!
config - INFO All priors ok!
config - INFO All hierarchicals ok!
config - INFO All hyperparameters ok!
config - INFO All priors ok!
models - INFO ... Initialising Distribution Optimizer ...

models - INFO Analysing problem ...
models - INFO ---------------------

geodetic - INFO Number of geodetic datasets: 2
geodetic - INFO Number of geodetic data points: 419
geodetic - WARNING Covariance estimation not implemented (yet)! Using imported covariances!
geodetic - INFO Initialising corrections ...
heart - INFO Setting up Ramps correction for Laquila_dscxn
heart - INFO Not correcting Laquila_dscxn for Euler Pole
heart - INFO Not correcting Laquila_dscxn for Strain Rate
heart - INFO Setting up Ramps correction for Laquila_ascxn
heart - INFO Not correcting Laquila_ascxn for Euler Pole
heart - INFO Not correcting Laquila_ascxn for Strain Rate
config - INFO not solving for utens, got fixed at 0.0
backend - INFO Loading multitrace from /home/a/Laquila/ffi/stage_-1
beat - INFO Importing hierarchicals for datatypes: geodetic
beat - INFO ---------------------------------------------

beat - INFO Geodetic datatype listed-importing ...
beat - INFO Importing correction parameters ...
beat - INFO Importing correction for Laquila_ascxn_range_ramp
beat - INFO Importing correction for Laquila_ascxn_offset
beat - INFO Importing correction for Laquila_ascxn_azimuth_ramp
beat - INFO Importing correction for Laquila_dscxn_range_ramp
beat - INFO Importing correction for Laquila_dscxn_offset
beat - INFO Importing correction for Laquila_dscxn_azimuth_ramp
beat - INFO seismic datatype not listed-not importing ...
beat - INFO Importing distributed slip results!
Traceback (most recent call last):
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 4381, in get_value
return libindex.get_value_box(s, key)
File "pandas/_libs/index.pyx", line 52, in pandas._libs.index.get_value_box
File "pandas/_libs/index.pyx", line 48, in pandas._libs.index.get_value_at
File "pandas/_libs/util.pxd", line 113, in pandas._libs.util.get_value_at
File "pandas/_libs/util.pxd", line 98, in pandas._libs.util.validate_indexer
TypeError: 'str' object cannot be interpreted as an integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/a/anaconda3/envs/beat/bin/beat", line 33, in
sys.exit(load_entry_point('beat==1.1', 'console_scripts', 'beat')())
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/apps/beat.py", line 2130, in main
globals()'command_' + command
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/apps/beat.py", line 639, in command_import
summarydf, varname=param, shape=shape, roundto=1)
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/backend.py", line 1283, in extract_bounds_from_summary
values[i] = operation(summary[quant][idx] * adjust) / adjust
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/pandas/core/series.py", line 868, in getitem
result = self.index.get_value(self, key)
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 4389, in get_value
raise e1
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 4375, in get_value
tz=getattr(series.dtype, 'tz', None))
File "pandas/_libs/index.pyx", line 81, in pandas._libs.index.IndexEngine.get_value
File "pandas/_libs/index.pyx", line 89, in pandas._libs.index.IndexEngine.get_value
File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 1601, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 1608, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'utens__0'

Did I do something wrong?
Thank you

It seems sth in your update must have gone wrong. Your code is still on the version prior to the fix. Please repeat.
https://pyrocko.org/beat/docs/current/updating.html

Dear @hvasbath ,
I have updated my beat master installation as described here https://pyrocko.org/beat/docs/current/updating.html. However I am still having problems when I run this command "beat import Laquila_kinematic --results=Laquila --mode=ffi --datatypes=geodetic --import_from_mode=ffi”.

Besides, I reinstalled ubuntu 20.04.3, Anaconda3-2021.05-Linux-x86_64, beat. I ran example 5 and still got the same error.

Also, I noticed that the slip-distribution was missing the legend when I ran the beat tutorial Example 4, and I uploaded the Example 4 result comparison chart.

The error message is:
(beat) a@a-virtual-machine:~$ beat import Laquila_kinematic --results=Laquila --mode=ffi --datatypes=geodetic --import_from_mode=ffi
beat - INFO Attempting to load results with mode ffi to config_ffi.yaml from directory: Laquila
config - INFO All hierarchicals ok!
config - INFO All hyperparameters ok!
config - INFO All priors ok!
config - INFO All hierarchicals ok!
config - INFO All hyperparameters ok!
config - INFO All priors ok!
models - INFO ... Initialising Distribution Optimizer ...

models - INFO Analysing problem ...
models - INFO ---------------------

geodetic - INFO Number of geodetic datasets: 2
geodetic - INFO Number of geodetic data points: 419
geodetic - WARNING Covariance estimation not implemented (yet)! Using imported covariances!
geodetic - INFO Initialising corrections ...
heart - INFO Setting up Ramps correction for Laquila_dscxn
heart - INFO Not correcting Laquila_dscxn for Euler Pole
heart - INFO Not correcting Laquila_dscxn for Strain Rate
heart - INFO Setting up Ramps correction for Laquila_ascxn
heart - INFO Not correcting Laquila_ascxn for Euler Pole
heart - INFO Not correcting Laquila_ascxn for Strain Rate
config - INFO not solving for utens, got fixed at 0.0
beat - INFO Importing priors for variables: uperp, utens, uparr
backend - INFO Loading multitrace from /home/a/Laquila/ffi/stage_-1
beat - INFO Importing hierarchicals for datatypes: geodetic
beat - INFO ---------------------------------------------

beat - INFO Geodetic datatype listed-importing ...
beat - INFO Importing correction parameters ...
beat - INFO Importing correction for Laquila_ascxn_offset
beat - INFO Importing correction for Laquila_ascxn_range_ramp
beat - INFO Importing correction for Laquila_dscxn_range_ramp
beat - INFO Importing correction for Laquila_dscxn_azimuth_ramp
beat - INFO Importing correction for Laquila_dscxn_offset
beat - INFO Importing correction for Laquila_ascxn_azimuth_ramp
beat - INFO seismic datatype not listed-not importing ...
beat - INFO Importing distributed slip results!
Traceback (most recent call last):
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2898, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 1675, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 1683, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'utens__0'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/a/anaconda3/envs/beat/bin/beat", line 33, in
sys.exit(load_entry_point('beat==1.1', 'console_scripts', 'beat')())
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/apps/beat.py", line 2133, in main
globals()'command_' + command
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/apps/beat.py", line 642, in command_import
summarydf, varname=param, shape=shape, roundto=1)
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/backend.py", line 1283, in extract_bounds_from_summary
values[i] = operation(summary[quant][idx] * adjust) / adjust
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/pandas/core/series.py", line 882, in getitem
return self._get_value(key)
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/pandas/core/series.py", line 990, in _get_value
loc = self.index.get_loc(label)
File "/home/a/anaconda3/envs/beat/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2900, in get_loc
raise KeyError(key) from err
KeyError: 'utens__0'

Example 4 result comparison chart

Dear @emiliaxin ,

thanks a lot for your patience! Yes the plots changed a bit- the arrow was removed on purpose as it did not add much information.
I confirm your update worked now! It was still a problem in the code. I reran the example myself now and found the problem.
Please update again and rerun and it should work now. I am sorry for the mess!

Hannes

Dear @emiliaxin did you have time to retry? Is it working now?

Hi @hvasbath ,
thank you very much for your patient reply. I can run sucessfully based on your suggestions.

Awesome! WIll mark as resolved then.