-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update plot_erp.jl * new tests, combined plot in docs * del * additional docs problems * little detail * dead links * docstring warnings * cross-refs again * test * pp_plot fixed * docs errors should be resolved * Update hide_deco.md * colorbar docs * liting * add Voltage label * linting + name consistency * formatter * no extra for circular * no extra toposeries * test for design matrix and no extra * test * no extra for erp * del extra in erpimage and parplot * g * citability * failed, but I will save it * fixed * fixed colorbar in toposeries * small test * review of current test * del chanNum argument --------- Co-authored-by: behinger (s-ccs 001) <[email protected]>
- Loading branch information
Showing
17 changed files
with
222 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
using LiveServer | ||
servedocs(skip_dir=joinpath("src","generated"),literate_dir=joinpath("literate"),foldername=".") | ||
servedocs(skip_dir=joinpath("src","generated"),literate_dir=joinpath("literate"),literate=joinpath("literate"),foldername=".") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
""" | ||
function plot_erpgrid!(f::Union{GridPosition, Figure}, data::Matrix{<:Real}, pos::Vector{Point{2,Float}}; kwargs...) | ||
function plot_erpgrid(data::Matrix{<:Real}, pos::Vector{Point{2,Float}}; kwargs...) | ||
Plot an ERP image. | ||
## Arguments: | ||
- `f::Union{GridPosition, Figure}`: Figure or GridPosition that the plot should be drawn into; | ||
- `plotData::Matrix{<:Real}`: Data for the plot visualization; | ||
- `pos::Vector{Point{2,Float}}`: electrode positions. | ||
## Keyword Arguments | ||
- `drawLabels` (bool, `false`) - Draw channels labels over each waveform. | ||
- `times`: (Vector, `1:size(plotData, 2)`) - Vector of size() | ||
## Return Value: | ||
The input `f` | ||
""" | ||
|
||
# no figure? | ||
plot_erpgrid(plotData::Matrix{<:Real}, pos; kwargs...) = | ||
plot_erpgrid!(Figure(), plotData, pos; kwargs...) | ||
|
||
function plot_erpgrid!( | ||
f::Union{GridPosition,Figure}, | ||
plotData::Matrix{<:Real}, | ||
pos; | ||
drawLabels = false, | ||
times = -1:size(plotData, 2)-2, #arbitrary strat just for fun | ||
kwargs..., | ||
) | ||
chanNum = size(plotData, 1) | ||
println(size(plotData, 1), " ", size(plotData, 2)) | ||
plotData = plotData[1:chanNum, :] | ||
pos = hcat([[p[1], p[2]] for p in pos]...) | ||
|
||
pos = pos[:, 1:chanNum] | ||
minmaxrange = (maximum(pos, dims = 2) - minimum(pos, dims = 2)) | ||
pos = (pos .- mean(pos, dims = 2)) ./ minmaxrange .+ 0.5 | ||
|
||
axlist = [] | ||
#ax = Axis(f[1, 1],backgroundcolor=:green)# | ||
|
||
rel_zeropoint = argmin(abs.(times)) ./ length(times) | ||
|
||
for (ix, p) in enumerate(eachcol(pos)) | ||
x = p[1] #- 0.1 | ||
y = p[2] #- 0.1 | ||
# todo: 0.1 should go into plot config | ||
ax = Axis( | ||
f[1, 1], | ||
width = Relative(0.2), | ||
height = Relative(0.2), | ||
halign = x, | ||
valign = y, | ||
)# title = raw_ch_names[1:30]) | ||
if drawLabels | ||
text!( | ||
ax, | ||
rel_zeropoint + 0.1, | ||
1, | ||
color = :gray, | ||
fontsize = 12, | ||
text = string.(ix), | ||
align = (:left, :top), | ||
space = :relative, | ||
) | ||
end | ||
# todo: add label if not nothing | ||
|
||
push!(axlist, ax) | ||
end | ||
# todo: make optional + be able to specify the linewidth + color | ||
hlines!.(axlist, Ref([0.0]), color = :gray, linewidth = 0.5) | ||
vlines!.(axlist, Ref([0.0]), color = :gray, linewidth = 0.5) | ||
|
||
times = isnothing(times) ? (1:size(plotData, 2)) : times | ||
|
||
# todo: add customizable kwargs | ||
h = lines!.(axlist, Ref(times), eachrow(plotData)) | ||
|
||
linkaxes!(axlist...) | ||
hidedecorations!.(axlist) | ||
hidespines!.(axlist) | ||
|
||
f | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
using UnfoldMakie | ||
include("setup.jl") | ||
#include("../src/UnfoldMakie.jl") | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
using UnfoldMakie | ||
using UnfoldSim | ||
using Test | ||
using CairoMakie | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
|
||
@testset "basic" begin | ||
include("../docs/example_data.jl") | ||
data, pos = example_data("TopoPlots.jl") | ||
plot_butterfly(data; positions = pos) | ||
end | ||
|
||
@testset "markersize change" begin | ||
include("../docs/example_data.jl") | ||
data, pos = example_data("TopoPlots.jl") | ||
plot_butterfly( | ||
data; | ||
positions = pos, | ||
markersize = 10, | ||
topomarkersize = 10, | ||
topoheigth = 0.4, | ||
topowidth = 0.4, | ||
) | ||
end | ||
|
||
|
||
@testset "markersize change" begin | ||
include("../docs/example_data.jl") | ||
data, pos = example_data("TopoPlots.jl") | ||
plot_butterfly(data; positions = pos) | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
data, pos = TopoPlots.example_data() | ||
data = data[:, :, 1] | ||
|
||
#times = -0.099609375:0.001953125:1.0 | ||
|
||
@testset "basic erpgrid: one plot is out of the border" begin | ||
plot_erpgrid(data[1:3, 1:20], pos) | ||
end | ||
|
||
@testset "basic erpgrid" begin | ||
plot_erpgrid(data[1:6, 1:20], pos) | ||
end | ||
|
||
@testset "erpgrid with GridPosition" begin | ||
f = Figure() | ||
plot_erpgrid!(f[1, 1], data, pos) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
|
||
@testset "markersize change" begin | ||
@testset "Figure, 3 channels, 1 condition" begin | ||
include("../docs/example_data.jl") | ||
results_plot, positions = example_data(); | ||
plot_parallelcoordinates(results_plot, [5,3,2]; # this selects channel 5,3 & 2 | ||
plot_parallelcoordinates(results_plot, [5, 3, 2]; # this selects channel 5,3 & 2 | ||
mapping = (color = :coefname, y = :estimate)) | ||
end | ||
|
||
|
||
@testset "GridPosition" begin | ||
uf_5chan = example_data("UnfoldLinearModelMultiChannel") | ||
d_singletrial, _ = UnfoldSim.predef_eeg(; return_epoched=true) | ||
|
||
f = Figure() | ||
plot_parallelcoordinates!(f[1, 1], uf_5chan, [1, 2, 3, 4, 5]; | ||
mapping=(; color=:coefname), layout=(; legendPosition=:bottom)) | ||
f | ||
end |
Oops, something went wrong.