ripyl.cython package

Submodules

ripyl.cython.decode module

Cython implementation of decode.py functions

class ripyl.cython.decode.Edge

Bases: object

state
time
ripyl.cython.decode.find_edges()
ripyl.cython.decode.find_multi_edges()

ripyl.cython.sigproc module

Cython implementation of sigproc.py functions

ripyl.cython.sigproc.capacify()

Simulate an RC filter on a waveform:

: samples >--R--+--> out
:               |
:               C
:              _|_

Warning: This function becomes unstable for small time constants (C * R). It is implemented with a simple application of the RC difference equations. The time step (dt) is taken from the sample period of each sample chunk divided by the number of iterations. The results will be inaccurate for large values of dt but still largely representative of the expected behavior.

This is a generator function.

Parameters:
  • samples (iterable of SampleChunk objects) – An iterable sample stream to modify.
  • capacitance (float) – The capacitance value. If resistance is kept at the default value of 1.0 Ohms this parameter is equivalent to the time constant tau (c = tau / r).
  • resistance (float) – The resistance value
  • iterations (int) – The number of iterations to calculate each sample. You can experience numeric instability if this value is too low.
Returns:

An iterator yielding a sample stream.

ripyl.cython.sigproc.edges_to_sample_stream()

Convert an edge stream to a sample stream

The output samples are scaled to the range of 0.0 to 1.0 regardless of the number of logic states.

Parameters:edges (iterable of (float, int) tuples) – An edge stream to sample

:param : :type sample_period: float :param sample_period:

The sample period for converting the edge stream
Parameters:logic_states (sequence of int) – The coded state values for the lowest and highest state in the edge stream. For 2-level states these will be (0,1). For 3-level: (-1, 1). For 5-level: (-2, 2).

:param : :type end_extension: float :param end_extension:

Optional amount of time to add to the end after the last edge transition
Parameters:chunk_size (int) – Number of samples in each SampleChunk
Returns:An iterator yielding a stream of SampleChunk objects.

Module contents

Cython extension package

ripyl.cython.find_cy_modules()

Find Cython modules

Returns:A list of cython module names.
ripyl.cython.find_files(pattern, path)

Recursively search for files that match a specified pattern

ripyl.cython.monkeypatch_modules(modules, lib_base)

Replace pure Python functions and classes with Cython equivalents

Parameters:
  • modules (dict of modules) – A dict of module objects keyed by their module name.
  • lib_base (string) – The base path of the library (ex: ‘ripyl’).
Returns:

A list of patchobject.