Detect bad channels and epochs:
= detect_bad(e10, method=[:flat, :p2p, :var])
bad_m, bad_epochs = plot(e10, ch=1:19, ep=2, bad=bad_m)
p plot_save(p, file_name="images/bad_epoch.png")
delete_epoch!(e10, ep=bad_epochs)
See detect_bad()
for the list of available methods and parameters use to tune
auto-detection.
Remove parts of the signal:
plot(e10, ep=1)
# remove one second
trim!(e10, segment=(1, 1*sr(e10)), keep_epochs=false)
# plot again
plot(e10, ep=1)
plot(e10, ep=2)
# remove segment [16, 17] s
trim!(e10, segment=(16, 17), keep_epochs=false)
Interpolate bad channels 1, 4, 6 in all epochs using planar interpolation:
= plinterpolate_channel(e10, ch=[1, 4, 6], ep=1:epoch_n(e10))
e10pl plot(e10.data[1, :, 1])
plot!(e10pl.data[1, :, 1])
(!) Planar interpolation requires electrode locations. Multiple channels may be interpolated at the same time.
Interpolate channel 1 in epochs 12, 15, 22 using linear regression:
= lrinterpolate_channel(e10, ch=1, ep=[12, 15, 22])
e10lr plot(e10.data[1, :, 12])
plot!(e10lr.data[1, :, 12])
(!) Linear regression interpolation requires ≥ 1 epoch of good signal in interpolated channel, as linear regressor is trained using good epochs. The more epochs with good signal, the better interpolation results. Only single channel may be interpolated at the same time.