forked from simpeg/simpeg
-
Notifications
You must be signed in to change notification settings - Fork 2
GEOPY-2522: Update simpeg fork to 0.25 #125
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
Open
domfournier
wants to merge
73
commits into
develop
Choose a base branch
from
GEOPY-2522
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <josephrcapriotti@gmail.com>
…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 <josephrcapriotti@gmail.com>
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 <josephrcapriotti@gmail.com>
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 <santisoler@fastmail.com>
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 <santisoler@fastmail.com>
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.
Use `conda-forge` instead of `defaults` channel when setting up the environment in Azure pipelines. This avoid us having to accept Anaconda's ToS. Fix bash syntax when defining `is_azure` variable. Use `python-build` instead of `build` in `.ci/azure/setup_env.sh` since `build` is not available in `conda-forge`.
Allow users to import `get_default_solver` and `set_default_solver` directly from `simpeg.utils` instead of having to do so from `simpeg.utils.solver_utils`, to avoid redundant words in import statements.
) Ditch the `DefaultSolverWarning` in `get_default_solver` and make the base PDE simulation class to handle the information message to users about using a default solver. The information message is sent through a new custom logger defined using `logging`. The information is sent from the constructor after obtaining the solver through `get_default_solver`. The solver class gets cached on instantiation, so the simulation will use the same solver even if the default solver changes later on. Warn users regarding poor performance when setting `SolverLU` or `Solver` as the solver. Adjust and extend tests. Also, add a `simpeg.utils.get_logger` function that returns the logger object used across the project, and a new `PerformanceWarning` class in a new `simpeg.utils.warnings` submodule.
Replace the deprecated `PointNaturalSource` and `Point3DTipper` NSEM receiver classes for their new counterparts (`Impedance` and `Tipper`) in examples and tests.
…1692) Make `Impedance.eval()` to return an array full of zeros in case that the receiver's orientation is `"xx"` or "`yy`" and the mesh is not 3D. This solves a bug that was causing the NSEM 1D simulation to error out after trying to cast the output of `eval()` into an array. Add test for the bugfix. --------- Co-authored-by: Santiago Soler <santisoler@fastmail.com>
Updates expired deprecation notifications missed in the 0.24.0 release. --------- Co-authored-by: Santiago Soler <santisoler@fastmail.com>
Update the implementation of the magnetic simulation using a differential approach solving the governing equation with finite volume. Support forward modelling TMI and the three components of the magnetic field. The simulation can take the magnetic permeability and/or remanent magnetization vectors as models. Test the simulation against analytic solution for ellipsoids. Add a new `EffectiveSusceptibilityMap` that converts effective susceptibility values into magnetic polarization. --------- Co-authored-by: domfournier <dominiquef@mirageoscience.com> Co-authored-by: Santiago Soler <santisoler@fastmail.com>
Fixes and standardizes the `SaveEveryIteration` child directives. They now reliably use the passed `directory` argument, and this also adds a few more safeguards to the file writes. --------- Co-authored-by: Santiago Soler <santisoler@fastmail.com>
Makes pytest error on implicit conversions of complex to real values.
…ulations (simpeg#1698) Avoid performing calculations for DC boundary conditions on the top of the mesh, where the simulation always explicitly uses a zero Neumann condition.
Create a new section in the User Guide: a How to Guide. Add a new document on how to choose a solver for PDE simulations. --------- Co-authored-by: Joseph Capriotti <josephrcapriotti@gmail.com>
Make Logger a bit quieter when running pytest by using a session wide auto-used fixture.
#### Summary Contains several updates for the CG based minimizer routines and their options to bring in line with more recent versions of SciPy. Also contains a bit of common code movement by using a `Bounded` and an `InexactCG` mix in classes for the minimizers.
#### Summary Linting failed with a new released version of some styles in between merges, Fix those errors.
Update meeting times to Wednesday afternoons in the `README.rst`.
Add new `_faceDiv` attribute to the `Fields3DMagneticField` and `Fields3DCurrentDensity` that holds the face divergence, needed to compute charge density. Add tests.
Create a custom RST landing page using `sphinx-design` that includes cards to the main sections of the docs. Move some content from the old landing page (present in the `README.rst`) into new sections in the User Guide: `citing.rst` and `about-simpeg.rst`.
Add a new page to the How to Guide that explains how to move a mesh to a given survey area. This is handy when working with real-world data, whose coordinates are going to be given in projected plain coordinates.
Add an admonition pointing users to the respective tutorials in User Tutorials.
Apply some minor improvements to the docs of `UpdateSensitivityWeights`: add admonition, fix usage of the `class` directive, update class names mentioned in the docs, improve list of options for different arguments.
Update the iteration write out order. For the longest time, the iteration printers have written out mismatched values at each iteration, and also did not print the last value of the inversion. This updates the write outs to happen after the line-search (matching the behavior of the save directives), but before the directives themselves alter the objective function. I've also removed several un-needed notifications: * setting bfgsH0 * only set on BFGS subclasses and * if the UpdatePreconditioner directive is not in the directive list (It handles the appoxHinv). * Removes the repeated notifications about no nans in the model, and instead raises an error if the model vector has any nans. Writers: * The iteration writer formatting logic was rather convoluted to me, so I refactored it a bit to make it a little easier to understand what it was doing...
Fix wrong B field when using the magnetic dipole source with the H-J formulation. When using the magnetic vector potential to define the source term in the H-J formulation, multiply by the face integration matrix before taking the curl and multiply by the inverse edge integration matrix afterwards.
Bump minimum required version of Python to 3.11.
Add a new page to the docs that specify the guidelines we follow to support older versions of Python and Numpy.
Remove most of the DC tutorials, and add an admonition pointing users to the respective tutorials in User Tutorials. Part of simpeg#1555
# Conflicts: # pyproject.toml # simpeg/directives/__init__.py # simpeg/directives/_regularization.py # simpeg/directives/directives.py # simpeg/directives/pgi_directives.py # simpeg/electromagnetics/base_1d.py # simpeg/electromagnetics/static/resistivity/simulation_2d.py # simpeg/maps/_base.py # simpeg/optimization.py # simpeg/potential_fields/base.py # simpeg/potential_fields/gravity/simulation.py # simpeg/potential_fields/magnetics/simulation.py # simpeg/survey.py
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
GEOPY-2522 - Update simpeg fork to 0.25