Skip to content

Latest commit

 

History

History
84 lines (57 loc) · 1.71 KB

README.md

File metadata and controls

84 lines (57 loc) · 1.71 KB

FreeQDSK

License py3comp

Read and write G-EQDSK, A-EQDSK, and P-EQDSK file formats, which are used to describe the tokamak fusion devices.

It has more features than other implementations, including aeqdsk and peqdsk formats, support for COCOS numbers != 1, some customisation of the header format.

It aims to be a well maintained community package, allowing to replace custom implementations by a feature complete, freely available implementation.

Installation

To install, you may need to update pip to the latest version:

$ python3 -m pip install --upgrade pip

You can then install using:

$ python3 -m pip install .

To run tests:

$ python3 -m install .[tests]
$ pytest -v

To build the docs:

$ python3 -m install .[docs]
$ cd docs
$ make html

Usage

A G-EQDSK file may be read using the geqdsk.read function:

from freeqdsk import geqdsk

with open(filename, "r") as f:
    data = geqdsk.read(f)

The result is a dict containing data from the G-EQDSK file. To write a file:

with open(filename, "w") as f:
    geqdsk.write(data, f)

Similarly, for A-EQDSK files:

from freeqdsk import aeqdsk

with open(filename, "r") as f:
    data = aeqdsk.read(f)

with open(filename, "w") as f:
    aeqdsk.write(data, f)

And again for P-EQDSK files:

from freeqdsk import peqdsk

with open(filename, "r") as f:
    data = peqdsk.read(f)

with open(filename, "w") as f:
    peqdsk.write(data, f)