model size
Closed this issue · 1 comments
I have a 2d model which produces 11*11 result, I resize it to 1d.
I run and I get the following error
PCGA Inversion
1. Initialize forward and inversion parameters
------------ Inversion Parameters -------------------------
Number of unknowns : 121
Number of observations : 121
Number of principal components (n_pc) : 50
Prior model : def kernel(r): return (prior_std ** 2) * np.exp(-r)
Prior variance : 4.000000e-02
Prior scale (correlation) parameter : [71. 71.]
Posterior cov computation : diag
Posterior variance computation : Direct
Number of CPU cores (n_core) : 4
Maximum GN iterations : 10
machine precision (delta = sqrt(precision)) : 1.000000e-08
Tol for iterations (norm(sol_diff)/norm(sol)) : 1.000000e-02
Levenberg-Marquardt (LM) : True
LM solution range constraints (LM_smin, LM_smax) : None, None
Line search : True
2. Construct Prior Covariance Matrix
- time for covariance matrix construction (m = 121) is 0 sec
3. Eigendecomposition of Prior Covariance
- time for eigendecomposition with k = 50 is 0 sec
- 1st eigv : 4.46991, 50-th eigv : 0.000505994, ratio: 0.0001132
4. Start PCGA Inversion
-- evaluate initial solution
obs. RMSE (norm(obs. diff.)/sqrt(nobs)): 18.3563, normalized obs. RMSE (norm(obs. diff./sqrtR)/sqrt(nobs)): 1835.63
***** Iteration 1 ******
Traceback (most recent call last):
File "/xxxx/scripts/inv_GaussPlume.py", line 57, in
s_hat, simul_obs, post_diagv, iter_best = prob.Run()
File "/usr/local/lib/python3.8/dist-packages/pyPCGA-0.1.0-py3.8.egg/pyPCGA/pcga.py", line 1332, in Run
s_hat, simul_obs, post_diagv, iter_best = self.GaussNewton()
File "/usr/local/lib/python3.8/dist-packages/pyPCGA-0.1.0-py3.8.egg/pyPCGA/pcga.py", line 1235, in GaussNewton
s_cur, beta_cur, simul_obs_cur, obj = self.LinearIteration(s_past, simul_obs)
File "/usr/local/lib/python3.8/dist-packages/pyPCGA-0.1.0-py3.8.egg/pyPCGA/pcga.py", line 1149, in LinearIteration
s_hat, beta, simul_obs_new = self.IterativeSolve(s_cur, simul_obs, precond = precond)
File "/usr/local/lib/python3.8/dist-packages/pyPCGA-0.1.0-py3.8.egg/pyPCGA/pcga.py", line 773, in IterativeSolve
HX, HZ, Hs, U_data = self.JacMat(s_cur, simul_obs, Z)
File "/usr/local/lib/python3.8/dist-packages/pyPCGA-0.1.0-py3.8.egg/pyPCGA/pcga.py", line 555, in JacMat
Htemp = self.JacVect(temp,s_cur,simul_obs,precision)
File "/usr/local/lib/python3.8/dist-packages/pyPCGA-0.1.0-py3.8.egg/pyPCGA/pcga.py", line 444, in JacVect
raise ValueError("size of simul_obs_purturbation (%d,%d) is not nruns %d" % (simul_obs_purturbation.shape[0], simul_obs_purturbation.shape[1], nruns))
ValueError: size of simul_obs_purturbation (121,1) is not nruns 52
Hi Pavane,
It seems something wrong in your forward model implementation. In pyPCGA, forward model implementation should follow a class format (see all example folders and forward model classes) in order to work correctly with data in parallel. You can contact me directly (my hawaii.edu email) with your implementation and I can help you to write a forward model class correctly.
By the way, given your covariance spectrum you may need 10-20 PCs to get a reasonable result. Do not need 50 PCs with spectral error 0.0001132 (between 0.001 and 0.05 would be enough in most applications).
Best,
Jonghyun Harry Lee