From adaae37c46867399b449c261681751b90362d53f Mon Sep 17 00:00:00 2001 From: "behinger (s-ccs 001)" Date: Mon, 11 Sep 2023 16:55:38 +0000 Subject: [PATCH] removed the double script example_data, loaded the docs one --- test/example_data.jl | 66 ----------------------------------------- test/setup.jl | 4 ++- test/test_toposeries.jl | 3 +- 3 files changed, 4 insertions(+), 69 deletions(-) delete mode 100644 test/example_data.jl diff --git a/test/example_data.jl b/test/example_data.jl deleted file mode 100644 index 2cc0d5e09..000000000 --- a/test/example_data.jl +++ /dev/null @@ -1,66 +0,0 @@ -using UnfoldSim -using TopoPlots -using Unfold -""" -Makes use of TopoPlots example data (originating from eegvis matlab toolbox). -type == -"TopoPlots.jl"(default) Returns tidy DataFrame with two conditions, 64 channels and 800ms of data. This is an average over many subjects. -""" - -function example_data(example="TopoPlots.jl") - - if example == "UnfoldLinearModel" - # load and generate a simulated Unfold Design - data,evts = UnfoldSim.predef_eeg(;noiselevel=10,return_epoched=true) - data = reshape(data,1,size(data)...) - f = @formula 0~1+condition+continuous - # generate ModelStruct - se_solver =(x,y)->Unfold.solver_default(x,y,stderror=true) - return fit(UnfoldModel,(Dict(Any=>(f,range(0,length=size(data,2),step=1/100)))) ,evts,data;solver=se_solver) - elseif example == "UnfoldLinearModelMultiChannel" - # load and generate a simulated Unfold Design - cAll = DataFrame() - sfreq = 100 - for ch = 1:5 - data,evts = UnfoldSim.predef_eeg(;p1 = (p100(;sfreq=sfreq), @formula(0~1),[5],Dict()), - - n1 = (n170(;sfreq=sfreq), @formula(0~1+condition),[5,-ch*0.5],Dict()), - p3 = (p300(;sfreq=sfreq), @formula(0~1+continuous),[ch,1],Dict()), - return_epoched=true) - data = reshape(data,1,size(data)...) - f = @formula 0~1+condition+continuous - # generate ModelStruct - - m= fit(UnfoldModel,(Dict(Any=>(f,range(0,length=size(data,2),step=1/100)))) ,evts,data) - d = coeftable(m) - d.channel .= ch - cAll = append!(cAll,d) - end - return cAll - - elseif example == "UnfoldLinearModelContinuousTime" - # load and generate a simulated Unfold Design - data,evts = UnfoldSim.predef_eeg(;) - data = reshape(data,1,size(data)...) - f = @formula 0~1+condition+continuous - basis = firbasis([0,0.5],100) - # generate ModelStruct - return fit(UnfoldModel,Dict(Any=>(f,basis)) ,evts,data) - - elseif example == "TopoPlots.jl" - data,chanlocs = TopoPlots.example_data(); - df = DataFrame(estimate=Float64[],time=Float64[],channel=Int64[],coefname=String[],topoPositions=[],se=Float64[],pval=Float64[]) - pos = TopoPlots.points2mat(chanlocs) - for ch = 1:size(data,1) - for t = 1:size(data,2) - append!(df,DataFrame(estimate=data[ch,t,1],se=data[ch,t,2],pval=data[ch,t,3],time=t,channel=ch,coefname="A",topoPositions=(pos[1,ch],pos[2,ch]))) - - - end - end - df.time = range(-0.3,0.5,step=1/500)[Int.(df.time)] - return df,chanlocs - else - error("unknown example data") - end -end \ No newline at end of file diff --git a/test/setup.jl b/test/setup.jl index 9063fd0db..1fb043909 100644 --- a/test/setup.jl +++ b/test/setup.jl @@ -4,4 +4,6 @@ using Test using CairoMakie using GeometryBasics using DataFrames -using TopoPlots \ No newline at end of file +using TopoPlots + +include("../docs/example_data.jl") \ No newline at end of file diff --git a/test/test_toposeries.jl b/test/test_toposeries.jl index 2d1e99d60..324df5148 100644 --- a/test/test_toposeries.jl +++ b/test/test_toposeries.jl @@ -1,5 +1,4 @@ -# 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)));