invert4geom.optimize_eq_source_params

invert4geom.optimize_eq_source_params#

optimize_eq_source_params(coordinates, data, n_trials=100, damping_limits=None, depth_limits=None, block_size_limits=None, sampler=None, plot=False, progressbar=True, parallel=False, fname=None, seed=0, **kwargs)[source]#

Use Optuna to find the optimal parameters for fitting equivalent sources to gravity data. The 3 parameters are damping, depth, and block size. Any or all of these can be optimized at the same time. Provide upper and lower limits for each parameter, or if you don’t want to optimize a parameter, provide a constant value of the parameter in the kwargs.

Parameters:
  • coordinates (tuple[Series | ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]], Series | ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]], Series | ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]]]) – tuple of coordinates in the order (easting, northing, upward) for the gravity observation locations.

  • data (Series | ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]]) – gravity data values

  • n_trials (int) – number of trials to run, by default 100

  • damping_limits (tuple[float, float] | None) – damping parameter limits, by default (0, 10**3)

  • depth_limits (tuple[float, float] | None) – source depth limits (positive downwards) in meters, by default (0, 10e6)

  • block_size_limits (tuple[float, float] | None) – block size limits in meters, by default None

  • sampler (BaseSampler | None) – specify which Optuna sampler to use, by default GPsampler

  • plot (bool) – plot the resulting optimization figures, by default False

  • progressbar (bool) – add a progressbar, by default True

  • parallel (bool) – run the optimization in parallel, by default False

  • fname (str | None) – file name to save the study to, by default None

  • seed (int) – random seed for the samplers, by default 0

  • kwargs (Any) – additional keyword arguments to pass to OptimalEqSourceParams, which are passed to eq_sources_score. These can include parameters to pass to harmonica.EquivalentSources; “damping”, “depth”, “block_size”, “parallel”, and “dtype”, or parameters to pass to vd.cross_val_score; “delayed”, or “weights”.

Return type:

tuple[Study, EquivalentSources]

Returns:

  • study (optuna.study.Study) – the completed optuna study

  • eqs (harmonica.EquivalentSources) – the fitted equivalent sources model