brainspy.processors.hardware.drivers package#

Module contents#

Package containing the drivers.

Subpackages#

Submodules#

brainspy.processors.hardware.drivers.cdaq module#

File containing the class for CDAQ to CDAQ drivers.

class brainspy.processors.hardware.drivers.cdaq.CDAQtoCDAQ(configs)[source]#

Bases: NationalInstrumentsSetup

Class to establish a connection (for a single, or multiple hardware DNPUs) with the CDAQ-to-CDAQ national instrument.

forward_numpy(y)[source]#

The forward function computes output numpy values from input numpy array. This is done to enable compatibility of the the model with numpy The first point of the read_data does not perform a reading. To synchronise it with the original signal, a point is added at the original signal y. The signal read in ‘data’ discards the first point

Parameters:

y (np.array) – Input data matrix to be sent to the device. The data should have a shape of: (device_input_channel_no, data_point_no) Where device_input_channel_no is typically the number of activation electrodes of the DNPU.

Returns:

Output data that has been read from the device when receiving the input y.

Return type:

np.array

brainspy.processors.hardware.drivers.nidaq module#

File containing the class for CDAQ to NiDAQ drivers.

class brainspy.processors.hardware.drivers.nidaq.CDAQtoNiDAQ(configs)[source]#

Bases: NationalInstrumentsSetup

Class to establish a connection (for a single, or multiple hardware DNPUs) with the CDAQtoNiDAQ national instrument. It requires an additional channel to send a spike from the CDAQ to the NIDAQ. The data is offsetted to let the NIDAQ read the spike and start synchronising after receiving it.

forward_numpy(y)[source]#

The forward function computes output numpy values from input numpy array. This is done to enable compatibility of the the model with numpy The first point of the read_data does not perform a reading. To synchronise it with the original signal, a point is added at the original signal y. The signal read in ‘data’ discards the first point.

Parameters:

y (np.array) – Input data matrix to be sent to the device. The data should have a shape of: (device_input_channel_no, data_point_no) Where device_input_channel_no is typically the number of activation electrodes of the DNPU.

Returns:

Output data that has been read from the device when receiving the input y.

Return type:

np.array

get_output_cut_value(read_data)[source]#

The input signal is synchronised with the output sending a spike through a synchronisation channel. This method gets the value where the output data should be cut in order to make the output signal be synchronised with regard to the input signal.

Parameters:

read_data (np.array) – Processed output data computed from the amplification value.

Returns:

Output cut value

Return type:

int

readout_trial(y)[source]#

Attempts to perform a readout from the device given an input array. Reads the data, processes it and synchronises the output with regard to the input data.

Parameters:

y (np.array) – Input data matrix to be sent to the device. The data should have a shape of: (device_input_channel_no, data_point_no) Where device_input_channel_no is typically the number of activation electrodes of the DNPU.

Returns:

Synchronised output data from the device and wheather the readout is complete

Return type:

np.array,bool

synchronise_input_data(y)[source]#

The input signal is synchronised with the output sending a spike through a synchronisation channel. In order to wait for the output reading module to receive the spike, zeros are added to the input data up until the point where the spike should have been received. This is done by adding an offset.

Parameters:

y (np.array) – Input data to be sent to the device.

Returns:

Synchronised input data based on the offset value, where the synchronisation spike should have been received.

Return type:

np.array

synchronise_output_data(read_data)[source]#

The input signal is synchronised with the output sending a spike through a synchronisation channel. All the data before the output reading instrument receives the spike is discarded. This method cuts the output data in order to make the input signal be synchronised with the output signal.

Parameters:

read_data (np.array) – processed output data computed from the amplification value

Returns:

  • np.array – synchronized output data

  • bool – Whether if the cut value is zero