From 3fb638ec2a44a0a2b66076558f29caa0d2e506d0 Mon Sep 17 00:00:00 2001 From: Vladimir Mikheev Date: Fri, 24 Nov 2023 18:10:29 +0000 Subject: [PATCH] reverse ERP image trials and sorted ERP image into combined plot --- docs/src/how_to/mult_vis_in_fig.md | 12 +++++++++--- docs/src/tutorials/erpimage.md | 2 +- test/test_complexplots.jl | 2 +- test/test_erpimage.jl | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/src/how_to/mult_vis_in_fig.md b/docs/src/how_to/mult_vis_in_fig.md index 1df4c4f51..feb4a3375 100644 --- a/docs/src/how_to/mult_vis_in_fig.md +++ b/docs/src/how_to/mult_vis_in_fig.md @@ -17,9 +17,15 @@ uf_deconv = example_data("UnfoldLinearModelContinuousTime") uf = example_data("UnfoldLinearModel") results = coeftable(uf) uf_5chan = example_data("UnfoldLinearModelMultiChannel") -d_singletrial, _ = UnfoldSim.predef_eeg(; return_epoched=true) -times = -0.099609375:0.001953125:1.0 data, positions = TopoPlots.example_data() +dat, evts = UnfoldSim.predef_eeg(; + onset=LogNormalOnset(μ=3.5, σ=0.4), + noiselevel=5 + ) +dat_e, times = Unfold.epoch(dat, evts, [-0.1, 1], 100) +evts, dat_e = Unfold.dropMissingEpochs(evts, dat_e) +evts.Δlatency = diff(vcat(evts.latency, 0)) *-1 +dat_e = dat_e[1, :, :] nothing #hide ``` This section discusses how users can incorporate multiple plots into a single figure. @@ -81,7 +87,7 @@ plot_erp!(f[2, 4:5], res_effects; categorical_color=false, categorical_group=tru plot_parallelcoordinates!(f[3, 2:3], uf_5chan, [1, 2, 3, 4, 5]; mapping=(; color=:coefname), layout=(; legend_position=:bottom)) -plot_erpimage!(f[1, 4:5], times, d_singletrial) +plot_erpimage!(f[1, 4:5], times, dat_e; sortvalues=evts.Δlatency) plot_circulareegtopoplot!(f[3:4, 4:5], d_topo[in.(d_topo.time, Ref(-0.3:0.1:0.5)), :]; positions=positions, predictor=:time, predictor_bounds=[-0.3, 0.5]) diff --git a/docs/src/tutorials/erpimage.md b/docs/src/tutorials/erpimage.md index 18dcb15da..94ecc9bb3 100644 --- a/docs/src/tutorials/erpimage.md +++ b/docs/src/tutorials/erpimage.md @@ -51,7 +51,7 @@ First, generate a data. Second, specify the necessary sorting parameter. ) dat_e, times = Unfold.epoch(dat, evts, [-0.1,1], 100) evts, dat_e = Unfold.dropMissingEpochs(evts, dat_e) - evts.Δlatency = diff(vcat(evts.latency, 0)) + evts.Δlatency = diff(vcat(evts.latency, 0)) *-1 dat_e = dat_e[1,:,:] plot_erpimage(times, dat_e; sortvalues=evts.Δlatency) diff --git a/test/test_complexplots.jl b/test/test_complexplots.jl index 83209e538..3a9f4edae 100644 --- a/test/test_complexplots.jl +++ b/test/test_complexplots.jl @@ -47,7 +47,7 @@ dat, evts = UnfoldSim.predef_eeg(;onset=LogNormalOnset(μ=3.5, σ=0.4), noiselevel = 5) dat_e, times = Unfold.epoch(dat,evts, [-0.1,1], 100) evts, dat_e = Unfold.dropMissingEpochs(evts, dat_e) - evts.Δlatency = diff(vcat(evts.latency, 0)) + evts.Δlatency = diff(vcat(evts.latency, 0)) *-1 dat_e = dat_e[1,:,:] plot_erpimage!(gf, times, dat_e; sortvalues=evts.Δlatency) plot_channelimage!(gg, data[:, :, 1], positions[1:30], raw_ch_names; ) diff --git a/test/test_erpimage.jl b/test/test_erpimage.jl index 612f8267a..e2b2a60e3 100644 --- a/test/test_erpimage.jl +++ b/test/test_erpimage.jl @@ -27,7 +27,7 @@ end UnfoldSim.predef_eeg(; onset = LogNormalOnset(μ = 3.5, σ = 0.4), noiselevel = 5) dat_e, times = Unfold.epoch(dat, evts, [-0.1, 1], 100) evts, dat_e = Unfold.dropMissingEpochs(evts, dat_e) - evts.Δlatency = diff(vcat(evts.latency, 0)) + evts.Δlatency = diff(vcat(evts.latency, 0)) *-1 dat_e = dat_e[1, :, :] plot_erpimage(times, dat_e; sortvalues = evts.Δlatency) end