Skip to content

Releases: emsig/emg3d

NumPy v2

09 Oct 16:28
639fabd
Compare
Choose a tag to compare

The code is now compatible with NumPy v2.

  • Created foundation for new module inversion.

  • Bumped the minimum requirements to:

    • Python 3.10
    • SciPy 1.10
    • empymod 2.3.2
    • Numba (without minimum version)
  • Maintenance

    • Testing: dropped Python 3.9 (Python 3.13 not added yet).
    • Update for NumPy v2: mainly np.infty -> np.inf.
    • Add notes for ipympl (interactive plots in modern Jupyter).
    • Reduce code by making use of new SciPy new features (complex-valued map_coordinate; lazy loading).

tol_gradient isfinite

27 Jun 11:24
9dea3cd
Compare
Choose a tag to compare
  • New hard dependency: empymod changed from being a soft dependency to being a hard dependency.

  • Simulation

    • A new parameter tol_gradient can be provided in the dict solver_opts; by default it is set to the value of tol. tol is the value used for compute (the forward), tol_gradient is used for gradient/jtvec and jvec (the gradient). In inversions, one can set the tolerance for the gradient often to a lower value, which saves computation time.
  • Survey

    • New attributes isfinite and finite_data. Former returns the indices of the finite data, latter returns directly the finite data.
  • Electrodes

    • Fixed TxMagneticDipole-representation and improved documentation of the magnetic sources.
  • Maintenance:

    • Bumped the minimum requirements to:

      • Python 3.9
      • SciPy 1.9
      • Numba 0.53
      • empymod 2.3.0 (NEW requirement)
    • Testing: added Python 3.12, dropped Python 3.8.

    • Fix remaining outdated python setup.py commands.

    • Many small things to keep the package updated.

convert & pip-full

31 May 14:57
ade673d
Compare
Choose a tag to compare
  • io: New function convert to convert a file that was saved with emg3d from one file format to another file format.

  • Installation through pip has new the option pip install emg3d[full] which installs all soft dependencies as well.

  • Bumped the minimum requirements to:

    • Python 3.8
    • NumPy 1.19
    • SciPy 1.5
    • Numba 0.50
  • Bug fixes, small improvements and maintenance

    • Testing: added Python 3.11, dropped Python 3.7.
    • Adjust copyright notice to only include original year, so it has not to be adjusted each year.

Bugfix ellipse

15 Oct 20:40
4053fbb
Compare
Choose a tag to compare
  • Small improvements to the ellipse-function (and the CLI):

    • The major and minor axis of the ellipse are new forced to be at least 1e-9.
    • A radius of 0.0 provided through the CLI is now respected (was before
      overwritten).
  • empymod is more verbose when using layered computations.

  • Maintenance:

    • Replace deprecated sphinx-panels with sphinx-design.

Layered modelling

31 Aug 15:32
3b9a3c9
Compare
Choose a tag to compare

The simulation class takes new the parameters layered and layered_opts,
where the default values are False and None, respectively. If layered=True,
there will be no 3D computations. Instead, it will create a local layered (1D)
model for each source-receiver pair, and compute the response using the
semi-analytical code empymod (which needs to be installed manually, as it
is a soft dependency). In this case an eventual gradient is computed using the
finite-difference method, not the adjoint-state method, perturbing each layer
slightly. The main purpose of these layered computations is for quick checks,
QC, verifications, etc. Layered computation is also possible through the CLI,
through the new flag -l or --layered, and a new section [layered]
in the config file.

Other changes (many of them related to the above):

  • Model instances have a new attribute exctract_1d, which returns a layered
    (1D) model, extracted from the 3D model according the provided parameters;
    see :attr:emg3d.models.Model.extract_1d.

  • CLI takes new the boolean add_noise in the section [noise_opts]
    (default is True).

  • Maps: New function ellipse_indices returning a boolean indicating which
    points fall within a general ellipse for the provided input parameters.

  • Bug fixes, small improvements and maintenance

    • Simulation.misfit returns an ndarray again instead of an DataArray (was
      erroneously changed in v1.2.1).
    • Write json can now handle NumPy int/bool/float.
    • A clean on a Simulation now removes correctly the weights.
    • Capture error in jtvec if weight is complex NaN (should be real).
    • Model: mapping can now be an already instantiated map (sort of
      undocumented).
    • Cleaned-up the namespace by setting dir() explicitly.
    • Replace pytest-flake8 by plain flake8.
    • Moved all multiprocessing-related functions to _multiprocessing.py.

