duat.config

Model OSIRIS configuration files.

class duat.config.Cathode(label=None)[source]

Set of sections defining a cathode.

__init__(label=None)[source]

Initialize self. See help(type(self)) for accurate signature.

class duat.config.CathodeList(label='cathodes')[source]

List of sections defining the cathodes

__init__(label='cathodes')[source]

Args: label (str): a label inserted as a comment when generating fortran code. lst (list of MetaSection): a preexisting list of sections conforming this one. default_type (str or class): the default type for implicit creation of content. If a str, a Section with the

provided name will be created. Otherwise, a instance of the provided class with no parameters will be created.
default_type

alias of Cathode

class duat.config.ConfigFile(d=1, template='default')[source]

Set of Sections defining an input file.

__init__(d=1, template='default')[source]

Create a default d-dimensional config file.

Parameters:
  • d (int) – The number of dimensions (1, 2 or 3), used if a template is provided.
  • template (str) – A model for the initial configuration. Available values are: * “default”: A basic configuration based on the examples. * “none”: Absolutely no configuration.
clone()[source]

Get a deep copy of the instance

Returns:a deep copy of this instance
Return type:ConfigFile
classmethod from_file(file_path)[source]

Create and return an instance from a fortran code representation in a file

classmethod from_string(string)[source]

Create and return an instance from a fortran code representation

get_d()[source]

Get the dimension of the configuration file.

Returns:
The dimension according to the mandatory xmax parameter in the space section. 0 if it could not be
found.
Return type:int
get_nodes()[source]

Get the number of nodes required by the instance.

Returns:Number of nodes.
Return type:int
to_fortran()[source]

Return a str with the fortran code representing the instance

write(path)[source]

Save the config file to the specified path.

Parameters:path – the path of the output file.
Raises:OSError – if the file could not be opened.
class duat.config.MetaSection[source]

Something behaving like a set of sections.

__str__()[source]

Return str(self).

classmethod get_structure(offset=0)[source]

Get a string representing the structure of the class.

This methods returns a string with lines in the format “- index (type)”, where index is the one used to access a subitem and type is the class of that item.

Parameters:offset – Two spaces times this number will be used to indent the returned string. This is used to generate a multi-level description.
Returns:A representation of the structure of the class.
Return type:(str)
to_fortran()[source]

Return a str with the fortran code representing the instance

class duat.config.Neutral(label=None)[source]

Set of sections defining a neutral.

__init__(label=None)[source]

Initialize self. See help(type(self)) for accurate signature.

class duat.config.NeutralList(label='neutrals')[source]

List of sections defining the neutrals

__init__(label='neutrals')[source]

Args: label (str): a label inserted as a comment when generating fortran code. lst (list of MetaSection): a preexisting list of sections conforming this one. default_type (str or class): the default type for implicit creation of content. If a str, a Section with the

provided name will be created. Otherwise, a instance of the provided class with no parameters will be created.
default_type

alias of Neutral

class duat.config.NeutralMovIonsList(label='neutral moving ions')[source]

List of sections defining the neutral moving ions

__init__(label='neutral moving ions')[source]

Args: label (str): a label inserted as a comment when generating fortran code. lst (list of MetaSection): a preexisting list of sections conforming this one. default_type (str or class): the default type for implicit creation of content. If a str, a Section with the

provided name will be created. Otherwise, a instance of the provided class with no parameters will be created.
class duat.config.Section(name, param=None)[source]

The class defining a configuration block.

__init__(name, param=None)[source]

Initialize self. See help(type(self)) for accurate signature.

remove_par(name)[source]

Remove the given parameter from the Section

set_par(name, val)[source]

Add or update the value of a parameter

set_pars(**kwargs)[source]

Add or update some parameters using keyword arguments

to_fortran()[source]

Return a str with the fortran code representing the instance

class duat.config.SectionList(label=None, lst=None, default_type=None)[source]

Class defining a list of sections in a numerical order.

Here ‘section’ refers to any subclass of MetaSection.

