simsopt.util package

Submodules

simsopt.util.constants module

simsopt.util.dev module

class simsopt.util.dev.SimsoptRequires(condition, message)

Bases: monty.dev.requires

__call__(_callable)
Parameters

_callable – Callable function or class.

simsopt.util.dev.deprecated(replacement=None, message=None, category=<class 'FutureWarning'>)

Decorator to mark classes or functions as deprecated, with a possible replacement. Credits: monty.dev package from Materials Virtual Lab

Parameters
  • replacement (callable) – A replacement class or method.

  • message (str) – A warning message to be displayed.

  • category (Warning) – Choose the category of the warning to issue. Defaults to FutureWarning. Another choice can be DeprecationWarning. NOte that FutureWarning is meant for end users and is always shown unless silenced. DeprecationWarning is meant for developers and is never shown unless python is run in developmental mode or the filter is changed. Make the choice accordingly.

Returns

Original function, but with a warning to use the updated class.

simsopt.util.log module

simsopt.util.log.initialize_logging(filename: Optional[str] = None, level: Optional[str] = None, mpi: bool = False) None

Initializes logging in a simple way for both serial and MPI jobs. The MPI logging uses MPILogger package.

Parameters
  • filename – Name of file to store the logging info

  • level – Logging level. Could be ‘INFO’, ‘DEBUG’, ‘WARNING’, etc.

  • mpi – If True MPI logging is used provided mpi4py is installed.

simsopt.util.mpi module

This module contains the MpiPartition class.

This module should be completely self-contained, depending only on mpi4py and numpy, not on any other simsopt components.

simsopt.util.mpi.log(level: int = 20)

Turn on logging. If MPI is available, the processor number will be added to all logging entries.

Parameters

level – Typically logging.INFO for regular output, or logging.DEBUG for more extensive output.

simsopt.util.mpi_logger module

simsopt.util.types module

This module contains small utility functions and classes.

simsopt.util.zoo module

simsopt.util.zoo.get_ncsx_data(Nt_coils=25, Nt_ma=10, ppp=10)

Get a configuration that corresponds to the modular coils of the NCSX experiment (circular coils are not included). :param Nt_coils: order of the curves representing the coils. :param Nt_ma: order of the curve representing the magnetic axis. :param ppp: point-per-period: number of quadrature points per period

Returns: 3 element tuple containing the coils, currents, and the magnetic axis.

Module contents