Skip to content

Commit 89d7dc6

Browse files
santisolerleouieda
authored andcommitted
Update code by removing old notebooks and scripts (#70)
Remove old notebooks, unused scripts. Update README.md and Makefile. Remove unimplemented tests
1 parent 1ddfa9a commit 89d7dc6

File tree

231 files changed

+511
-7233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+511
-7233
lines changed

code/Makefile

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Manages building, testing, and cleaning the code as well as running the code
1+
# Manages building and cleaning the code as well as running the code
22
# to generate the results and figures for the paper.
33

44
# CONFIGURATION
@@ -7,7 +7,6 @@
77
# Set the package name
88
PACKAGE = tesseroid_density
99

10-
TESTDIR = tests
1110
SCRIPTSDIR = scripts
1211
RESDIR = $(SCRIPTSDIR)/results
1312

@@ -26,13 +25,6 @@ RESULTS = $(RESDIR)/linear \
2625
$(RESDIR)/computation_time \
2726
$(RESDIR)/neuquen \
2827

29-
PYTEST_ARGS = --doctest-modules -v
30-
PYTEST_COV_ARGS = --cov-report=term-missing
31-
32-
# Execute a notebook on the command line. Modifies the notebook inplace so the
33-
# final execution order will be linear (from top to bottom). Running notebooks
34-
# like this helps ensure that the final results are not a product of a
35-
# non-linear execution order that can't be reproduced.
3628
RUN = python
3729

3830

@@ -42,10 +34,8 @@ RUN = python
4234
help:
4335
@echo "Commands:"
4436
@echo ""
45-
@echo " all runs 'build', 'test', and 'figures'"
37+
@echo " all runs 'build' and 'figures'"
4638
@echo " build build and install the package"
47-
@echo " test run the test suite (including doctests)"
48-
@echo " coverage calculate test coverage"
4939
@echo " check run all code quality checks (pep8, linter)"
5040
@echo " pep8 check for PEP8 style compliance"
5141
@echo " lint run static analysis using pylint"
@@ -59,12 +49,12 @@ help:
5949
# the results of long running computations.
6050
clean:
6151
find . -name "*.pyc" -exec rm -v {} \;
62-
rm -rvf build dist MANIFEST *.egg-info __pycache__ .coverage .cache
52+
rm -rvf build dist MANIFEST *.egg-info __pycache__ .cache
6353

6454

6555
# Run all steps to generate the final figures. Results files are generated
6656
# based on the figure requirements (see below).
67-
all: build test figures
57+
all: build figures
6858

6959

7060
# Generating figures
@@ -82,22 +72,16 @@ results:
8272
$(foreach script, $(SCRIPTS), $(RUN) $(script);)
8373

8474

85-
# Building and testing the code
75+
# Building and linting the code
8676
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8777

8878
build:
8979
pip install --no-deps -e .
9080

91-
test:
92-
pytest $(PYTEST_ARGS) $(PACKAGE) $(TESTDIR)
93-
94-
coverage:
95-
pytest $(PYTEST_COV_ARGS) --cov=$(PACKAGE) $(PYTEST_ARGS) $(PACKAGE) $(TESTDIR)
96-
9781
check: pep8 lint
9882

9983
pep8:
100-
flake8 $(PACKAGE) $(TESTDIR) setup.py
84+
flake8 $(PACKAGE) setup.py
10185

10286
lint:
10387
pylint $(PACKAGE) setup.py

code/README.md

Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
The code is divided between Python modules in `tesseroid-density`, Jupyter
44
notebooks in `notebooks`, and analysis scripts in `scripts`.
55
The modules implement the methodology and code that is reused in different applications.
6-
This code is tested using `pytest` with the test code in `tests`.
76

87
The `Makefile` automates all processes related to executing code.
98
Run the following to perform all actions from building the software to
@@ -24,9 +23,9 @@ function to every tesseroid by defining a regular Python function with a single
2423
`height` argument (float or numpy 1d array) that returns a float.
2524

2625

27-
## Building, testing, and linting
26+
## Building and linting
2827

29-
Use the `Makefile` to build, test, and lint the software:
28+
Use the `Makefile` to build and lint the software:
3029

3130
* Build and install:
3231

@@ -36,45 +35,62 @@ Use the `Makefile` to build, test, and lint the software:
3635

3736
make check
3837

39-
* Run the tests in `tests` and doctests in docstrings:
4038

41-
make test
42-
43-
* Calculate the test coverage of the main Python code (not including the
44-
notebooks):
45-
46-
make coverage
39+
## Scripts
40+
41+
Inside `scripts` we can find the Python scripts that create the results and figures
42+
shown on the manuscript.
43+
44+
- `density-based-discretization.py`: Create example figure for how the
45+
discretization-based algorithm works.
46+
- `linear_density.py`: Compares the numerical results of a spherical shell with its
47+
analytical solution in case of a linear density in depth. Only the adaptive
48+
discretization algorithm is performed.
49+
- `grid_search.py`: Performs a grid search by comparing the numerical results of
50+
a spherical shell with its analytical solution in case of an exponential density. The
51+
grid search is done by exploring values of distance-size ratio (D) and delta ratio.
52+
- `exponential_density.py`: Compares the numerical results of a spherical shell with its
53+
analytical solution in case of an exponential density in depth. It fixes the
54+
distance-size ratio (D) for the values obtained on the linear density case.
55+
- `sine_density.py`: Compares the numerical results of a spherical shell with its
56+
analytical solution in case of a sinusoidal density in depth. The purpose of this
57+
comparison is only to test the behaviour of the numerical approximation even on
58+
a highly varying density function. These kind of density functions are not intended to
59+
be applied on an actual geophysical case.
60+
- `number-of-tesseroids.py`: Compute the number of discretization the density-based
61+
algorithm performs for different density functions.
62+
- `neuquen_basin.py`: Apply the new methodology to forward model the Neuquén Basin with
63+
an exponential increasing density in depth and compare it with the results for an
64+
homogeneous and a linear density.
65+
66+
Extra files:
67+
- `tesseroid_model.py`: File containing useful classes for the Neuquén Basin forward
68+
modelling.
69+
70+
Directories:
71+
- `results`: Directory where all resulting files generated by the scripts will be saved.
72+
73+
74+
You can generate the results by running all scripts with:
75+
```
76+
make results
77+
```
78+
This could take a lot of time, so please be patient.
79+
80+
Or you can just recreate the figures with:
81+
```
82+
make figures
83+
```
4784

4885
## Notebooks
4986

50-
Inside `notebooks` we can find notebooks that show examples on how to use the
51-
package, solve the analytical solutions of the gravity fields generated by a
52-
spherical shell with variable density, determine the optimal parameters needed
53-
to achieve a good numerical approximation of the gravity fields and perform a
54-
forward modelling of the Neuquén Basin using an increasing exponential density
55-
function with depth.
87+
Inside `notebooks` we can find a single notebook showing how `tesseroid_density` could
88+
be used on forward modelling a mesh of tesseroids or a single one.
5689

57-
* [01-simple-example.ipynb](): Shows examples on how to use the variable
58-
density tesseroid code to model a single Tesseroid or Tesseroids meshes and
90+
* [tesseroid_density_example.ipynb](): Shows examples on how to use the variable
91+
density tesseroid code to model a single tesseroid or tesseroids meshes and
5992
compute the gravitational fields they generate.
60-
* [02-spherical-shell-analytical-solutions.ipynb](): Obtains the analytical
61-
solution for the gravitational potential generated by a spherical shell with
62-
variable density in the radial direction. Gives specific solutions for
63-
linear and exponential density functions.
64-
* [03-linear-density-test.ipynb](): Obtains the density-size ratio for the
65-
for a linear density Tesseroids by comparing the numerical results with the
66-
analytical solution of the gravitational fields generated by a spherical
67-
shell with the same linear density.
68-
* [04-density-based-discretization-algorithm.ipynb](): Illustrates how the new
69-
density-based discretization algorithm works and how a lower value of delta
70-
produces more subdivisions to the original tesseroids.
71-
* [05-exponential-density-grid-search.ipynb](): Performs a grid search on the
72-
D-delta space to find the optimal distance-size ratio and delta ratio pair by
73-
comparing the numerical result with the analytical solution for the spherical
74-
shell.
75-
* [06-exponential-density-delta-determination.ipynb](): Determines the optimal
76-
value of delta ratio for several exponential density functions while keeping
77-
D equal to the values determined in the linear density case.
78-
* [07-neuquen-basin.ipynb](): Forward model of the Neuquén Basin using an
79-
increasing exponential density.
80-
* [08-plot-figures.ipynb](): Produces ready to publish figures.
93+
94+
In order to open the notebook, run `jupyter-notebook`. It will open a new tab on your
95+
web browser in which you can navigate and open the notebook.
96+
If you want to obtain the same results, run the cells in order.

code/notebooks/01-simple-example.ipynb

Lines changed: 0 additions & 634 deletions
This file was deleted.

0 commit comments

Comments
 (0)