-
Notifications
You must be signed in to change notification settings - Fork 4
Inverse component
mfangaritav edited this page Jan 11, 2024
·
5 revisions
The last step to run an inversion with VMOD is to declare an Inverse object. The only attribute in this class stores the dataset in the attribute data. It is also necessary to include the sources that the user wants to retrieve the parameters with the method register_source
import Inverse
inv = Inverse(obs)
inv.register_source(mogi)
inv.register_source(yang)
The user can choose to run a fast gradient based algorithm to find a good solution that match the observations.
import Inverse
ans=inv.nlsq()
print('Solution', ans.x)
The user can choose to run a Bayesian algorithm. However, the calculation is substantial more time-consuming than the gradient based algorithm.
import Inverse
trace=inv.mcmc('solution')
The string 'solution' is the filename for a .pkl file that stores the solutions in case the user wants to halt the inversion at some point. The output will give empirical distributions for all the parameters in the model.