Previous topic


Next topic


This Page


NepidemiXConfigParser.getrange(section, option, default=None, add_if_not_existing=True, dtype=<type 'str'>)

Create a range of values from option string.

The valid formats of the string are

  • A single value.
  • A comma-separated list of values
  • The form <first>:<step>:<last>

The function create an array containing the values, and also generate the range in the last case.

Thus the value of the option should be on the form:

<option> = <value>

<option> = <value>, <value>, <value>, ..., <value>

<option> = <number>:<number>:<number>

Parameters :

section :str :

The config section.

option : str

The config option.

default : special, optional

If None an exception will be raised if option does not exist. If not None, the value of default will be returned and no exception raised. Default - None.

add_if_not_existing : bool, optional

If this is True, the option does not exist and` default` != None, the option will be created and set to the value of default.

dtype : special, optional

The datatype of the returned numpy array. Default: str .

Returns :

rangeArray : numpy.array

The method returns a numpy array contining the values in the string either the single value, the list of values, or the range from first (inclusive) to last (exclusive) by the step step.