Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error import geometry to ffi v1.1_dev_rc #66

Closed
ranneylxr opened this issue Feb 1, 2021 · 6 comments
Closed

error import geometry to ffi v1.1_dev_rc #66

ranneylxr opened this issue Feb 1, 2021 · 6 comments

Comments

@ranneylxr
Copy link

Hi @hvasbath
Sorry for disturbing you again......
The beat work well for the uniform inversion and I got a very good results.
But when I want to try the distributed slip inversion, I got an error like following (I updated the beat software before I used it in case there are new changes):

[lxrtest@dqcentos7insar BEAT]$ beat import BalochistanEQ7 --results=BalochistanEQ7 --mode='geometry' --datatypes=geodetic
beat         - INFO     Attempting to load results with mode ffi to config_geometry.yaml from directory: BalochistanEQ7
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: 1190 
geodetic     - WARNING  Covariance estimation not implemented (yet)! Using imported covariances!
geodetic     - INFO     Initialising corrections ...
heart        - INFO     Not correcting Sen201410_201712ascMeter_sub for Euler Pole
heart        - INFO     Setting up Ramps correction for Sen201410_201712ascMeter_sub
heart        - INFO     Not correcting Sen201410_201712desMeter_sub for Euler Pole
heart        - INFO     Setting up Ramps correction for Sen201410_201712desMeter_sub
models       - INFO     Using "none" regularization ...
Traceback (most recent call last):
  File "/home/lxrtest/wclsolid/pyenv/versions/miniconda3-4.7.12/bin/beat", line 11, in <module>
    load_entry_point('beat==1.1', 'console_scripts', 'beat')()
  File "/home/lxrtest/wclsolid/pyenv/versions/miniconda3-4.7.12/lib/python3.7/site-packages/beat-1.1-py3.7-linux-x86_64.egg/beat/apps/beat.py", line 2041, in main
    globals()['command_' + command](args)
  File "/home/lxrtest/wclsolid/pyenv/versions/miniconda3-4.7.12/lib/python3.7/site-packages/beat-1.1-py3.7-linux-x86_64.egg/beat/apps/beat.py", line 499, in command_import
    load='trace', chains=[-1])
  File "/home/lxrtest/wclsolid/pyenv/versions/miniconda3-4.7.12/lib/python3.7/site-packages/beat-1.1-py3.7-linux-x86_64.egg/beat/models/base.py", line 387, in load_results
    stage_number = self.handler.highest_sampled_stage()
  File "/home/lxrtest/wclsolid/pyenv/versions/miniconda3-4.7.12/lib/python3.7/site-packages/beat-1.1-py3.7-linux-x86_64.egg/beat/backend.py", line 906, in highest_sampled_stage
    return max(self.stage_number(s) for s in glob(self.stage_path('*')))
ValueError: max() arg is an empty sequence

Before running this command, I ran:
beat init BalochistanEQ7 --mode='ffi' --datatypes=geodetic

Could you please give me some suggestion?
Thank you very much!
Best regards

@hvasbath
Copy link
Owner

hvasbath commented Feb 1, 2021

The import functionality changed and the tutorial needs updating. Which is work in progress.
The mode argument was changed there and it is now consistently referring again to the mode of the current project.
There is an additional argument --import_from_mode that you need to specify now.
Likely for your current setup this could work:

beat import BalochistanEQ7 --results=BalochistanEQ7 --mode=ffi --datatypes=geodetic --import_from_mode=geometry

Saying you want to import from the geometry of BalochistanEQ7, to: ffi of BalochistanEQ7.

I also recommend to use the absolut path to the results argument instead of a relative path. This could also cause troubles- not sure about it.

@hvasbath hvasbath changed the title Error when running "beat import BalochistanEQ7 --results=BalochistanEQ7 --mode='geometry' --datatypes=geodetic" command error import geometry to ffi v1.1_dev_rc Feb 1, 2021
@ranneylxr
Copy link
Author

Hi @hvasbath
The import command works well. Thank you!
However, unfortunately, I meet a new error when I ran the command "beat sample BalochistanEQ7 --hypers --mode=ffi"...
The error message is:

beat sample BalochistanEQ7 --hypers --mode=ffi
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: 1190 
geodetic     - WARNING  Covariance estimation not implemented (yet)! Using imported covariances!
geodetic     - INFO     Initialising corrections ...
heart        - INFO     Not correcting Sen201410_201712ascMeter_sub for Euler Pole
heart        - INFO     Setting up Ramps correction for Sen201410_201712ascMeter_sub
heart        - INFO     Not correcting Sen201410_201712desMeter_sub for Euler Pole
heart        - INFO     Setting up Ramps correction for Sen201410_201712desMeter_sub
models       - INFO     Using "none" regularization ...
models       - INFO     ... Building Hyper model ...

geodetic     - INFO     Evaluating config for Euler Pole corrections for datasets...
geodetic     - INFO     No Euler Pole correction!
geodetic     - INFO     Evaluating config for Ramps corrections for datasets...
geodetic     - INFO     Initialized 6 hierarchical parameters.
Traceback (most recent call last):
  File "/home/lxrtest/wclsolid/pyenv/versions/miniconda3-4.7.12/lib/python3.7/site-packages/beat-1.1-py3.7-linux-x86_64.egg/beat/heart.py", line 628, in random
    dimension) + self.lower
