hvasbath / beat

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

Sample covariance contains NaN #63

Closed sandragharbi closed 1 year ago

sandragharbi commented 3 years ago

Hi Hannes,

I am getting this error when I start sampling the data. Is it due to GFs?

heart - INFO Number of seismic datasets for wavemap: any_S_1: 7 models - INFO ... Building model ...

models - INFO Initialised hyperparameter h_any_P_0_Z with size 1 models - INFO Initialised hyperparameter h_any_S_1_T with size 1 models - INFO Optimization for 2 hyperparameters in total! seismic - INFO Seismic optimization on: depth, duration, east_shift, magnitude, mdd, med, mee, mnd, mne, mnn, north_shift, time seismic - INFO Estimating time shift for each station and waveform map... seismic - INFO For time_shifts_any_P_0 with 20 shifts seismic - INFO For time_shifts_any_S_1 with 7 shifts seismic - INFO Retrieving seismic data-covariances with structure "variance" for any_P0 ... /home/sandrag/anaconda3/envs/beat/lib/python3.6/site-packages/pyrocko/spit.py:71: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray wn = num.multiply.reduce(num.ix(ws)) seismic - INFO Retrieving seismic data-covariances with structure "variance" for any_S_1 ... seismic - INFO Initialized 27 hierarchical parameters for station corrections. seismic - INFO Preparing data of "any_P0" for optimization /home/sandrag/anaconda3/envs/beat/lib/python3.6/site-packages/pyrocko/spit.py:71: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray wn = num.multiply.reduce(num.ix(ws)) seismic - INFO Initializing synthesizer for "any_P_0" seismic - INFO Using all sources for wavemap any_P_0 ! seismic - INFO Preparing data of "any_S1" for optimization /home/sandrag/anaconda3/envs/beat/lib/python3.6/site-packages/pyrocko/spit.py:71: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray wn = num.multiply.reduce(num.ix(*ws)) seismic - INFO Initializing synthesizer for "any_S_1" seismic - INFO Using all sources for wavemap any_S_1 ! models - INFO Model building was successful!

models - INFO Using "bin" backend to store samples! models - INFO ... Initiate Sequential Monte Carlo ... n_chains=2000, tune_interval=50, n_jobs=4, proposal_distribution: MultivariateCauchy,

metropolis - INFO Creating initial population for 2000 chains ... metropolis - INFO Time for proposal covariance init: 2.408823 models - INFO Compilation time: 43.448162 models.base - INFO ... Starting SMC ...

backend - INFO Init new trace! smc - INFO Sample initial stage: ... smc - INFO Beta: 0.000000 Stage: 0 sampler - INFO Initialising 2000 chain traces ... sampler - INFO Serial time per sample: 0.023492 sampler - INFO Data to be memory shared: sampler - INFO No data to be memshared! sampler - INFO Sampling ... parallel - INFO
Feierabend! Done with the work!
backend - INFO Loading multitrace from /home/sandrag/beat/GP_JuneMT_ALL/geometry/stage_0 /home/sandrag/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/sampler/smc.py:168: RuntimeWarning: Degrees of freedom <= 0 for slice
rowvar=0)
Traceback (most recent call last):
File "/home/sandrag/anaconda3/envs/beat/bin/beat", line 33, in sys.exit(load_entry_point('beat==1.1', 'console_scripts', 'beat')()) File "/home/sandrag/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x8664.egg/beat/apps/beat.py", line 1932, in main globals()['command' + command](args) File "/home/sandrag/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/apps/beat.py", line 832, in command_sample sample(step, problem) File "/home/sandrag/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/models/base.py", line 224, in sample rm_flag=pa.rm_flag) File "/home/sandrag/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/sampler/smc.py", line 483, in smc_sample step.covariance = step.calc_covariance() File "/home/sandrag/anaconda3/envs/beat/lib/python3.6/site-packages/beat-1.1-py3.6-linux-x86_64.egg/beat/sampler/smc.py", line 173, in calc_covariance 'Sample covariances contains Inf or NaN!') ValueError: Sample covariances contains Inf or NaN!

hvasbath commented 3 years ago

Please check your bounds for the hyper-parameters. Are they still very wide? Then this can happen. Please reduce them significantly to like -1 to 3.