Various helper functions.
Samples from a distribution defined by a vector the sum in. The vector doesn’t have to add up to one it will be automatically normalized.
Parameters : | bins : ndarray
number_of_samples : int
|
---|
Returns the value of probability density of normal distribution N(mean,sigma) at point x.
This module contains extension of the param package, and a collection of functions that allow for powerfull filtering of sets of MozaikParametrized instances based on the values of their parameters.
When parametrizing mozaik objects we will allow only SNumber, SInteger and SString parameters. These are extension of corresponding parametrized parameters that automatically allow None value, are instantiated and allow for definition of units and period.
A mozaik parameter that can hold a number. For the full range of options the parameter offers reffer to the Number class in param package.
On top of the Number class it adds the ability to specify units and period in constructor. The units should be quantities.units.
A mozaik parameter that can hold an integer. For the full range of options the parameter offers reffer to the Integer class in param package.
On top of the Integer class it adds the ability to specify units in constructor. The units should be quantities.units.
A mozaik parameter that can hold an string. For the full range of options the parameter offers reffer to the Integer class in param package.
This class is here for consistency reasons as it defines the units and period properties, just like SInteger and SNumber, but automatically sets them to None.
Bases: param.parameterized.Parameterized
We extend the topographica Parametrized package to constrain the parametrization. We allow only three parameter types (SNumber or SInteger or SString) that we have extended with further information.
This allows us to define several useful operations over such parametrized objects that we will use extensively (see above).
Currently the main use of this parametrization is for defining stimuli and analysis data structures. It allows us to write general and powerfull querying functions, automatically handle parameter units and parameter names.
For the usage of the MozaikParametrized class refer to the Parameterized in param package, as the behaviour of this class is identical, with the exception that it restricts the possbile parameters used to the trio of SNumber or SInteger or SString.
This class also adds several utility functions documented below.
Returns True if self and other have the same parameters and all their values match. False otherwise.
JACOMMENT: This seems to work only because get_param_values sorts the list by names which is undocumented!
Returns True if self and other have the same parameters and all their values match with the exception of the parameter in except. False otherwise.
In MozaikParametrized we hide parameters with precedence below 0 from users.
This class method is used in concjuction with the MozaikParametrized.__str__ function that stores all the parameters and the class and module of an object. This method restores a ‘Shell’ object out of this str. The returned object will be of the same type as the original object and will contain all its original parameters and their values, BUT WILL NOT BE INITIALIZED and so should not be used for anything else other than examining it’s parameters!!!!
Furthermore if given an instance of MozaikParametrized instead it will convert it into the ‘Shell’ object.
Returns a subset of object_list containing MozaikParametrized instances (and associated data if data_list!=None) for which the parameters in kwargs match.
Parameters : | object_list : list(MozaikParametrized)
extra_data_list : list(object)
allow_non_existent_parameters : bool
**kwargs : dict
|
---|---|
Returns : | if data_list == None : subset of object_list containing elements that match the kwargs parameters if data_list != None : tuple (a,b) where a is a subset of object_list containing elements that match the kwargs parameters and b is the corresponding subset of data_list |
It collapses the data_list against parameters of objects in object_list that are in parameter_list. This means that the new list of parameters (and associated datalist) will contain one object for each combination of parameter values not among the paramters against which to collapse. Each such object will be associated with a list of data that corresponded to object with the same parameter values, but any values for the parameters against which one is collapsing. The collapsed parameters in the object_list will be replaced with None.
Parameters : | func : bool
data_list : list
object_list : list(MozaikParametrized)
parameter_list : list
func : func()
allow_non_identical_objects : bool, optional
|
---|---|
Returns : | (v,object_id) : list,list
|
Find the varying list of params. Can be only applied on list of MozaikParametrized that have the same parameter set.
Returns : | List of parameters of the `MozaikParamterrized` objects in `parametrized_objects` that have at least 2 different values within the list. : |
---|
Returns the list of values the given parameter has in the list of MozaikParametrized instances.
Parameters : | parametrized_objects : list
param : str
|
---|---|
Returns : | A list of different values that the parameter param has across the `MozaikParametrized` objects in `parametrized_objects` list. : |
Check whether the objects have the same parameters.
Returns : | True if all instances of `MozaikParametrized` in `parametrized_objects` have the same set of parameters (not values!). : Otherwise returns False. : |
---|
Checks whether parametrized_objects have the same parameter values for parameters in params or not in except_params.
Parameters : | parametrized_objects : list
params : list,optional
except_params : list, optional
|
---|---|
Returns : | if params != None :
if except_params != None :
if except_params == None and except_params == None :
if except_params != None and except_params != None :
|
Colapse out a parameter parameter_name of a list of MozaikParametrized instances.
Parameters : | value_list : list
parametrized_objects : list
parameter_name : str
|
---|---|
Returns : | D : dict
|
This module contains several helper functions for working with periodic variables.
Returns the distance between a and b (scalars) in a domain with period period.
Converts a vector/matrix of angles (0, 2*pi) to vector/matrix of complex numbers (that will lie on the unit circle) and correspond to the given angle.
Returns angles of complex numbers in array but in (0, 2*pi) interval unlike numpy.angle the returns it in (-pi, pi).
Circular mean of matrix. Weighted if weights are not none. Mean will be computed along axis axis.
Parameters : | matrix : ndarray
weights : ndarray, optional
low, high : double, optional
axis : int, optional
normalize : bool
|
---|---|
Returns : | (angle, length) : ndarray,ndarray
|
This module contains code interfacing NeuroTools parameters, and pyNN distribution interface.
In future pyNN plans to make an comprehensive merge between NeuroTools parametrization system and pyNN, in which case this code should become obsolete and mozaik should fully switch to such new system.
A simple function for loading parameters that replaces the values in modified_parameters in the loaded parameters and subsequently expands references.
Bases: pyNN.random.RandomDistribution
This will be the wraper for the PyNN RandomDistribution
The first parameter is the name of the distribution (see pyNN.random.RandomDistribution) The params is a tuple of parameters of the corresponding numpy distribution (see pyNN.random.RandomDistribution) For the rest of the parameters see pyNN.random.RandomDistribution
Bases: parameters.ParameterSet
This is an extension to ParameterSet class which adds the PyNNDistribution as a possible type of a parameter.
Various helper functions.
Samples from a distribution defined by a vector the sum in. The vector doesn’t have to add up to one it will be automatically normalized.
Parameters : | bins : ndarray
number_of_samples : int
|
---|
Returns the value of probability density of normal distribution N(mean,sigma) at point x.
This file contains various operations over Neo objects. Such as sum over lists of Neo objects etc.
This function gets a list of Neo objects and it adds them up. Importantly unlike Python sum function it starts adding to the first element of the list no to 0.
Calculates the mean over list of Neo objects. See neo_sum for more details.