ValueError: operands could not be broadcast together with shapes (7,) (420,) 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lxrtest/wclsolid/pyenv/versions/miniconda3-4.7.12/bin/beat", line 11, in <module>
    load_entry_point('beat==1.1', 'console_scripts', 'beat')()
  File "/home/lxrtest/wclsolid/pyenv/versions/miniconda3-4.7.12/lib/python3.7/site-packages/beat-1.1-py3.7-linux-x86_64.egg/beat/apps/beat.py", line 2041, in main
    globals()['command_' + command](args)
  File "/home/lxrtest/wclsolid/pyenv/versions/miniconda3-4.7.12/lib/python3.7/site-packages/beat-1.1-py3.7-linux-x86_64.egg/beat/apps/beat.py", line 902, in command_sample
    project_dir, options.mode, options.hypers)
  File "/home/lxrtest/wclsolid/pyenv/versions/miniconda3-4.7.12/lib/python3.7/site-packages/beat-1.1-py3.7-linux-x86_64.egg/beat/models/problems.py", line 885, in load_model
    problem.built_hyper_model()
  File "/home/lxrtest/wclsolid/pyenv/versions/miniconda3-4.7.12/lib/python3.7/site-packages/beat-1.1-py3.7-linux-x86_64.egg/beat/models/problems.py", line 277, in built_hyper_model
    point = self.get_random_point(include=['hierarchicals', 'priors'])
  File "/home/lxrtest/wclsolid/pyenv/versions/miniconda3-4.7.12/lib/python3.7/site-packages/beat-1.1-py3.7-linux-x86_64.egg/beat/models/problems.py", line 317, in get_random_point
    point[param.name] = param.random(dimension=dimension)
  File "/home/lxrtest/wclsolid/pyenv/versions/miniconda3-4.7.12/lib/python3.7/site-packages/beat-1.1-py3.7-linux-x86_64.egg/beat/heart.py", line 633, in random
    self.name, self.lower.size))
ValueError: Either use number of patches input vector size for variable uparr or only [1]]! Now the size is 7!

I used 7 sub-faults and the hypers part in config_ffi.yaml file is:

problem_config: !beat.ProblemConfig
  mode: ffi
  mode_config: !beat.FFIConfig
    regularization: none
    initialization: random
    npatches: 420
  source_type: RectangularSource
  stf_type: HalfSinusoid
  decimation_factors:
    geodetic: 4
  n_sources: 7
  datatypes:
  - geodetic
  hyperparameters:
    h_SAR: !beat.heart.Parameter
      name: h_SAR
      form: Uniform
      lower:
      - -5.0
      upper:
      - 8.0
      testvalue:
      - 1.5
  priors:
    uparr: !beat.heart.Parameter
      name: uparr
      form: Uniform
      lower:
      - -0.05
      - -0.05
      - -0.05
      - -0.05
      - -0.05
      - -0.05
      - -0.05
      upper:
      - 6.0
      - 6.0
      - 6.0
      - 6.0
      - 6.0
      - 6.0
      - 6.0
      testvalue:
      - 1.15
      - 1.15
      - 1.15
      - 1.15
      - 1.15
      - 1.15
      - 1.15
    uperp: !beat.heart.Parameter
      name: uperp
      form: Uniform
      lower:
      - -0.3
      - -0.3
      - -0.3
      - -0.3
      - -0.3
      - -0.3
      - -0.3
      upper:
      - 4.0
      - 4.0
      - 4.0
      - 4.0
      - 4.0
      - 4.0
      - 4.0
      testvalue:
      - 0.5
      - 0.5
      - 0.5
      - 0.5
      - 0.5
      - 0.5
      - 0.5
  hierarchicals:
    Sen201410_201712ascMeter_sub_azimuth_ramp: !beat.heart.Parameter

Thank you very much!

@hvasbath
Copy link
Owner

hvasbath commented Feb 1, 2021

Please read the error. Is that unclear? If so we need to work on the text ...
But we might want to offer that as an option for the user to allow for subfault specific priors ...
Going to open another issue ... #70

@ranneylxr
Copy link
Author

Hi @hvasbath
I know what the error message mean now.
Could the error message tell the users something like that the beat uses a single value for all subfault ? So that it would be much clearer.
Because, as a user, I firstly thought that the settings of slip prior for subfault would be same as the settings of geometry parameters in config_geometry.yaml, which means that there are 7 pairs of settings for slip prior. And I may doubt whether it is correct to only use a value of slip prior for all subfaults.
These are my experience about it and if they are wrong please don't mind!
Thank you very much for your patient help!

@hvasbath
Copy link
Owner

hvasbath commented Feb 1, 2021

You are totally right! As the new issue is for resolving that! Thanks for reporting!

@hvasbath
Copy link
Owner

hvasbath commented Apr 8, 2021

Requested feature is now implemented in: #82

@hvasbath hvasbath closed this as completed Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants