Skip to content

Conversation

@domfournier
Copy link

@domfournier domfournier commented Nov 6, 2025

GEOPY-2522 - Update simpeg fork to 0.25

santisoler and others added 30 commits March 6, 2025 09:09
Since zizmor is now available through conda-forge, we don't need to
install it through `pip` when creating a conda environment from
`environment.yml`.
Make `BaseDataMisfit.residual` to raise an error if the simulation
returns an array with `nan`s and/or `inf`s after calling the `dpred`
method. Add tests to check if the errors are correctly raised. Remove
error in case `BaseDataMisfit.data` is `None`: the `data` setter method
doesn't allow `BaseDataMisfit.data` to be `None`, therefore the error
will never be raised.
Remove non-supported Python versions and add latest ones.
Use shell rendering in the runtime information required in the Bug
Report Template.
Move some documentation pages like Getting Started, Examples and
Tutorials inside the User Guide. Create a new `docs/content/user-guide`
folder. Move Getting Started, Tutorials and Examples inside the new
folder. Remove the `docs/content/user_guide.rst` and replace it by a
`docs/content/user-guide/index.rst` file. Rename the `getting_started`
folder into `getting-started` (to make a consistent use of the dash in
urls). Update relevant index files, `docs/c onf.py`, `.gitignore` and
`docs/Makefile`. Configure `sphinx-redirects` so Sphinx create dummy
`.html` files for old locations of documentation pages that redirect to
the new locations. Fix link to Octocat image.
Correctly use the "bug" label in the issue template for bug reports.
Fix the number of `../` should be pre-appended to the target link to
generate the right redirect.
Assign the model before returning the Jacobian matrix. Don't use Numpy's
`dot` function: it doesn't work propertly when mixing Numpy arrays and
Scipy's sparse arrays. Use the matmul (`@`) operator instead. Add tests
that catch the bug.
Fix manual redirect for the index page of the User Guide.
Add new `get_slice` and `get_all_slices` methods to `BaseSurvey` that
mimics the behaviour of indexing `Data` objects. `get_slice` returns a
`slice` object that can be used to slice flat arrays like data or
uncertainty arrays. `get_all_slices` returns a dictionary with
source-receiver pairs as keys, and their corresponding `slice` object as
values. Optimize the implementation of these methods by working with
slices rather than Numpy arrays with indices. Add tests for the new
methods. Use `get_slice` in `Data`'s `__getitem__` and `__setitem__`
instead of the `indexing_dictionary`. Add `typing_extensions` as a
dependency for Python<3.13, and use the `deprecated` decorator to
deprecate the `index_dictionary` property.

---------

Co-authored-by: Joseph Capriotti <[email protected]>
…g#1622)

Make the `G` property in the gravity survey to be either a 2D Numpy
array, or a `scipy.sparse.LinearOperator` if `store_sensitivities` is
set to `"forward_only"`. The `LinearOperator` is capable of performing
operations like `G @ m` and `G.T @ v` without allocating the full `G`
matrix on memory or disk. This allows `Jvec` and `Jtvec` to be called
and not allocate the full `G` matrix. The `getJ` method also returns
either a 2D Numpy array or a `LinearOperator` formed by the product
between `G` and the `rhoDeriv` as a `LinearOperator` as well.
Reimplement the `getJtJdiag` method: allow it to get the diagonal
without building `G` if `"forward_only"`, optimize the computation of
the diagonal when `G` is fully formed through `einsum`s, and fix the
cache of `gtg_diagonal` by checking the hash of the `W` argument.
Deprecate the public `gtg_diagonal` property. Extend docstrings of
relevant methods. Add tests for all the new features.

---------

Co-authored-by: Joseph Capriotti <[email protected]>
Increase maximum number of iterations in magnetic equivalent sources
test.
#### Summary
Allows multiple locations for EM1D receivers

#### PR Checklist
* [x] If this is a work in progress PR, set as a Draft PR
* [x] Linted my code according to the [style
guides](https://docs.simpeg.xyz/latest/content/getting_started/contributing/code-style.html).
* [x] Added
[tests](https://docs.simpeg.xyz/latest/content/getting_started/contributing/testing.html)
to verify changes to the code.
* [x] Added necessary documentation to any new functions/classes
following the
expect
[style](https://docs.simpeg.xyz/latest/content/getting_started/contributing/documentation.html).
* [x] Marked as ready for review (if this is was a draft PR), and
converted
      to a Pull Request
* [x] Tagged ``@simpeg/simpeg-developers`` when ready for review.

#### Reference issue
Closes simpeg#1629

#### What does this implement/fix?
Allows for multiple locations in a single receiver for both 1D layered
FDEM and TDEM simulations (and adds some simple testing to ensure it
works).
Fix of the definition of `model` in J-related tests for the gravity
simulation: use the inverse of the mapping to define the `model` based
on the sample `densities`.
Fix typo, improve description of parameters and add some examples that
can be tested.
Avoid using `dpred` in the gravity test that might lead to confusion.
When the mapping is not a linear function, the `J @ m` is just a first
order approximation of the forward model and not equal to the `dpred`.
Extend test of the `getJ` method of the gravity simulation: test the
transpose of the `J` linear operator.
Add a new `.github/zizmor.yml` configuration file that allows zizmor to
use tags to pin the two reviewdog actions we currently use:
`reviewdog/action-flake8` and `reviewdog/action-black`.
Deprecate the `components` properties in potential field surveys. These
properties weren't returning the expected output. Since receivers within
the same survey can have different components, returning the components
of the first receiver is misleading.

---------

Co-authored-by: Joseph Capriotti <[email protected]>
Make use of `survey.nD` instead of just using the total number of
receiver locations. Add the special case where `is_amplitude_data` is
`True`. Add tests.
Use pytest's warning filter to make tests error when running a
randomized discretize test that doesn't use a random seed.
Sets source list on potential fields receivers to the source field input
(while ensuring their is only 1 item.
Make the `G` property in the magnetic survey to be either a 2D Numpy
array, or a `scipy.sparse.LinearOperator` if `store_sensitivities` is
set to `"forward_only"`. The `LinearOperator` is capable of performing
operations like `G @ m` and `G.T @ v` without allocating the full `G`
matrix on memory or disk. This allows `Jvec` and `Jtvec` to be called
and not allocate the full `G` matrix. Overwrite the `getJ` method to
return either a 2D Numpy array or a `LinearOperator` formed by the
product between `G` and the `chiDeriv` as a `LinearOperator` as well.
Reimplement the `getJtJdiag` method: allow it to get the diagonal
without building `G` if `"forward_only"`, optimize the computation of
the diagonal when `G` is fully formed through `einsum`s, and fix the
cache of `gtg_diagonal` by checking the hash of the `W` argument. Raise
`NotImplementedError`s in some methods when `is_amplitude_data` is
`True`, specially the `"forward_only"` cases where we don't want to
allocate the `G` matrix. Extend docstrings of relevant methods. Add
tests for all the new features.
Use Numpy's RNG and ditch `unittest` in tests for depth weighting.
Overwrite the `getJ` method of the NSEM 1D finite volume simulations so
they raise a `NotImplementedError`. Add tests for the new errors.

First step towards addressing simpeg#1541.
)

Make sure we set the model when calling getJ. This will ensure that if
the model is changed, the sensitivity matrix is cleared (for nonlinear
problems) and the sensitivity recomputed. This will close simpeg#1358

---------

Co-authored-by: Santiago Soler <[email protected]>
Standardize the `getJ` methods of TDEM and FDEM 1D simulations so they
return a dense array instead of a dictionary with blocks of the `J`
matrix. Make the old `getJ` method private by renaming it to `_getJ`.
The new `getJ` method reuses the `_getJ` and builds the while `J` as a
dense array before returning it. Update `Jvec` and `Jtvec` so they use
the new private method. Add tests to check the behaviour of the new
public method.

---------

Co-authored-by: Santiago Soler <[email protected]>
Add release notes for SimPEG v0.24.0, and update the version switcher.
…peg#1665)

Adds a description and units for gravity UV component in docstrings.
YingHuuu and others added 14 commits October 15, 2025 18:29
Standardize signature of `deriv` method across mappings: make sure they
are all defined as `deriv(m, v=None)`. Implement the dot product between
the derivative matrix and `v` if `v` is not `None`. Add tests for the
modified methods.

---------

Co-authored-by: Santiago Soler <[email protected]>
Update how mappings are being used in regularizations: regularize on
`mapping(m) - mapping(m_ref)` instead of `mapping(m - m_ref)`. Update
implementations and documentation of `Smallness`,
`SmoothnessFirstOrder`, `SmoothnessSecondOrder`, and
`SmoothnessFullGradient`: the `f_m` will compute difference of the
mapped model and reference model, while the `f_m_deriv` will not make
use of the reference model now, since it's not carried out in the
derivative. Add tests to check this intended behaviour.
#### Fixes for pymatsolver 0.4.0
<!-- Add a summary of this Pull Request -->

#### PR Checklist
* [x] If this is a work in progress PR, set as a Draft PR
* [x] Linted my code according to the [style
guides](https://docs.simpeg.xyz/latest/content/getting_started/contributing/code-style.html).
* [x] Added
[tests](https://docs.simpeg.xyz/latest/content/getting_started/contributing/testing.html)
to verify changes to the code.
* [x] Added necessary documentation to any new functions/classes
following the
expect
[style](https://docs.simpeg.xyz/latest/content/getting_started/contributing/documentation.html).
* [x] Marked as ready for review (if this is was a draft PR), and
converted
      to a Pull Request
* [x] Tagged ``@simpeg/simpeg-developers`` when ready for review.

#### What does this implement/fix?
Squeeze these two locations in the SimulationDC operation (to be
consistent on output of `__inner_mat_mul `operation)

#### Additional information
The `__inner_mat_mul` function will "squeeze" out single length second
axes, so this fix causes it to be consistent for this operation in CG.
This function had to perform this way because of the way pymatsoler
previously handled single length array inputs.
Remove the duplicated current being multiplied when computing the `Mejs`
in `LineCurrent`. Add a test that checks that the electric fields are
linear in the current.
Apply some fixes to LaTeX equations in some regularization classes.
Make the `get_indices_block` function to always return an array of
integers for the cells that belong to the specified block, instead of
returning a tuple with just a single array. Improve its implementation.
Fix it for 1D mesh since it wasn't working properly. Improve error
messages: raise better errors than just `AssertError`s and improve
messages. Avoid overwriting the `p0` and `p1` arrays in-place if they
are not provided in the right order (west-south-bottom and then
east-north-top). Add tests for the function. Update usage of the
function across tests and examples. This introduces a backward
incompatible change.
Remove the `Data.index_dictionary` property. Remove the `gtg_diagonal`
property from gravity simulation. Remove the `components` property from
gravity and magnetic surveys. Remove the
`HasModel.deleteTheseOnModelUpdate` property.
Add new `shift_to_discrete_topography` function that shifts locations
relative to discrete surface topography. Add also a new
`get_discrete_topography` function that generates discrete topography
locations out of a mesh and its active cells. We measure electric fields
at the Earth's surface when performing MT surveys. Like DC/IP, the
original measurement locations of the electric fields can end up in air
cells when we define discrete surface topography. These functions allow
the user to shift locations relative to discrete topography on Tensor
and Tree meshes. For Airborne NSEM, they also allow the user to preserve
the original flight heights. Deprecate the following functions:
`gettopoCC`, `drapeTopotoLoc`, and `closestPointsGrid`.

---------

Co-authored-by: Santiago Soler <[email protected]>
…g#1723)

Deprecate the unused `force` and `topography` arguments of the method.
Add tests to check the warnings are raised.
Fix a few LaTeX equations in
`simpeg.potential_fields.magnetics.Simulation3DDifferential` that
weren't rendering correctly.
Implement the B field computation from a closed-loop wire source in the
TDEM code. We first compute the vector potential using the Biot-Savart
Law (implemented in geoana) and then take the curl to get the initial
B-field. Adds the computation of B with a step-off waveform using the B
or H formulations.

---------

Co-authored-by: Joseph Capriotti <[email protected]>
Co-authored-by: Santiago Soler <[email protected]>
…mpeg#1714)

Allow passing `ramp_start` and `ramp_end` to the `RampOffWaveform` TDEM
source and fix issue with waveform being wrong at times before
`-epsilon`. Deprecate the `off_time` argument.
Add changelog for next release of SimPEG: v0.25.0. Add the new version
to the version switcher.

---------

Co-authored-by: Joseph Capriotti <[email protected]>
Co-authored-by: Lindsey Heagy <[email protected]>
Forgot to add the new release notes to the index, so they can show up in
the website. Update the release date. Minor corrections to RST syntax.
@github-actions github-actions bot changed the title GEOPY-2522 GEOPY-2522: Update simpeg fork to 0.25 Nov 6, 2025
santisoler and others added 13 commits November 27, 2025 17:48
Fix the name of the `threshold_value` argument in the docstring of the
`UpdateSensitivityWeights` directive.
#### Summary
Support complex permeability in forward 1D time-domain em simulations.

#### PR Checklist
* [x] If this is a work in progress PR, set as a Draft PR
* [x] Linted my code according to the [style
guides](https://docs.simpeg.xyz/latest/content/getting_started/contributing/code-style.html).
* [x] Added
[tests](https://docs.simpeg.xyz/latest/content/getting_started/contributing/testing.html)
to verify changes to the code.
* [x] Added necessary documentation to any new functions/classes
following the
expect
[style](https://docs.simpeg.xyz/latest/content/getting_started/contributing/documentation.html).
* [x] Marked as ready for review (if this is was a draft PR), and
converted
      to a Pull Request
* [x] Tagged ``@simpeg/simpeg-developers`` when ready for review.


#### What does this implement/fix?
removes cast to `real`

#### Additional information

`geoana` supports complex permeability in the kernel, so the cast to
real is unnecessary.
#### Summary
allows the sigmoid to map from `a` to `b` regardless of their respective
order, only errors if they are equal.

#### PR Checklist
* [x] If this is a work in progress PR, set as a Draft PR
* [x] Linted my code according to the [style
guides](https://docs.simpeg.xyz/latest/content/getting_started/contributing/code-style.html).
* [x] Added
[tests](https://docs.simpeg.xyz/latest/content/getting_started/contributing/testing.html)
to verify changes to the code.
* [x] Added necessary documentation to any new functions/classes
following the
expect
[style](https://docs.simpeg.xyz/latest/content/getting_started/contributing/documentation.html).
* [x] Marked as ready for review (if this is was a draft PR), and
converted
      to a Pull Request
* [x] Tagged ``@simpeg/simpeg-developers`` when ready for review.


#### What does this implement/fix?
Allows the sigmoid map to go arbitrarily between two numbers `a` and
`b`,

#### Additional information

having the sigmoid map the interval to [-5, 5] is just as valid as [5,
-5]
Since sklearn 1.8.0, many methods of their `GaussianMixtureModel` take
an extra `xp` parameter that's intended to be a module compatible with
the array API. Methods like `fit` are passing that extra parameter to
these methods, making SimPEG's GMMs to fail due to invalid argument.
This PR patches SimPEG's GMMs to take that extra `xp` parameter, while
raising a warning in case `xp` is not Numpy.
This PR is meant to fix a bug in the NSEM ApparentConductivity receiver
class. The current implementation adds the fields for x and y
polarizations before taking the absolute value. This is incorrect. As
you can see, the anomalies do not align with 3D structures. This was
missed in current pytesting since the forward simulation is being
validated for a 1D model.
Improve the style of the docstrings of a few GMM classes used in PGI.
(cherry picked from commit a39f9b18c127505fd5e33cb8ccad9325b8521813)
@domfournier domfournier merged commit 03bcafc into develop Jan 9, 2026
9 checks passed
@domfournier domfournier deleted the GEOPY-2522 branch January 9, 2026 23:01
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.