error when using multi fault--could not broadcast input array from shape (2,1) into shape (1,2) for "magnitude" attribute in lpoint
ranneylxr opened this issue · comments
Hi @hvasbath
The developed version of beat works well for single fault, but I meet an error when I tried to use multi-faults. The error occurred when the command "beat summarize --stage_number=-1" and the error message is:
[lxrtest@dqcentos7insar BalochistanEQ2]$ beat summarize --stage_number=-1
beat - INFO Loading problem ...
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: 919
geodetic - WARNING Covariance estimation not implemented (yet)! Using imported covariances!
geodetic - INFO Initialising corrections ...
heart - INFO Not correcting Sen201410_201712asc for Euler Pole
heart - INFO Not correcting Sen201410_201712asc for Ramps
heart - INFO Not correcting Sen201410_201712des for Euler Pole
heart - INFO Not correcting Sen201410_201712des for Ramps
models - INFO ... Building model ...
models - INFO Initialised hyperparameter h_SAR with size 1
models - INFO Optimization for 1 hyperparameters in total!
geodetic - INFO Geodetic optimization on:
depth, dip, east_shift, length, north_shift, rake, slip, strike, width
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 0 hierarchical parameters.
geodetic - INFO Applying corrections! ...
models - INFO Model building was successful!
beat - INFO Summarizing stage(s): -1
beat - INFO Summarizing stage under: /data/lxrtest/insarlab/BEAT/BalochistanEQ2/geometry/stage_-1
backend - INFO Loading multitrace from /data/lxrtest/insarlab/BEAT/BalochistanEQ2/geometry/stage_-1
backend - INFO Adding derived variables magnitude to trace.
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [00:02<00:00, 405.79it/s]
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 1105, in command_summarize
rtrace.record_buffer()
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 333, in record_buffer
self._write_data_to_file()
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 728, in _write_data_to_file
lpoint2file(fh, self.varnames, data, lpoint)
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 711, in lpoint2file
data[names] = array
ValueError: could not broadcast input array from shape (2,1) into shape (1,2)
I tried to debug to find the reason for this error and it seems that when it tried to summarize "magnitude" attribute in lpoint into "data", the size of "magnitude" is (2, 1) but the size of other attributes in lpoint is (2,). The details are following:
(Pdb) names
'magnitude'
(Pdb) lpoint[-1]
array([[7.17854651],
[7.26610615]])
(Pdb) lpoint[0]
array([0.49622183, 0.44478329])
Could you please give me some suggestions about how to change lpoint?
Thank you!
Yes the summarize command is a pain lately ;) . I added functionality there. Can you confirm that you updated to the last version on the v1.1_dev_rc branch? There are almost daily updates currently on that branch.
I just noticed you are in the geometry mode. That would have worked also in the current master. Will check whats going on there ...
@ranneylxr please update again and try again! Please let me know if it works. Locally a multifault setup worked now.
Awesome! Thanks again for reporting! Closing ...