Modifiers — Crappy 1.5.3 documentation

# Modifiers

## Modifier

class crappy.modifier.modifier.MetaModifier(name, bases, dict_)

  To keep track of all Modifiers (formerly Conditions)

## Demux

class crappy.modifier.demux.Demux(*labels: Union[str, list], stream: str = 'stream', mean: bool = False, time_label: str = 't(s)', transpose: bool = False)

  Modifier to change a stream table into a `dict` with values (to plot streams).

  This modifier turns the array return by a streaming device into a `dict` with individual values (but only one per table). This allows attaching graphers to HF acquisition devices.

  Note

  The table will be lost in the process.

  __init__(*labels: Union[str, list], stream: str = 'stream', mean: bool = False, time_label: str = 't(s)', transpose: bool = False) → None

    Sets the instance attributes.

    Parameters

      - *labels (`str`, `list`) – The names of the labels to use for each column of the array. May be either a list of labels, or the labels given as separate arguments.

      - stream (`str`, optional) – The name of the label containing the stream.

      - mean (`bool`, optional) – If `True`, the returned value will be the average of the column.

      - time_label (`str`, optional) – The name of the label of the time table.

      - transpose (`bool`, optional) –

## Differentiate

class crappy.modifier.differentiate.Diff(label: str, time: str = 't(s)', out_label: Optional[str] = None)

  Differentiation filter.

  This will differentiate the value at `label` over time.

  Note

  The time label must be specified with time=’…’.

## Integrate

class crappy.modifier.integrate.Integrate(label: str, time: str = 't(s)', out_label: Optional[str] = None)

  Integration filter.

  This will integrate the value at `label` over time.

  Note

  The time label must be specified with time=’…’.

## Mean

class crappy.modifier.mean.Mean(npoints: int = 100)

  Mean filter.

  Note

  Will divide the output freq by `npoints`.

  If you need the same freq, see Moving average.

  Returns

    The mean value every `npoints` point of data.

  __init__(npoints: int = 100) → None

    Sets the instance attributes.

    Parameters

      npoints (`int`) – The number of points it takes to return 1 value.

## Median

class crappy.modifier.median.Median(npoints: int = 100)

  Median filter.

  Returns

    The median value every `npoints` point of data.

  __init__(npoints: int = 100) → None

    Sets the instance attributes.

    Parameters

      npoints (`int`) – The number of points it takes to return 1 value.

## Moving average

More documentation coming soon !

## Moving med

More documentation coming soon !

## Trig on change

class crappy.modifier.trig_on_change.Trig_on_change(name: str)

  Can be used to trig an event when the value of a given label changes.

  __init__(name: str) → None

    Sets the instance attributes.

    Parameters

      name (`str`) – The name of the label to monitor.

## Trig on value

class crappy.modifier.trig_on_value.Trig_on_value(name: str, values: list)

  Can be used to send data (an empty `dict`) when the input reached a given value.

  Note

  The modifier will trig if data[name] is in `values`.

  __init__(name: str, values: list) → None

    Sets the instance attributes.

    Parameters

      - name (`str`) – The name of the label to monitor.

      - values (`list`) – A list containing the possible values to send the signal.