Skip to content

Commit

Permalink
reverse ERP image trials and sorted ERP image into combined plot
Browse files Browse the repository at this point in the history
  • Loading branch information
vladdez committed Nov 24, 2023
1 parent 05515f9 commit 3fb638e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
12 changes: 9 additions & 3 deletions docs/src/how_to/mult_vis_in_fig.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/erpimage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/test_complexplots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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; )
Expand Down
2 changes: 1 addition & 1 deletion test/test_erpimage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3fb638e

Please sign in to comment.