A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/AnkitBarik/planetMagFields below:

AnkitBarik/planetMagFields: Routines to plot and analyze magnetic fields of planets in our solar system

Software to easily access and analyze information about magnetic fields of planets in our solar system and visualize them in both 2D and 3D.

Prerequisites

Installation

Features and examples

Jupyter notebook

Documentation

Code contribution and reporting issues

Citing planetMagFields

Acknowledgements

planetMagFields requires NumPy, Matplotlib and SciPy. Other than that, the following external libraries are used for a few different functions:

planetMagFields can be installed in a few different ways:

planetMagFields is available on PyPI and can be installed with

$ python3 -m pip install planetMagFields

You can also use setup.py to install planetMagFields:

$ git clone https://github.com/AnkitBarik/planetMagFields
$ cd planetMagFields
$ pytho3 setup.py install --user

Or using pip:

$ git clone https://github.com/AnkitBarik/planetMagFields
$ cd planetMagFields
$ python3 -m pip install . --user

Download the package from the GitHub repository and add it to PYTHONPATH:

$ git clone https://github.com/AnkitBarik/planetMagFields
$ export PYTHONPATH=$PYTHONPATH:/path/to/planetMagFields

This gives access to all the relevant properties of a planet and has methods to plot the field and write a vts file for 3D visualization. Usage:

from planetmagfields import Planet
p = Planet(name='earth',datDir='planetmagfields/data/')

This displays the some information about the planet

Planet: Earth
l_max = 13
Dipole tilt (degrees) = -9.410531

and gives access to variables associated with the planet such as:

Example using IPython:

In [1]: from planetmagfields import Planet

In [2]: p = Planet(name='jupiter',model='jrm09')
Planet: Jupiter
Model: jrm09
l_max = 10
Dipole tilt (degrees) = 10.307870

In [3]: p.glm[p.idx[2,0]]      # g20
Out[3]: 11670.4

In [4]: p.hlm[p.idx[4,2]]      # h42
Out[4]: 27811.2

planetMagFields can be used to produce both 2D and 3D visualizations of a planetary field. While doing so, it also provides the option of potential extrapolation using the SHTns library. Two examples are shown below: Earth's surface field and a 3D visualization of Jupiter's field using Paraview. This is done by writing a .vts file using the PyEVTK library.

For quick and easy visualization we include a Jupyter notebook with a binder link (see badge at the top). This makes use of Jupyter widgets to provide dropdown lists of planets and available magnetic field models for each as well as a slider for radial level, as shown below

This plots the radial magnetic field at the chosen radial level and the corresponding magnetic field spectrum,

Full list of features with examples as well as the magnetic field models used are described in detail in the documentation, available here: https://ankitbarik.github.io/planetMagFields/

Code contribution and reporting issues

planetMagFields is an open source project and anyone is welcome to contribute to it. If you wish to contribute to this project, please follow the guidelines below:

Please report any bugs or other issues through GitHub Issues.

If you're using planetMagFields for your work, please cite the JOSS paper:

Barik et al., (2024). planetMagFields: A Python package for analyzing and plotting planetary magnetic field data. Journal of Open Source Software, 9(97), 6677, https://doi.org/10.21105/joss.06677

@article{Barik2024,
  doi = {10.21105/joss.06677},
  url = {https://doi.org/10.21105/joss.06677},
  year = {2024},
  publisher = {The Open Journal},
  volume = {9},
  number = {97},
  pages = {6677},
  author = {Barik, Ankit and Angappan, Regupathi},
  title = {planetMagFields: A Python package for analyzing and plotting planetary magnetic field data},
  journal = {Journal of Open Source Software}
}

I would like to thank Regupathi Angappan for motivating me to create this package, testing it and for writing the Jupyter notebook. I thank Jon Aurnou for testing it out and pointing out runtime errors. I would like to thank Thomas Gastine for comparing the plots with real data and pointing out a normalization error which has been fixed. Thanks a lot to Arthus for adding the setup.py.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4