svaberg / starwinds-magnetogram

Magnetogram manipulation routines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The starwinds-magnetogram python package

Python package DOI GitHub release (latest SemVer) GitHub tag (latest SemVer) Codacy Badge Codacy Badge

This package contains basic processing tools for manipulating and visualising Solar and stellar magnetograms. These tools were originally developed during my Ph.D. at the University of Southern Queensland. Please cite Evensberget et al. (2021) or Evensberget et al. (2022) and mention the starwinds-magnetogram package if you use these tools in your research.

Features

  • Convert magnetogram coefficients from ZDI format to Stanford PFSS format suitable for ingestion into the SWMF;
  • Plotting of ZDI and PFSS magnetograms;
  • Magnetogram generation from e.g. noise and manipulation;
  • Free rotation of a magnetogram;
  • Some routines related to the Parker wind solution and Alfvén surface.

Installation

Once the repository is cloned, install using

pip install .

As usual, the --user flag is required when the user cannot install in the root such as on an HPC; this will put the entry points in ~/.local/bin, which must then be on the $PATH.

Getting started

Development info

This section may be ignored unless you want to make changes to starwinds-magnetogram.

Editable installation

To make the installation editable use the --editable flag:

pip install --editable .

Conda environment

There is a conda environment file environment.yml in the project folder; it may be used to create a conda environment in the regular way.

Test summary

To run the tests locally and generate a test summary type

cd tests
pytest -v --tb=no

there should be no failures in the code and tests. Test output is placed in the tests/artifacts folder. The --disable-warnings flag can be used to hide any warnings (should be unnecessary).

Debugging

To debug through the entry points (e.g. the sw-plot-magnetogram command), this should work:

python -m pdb $(\which sw-plot-magnetogram)

The backslash character before which is present since the which command may be aliased to type -all on MacOS.

About

Magnetogram manipulation routines


Languages

Language:Python 100.0%