pynn_brainscales.brainscales2.populations.ParameterSpace

class pynn_brainscales.brainscales2.populations.ParameterSpace(parameters, schema=None, shape=None, component=None)

Bases: object

Representation of one or more points in a parameter space.

i.e. represents one or more parameter sets, where each parameter set has the same parameter names and types but the parameters may have different values.

Arguments:
parameters:

a dict containing values of any type that may be used to construct a lazy array, i.e. int, float, NumPy array, RandomDistribution, function that accepts a single argument.

schema:

a dict whose keys are the expected parameter names and whose values are the expected parameter types

component:

optional - class for which the parameters are destined. Used in error messages.

shape:

the shape of the lazy arrays that will be constructed.

__init__(parameters, schema=None, shape=None, component=None)

Methods

__init__(parameters[, schema, shape, component])

add_child(name, child_space)

as_dict()

Return a plain dict containing the same keys and values as the parameter space.

columns()

For a 2D space, return a column-wise iterator over the parameter space.

evaluate([mask, simplify])

Evaluate all lazy arrays contained in the parameter space, using the given mask.

expand(new_shape, mask)

Increase the size of the ParameterSpace.

flatten([with_prefix])

items()

Note that the values will all be LazyArray objects.

keys()

pop(name[, d])

Remove the given parameter from the parameter set and from its schema, and return its value.

update(**parameters)

Update the contents of the parameter space according to the (key, value) pairs in **parameters.

Attributes

has_native_rngs

Return True if the parameter set contains any NativeRNGs

is_homogeneous

True if all of the lazy arrays within are homogeneous.

parallel_safe

shape

Size of the lazy arrays contained within the parameter space

add_child(name, child_space)
as_dict()

Return a plain dict containing the same keys and values as the parameter space. The values must first have been evaluated.

columns()

For a 2D space, return a column-wise iterator over the parameter space.

evaluate(mask=None, simplify=False)

Evaluate all lazy arrays contained in the parameter space, using the given mask.

expand(new_shape, mask)

Increase the size of the ParameterSpace.

Existing array values are mapped to the indices given in mask. New array values are set to NaN.

flatten(with_prefix=True)
property has_native_rngs

Return True if the parameter set contains any NativeRNGs

property is_homogeneous

True if all of the lazy arrays within are homogeneous.

items() → an iterator over the (key, value) items of PS.

Note that the values will all be LazyArray objects.

keys() → list of PS’s keys.
property parallel_safe
pop(name, d=None)

Remove the given parameter from the parameter set and from its schema, and return its value.

property shape

Size of the lazy arrays contained within the parameter space

update(**parameters)

Update the contents of the parameter space according to the (key, value) pairs in **parameters. All values will be turned into lazy arrays.

If the ParameterSpace has a schema, the keys and the data types of the values will be checked against the schema.