Skip to main content

A python library for mapping between Fusion data formats

Project description

pytokamap

Quickstart

The example below maps signals from a UDA shot to a Zarr or NetCDF file.

import pytokamap
mapper = pytokamap.load_mapping("uda.jinja", "globals.json")
mapper.to_zarr(30420, "30420.zarr")
mapper.to_netcdf(30420, "30420.nc")

With the following example template mapping file called uda.jinja:

{
    {% macro comma(loop) %}
        {% if not loop.last %},{% endif %}
    {% endmacro %}

    "amc/plasma_current": {
        "MAP_TYPE": "PLUGIN",
        "PLUGIN": "UDA",
        "ARGS": {"signal": "ip", "format": "IDA"},
        "SCALE": 1000
    },
    {% for index in range(1, TCAM.N+1) %}
    "_xsx/tcam_{{index}}": {
        "MAP_TYPE": "PLUGIN",
        "PLUGIN": "UDA",
        "ARGS": {"signal": "XSX/TCAM/{{ index }}", "format": "IDA"}
    },
    {% endfor %}
    "xsx/tcam": {
        "MAP_TYPE": "CUSTOM",
        "CUSTOM_TYPE": "COMBINE",
        "ARGS": [
            {% for index in range(1, TCAM.N+1) %}
                "_xsx/tcam_{{index}}"{{ comma(loop) }}
            {% endfor %}
        ]
    }
}

And the following globals.json file:

{
    "TCAM": {
        "N": 3
    }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytokamap-2024.0.0.tar.gz (13.0 kB view hashes)

Uploaded Source

Built Distribution

pytokamap-2024.0.0-py3-none-any.whl (13.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page