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

Add sum model #364

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from
Draft

Add sum model #364

wants to merge 29 commits into from

Conversation

MuellerSeb
Copy link
Member

@MuellerSeb MuellerSeb commented Aug 11, 2024

  • added SumModel class
    • represents sum of covariance models
    • behaves just as a normal covariance model with kriging and field generation
    • covariance models can be added with overloaded + operator: model = m1 + m2
    • class is subscriptable to access sub-models by index: m1 = model[0]
    • included models will get a nugget of 0 and the nugget is stored separately in the sum-model
    • model variance is the sum of the sub-model variances
    • model length-scale is weighted sum of sub-model len-scales, where the weights are the ratios of the sub-models variance to the sum variance
    • anisotropy and rotation need to be the same for all included sub-models
    • parameters of the sub-models can be accessed by name with added index suffix
  • added Nugget class (empty SumModel)
    • allow len scale of 0 in CovModel to enable a pure nugget model
    • added zero_var attribute to Field generators to shortcut field generation for pure nugget models
import gstools as gs
m1 = gs.Gaussian(dim=2, var=1.0, len_scale=2.0)
m2 = gs.Gaussian(dim=2, var=2.0, len_scale=20.0)
model = m1 + m2
model.plot()

Other changes

  • removed var_raw attribute from CovModel (was rarely used and only relevant for the truncated power law models)
    • BREAKING CHANGE (but not to many should be affected)
    • TPLCovModel now has a intensity attribute which calculates was
  • simplified variogram fitting (var_raw was a bad idea in the first place)
  • variogram plotting now handles a len-scale of 0 (to properly plot nugget models)

TODOs

  • enable fitting of summed models (harder than I though, since sub-arguments may have restrictions from the sum model like a fixed length-scale that is affected by the variance ratios and the sub length scales)
  • testing the sum-model

@MuellerSeb MuellerSeb marked this pull request as draft August 11, 2024 15:05
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

Successfully merging this pull request may close these issues.

1 participant