Skip to content

change_sig_prop

change_sig_prop changes the color and/or the filters of channels in AnyWave.

aw.change_sig_prop(cfg)

cfg is a dict:

key content required
'labels' list of the labels of the channels to change yes
'color' color of the trace, '#RRGGBB' no
'hp' high pass filter in Hz no
'lp' low pass filter in Hz no
'notch' notch filter in Hz no

Give at least one of color, hp, lp, notch. The change applies to the channels of the current montage.

Examples

Change the color of channel A1:

import sys
import anywave as aw

aw.init(sys.argv)

aw.change_sig_prop({'labels': ['A1'], 'color': '#008800'})      # green

Change the filters and the color of several channels at once:

cfg = {'labels': ['A1', 'A4', 'A5'], 'color': '#001199', 'hp': 1, 'lp': 80}     # 1 Hz high pass, 80 Hz low pass
aw.change_sig_prop(cfg)

Add a 50 Hz notch:

aw.change_sig_prop({'labels': ['A1', 'A4', 'A5'], 'notch': 50})

Effect on the following requests

The new filters are the filters of the channels in AnyWave. A following get_data therefore returns filtered data, and the hp, lp, notch attributes of its channels tell which filters were applied:

aw.change_sig_prop({'labels': ['Fp1', 'Cz'], 'hp': 1, 'lp': 40})

out = aw.get_data({'labels': ['Fp1', 'Cz']})
print([(c.name, c.hp, c.lp) for c in out[0]['channels']])       # [('Fp1', 1.0, 40.0), ('Cz', 1.0, 40.0)]

Use 'raw_data': True in get_data when you need the unfiltered values, see get_data.

Errors

When AnyWave refuses the request, change_sig_prop raises an Exception with the message of AnyWave:

message cause
ERROR: labels key is not specified in struct/dict parameter. no 'labels' key
ERROR: labels is empty. 'labels' is an empty list
change_sig_prop: argument must be a dict the argument is not a dict

A single label may be given as a string: {'labels': 'A1'} is the same as {'labels': ['A1']}.