__init__(label=None, lst=None, default_type=None)[source]
Parameters:
  • label (str) – a label inserted as a comment when generating fortran code.
  • lst (list of MetaSection) – a preexisting list of sections conforming this one.
  • default_type (str or class) – the default type for implicit creation of content. If a str, a Section with the provided name will be created. Otherwise, a instance of the provided class with no parameters will be created.
default_type

alias of Section

classmethod get_structure(offset=0)[source]

Get a string representing the structure of the class.

This methods returns a string with lines in the format “- index (type)”, where index is the one used to access a subitem and type is the class of that item.

Parameters:offset – Two spaces times this number will be used to indent the returned string. This is used to generate a multi-level description.
Returns:A representation of the structure of the class.
Return type:(str)
remove_section(number=-1)[source]

Remove the section in the position given the index. By default, the last one.

to_fortran()[source]

Return a str with the fortran code representing the instance

class duat.config.SectionOrdered(label=None, order=None, fixed=True, types=None)[source]

Class defining a set of sections that must be outputted in a particular order given by a keyword related to them.

Here ‘section’ refers to any subclass of MetaSection.

__init__(label=None, order=None, fixed=True, types=None)[source]

Initialize self. See help(type(self)) for accurate signature.

classmethod get_structure(offset=0)[source]

Get a string representing the structure of the class.

This methods returns a string with lines in the format “- index (type)”, where index is the one used to access a subitem and type is the class of that item.

Parameters:offset – Two spaces times this number will be used to indent the returned string. This is used to generate a multi-level description.
Returns:A representation of the structure of the class.
Return type:(str)
remove_section(name)[source]

Remove the section with the given name

set_section(name, section=None)[source]

Add or replace a section.

to_fortran()[source]

Return a str with the fortran code representing the instance

class duat.config.SmoothCurrent(name)[source]
__init__(name)[source]

Initialize self. See help(type(self)) for accurate signature.

class duat.config.Species(label=None, dim=None)[source]

Set of sections defining a species.

__init__(label=None, dim=None)[source]

Initialize self. See help(type(self)) for accurate signature.

class duat.config.SpeciesList(label='species')[source]

List of sections defining the species

__init__(label='species')[source]

Args: label (str): a label inserted as a comment when generating fortran code. lst (list of MetaSection): a preexisting list of sections conforming this one. default_type (str or class): the default type for implicit creation of content. If a str, a Section with the

provided name will be created. Otherwise, a instance of the provided class with no parameters will be created.
default_type

alias of Species

class duat.config.Variation(*args, epilog=None)[source]

Represents a variation of a set of parameters in config files.

Each parameter varies in list of values. The configuration files produced by this class take into account all combinations of values, i.e., the parameter space is given by the cartesian product.

__init__(*args, epilog=None)[source]

Create a Variation with the given parameters and values.

Parameters:
  • *args (2-tuple of list) – Each argument must be a 2-tuple whose first elements is a list of str or int which identifies the parameter in its section and a list of the values the parameter will take. The list can be None to perform no action while passing the parameter to the epilog function (see below).
  • epilog (callable) – A function of two arguments that will be called with the simulation and the list of parameters when a config is being generated. This can be used for advanced modification, for example, to set two parameters to a related value (like two species temperature).
__repr__()[source]

Return repr(self).

get_generator(config)[source]

Get a generator that produces ConfigFile objects following the Variation.

Parameters:config (ConfigFile) – The configuration where the Variation will be applied.
Returns:A generator which provides the ConfigFile instances.
Return type:generator
get_parameter_list()[source]

Get a list with the parameter values in the same order that get_generator().

This method might be useful to post-process the results if the parameter space is simple.

Returns:A list with the values of the parameters in the cartesian product order.
Return type:list of tuple
class duat.config.ZpulseList(label='zpulses')[source]

List of sections defining the laser pulses

__init__(label='zpulses')[source]

Args: label (str): a label inserted as a comment when generating fortran code. lst (list of MetaSection): a preexisting list of sections conforming this one. default_type (str or class): the default type for implicit creation of content. If a str, a Section with the

provided name will be created. Otherwise, a instance of the provided class with no parameters will be created.