py4sci

Table Of Contents

Next topic

Source Documentation

This Page

pyMagnetics – The Magnetics Analysis Package for DIII-D

Version:1.0.0
Author:N.C. Logan
Email:nlogan@pppl.gov

Magnetics Analysis at DIII-D

This module handles magnetics data collection, manipulation, and visualization.

Typical uses include:

  • DC and low frequency (<=1kHz for B_r) mode fitting (1D or 2D arrays)
  • AC/DC vacuum compensation for C/I-coils.
  • Maxwell Stress Calculations

Possible additions:

  • eigspec wrapper/interface for high frequency mode analysis
  • slc3d wrapper

Python and pyD3D at General Atomics

This package is maintained compatible with the Anaconda installation of python at /task/imd/anaconda/. To use this installation, users should add /task/imd/anaconda/bin to their path.

Python Tutorials

The 3 workhorse modules for scientific programming in python are numpy, scipy and matplotlib. Tutorials for each can be found at

numpy tutorial

scipy tutorial

matplotlib tutorial

Using the Best Environment

The ipython (interactive) environment is recommended for command-line analysis. When starting, it is easiest to auto-import a number of basic mathematic and visualization modules and use an enhanced interactivity for displaying figures. To do this enter the following into the terminal on a General Atomics Fusion machine:

ipython --pylab

Look into online tutorials on numpy and matplotlib. Advanced users are recommended to edit ~/.config/matplotlib/matplotlibrc as well as add automatic imports and more using files in ~/.ipython/profile_default/startup.

Computationally Intensive Work

It is not nice to slow down venus for everyone when chugging through your analysis. On a run day, heavy computation on venus can even affect the speed at which data is available to the control room (not good!). To avoid ever being “that person”, users are encouraged to use this nifty alias:

alias ipython "v 'ipython \!*'"

pyD3d

The pyMagnetics module is modeled after, and dependent on the pyD3D python toolset. For the official pyD3D installation instructions and complete documentation see pyD3D docs.

Note

This module is not yet part of the official pyD3D distribution. It is installed seperately with the anaconda distribution listed above, and is not available on other python distributions at General Atomics.

How to Contibute

There is a github repository for this module to facilitate version control and collaborative contributions.

To become a contributor to the pyMagnetics package, first go to the repository on github and fork using the button in the upper right. Copy the clone url from the box in the right side panel of your forked repository. Now create a local directory in your user area on the GA computers where you will make your changes. Navigate there and do:

git clone <copied-url-from-github-fork>
git checkout -b <new-branch>

and for convinience, add:

git remote add github <copied-url-from-github-fork>

By convention, use your GA username as the branch. Now you can freely edit files in the lib and bin directories. As you add files or make changes remember to:

git add <new-file>
git commit # Will open $EDITOR for message

When you have finished a significant addition/improvement push it using:

git push --set-upstream github <new_branch>

When things are really working beautifully and you are ready to share your new developments with the community at large, go back on github, go to your forked repository, and submit a new pull request. Email nlogan@pppl.gov to have your code reviewed before being merged with the master.

Indices and tables