Configuration file class

class arepy.files.config(fileName=None, show=False, notes=False)

Configuration file class

This class reads, modifies and saves Arepo configuration files

Parameters
  • fileName (str) – Name of a configuration file that should be opened

  • show (bool) – Print out an opened configuration file

  • notes (bool) – Read also comments after the parameters

Variables
  • params – List of parameters

  • groups – List of parameter groups

parse(rmGroups=[], rmParams=[], cmGroups=[], cmParams=[])

Parse a configuration file as a string

Parameters
  • rmGroups (list[str]) – List of parameter groups that should be removed

  • rmParams (list[str]) – List of parameters that should be removed

  • cmGroups (list[str]) – List of parameter groups that should be commented

  • cmParams (list[str]) – List of parameters that should be commented

Return str

A parsed configuration list

read(fileName, show=False, notes=False)

Read a configuration file

Parameters
  • fileName (str) – path to a parameter file

  • show (bool) – Print all parameters to the console

  • notes (bool) – Read also comments behind parameters

write(fileName, rmGroups=[], rmParams=[], cmGroups=[], cmParams=[], meshrelax=False)

Save a configuration file

Parameters
  • fileName (str) – Name of a new parameter file

  • rmGroups (list[str]) – List of parameter groups that should be removed

  • rmParams (list[str]) – List of parameters that should be removed

  • cmGroups (list[str]) – List of parameter groups that should be commented

  • cmParams (list[str]) – List of parameters that should be commented

  • meshrelax (bool) – Set MESHRELAX parameters

setValue(param, value=None, note=None)

Set a parameter value

Parameters
  • param (str) – Parameter name

  • value – New value of a parameter

  • note (str) – Comment to include after the parameter

getValue(param)

Get a parameter value

Parameters

param (str) – Parameter name

Returns

Parameter value

formatValue(param, value=None)

Return a parameter value in its standard format

Parameters
  • param (str) – Parameter name

  • value – If set, the function will format this value

Returns

Formated parameter value

getDtype(param)

Get a parameter datatype

Parameters

param (str) – Parameter name

Returns

Parameter value