hvasbath / beat

Bayesian Earthquake Analysis Tool
GNU General Public License v3.0
128 stars 42 forks source link

Error when running beat import Laquila #88

Closed emiliaxin closed 2 years ago

emiliaxin commented 2 years ago

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_P0: 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-x8664.egg/beat/apps/beat.py", line 2127, in main globals()['command' + command](args) 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

hvasbath commented 2 years ago

Dear @emiliaxin ,

thanks a lot for reporting. I was recently working on many improvements regarding plotting functionality here: https://github.com/hvasbath/beat/commit/d868a11258e00b038ac2fee7910ebbb4c47fbc71

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

emiliaxin commented 2 years ago

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 Laquilaascxn 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-x8664.egg/beat/apps/beat.py", line 2127, in main globals()['command' + command](args) 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

hvasbath commented 2 years ago

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!

emiliaxin commented 2 years ago

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 Laquilaascxn 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-x8664.egg/beat/apps/beat.py", line 2127, in main globals()['command' + command](args) 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'

hvasbath commented 2 years ago

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.

emiliaxin commented 2 years ago

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 Laquilaascxn 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-x8664.egg/beat/apps/beat.py", line 2130, in main globals()['command' + command](args) 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

hvasbath commented 2 years ago

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

emiliaxin commented 2 years ago

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 Laquilaascxn 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-x8664.egg/beat/apps/beat.py", line 2133, in main globals()['command' + command](args) 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

hvasbath commented 2 years ago

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

hvasbath commented 2 years ago

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

emiliaxin commented 2 years ago

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

hvasbath commented 2 years ago

Awesome! WIll mark as resolved then.