sportran.current

This module handles all the various type of currents and units of measure that can be handled natively by this library.

The currently supported units and currents can be viewed by calling the function build_currents_units_table()

To add a new current type and/or unit you have to do the following. 1. define in a new file a class derived from current.Current with the following class variables:

  • _current_type that you can set to the name of the current that will be used in all the user interfaces

  • _input_parameters is the set of the parameters that your current needs. Usually {‘DT_FS’, ‘UNITS’, ‘TEMPERATURE’, ‘VOLUME’}

  • _KAPPA_SI_UNITS string that describes the units of the final result to be displayed where appropriate

  1. define __init__ like

`` def __init__(self, traj, **params):

super().__init__(traj, **params)

``

  1. define _get_builder that must return the current class type and a list of parameters that applied to the class constructor generate an instance identical to the current one, so that it can be used like `` CurrentType, builder = self._get_builder() new_ts = CurrentType(**builder) ``

  2. define the units for your class. The units are automatically retrieved from the module current.units. You must do the following: - add a file named _current_type.py (a file with the same name of your class attribute value) - write inside the file some functions scale_kappa_* the part of the name after scale_kappa_ will be the name of the unit used in the user interfaces.

    The parameters must be consistent with _input_parameters. The parameters (with the same name) will be provided by the user in the class constructor or in the various interfaces

Functions

build_currents_units_table([col])

Print a table with the Current classes and the units implemented for each class

sportran.current.build_currents_units_table(col=9)

Print a table with the Current classes and the units implemented for each class

Modules

sportran.current.current

Current defines a generic flux time series that can be associated to a transport coefficient.

sportran.current.electric

sportran.current.generic

sportran.current.heat

sportran.current.stress

sportran.current.tools

sportran.current.units