Modifiers

Apply Strain

class crappy.modifier.apply_strain_img.Apply_strain_img(img, exx_label: str = 'Exx(%)', eyy_label: str = 'Eyy(%)', img_label: str = 'frame')[source]

This modifier reads the strain values along X and Y (in %) and creates an image deformed to match these values.

__init__(img, exx_label: str = 'Exx(%)', eyy_label: str = 'Eyy(%)', img_label: str = 'frame') None[source]

Sets the instance attributes.

Parameters
  • img – The image to use (must be a numpy array)

  • exx_label (str, optional) – The labels containing the strain to apply

  • eyy_label (str, optional) – The labels containing the strain to apply

  • img_label (str, optional) – The label of the generated image

Modifier

class crappy.modifier.modifier.MetaModifier(name: str, bases: tuple, dict_: dict)[source]

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)[source]

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

This modifier turns the array returned 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[source]

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)[source]

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)[source]

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)[source]

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[source]

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)[source]

Median filter.

Returns

The median value every npoints point of data.

__init__(npoints: int = 100) None[source]

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)[source]

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

__init__(name: str) None[source]

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)[source]

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[source]

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.