calix.common.helpers

Various helper functions that are more general and thus not contained in one of the named modules.

Functions

calix.common.helpers.capmem_noise(start: int = - 5, end: int = 6, size: Optional[Union[int, Tuple[int]]] = None)Union[int, numpy.ndarray]

Creates random integers between start and end-1. Used mainly to vary CapMem settings in order to avoid setting many cells to the same value.

Parameters
  • start – Lower end of the random range.

  • end – One above the upper end of the random range.

  • size – Number/shape of values to draw. If None, a single integer is returned.

Returns

Array with integer noise, or single integer.

calix.common.helpers.capmem_set_neuron_cells(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, config: Dict[pyhalco_hicann_dls_vx_v3.CapMemRowOnCapMemBlock, Union[int, numpy.ndarray]])calix.common.base.WriteRecordingPlaybackProgramBuilder

Set single CapMem rows on the neurons to the desired values. Expects parameters to be configured along with the desired row coordinates. The parameters can either be a numpy array of integer values, which are written to the neurons directly, or a single value, which is written only after adding some noise of +/- 5, if the range allows. Values of zero are not changed, turning something off is always possible.

Parameters
  • builder – Builder to append configuration to.

  • config – Dict which contains pairs of CapMemRowOnCapMemBlock coordinates and either a single CapMemCell value or an array of CapMemCell values. In case a single non-zero value is given, it is changed to an array with noise and this array is written to hardware. This aims to reduce the crosstalk between CapMem cells.

Returns

Builder with configuration appended.

calix.common.helpers.capmem_set_quadrant_cells(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, config: Dict[pyhalco_hicann_dls_vx_v3.CapMemCellOnCapMemBlock, Union[int, numpy.ndarray]])calix.common.base.WriteRecordingPlaybackProgramBuilder

Set multiple CapMem cells that are global per quadrant to the same provided values.

Parameters
  • builder – Builder to append configuration to.

  • config – Dict with the desired configuration.

Returns

Builder with configuration appended.

calix.common.helpers.wait(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, waiting_time: quantities.quantity.Quantity)calix.common.base.WriteRecordingPlaybackProgramBuilder

Waits for a given amount of time.

This function appends instructions to the given builder which first reset the timer and then wait until the given time is reached.

Parameters
  • builder – Builder to add wait instruction to.

  • waiting_time – Time to wait for.

Returns

Builder with wait instruction added to.