Delay#

class braincore.Delay(target_info, time=None, init=None, entries=None, method='rotation', name=None, mode=None)#

Generate Delays for the given State instance.

The data in this delay variable is arranged as:

delay = 0             [ data
delay = 1               data
delay = 2               data
...                     ....
...                     ....
delay = length-1        data
delay = length          data ]
Parameters:
  • time (Union[int, float, None]) – int, float. The delay time.

  • init (Union[Array, ndarray, bool_, number, bool, int, float, complex, Callable, None]) –

    Any. The delay data. It can be a Python number, like float, int, boolean values. It can also be arrays. Or a callable function or instance of Connector. Note that initial_delay_data should be arranged as the following way:

    delay = 1             [ data
    delay = 2               data
    ...                     ....
    ...                     ....
    delay = length-1        data
    delay = length          data ]
    

  • entries (Optional[Dict]) – optional, dict. The delay access entries.

  • name (Optional[str]) – str. The delay name.

  • method (Optional[str]) – str. The method used for updating delay. Default None.

  • mode (Optional[Mode]) – Mode. The computing mode. Default None.

at(entry, *indices)[source]#

Get the data at the given entry.

Parameters:
  • entry (str) – str. The entry to access the data.

  • *indices – The slicing indices. Not include the slice at the batch dimension.

Return type:

Union[Array, ndarray, bool_, number, bool, int, float, complex]

Returns:

The data.

init_state(batch_size=None, **kwargs)[source]#

State initialization function.

register_entry(entry, delay_time=None, delay_step=None)[source]#

Register an entry to access the data.

Parameters:
  • entry (str) – str. The entry to access the delay data.

  • delay_time (Union[int, float, None]) – The delay time of the entry (can be a float).

  • delay_step (Optional[int]) – The delay step of the entry (must be an int). delat_step = delay_time / dt.

Return type:

Delay

Returns:

Return the self.

retrieve(delay_step, *indices)[source]#

Retrieve the delay data according to the delay length.

Parameters:

delay_step (int) – The delay length used to retrieve the data.

update(current)[source]#

Update delay variable with the new data.

Return type:

None