Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in toposeries #57

Merged
merged 5 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions src/plot_topoplotseries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,35 @@ Plot a Topoplot Series.
The input `f`

"""
plot_topoplotseries(plotData::DataFrame,Δbin::Real;kwargs...) = plot_topoplotseries!(Figure(), plotData, Δbin; kwargs...)
plot_topoplotseries(plotData::DataFrame, Δbin::Real; kwargs...) = plot_topoplotseries!(Figure(), plotData, Δbin; kwargs...)


function plot_topoplotseries!(f::Union{GridPosition, Figure}, plotData::DataFrame, Δbin; positions=nothing, labels=nothing, kwargs...)
function plot_topoplotseries!(f::Union{GridPosition,Figure}, plotData::DataFrame, Δbin; positions=nothing, labels=nothing, kwargs...)
config = PlotConfig(:topoplotseries)
config_kwargs!(config;kwargs...)
config_kwargs!(config; kwargs...)

plotData = deepcopy(plotData)

# resolve columns with data
config.mapping = resolveMappings(plotData, config.mapping)

positions = getTopoPositions(;positions=positions, labels=label)
positions = getTopoPositions(; positions=positions, labels=labels)


if "label" ∉ names(plotData)
plotData.label = plotData.channel
end

eeg_topoplot_series!(f, plotData, Δbin;
col_y = config.mapping.y,
col_y=config.mapping.y,
col_label=:label,
col = config.mapping.col,
row = config.mapping.row,
combinefun = config.extra.combinefun,
col=config.mapping.col,
row=config.mapping.row,
combinefun=config.extra.combinefun,
positions=positions,
config.visual...
)
)

return f

end
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TopoPlots = "2bdbdf9c-dbd8-403f-947b-1a4e0dd41a7a"
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ include("setup.jl")

@testset "UnfoldMakie.jl" begin
include("test_plot_circulareegtopoplot.jl")
end

@testset "UnfoldMakie.jl" begin
include("test_toposeries.jl")
end
3 changes: 2 additions & 1 deletion test/setup.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using UnfoldMakie
using Test
using CairoMakie
using GeometryBasics
using DataFrames
using UnfoldMakie
using TopoPlots
7 changes: 4 additions & 3 deletions test/test_plot_circulareegtopoplot.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include("setup.jl")

@testset "error cases and warns" begin

@testset "out of error bounds" begin
Expand All @@ -12,12 +14,11 @@

@testset "tooManyBoundsErr" begin
testdf = DataFrame(
effect = [[4.0,1.0],[4.0,3.0],[4.0,3.0]],
estimate = [[4.0,1.0],[4.0,3.0],[4.0,3.0]],
predictor = [70,80,90],
)

@test_throws ErrorException plot_circulareegtopoplot(testdf; extra=(;predictorBounds=[0,100,360]), positions = [Point(1.0,2.0), Point(1.0,2.0), Point(1.0,2.0)],
)
@test_throws ErrorException plot_circulareegtopoplot(testdf; extra=(;predictorBounds=[0,100,360]), positions = [Point(1.0,2.0), Point(1.0,2.0), Point(1.0,2.0)],)

end
end
Expand Down
9 changes: 9 additions & 0 deletions test/test_toposeries.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# include("../UnfoldMakie/test/test_toposeries.jl")
#include("setup.jl")
@testset "testing calculateBBox" begin
data, positions = TopoPlots.example_data()
df = UnfoldMakie.eeg_matrix_to_dataframe(data[:, :, 1], string.(1:length(positions)));
Δbin=80
UnfoldMakie.plot_topoplotseries(df, Δbin; positions=positions)

end
Loading