Skip to content
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

Dev #36

Merged
merged 10 commits into from
Dec 6, 2023
Merged

Dev #36

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing
# How to contribute

See the [Scientific Python Developer Guide][spc-dev-intro] for a detailed
description of best practices for developing scientific packages.
Expand Down
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Report a problem/bug to help us improve.
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**Full code that generate the error**
<!--
Include any data files or inputs required to run the code. It really helps if
we can run the code on our own machines.
-->

```python
PASTE YOUR CODE HERE
```

**Full error message**

```
PASTE ERROR MESSAGE HERE
```
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: ""
assignees: ""
---

**Description of the desired feature:**

<!--
Add as much detail as you can in your description below. If possible, include an
example of how you would like to use this feature (even better if it's a code
example).
-->

**Are you willing to help implement and maintain this feature?**

<!--
Every feature we add is code that we will have to maintain and keep updated.
Please let us know if you're willing to help maintain this feature in the future.
-->
24 changes: 24 additions & 0 deletions .github/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Inspired by [PyGMT](https://github.com/GenericMappingTools/pygmt) welcome messages.
# Configuration for welcome - https://github.com/behaviorbot/welcome

# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome

# Comment to be posted to on first time issues
newIssueWelcomeComment: >
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our [contributing guidelines](https://github.com/mdtanker/invert4geom/blob/main/docs/contribute.md).
# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome

# Comment to be posted to on PRs from first time contributors in your repository
newPRWelcomeComment: >
💖 Thanks for opening this pull request! 💖
Please make sure you read our [contributing guidelines](https://github.com/mdtanker/invert4geom/blob/main/.github/CONTRIBUTING.md).
A few things to keep in mind:
* If you need help writing tests, take a look at the existing ones for inspiration. If you don't know where to start, let us know and we'll walk you through it.
* All new features should be documented. It helps to write the docstrings for your functions/classes before writing the code. This will help you think about your code design and results in better code.
* No matter what, we are really grateful that you put in the effort to do this! 🎉
# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge

# Comment to be posted to on pull requests merged by a first time user
firstPRMergeComment: >
🎉🎉🎉 Congrats on merging your first pull request and welcome to the team! 🎉🎉🎉
We hope that this was a good experience for you. Let us know if there is any way that the contributing process could be improved.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ exclude: |
docs/api/invert4geom.regional.rst|
docs/api/invert4geom.optimization.rst|
CHANGELOG.md|
.github/ISSUE_TEMPLATE/bug_report.md|
.github/ISSUE_TEMPLATE/feature_request.md|
.github/config.yml|
)$

repos:
Expand Down Expand Up @@ -90,6 +93,7 @@ repos:
hooks:
- id: shellcheck

# check for commonly miss-capitalized words
- repo: local
hooks:
- id: disallow-caps
Expand Down
8 changes: 4 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@
#
# Runtime deps
#
"numpy": ("https://docs.scipy.org/doc/numpy/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"pandas": ("http://pandas.pydata.org/pandas-docs/stable/", None),
"xarray": ("http://xarray.pydata.org/en/stable/", None),
"xarray": ("https://docs.xarray.dev/en/stable/", None),
"verde": ("https://www.fatiando.org/verde/latest/", None),
"rioxarray": ("https://corteva.github.io/rioxarray/stable/", None),
# pykdtree
"xrft": ("https://xrft.readthedocs.io/en/stable/", None),
"harmonica": ("https://www.fatiando.org/harmonica/latest/", None),
"antarctic_plots": ("https://antarctic-plots.readthedocs.io/en/latest/", None),
"numba": ("https://numba.pydata.org/numba-doc/latest/", None),
"scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
# nptyping
# numba_progress
# "tqdm": ("https://tqdm.github.io/", None),
Expand All @@ -61,7 +61,7 @@
"pyvista": ("https://docs.pyvista.org/", None),
# trame
# ipywidgets
"matplotlib": ("https://matplotlib.org/", None),
"matplotlib": ("https://matplotlib.org/stable/", None),
"seaborn": ("https://seaborn.pydata.org/", None),
#
# Opti deps
Expand Down
3 changes: 3 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```{include} ../.github/CONTRIBUTING.md

```
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ gallery/index.md
api/invert4geom
citing.md
changelog.md
references.md
references.rst
```

```{toctree}
:maxdepth: 1
:hidden:
:caption: ℹ️ Other resources
How to contribute <https://github.com/mdtanker/invert4geom/blob/main/.github/CONTRIBUTING.md>
contributing.md
Source code on GitHub <https://github.com/mdtanker/invert4geom>
```

Expand Down Expand Up @@ -120,7 +120,7 @@ make changes to the ones we already have while we try to improve the
software based on users' experience, test new ideas, take better design
decisions, etc.
Some of these changes could be **backwards incompatible**. Keep that in
mind before you update Harmonica to a newer version.
mind before you update Invert4Geom to a newer version.
```

```{admonition} How to contribute
Expand Down
4 changes: 2 additions & 2 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ in the **Regional** module for finding the optimal regional separation methods.

## Plotting

Various function for plotting maps and graphs used throughout the other modules
Various function for plotting maps and graphs used throughout the other modules.

## Utils

Utilities used throughout the other modules
Utilities used throughout the other modules.

## Synthetic

Expand Down
10 changes: 5 additions & 5 deletions env/RTD_env.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Requirements for running the github action: test only need run-time dependencies
# Requirements for building the documentation
name: invert4geom
channels:
- conda-forge
Expand All @@ -24,10 +24,10 @@ dependencies:
- pygmt
- dask
# opti
- optuna>=3.1.0
- botorch>=0.4.0
- psutil
- joblib
# - optuna>=3.1.0
# - botorch>=0.4.0
# - psutil
# - joblib
# docs
- sphinx>=4.0
- myst-parser
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def docs(session: nox.Session) -> None:

extra_installs = ["sphinx-autobuild"] if args.serve else []

session.install("-e.[opti,docs,viz]", *extra_installs)
session.install("-e.[docs]", *extra_installs)
session.chdir("docs")

if args.builder == "linkcheck":
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ classifiers = [
]
readme = "README.md"
version = "0.3.0"
license = {file = "LICENSE"}

dependencies = [
"numpy",
Expand Down
14 changes: 7 additions & 7 deletions src/invert4geom/inversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,17 @@ def jacobian_annular(
jac: NDArray,
) -> NDArray:
"""
Function to calculate the Jacobian matrix using the annular cylinder
approximation. The resulting Jacobian is a matrix (numpy array) with a row per
gravity observation and a column per prism. This approximates the prisms as an
annulus, and calculates it's vertical gravity derivative. Takes arrays from
`jacobian`, feeds them into `grav_column_der`, and returns the jacobian.
Function to calculate the Jacobian matrix using the annular cylinder
approximation. The resulting Jacobian is a matrix (numpy array) with a row per
gravity observation and a column per prism. This approximates the prisms as an
annulus, and calculates it's vertical gravity derivative. Takes arrays from
`jacobian`, feeds them into `grav_column_der`, and returns the jacobian.

Parameters
----------
grav_easting, grav_northing, grav_upward : NDArray
coordinates of gravity observation points.
prism_easting, prism_northing, prism_top, : NDArray
coordinates of gravity observation points
prism_easting, prism_northing, prism_top : NDArray
coordinates of prism's center in northing, easting, and upward directions,
respectively
prism_density : NDArray
Expand Down
6 changes: 3 additions & 3 deletions src/invert4geom/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def available_cpu_count() -> typing.Any:
# cpuset may restrict the number of *available* processors
try:
# m = re.search(r"(?m)^Cpus_allowed:\s*(.*)$", open("/proc/self/status").read())
with pathlib.Path("/proc/self/status").open() as f: # pylint: disable=unspecified-encoding
with pathlib.Path("/proc/self/status").open(encoding="utf8") as f:
m = re.search(r"(?m)^Cpus_allowed:\s*(.*)$", f.read())
if m:
res = bin(int(m.group(1).replace(",", ""), 16)).count("1")
Expand Down Expand Up @@ -138,7 +138,7 @@ def available_cpu_count() -> typing.Any:
# Linux
try:
# res = open("/proc/cpuinfo").read().count("processor\t:")
with pathlib.Path("/proc/cpuinfo").open() as f: # pylint: disable=unspecified-encoding
with pathlib.Path("/proc/cpuinfo").open(encoding="utf8") as f:
res = f.read().count("processor\t:")

if res > 0:
Expand All @@ -163,7 +163,7 @@ def available_cpu_count() -> typing.Any:
try:
try:
# dmesg = open("/var/run/dmesg.boot").read()
with pathlib.Path("/var/run/dmesg.boot").open() as f: # pylint: disable=unspecified-encoding
with pathlib.Path("/var/run/dmesg.boot").open(encoding="utf8") as f:
dmesg = f.read()
# dmesg = pathlib.Path("/var/run/dmesg.boot").open().read()
except OSError:
Expand Down
Loading