Bugfix trimmed z-vector

02 Aug 13:06
df86cc5
Compare
Choose a tag to compare
  • Meshing: Small fix to the automatic gridding from v1.5.0 (non-backwards
    compatible). A provided z-vector is new trimmed to the domain before the
    domain might be expanded due to the provided seasurface (which is as it was
    always intended, but not as it was implemented).
  • Few small maintenance things in the meta files.

CLI-clean

21 May 11:37
a4ea65e
Compare
Choose a tag to compare
  • CLI:

    • New command-line argument --clean: If an existing simulation is loaded,
      setting clean will remove any existing computed data (fields, misfit,
      gradient, residuals, synthetic data) and replace the model with the
      currently provided one.
    • New command-line argument --cache (or as parameter cache in the
      configuration file under [files]): Acts as a shortcut for --load --save using the same file name.
    • Parameters for noise generation should new be provided under their own
      section [noise_opts]; providing them under [simulation] is
      deprecated and will be removed in v1.9.0.
  • Simulation:

    • 'all' is now the same as 'computed' in to_file and to_dict,
      meaning the grids are stored as well.
    • Deprecation: The 'expand'-functionality in the gridding options is
      deprecated and will be removed in v1.9.0. A property-complete model has to
      be provided.
  • Meshes: Bumped the change of the default value for center_on_edge from
    True to False to v1.9.0, coinciding with the above deprecations.

Max offset

11 May 15:18
4432425
Compare
Choose a tag to compare
  • Survey: add_noise takes new a max_offset argument; receivers
    responses at offsets greater than maximum offset are set to NaN (also
    available through the CLI).

Anisotropic gradient

30 Apr 18:56
972adeb
Compare
Choose a tag to compare
  • Simulation: gradient, jvec, and jtvec new support triaxial
    anisotropy (also through the CLI). As a consequence, gradient and
    jtvec return an ndarray of shape (nx, ny, nz) (isotropic) or
    ({2;3}, nx, ny, nz) (VTI/HTI; triaxial), and jvec expects an ndarray
    of shape (nx, ny, nz) (isotropic) or ({1;2;3}, nx, ny, nz)
    (isotropic; VTI/HTI; triaxial).

Meshing: center on edge

30 Mar 18:11
df54e3f
Compare
Choose a tag to compare
  • Meshes:

    • construct_mesh and origin_and_widths take a new variable
      center_on_edge: If True, the center is put on an edge, if
      False, it is put at the cell center. Status quo is True, but the
      default will change to False in v1.7.0. If not set, it will
      currently raise a FutureWarning making the user aware of the change.
      Setting center_on_edge explicitly will suppress the warning.
    • Constructed grids through construct_mesh and origin_and_widths with
      a defined seasurface might slightly change due to some improvements and
      refactoring in the course of the above changes to the center. The changes
      should not be severe.
  • Simulation:

    • gradient: Changed slightly to use the proper adjoint (changed only if
      the computational grids differ from the inversion grid; requires
      discretize).
    • jvec: Adjusted to work for any mapping, not only conductivity, and also
      with adaptive gridding. It expects new a Fortran-ordered vector with the
      shape of the model (or a vector of that size).
      Gently reminder that the functions gradient, jvec, and jtvec
      are still considered experimental, and might change.
    • New optional keyword tqdm_opts. With False you can switch off the
      progress bars. Alternatively one can provide a dict, which is forwarded
      to tqdm.
  • CLI:

    • Expose mean_noise and ntype, in addition to min_offset, to the
      CLI (for adding noise); also plain (for solver), and center_on_edge
      (for gridding options).