Skip to content

Commit

Permalink
sorted erp added to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vladdez committed Nov 16, 2023
1 parent c1f13ee commit 99a96b5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
32 changes: 24 additions & 8 deletions docs/src/tutorials/erpimage.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,23 @@ include("../../example_data.jl")
```


## Plot ERP Images
## Plot ERP image

The following code will result in the default configuration.
```@example main
data, evts = UnfoldSim.predef_eeg(; noiselevel=10, return_epoched=true)
plot_erpimage(data)
```

## Column Mappings for ERP Images
## Column Mappings for ERP image

Since ERP images use a `Matrix` as an input, the library does not need any informations about the mapping.

- erpblur (number, 10) - Is a number indicating how much blur is applied to the image; using Gaussian blur of the ImageFiltering module. Negative values deactivate the blur.

- sortvalues - Indicating whether the data is sorted; using sortperm() of Base Julia.
(sortperm() computes a permutation of the array's indices that puts the array into sorted order).

- meanplot (bool, false) - Indicating whether the plot should add a line plot below the ERP image, showing the mean of the data. If limits are set in the axis values both plots will be aligned.
- `erpblur` (Number, `10`): number indicating how much blur is applied to the image; using Gaussian blur of the ImageFiltering module.
Non-Positive values deactivate the blur.
- `sortvalues` (bool, `false`): parameter over which plot will be sorted. Using sortperm() of Base Julia.
- sortperm() computes a permutation of the array's indices that puts the array into sorted order.
- `meanplot` (bool, `false`): Indicating whether the plot should add a line plot below the ERP image, showing the mean of the data.

```@example main
plot_erpimage(data;
Expand All @@ -40,3 +39,20 @@ plot_erpimage(data;
visual = (colormap = :viridis, colorrange = (-40, 40)))
```

## Sorted ERP image

First, generate a data. Second, specify the necessary sorting parameter.

```@example main
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))
dat_e = dat_e[1,:,:]
plot_erpimage(times, dat_e; sortvalues=evts.Δlatency)
```
6 changes: 3 additions & 3 deletions src/plot_erpimage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ Plot an ERP image.
- `plot::Matrix{Float64}`: Data for the plot visualization
## Keyword Arguments
- `erpblur` (Number, `10`) - Number indicating how much blur is applied to the image; using Gaussian blur of the ImageFiltering module.
- `erpblur` (Number, `10`): number indicating how much blur is applied to the image; using Gaussian blur of the ImageFiltering module.
Non-Positive values deactivate the blur.
- `sortix` (default: `nothing`): .
- `sortvalues` (bool, `false`) - parameter over which plot will be sorted. Using sortperm() of Base Julia.
- `sortvalues` (bool, `false`): parameter over which plot will be sorted. Using sortperm() of Base Julia.
- sortperm() computes a permutation of the array's indices that puts the array into sorted order.
- `meanplot`: (bool, `false`) - Indicating whether the plot should add a line plot below the ERP image, showing the mean of the data.
- `meanplot` (bool, `false`): Indicating whether the plot should add a line plot below the ERP image, showing the mean of the data.
$(_docstring(:erpimage))
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
1 change: 0 additions & 1 deletion test/test_butterfly.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

include("../docs/example_data.jl")
data, pos = example_data("TopoPlots.jl")
using Colors

@testset "basic" begin
plot_butterfly(data; positions = pos)
Expand Down

0 comments on commit 99a96b5

Please sign in to comment.