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

sequence of different events #71

Open
behinger opened this issue Feb 6, 2024 · 3 comments
Open

sequence of different events #71

behinger opened this issue Feb 6, 2024 · 3 comments

Comments

@behinger
Copy link
Member

behinger commented Feb 6, 2024

Currently not clear how to best do something like
A -> B -> C as three different events, or even worse, B follows A in 80% of cases, etc.


@behinger
Copy link
Member Author

behinger commented Feb 6, 2024

begin
c_design = UnfoldSim.SingleSubjectDesign(;conditions= Dict(:duration=>[0.2*sfreq],:shift => 0.2.*sfreq .+ rand(500).*sfreq/3))

r_design = UnfoldSim.SingleSubjectDesign(;conditions= Dict(:duration=>[0.4*sfreq],:shift =>generate(c_design).shift .+ 0.1.*sfreq .+ rand(500).*sfreq/3))
end

	p1 =  LinearModelComponent(;
        basis = p100(),
        formula = @formula(0~1),
        β = [2]
        );

n1 =  LinearModelComponent(;
        basis = n170(), # negative already
        formula = @formula(0~1),
        β = [2]
        );

p3 =TimeVaryingComponent(basis_shiftduration,200)

c_component = TimeVaryingComponent(basis_shiftduration,200)

s_data,s_evts = simulate(MersenneTwister(1),c_design, [p1,n1],  UniformOnset(0,2*sfreq), NoNoise());
r_data,r_evts = simulate(MersenneTwister(1),r_design, [p3], UniformOnset(0,2*sfreq),NoNoise())# CustomOnset(evts.latency .+0.5*sfreq),NoNoise())
c_data,c_evts = simulate(MersenneTwister(1),c_design, [c_component], UniformOnset(0,2*sfreq),PinkNoise(noiselevel=noiselevel))

@behinger
Copy link
Member Author

p1 = Component
n1 = Component
p3 = Component

eventA = [p1,n1]
eventB = [p1,p3]

seq = 'AAAB'
repeats=5

evts = generate_events(Design(
    sequence = seq
)|>RepeatDesign(x)) # repeatdesign repeats the blocks!

# evts now contains a "protected" field `event`
#evts.event = repeat(['A','A','A','B'],5)

simulate(design,['A'=>eventA,'B'=>eventB],Overlap,Noise)

Sequence syntax

maybe a syntax similar to regex?

seq = 'AA[B]{1,3}' # can generate AAB,AABB,AABBB

seq = '[AB]{2}' # can generate  AA,AB,BA,BB

seq = '[(AB)]{2}'  # can generate ABAB 
seq = '[(AB)B]{2}' # can generate ABB ABAB BAB BB

Block / non-overlapping

simplest solution could be to have

seq = 'AAB_' or something to indicate that the _ entrance should be moved at least `maxlength(components)' to ensure no overlap

One thing I havent thought now is how to specify to put as many events as there is time-left. E.g. an 'A' event (stimulus) for 5s, put in as many 'B' (fixation) events as possible. Maybe seq = 'AB*' ? but then how to specify the maxtime of a?
seq = 'A=5000B*' looks terrible. we would need an extra field...

@jschepers what do you think?

@behinger
Copy link
Member Author

behinger commented Feb 26, 2024

see #83 for an implementation.
A=5000 B* with a space starts to not look so bad. what do you think?#
SF*, sequencelength=5000
(SF*)=5000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant