Skip to content

Conversation

@domfournier
Copy link

@domfournier domfournier commented Feb 24, 2025

GEOPY-2029 - Update Simpeg 0.21.2 to 0.23

santisoler and others added 30 commits June 10, 2024 09:25
Add `random_seed` argument to `IdentityMap.test`. Add a new
`random_seed` argument to the `test` method of `IdentityMap` to control
the random state for creating the `m` array if it's not provided. Update
tests to use the `random_seed`. If the `m` array is passed while running
the `test()` method, specify the keyword for the argument to avoid
relying only on its position.
Replace the usage of the deprecated functions in `numpy.random` module
for the Numpy's random number generator class and its methods, in most
of the TDEM tests.

Part of the solution to simpeg#1289
Make use of the `random_seed` arguments in a few objective function
tests that were missed in previous PR.

Related to simpeg#1448.
Correcting contour colors in a gravity plot in the User Guide for a
gravity plot: correctly use the color limits both in the contours and
while building the custom color bar.
Configure Sphinx autodoc to hide type hints from signatures of
functions, methods and classes to improve readability. Expected types
for each parameter should be listed in the docstring.
Remove the `simpeg/maps.py` file and create a new `simpeg/maps`
directory. Add private files for each category of map classes inside the
new submodule. Make these classes public through the
`simpeg/maps/__init__.py`.
Moves simpeg to a pyproject.toml based setup.

* as much configuration as possible in `pyproject.toml`
* general repository cleanup
* ci shell scripts
Replace the usage of the deprecated functions in `numpy.random` module
for the Numpy's random number generator class and its methods, in most
of the static EM tests.

Part of the solution to simpeg#1289
Split the stages from `azure-pipelines.yml` into multiple files under
the `.ci/azure` directory. Strip deployment to PyPI from the deployment
of the docs into different stages. Add new job to upload each version
merged to `main` to TestPyPI. Configure the `setuptools_scm` local
version scheme so we can modify it before building the wheels for
TestPyPI. Refactor the new docs pipeline: have a single build job and
two jobs for deploying the docs to `simpeg-doctest`, one after a release
and one for nightly builds. While building the sdist (before pushing to
PyPI), rely on `build` to install build dependencies listed in
`pyproject.toml` in isolation.

---------

Co-authored-by: Joseph Capriotti <josephrcapriotti@gmail.com>
Ignore the `survey_type` argument in the dc and sip survey constructors
and raise warning. Raise warning when trying to access or set the
`survey_type` properties. The `survey_type` argument is not being used
anymore and was a residue from an older implementation of the survey
classes. Keeping it as part of the class creates confusion among users
on how to properly use it. Update tests and examples that were still
using that argument. Add tests to check if warnings are being raised
when trying to access the `survey_type` property.

Fixes simpeg#1432
Remove the `old-docs.yml` Azure pipeline. Update the new pipelines to
deploy docs so they push the changes to the `gh-pages` and `dev`
branches in the `simpeg-docs` repo. Update the url for the
`versions.json`. Move scripts that deploy the docs to actual bash
scripts. Apply some improvements to the scripts and solve a few issues
in them that weren't working as expected.
This commit should be reverted after checking that everything works
fine.
Remove the `F821` warning from the ignored flake8 warning lists. Solve a
few undefined variables across the repository. Remove the unused
`DerivProjfieldsTest` test function.

---------

Co-authored-by: Lindsey Heagy <lindseyheagy@gmail.com>
Replace the usage of the deprecated functions in `numpy.random` module
for the Numpy's random number generator class and its methods, in most
of the Viscous Remanent Magnetization tests.

Part of the solution to simpeg#1289
Replace the usage of the deprecated functions in `numpy.random` module
for the Numpy's random number generator class and its methods, in most
of the NSEM tests.

Part of the solution to simpeg#1289
Remove new line characters in release checklist so the paragraphs and
list items are unwrapped. This improves how GitHub renders the issue
template. Minor improvements to Markdown style.
Improve the instructions to update the `versions.json` file in the
release checklist.
Add release notes for v0.22.0. Add new version to `versions.json` file
and mark it as the latest.
Configure the version warning banner in Sphinx PyData theme. Set v0.22.0
as the preferred version in `versions.json`. Remove leading `v` in
version numbers in `versions.json`. Remove leading `v` in the
`switcher_version` variable defined in `docs/conf.py`.
Make them less prone to failing by splitting the imports, so we don't
rely on matplotib importing numpy in its base `__init__.py`.

