Skip to content

plot_splines only works for first event #375

@behinger

Description

@behinger

Describe the bug
plot_splines only works for first event. This was reported here unfoldtoolbox/Unfold.jl#277 by @EmmanuelleKris

Code To Reproduce

	using Unfold,UnfoldMakie,UnfoldSim
	using CairoMakie

	data,evts = UnfoldSim.predef_eeg()
	evts.event .= rand(["stimonset","buttonpress","saccade"],size(evts,1))
	Unfold.rename!(evts,:continuous=>:sac_amplitude)

fbutton = @formula(0 ~ 1 )
fstim= @formula(0 ~ 1 )
fsacc= @formula(0 ~ 1+spl(sac_amplitude,10))
sfreq = 100
bfsacc = firbasis((-0.1, 0.8), sfreq)
bfstim = firbasis((-0.2, 0.8), sfreq)
bfbutton= firbasis((-0.25, 0.254), sfreq)

bfDict = [ "saccade" => (fsacc,bfsacc),
		   "stimonset" => (fstim, bfstim),
"buttonpress" => (fbutton, bfbutton),
]

m = Unfold.fit(UnfoldModel,bfDict,evts,data,eventcolumn = "event")

plot_splines(m)

Expected behavior
all splines of all events should be found, not only of the (alphabetically) first event


The problem is here:

terms = Unfold.terms(Unfold.formulas(m)[1].rhs)

only the first formula is checked, not all of them. The check should be refactored and applied to all forulas of a model. The spline-terms could be grouped irrespective of event, but o.c. it would be nicer if in the plot it is somehow made clear from which event the spline is coming from

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions