Skip to main content

Python Library performing Geomagnetic Field inversions for (paleo)magnetic data

Project description

DOI

pymaginverse

Library for the numerical inversion of geomagnetic field data. This library is brough to you by Frenk Out, Maximilian Schanner, Liz van Grinsven, Monika Korte, and Lennart de Groot. This code is based on Fortran code used for the following two papers:

Library

The library consists of two main modules:

  • pymaginverse/data_prep.py: contains methods for correctly preparing data for the FieldInversion-class. This method stores all required parameters per station into one class, which can then be imported directly into FieldInversion. The class takes a csv-file of declination, inclination, intensity, x, y, z, and/or h-component magnetic data + accompanying data errors.
  • pymaginverse/field_inversion.py: contains the FieldInversion-class that performs the actual inversion of geomagnetic field data. It requires, besides the time vector over which the inversion will take place, an instance of InputData as minimum input.

Installation

option a: pip

The easiest way to get a working environment set up is using the conda dependency manager, e.g. from here. Replacing with a name of your choice, you can create a conda environment with all dependencies provided using:

conda create --name <env-name> "python==3.11"

Then, activate your environment

conda activate <env-name>

Subsequently, either enter the root directory of the repository (which you should have downloaded with either git clone or the download button above), to install the package:

pip install . -U

or pip install directly from the pypi repository:

pip install pymaginverse

Option b: poetry

In order to get the inversion code running with poetry, you need to have poetry properly installed. See the website of poetry, or run:

curl -sSL https://install.python-poetry.org | python3 -

The easiest way to get a working environment set up is using the conda dependency manager, e.g. from here. Replacing with a name of your choice, you can create a conda environment with all dependencies provided using:

conda create --name <env-name> "python==3.11"

Then, activate your environment

conda activate <env-name>

Enter the root directory of the repository (which you should have downloaded with either git clone or the download button above), to install the package.

poetry install

Uninstallation

Uninstallation is possible by typing in the terminal (possibly in the specific virtual environment):

pip uninstall pymaginverse

Tutorial

We have provided four tutorials to make the library easier to use and understand. You can find the jupyter notebooks containing the tutorials in the doc-folder. The tutorials are:

  1. Tutorial 1: loading data and running a model. In this Tutorial we show how to load data into the InputData-class, and teach you the basics of the FieldInversion-class (including several damping types).
  2. Tutorial 2: plotting results. We show some basic plotting tools allowing a better understanding of the created geomagnetic model. Examples consist of residual plots, gauss coefficients, powerspectra, and global magnetic field maps.
  3. Tutorial 3: sweeping through models. We show how to loop through models with different damping parameters to find a optimal model with the help of the elbow-plot and powerspectra.
  4. Tutorial 4: loading geomagia dataset. We show how to load a geomagia dataset with our InputData-class.

All files required for the tutorials are also found in the doc-folder.

Testing

All tests for this library can be found in the test-folder. To run the tests you need to have pytest installed. After installation of pytest, you can test the code by typing pytest.

Accompanying Article

The Article describing this library can be found here:

Acknowledgements

This Python code is based on a version of Fortran codes that have been spread within the geomagnetic community by personal communication and in its original version were mainly written by David Gubbins, Kathryn Whaler, Jeremy Bloxham, and Andrew Jackson. The authors want to express their gratitude to Sanja Panovska for the fruitful discussions on the algorithm and its spatial and temporal damping options.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymaginverse-1.1.0.tar.gz (24.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pymaginverse-1.1.0-cp311-cp311-win_amd64.whl (27.2 kB view details)

Uploaded CPython 3.11Windows x86-64

pymaginverse-1.1.0-cp311-cp311-manylinux_2_35_x86_64.whl (490.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ x86-64

pymaginverse-1.1.0-cp311-cp311-macosx_13_0_x86_64.whl (172.3 kB view details)

Uploaded CPython 3.11macOS 13.0+ x86-64

pymaginverse-1.1.0-cp310-cp310-win_amd64.whl (27.2 kB view details)

Uploaded CPython 3.10Windows x86-64

pymaginverse-1.1.0-cp310-cp310-manylinux_2_35_x86_64.whl (455.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ x86-64

pymaginverse-1.1.0-cp310-cp310-macosx_13_0_x86_64.whl (102.1 kB view details)

Uploaded CPython 3.10macOS 13.0+ x86-64

pymaginverse-1.1.0-cp39-cp39-win_amd64.whl (27.2 kB view details)

Uploaded CPython 3.9Windows x86-64

pymaginverse-1.1.0-cp39-cp39-manylinux_2_35_x86_64.whl (457.8 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.35+ x86-64

pymaginverse-1.1.0-cp39-cp39-macosx_13_0_x86_64.whl (102.6 kB view details)

Uploaded CPython 3.9macOS 13.0+ x86-64

File details

Details for the file pymaginverse-1.1.0.tar.gz.

File metadata

  • Download URL: pymaginverse-1.1.0.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pymaginverse-1.1.0.tar.gz
Algorithm Hash digest
SHA256 662cead14ee6b880cba8bf95fbcbdf59487576716bb5470489aa7dfe81242c29
MD5 48b9473db4ccc9841de21ef90eb8155b
BLAKE2b-256 e20ab92e7d5ce39740798dc20024a8fc2265b9fbf99b1af1e8496ff524545f13

See more details on using hashes here.

File details

Details for the file pymaginverse-1.1.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pymaginverse-1.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 23beb8b9a15ba8a39e9814180c637b7528a32e24cd68247d4d990537eb783dd8
MD5 69b396a89756a4db7205156ba3a8d9ef
BLAKE2b-256 95544295481087768d65497f5e5d4de3adc7610638b68e299902757595fa5071

See more details on using hashes here.

File details

Details for the file pymaginverse-1.1.0-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pymaginverse-1.1.0-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 1130f312116009bbc2eb0d863273caf199f73fa1a6ea9e47673615ae09a32a5b
MD5 9a73370ce6c828640b9068390b32b28c
BLAKE2b-256 5d14bb3e381ce178b455e6481c150f33914c01ecfbe401c9fcc6348af8d6b79b

See more details on using hashes here.

File details

Details for the file pymaginverse-1.1.0-cp311-cp311-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pymaginverse-1.1.0-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 0f6a749cf3439041cf9e7c687cc7a9c2e03406b0091b3e4bf3e72e1b055850cb
MD5 acfebdcfa825df33d63de6ee8729172d
BLAKE2b-256 12a57554684bdaeb102ca8ea460bac0395ebd7910b52a62e743bfb0ac1e35291

See more details on using hashes here.

File details

Details for the file pymaginverse-1.1.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pymaginverse-1.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 16d7632444e215eb0c869e2aa67307c41af10b257bb0f2b10b6da3d752aa8783
MD5 c1778fc8b426279538ccc3b15c2bebc1
BLAKE2b-256 d5d8b8fd7c41852fcb25facaf80900763c4159ad3a176a6c4e9e36edd0132de8

See more details on using hashes here.

File details

Details for the file pymaginverse-1.1.0-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pymaginverse-1.1.0-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 be9e764acb5b367fd538c924af6f52634321722f13ff27513c136bd052a5f6e1
MD5 a4b77cd627f9646821ddc9aee3054dc5
BLAKE2b-256 2ab394b2bbdf163ca6787eb08a70eace3bb99f068d49f8f16bf4a2d0ef4b8a2c

See more details on using hashes here.

File details

Details for the file pymaginverse-1.1.0-cp310-cp310-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pymaginverse-1.1.0-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 de80b27dd8ab3e0060681fb1fa70da3037d65d246592c37925fd96f3974f0b25
MD5 5e040edaf97df2d9dc50e49852715e54
BLAKE2b-256 066a7b249ff97a4779bbefb0b16f6c0d3343cc08ca8333e4ac2276dd592020ed

See more details on using hashes here.

File details

Details for the file pymaginverse-1.1.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pymaginverse-1.1.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pymaginverse-1.1.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 7172b2a62273baef874ac9a74b2505f956acc159080e766b5e8c017c6a6fa0bc
MD5 bcb94b8fb889e1566d455061e1957a12
BLAKE2b-256 df50d00b2879a590a55641e671a14de76d25609afb00f830b42d134fe62595ad

See more details on using hashes here.

File details

Details for the file pymaginverse-1.1.0-cp39-cp39-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pymaginverse-1.1.0-cp39-cp39-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 e242540a2573ed151f3e5ec26b70032a97a9ceb38bd03c4b8ed35cfe5ab45975
MD5 956461a70f85f4a4c8c9c0a88aee421f
BLAKE2b-256 ebdd89c2d1c2ba72baf06018bdfc457866ab16e2ab5772d8765591b210642e88

See more details on using hashes here.

File details

Details for the file pymaginverse-1.1.0-cp39-cp39-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pymaginverse-1.1.0-cp39-cp39-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 60b773d2db46b6414eb4498b6a27a8c7c087c4d39aa79b3ef7117fcd66d23fb8
MD5 f7e702fb56b4226b3d3a27f129688ac1
BLAKE2b-256 ac544b3fe6fd9228d0e3cb676cfabe8a369db0bbd4e2256d4cf6b0ac9ddd1644

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page