Fixes simpeg#1502
Add release noted for v0.22.1, and include them in the releases index.
Update `versions.json` file: add v0.22.1 as the latest and preferred
version.
Configure the deploy job in the PyPI stage on Azure to only trigger
after a release or a nightly run. This prevents trying to push the same
release to TestPyPI multiple times.
Fix typo and update ASCII style of a comment block in `pgi_utils.py`.
Small non-controversial take-out from simpeg#1075.
Use the `discretize`'s `requires` to decorate `mem_profile_class`,
instead of `simpeg.utils.code_utils.requires`, since the former is
intended to be used for modules, while the latter should be used for
attributes.
Replace `SimPEG` for `simpeg` in a few missing docstrings, so Sphinx can
link them to the respective classes and functions.
Pass `rtol` or `tol` to SciPy solvers depending on the available version
of SciPy: for `scipy>=1.12` use `rtol`, otherwise use `tol`. SciPy 1.12
changed `tol` to `rtol` for `scipy.sparse.linalg...`, and removed `tol`
in SciPy 1.14.

Closes simpeg#1516

---------

Co-authored-by: Santiago Soler <santisoler@fastmail.com>
Set `sklearn` and `pandas` as optional dependencies in `pyproject.toml`.
Make use of `discretize`'s `requires` utils function to decorate the
functions and methods that require either `pandas` or `scikit-learn` to
be installed, specifically in
`simpeg.electromagnetics.static.resisitivity.IO` and PGI-related
classes.
#### Summary
Updates for `dask>2024.2.1`

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

#### What does this implement/fix?
A few things:
1) dask recently updated how things items are hashed to create a more
deterministic hash for items. For objects it will change depending on
the state of the objects. `Simulation` objects are mutable things, thus
their hash would change overtime for the same object. For the
`DaskMetaSimulation`, we want a single simulation's hash (also a single
map's hash) to be constant in time, so this PR adds uuid properties to
each of those base classes that are then registered to be used by dask
to hash the objects.

2) This deterministic hashing lead to a race condition in the error
testing. When objects are scattered, dereferenced, then scattered again.
The garbage collector would destroy the scattered objects dereferenced
from the first call `after` the second scatter, thus creating a case
where we are trying to access a Canceled Future.

3) This is also now a bit more rigorous about only using a single worker
for each simulation operation when the simulations inadvertently live on
multiple workers, by selecting the worker that had fewer simulations
assigned to it.

#### Additional information

See dask/distributed#8576 for more information
about the race condition.

This also implements one of the updates in simpeg#1444 regarding the testing
environment script so that we are sure we are creating the correct
environment.
dccowan and others added 24 commits November 1, 2024 17:24
#### Summary
Add/modify NSEM receiver classes to simulate various AirMT data types,
both theoretical and ones used in practice. Data types include:

* Admittance tensor data
* ZTEM data (all fields measured at same location before)
* Quasi-impedance data
* MobileMT data

Also includes simpeg#1507
---------

Co-authored-by: Santiago Soler <santisoler@fastmail.com>
Co-authored-by: Joseph Capriotti <josephrcapriotti@gmail.com>
#### Summary
Uploads all the codecov files at once.

#### 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.
…#1310)

Add a new `distance_weighting` function with a new Numba-based
implementation that makes it more memory efficient that using Scipy's
`spatial_distance.cdist`. Add more tests and a tutorial comparing depth,
distance, and sensitivity weighting.

Co-authored-by: Santiago Soler <santisoler@fastmail.com>
Co-authored-by: Joseph Capriotti <josephrcapriotti@gmail.com>
#### Summary
`empymod` is a pretty heavy dependency for the functionality we are
using from it. This removes the dependency and instead uses `libdlf` to
get the filters, and a streamlined `get_splined_dlf_points` for our
internal use.

#### 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.

#### Additional information
I say `empymod` is a heavy dependency because it in turn relies on
`numba`.
Add changelog for SimPEG v0.23.0.

Co-authored-by: Joseph Capriotti <josephrcapriotti@gmail.com>
Add entry for v0.23.0 in `_versions.json`.
Fix release date for v0.23.0.
#### Summary
Bugfix so that the initial fields produced for `db/dt`, `dh/dt`, from
the B field or H field simulations are zero. There was previously a bug
where we set the electric source term to `Zero()` when infact it should
have been evaluated. This would only effect `db/dt` (or `dh/dt`) that
were measured before the first time-step, but it also impacted
visualizations of the fields.

To catch this issue, I have extended our cross-check tests for tdem
simulation to also include an evaluation of the data at t=0. Running
this test on the current main version of SimPEG will fail.
#### Summary
UBC style printout on minimizers were never updated for simpeg#1326, this
fixes that and removes the "factor" property that was used to handle
that printout style.


#### Reference issue
Related to simpeg#763

#### What does this implement/fix?
Fixes the UBC style printout
…#1578)

#### Summary

Add missing docstring to the `n_processes` property in potential field
simulation classes.

The missing docstrings were raised by @thibaut-kobold in Mattermost.
…#1582)

#### Summary
Move `solver` attribute to the `BasePDESimulation`.


#### What does this implement/fix?
Not all simulations need `solver`, leading to awkward setting of
`solver=None` on `LinearSimulation`, and also on the layered 1D
simulations. This move the `solver` attribute to the `BasePDESimulation`
(the ones that actually need a solver).
Update the instructions on how to build the documentation pages and
serve them locally.

---------

Co-authored-by: Joseph Capriotti <josephrcapriotti@gmail.com>
Removes the `mesh` attribute of `BaseSimulation` as not all simulations require meshes.


Not all simulations require a `mesh`, so this makes it more explicit which simulations actually require it, and I've added further
constraints on mesh types for simulations which are restricted on their mesh types allowed.

#### Additional Information
This branches off of simpeg#1582. so should be merged after that one.

---------

Co-authored-by: Santiago Soler <santisoler@fastmail.com>
Speed up dot products in the derivative methods of the PGI
regularization classes by making use of Numpy functions instead of for
loops that perform a significant number of iterations.
…impeg#1588)

Change the `__call__` method in PGI smallness to avoid for loops through
numpy arrays. Fix the docstring to reflect that physical properties can
still be correlated if `approx_eval=True` and `approx_gradient=True`.
#### Summary
Privatizes the `deleteOnModelUpdate` property, and unify with the
`clean_on_model_update`.

#### Reference issue
Working towards simpeg#1429

#### What does this implement/fix?
The `deleteOnModelUpdate` property is not needed to be public, this
privatizes it. It also removes the somewhat duplicated purpose of the
`clean_on_model_change` property, as we should rely on the solvers to
clean themselves up properly upon deletion instead of manually
triggering it.
…#1595)

#### Summary
Updates the PGI plotting example for matplotlib 3.10 removals.

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

#### What does this implement/fix?
This makes the azure-pipeline codecov upload step run if the tests
succeed or fail, as it can still be useful to see coverage analyses of
failed tests.
Make use of `zizmor` to lint the GitHub Actions workflows under the
`.github/workflows` directory for common security vulnerabilities. Add a
new `check-actions` target in the `Makefile` that runs `zizmor` on those
files. Add a new GitHub Action that runs `zizmor`. Add `zizmor` to the
`environment.yml`. Add warning to the `pull_request.yml` workflow about
not running code from the PR branch since it makes use of the
`pull_request_target` trigger, and make `zizmor` to ignore the
`pull-request_target` trigger. Fix some of the warnings raised by
`zizmor`.

---------

Co-authored-by: Joseph Capriotti <josephrcapriotti@gmail.com>
Apply some improvements to the installation instructions under the
Getting Started documentation page. Recommend Miniforge over Anaconda as
Python distribution. Remove the admonition that warns about using Python
2.7 to run SimPEG. Replace link to Google Form for one to the Discourse
forum. Minor improvements on format and style, with minor changes in
wording.
simpeg#1602)

#### Summary
Set `permissions` in Action workflows to solve zizmor's complains about
excessive permissions for the `GITHUB_TOKEN`.

#### Additional information

Some references:

* [zizmor docs for the `excessive-permissions` audit
rule](https://woodruffw.github.io/zizmor/audits/#excessive-permissions)
* [Defining access for the GITHUB_TOKEN
permissions](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token#defining-access-for-the-github_token-permissions)
* [Controlling permissions for
`GITHUB_TOKEN`](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token)
#### Summary
The function `scipy.integrate.quadrature` was removed in scipy v1.15.0
in favor of `scipy.integrate.quad`. This function is available in 1.8 so
no need to update the minimum required scipy version.
# Conflicts:
#	.pre-commit-config.yaml
#	pyproject.toml
#	simpeg/dask/simulation.py
#	simpeg/directives/__init__.py
#	simpeg/directives/directives.py
#	simpeg/electromagnetics/natural_source/receivers.py
#	simpeg/electromagnetics/natural_source/utils/plot_data_types.py
#	simpeg/electromagnetics/static/resistivity/simulation.py
#	simpeg/electromagnetics/static/spectral_induced_polarization/survey.py
#	simpeg/maps.py
#	simpeg/potential_fields/base.py
#	simpeg/props.py
#	simpeg/simulation.py
@github-actions github-actions bot changed the title Geopy 2029 GEOPY-2029: Update Simpeg 0.21.2 to 0.23 Feb 24, 2025
@domfournier domfournier merged commit e9911e1 into develop Feb 25, 2025
5 of 6 checks passed
@domfournier domfournier deleted the GEOPY-2029 branch February 25, 2025 19:16
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.