SIMION.PA - PA Library in Python

SIMION.PA - Python (not Lua) module for reading/writing/manipulating SIMION potential arrays.

DESCRIPTION

This module is for manipulating SIMION potential array (PA/PA?) files (including creating, loading, modifying, and saving) in the Python language. See Appendix F.5 of the SIMION 8.0 manual (or Appendix p. D-5 of the SIMION 7.0 manual) for the PA file format specification.

This modules is intended to be very robust and has been put through an extensive test suite. It is also intended to be simple to use and very Pythonic. The module is, however, not as fast as the corresponding C++ implementation, even though speed has been considered, so use the C++ implementation if speed is critical.

SYNOPSIS

from SIMION.PA import *

#-- reading an existing array
pa = PA(file = 'buncher.pa#')
# print header parameters the simple way
print pa.header_string()

#-- creating an array from scratch
pa2 = PA(nx = 100, ny = 20, symmetry = 'cylindrical')

z = 0
for x in range(0, pa.nx()):
  ...    for y in range(0, pa.ny()):
  ...        inside = (x + y < 10)
  ...        if inside:
  ...            pa.point(x, y, z, 1, 5.0)  # electrode, 5V
pa2.save('cone.pa#')

#-- creating a magnetic field from scratch
pa3 = PA(nx = 50, ny = 50, field_type = 'magnetic')
z = 0
for x in range(0, pa.nx()):
    for y in range(0, pa.ny()):
        ex = x
        ey = y**2
        ez = 0
        pa3.field(x, y, z, ex, ey, ez)
pa3.save('mag1.pa')

Note

This page is abridged from the full SIMION "Supplemental Documentation" (Help file). The following additional sections can be found in the full version of this page accessible via the "Help > Supplemental Documentation" menu in SIMION 8.1.1 or above:
  • INTERFACE

  • CHANGES

SOURCE

version: 20110811