OpenViBE forum

The OpenViBE community
It is currently Thu Aug 22, 2019 10:01 pm

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: Thu Nov 29, 2018 1:49 pm 
Offline

Joined: Wed Nov 14, 2018 6:10 pm
Posts: 27
I am implementing Stimulus based epoching box and time based epoching box. The Stimulus based epoching epochs 15 sec instantly after stimulus and time based epoching box epochs 0.5 seconds every 0.5 seconds.The stimulus is given 10 times . Then I process it to get relative power and display it as well as save it. My problem is that in the written file I have expected 300 epoch values saved( 15/0.5=30 and 30*10 trials=300), but the first display using "instant bar" box happens once after 15 sec of stimulus, on every trial. I want it to visualize instantly as soon as 0.5 sec is epoched. Is there something I can do?


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 03, 2018 2:10 pm 
Offline

Joined: Wed Oct 31, 2018 9:14 am
Posts: 93
I don't understand what do you want and what do you get.^^
your stimulations match (for the time I speak)?
the box stimulation listener will allow you to check in live when the stimulation is launch and the name of the stimulation.


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 03, 2018 2:14 pm 
Offline

Joined: Wed Nov 14, 2018 6:10 pm
Posts: 27
I want to an instantaneous visualization after 0.5 sec is completed,not waiting for the stimulus based epoch to complete epoching 15 seconds and then the time based epoching box segmenting it further and then displaying after 15 secs are over


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 03, 2018 2:17 pm 
Offline

Joined: Wed Nov 14, 2018 6:10 pm
Posts: 27
Attachment:
Screenshot (51).png
Screenshot (51).png [ 197 KiB | Viewed 1468 times ]


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 03, 2018 2:32 pm 
Offline

Joined: Wed Oct 31, 2018 9:14 am
Posts: 93
Check if you send a stimulation at time 0 to enable your epoching.
But In your Case it's better I think to use only one lua script who send for exemple

00.0s OVTK_StimulationId_ExperimentStart
05.0s OVTK_StimulationId_SegmentStart
05.0s OVTK_StimulationId_TrialStart
05.5s OVTK_StimulationId_TrialStart
06.0s OVTK_StimulationId_TrialStart
......
20.0s OVTK_StimulationId_SegmentStart
20.0s OVTK_StimulationId_TrialStart
20.5s OVTK_StimulationId_TrialStart
......
XX.Xs OVTK_StimulationId_ExperimentStop

If you have a pause between two segment of 15s you can use use
OVTK_StimulationId_SegmentStop at 20.0s and make OVTK_StimulationId_SegmentStart at 25s for example (the first 5s is just a habit that I have to avoid some incomming signal problem at the beginning)

Edit : But if you need only an 0.5s epoching stimulations is not necessary in signal processing pipelin just in save you cna use a clock stimulation to add stimulation each 15s to your csv


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 03, 2018 2:50 pm 
Offline

Joined: Wed Nov 14, 2018 6:10 pm
Posts: 27
Attachment:
Screenshot (55).png
Screenshot (55).png [ 134.1 KiB | Viewed 1463 times ]
I am using the same stimulus id as the cue for my paradigm to epoch:


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 03, 2018 2:53 pm 
Offline

Joined: Wed Nov 14, 2018 6:10 pm
Posts: 27
I do not understand. Do I need to specifically add additional stimulus for epoching?


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 03, 2018 3:23 pm 
Offline

Joined: Wed Oct 31, 2018 9:14 am
Posts: 93
Not necessary I propose one solution.
You want 10 trials of 15s and each trials is cut in 0.5s epoch (so 300 epoch in output)
One solution is to use lua stimulator as you make.
An other solution more simple is : If your epoch are continuous (without pause), stimulation on input are useless.
- You need only the time based epoching with 0.5s duration and interval.
- You can use a clock stimulation box (15s) to add stimulation when your trials begin on csv
- Stop your scenario with a Timeout box (150s) and player control box (if you want stop)


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 03, 2018 3:27 pm 
Offline

Joined: Wed Nov 14, 2018 6:10 pm
Posts: 27
My epochs are not continuous, because my protocol is:
pre_baseline_duration = 0
baseline_duration = 10
post_baseline_duration = 0
cross_duration = 1
post_cross_duration = 1
display_cue_duration = 15
post_cue_duration = 0
rest_duration = 15
post_end_duration = 0

Also, I am using Lua Stimulator, My script is:
Quote:
function initialize(box)


dofile(box:get_config("${Path_Data}") .. "/plugins/stimulation/lua-stimulator-stim-codes.lua")


-- each stimulation sent that gets rendered by Display Cue Image box

-- should probably have a little period of time before the next one or the box wont be happy

pre_baseline_duration = 0
baseline_duration = 10

post_baseline_duration = 0

cross_duration = 1

post_cross_duration = 1

display_cue_duration = 15

post_cue_duration = 0
rest_duration = 15

post_end_duration = 0
number_trials=10

end

function
process(box)


local t = 0

-- Delays before the trial sequence starts

box:send_stimulation(1, OVTK_StimulationId_ExperimentStart, t, 0)

t = t + pre_baseline_duration


box:send_stimulation(1, OVTK_StimulationId_BaselineStart, t, 0)

t = t + baseline_duration


box:send_stimulation(1, OVTK_StimulationId_BaselineStop, t, 0)

t = t + post_baseline_duration

-- creates each trial

for i = 1,number_trials
do

-- first display a cross on screen

box:send_stimulation(1, OVTK_GDF_Start_Of_Trial, t, 0)

box:send_stimulation(1, OVTK_GDF_Cross_On_Screen, t, 0)

box:send_stimulation(1, OVTK_StimulationId_Beep, t, 0)

t = t + cross_duration


-- Clear cross.

box:send_stimulation(1, OVTK_StimulationId_VisualStimulationStop, t, 0)

t = t + post_cross_duration

-- display cue

box:send_stimulation(1, OVTK_StimulationId_Label_01, t, 0)

t = t + display_cue_duration


-- clear cue.

box:send_stimulation(1, OVTK_StimulationId_VisualStimulationStop, t, 0)
t = t + post_cue_duration


-- rest period

box:send_stimulation(1, OVTK_StimulationId_RestStart, t, 0)

t = t + rest_duration


-- end of rest and
box:send_stimulation(1, OVTK_StimulationId_VisualStimulationStop, t, 0)

box:send_stimulation(1, OVTK_StimulationId_RestStop, t, 0)
box:send_stimulation(1, OVTK_GDF_End_Of_Trial, t, 0)

t = t + post_end_duration

end


-- send end for completeness
box:send_stimulation(1, OVTK_GDF_End_Of_Session, t, 0)

t = t + 5


-- used to cause the acquisition scenario to stop and denote final end of file


box:send_stimulation(1, OVTK_StimulationId_ExperimentStop, t, 0)


end


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 03, 2018 3:47 pm 
Offline

Joined: Wed Nov 14, 2018 6:10 pm
Posts: 27
Hi !
So I finally understood one of your solutions. I sent special stimulations to start segmenting 0.5 seconds after stimulus starts, 30 times. I got rid of the time epoching box. Now I get what I want i.e., process and display as soon as 0.5 seconds pass after stimulus. Thank You.
Quote:
function initialize(box)


dofile(box:get_config("${Path_Data}") .. "/plugins/stimulation/lua-stimulator-stim-codes.lua")


-- each stimulation sent that gets rendered by Display Cue Image box

-- should probably have a little period of time before the next one or the box wont be happy

pre_baseline_duration = 0
baseline_duration = 10

post_baseline_duration = 0

cross_duration = 1

post_cross_duration = 1

display_cue_duration = 15

post_cue_duration = 0
rest_duration = 15

post_end_duration = 0
number_trials=10

end

function
process(box)


local t = 0

-- Delays before the trial sequence starts

box:send_stimulation(1, OVTK_StimulationId_ExperimentStart, t, 0)

t = t + pre_baseline_duration


box:send_stimulation(1, OVTK_StimulationId_BaselineStart, t, 0)

t = t + baseline_duration


box:send_stimulation(1, OVTK_StimulationId_BaselineStop, t, 0)

t = t + post_baseline_duration

-- creates each trial

for i = 1,number_trials
do

-- first display a cross on screen

box:send_stimulation(1, OVTK_GDF_Start_Of_Trial, t, 0)

box:send_stimulation(1, OVTK_GDF_Cross_On_Screen, t, 0)

box:send_stimulation(1, OVTK_StimulationId_Beep, t, 0)

t = t + cross_duration


-- Clear cross.

box:send_stimulation(1, OVTK_StimulationId_VisualStimulationStop, t, 0)

t = t + post_cross_duration

-- display cue

box:send_stimulation(1, OVTK_StimulationId_Label_01, t, 0)

box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)

t=t+0.5
-- clear cue.

box:send_stimulation(1, OVTK_StimulationId_VisualStimulationStop, t, 0)
t = t + post_cue_duration


-- rest period

box:send_stimulation(1, OVTK_StimulationId_RestStart, t, 0)

t = t + rest_duration


-- end of rest and
box:send_stimulation(1, OVTK_StimulationId_VisualStimulationStop, t, 0)

box:send_stimulation(1, OVTK_StimulationId_RestStop, t, 0)
box:send_stimulation(1, OVTK_GDF_End_Of_Trial, t, 0)

t = t + post_end_duration

end


-- send end for completeness
box:send_stimulation(1, OVTK_GDF_End_Of_Session, t, 0)

t = t + 5


-- used to cause the acquisition scenario to stop and denote final end of file


box:send_stimulation(1, OVTK_StimulationId_ExperimentStop, t, 0)


end


Thank you


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 03, 2018 3:59 pm 
Offline

Joined: Wed Oct 31, 2018 9:14 am
Posts: 93
Hmmmm
We separated the baseline from the rest in a separate scenario.
But keeping as you do Stimulation based epoching is not the solution, I think.

I start from the beginning: Seeing your script and your scenario I have the impression that the problem is only on the data to analyze.
- The display part image and your stimulations are as you wish.
- Your pipeline stimulation (if you add a stimulation listener) is as you wish.
- You want to record in your CSV the modified data (with the stimulations) of your trials of 15s BUT NOT THE REST (data between trials).

you can use a stream switch box to send in a different output the data you do not want to use (this output will not need to be connected). Thus, there will be no deceleration or recording of data that you do not want.

Edit : if now it works good (but maybe not the optimus solution i'm not sure to have clearly understand the problem finally^^)


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 03, 2018 4:08 pm 
Offline

Joined: Wed Nov 14, 2018 6:10 pm
Posts: 27
I guess you realised that the script is long. I enclosed it in a loop.
Quote:
function initialize(box)


dofile(box:get_config("${Path_Data}") .. "/plugins/stimulation/lua-stimulator-stim-codes.lua")


-- each stimulation sent that gets rendered by Display Cue Image box

-- should probably have a little period of time before the next one or the box wont be happy

pre_baseline_duration = 0
baseline_duration = 10

post_baseline_duration = 0

cross_duration = 1

post_cross_duration = 1

display_cue_duration = 15

post_cue_duration = 0
rest_duration = 15

post_end_duration = 0
number_trials=10

end

function
process(box)


local t = 0

-- Delays before the trial sequence starts

box:send_stimulation(1, OVTK_StimulationId_ExperimentStart, t, 0)

t = t + pre_baseline_duration


box:send_stimulation(1, OVTK_StimulationId_BaselineStart, t, 0)

t = t + baseline_duration


box:send_stimulation(1, OVTK_StimulationId_BaselineStop, t, 0)

t = t + post_baseline_duration

-- creates each trial

for i = 1,number_trials
do

-- first display a cross on screen

box:send_stimulation(1, OVTK_GDF_Start_Of_Trial, t, 0)

box:send_stimulation(1, OVTK_GDF_Cross_On_Screen, t, 0)

box:send_stimulation(1, OVTK_StimulationId_Beep, t, 0)

t = t + cross_duration


-- Clear cross.

box:send_stimulation(1, OVTK_StimulationId_VisualStimulationStop, t, 0)

t = t + post_cross_duration

-- display cue

box:send_stimulation(1, OVTK_StimulationId_Label_01, t, 0)

for j=1,30
do
box:send_stimulation(1, OVTK_StimulationId_SegmentStart, t, 0)
t=t+0.5
end

-- clear cue.

box:send_stimulation(1, OVTK_StimulationId_VisualStimulationStop, t, 0)
t = t + post_cue_duration


-- rest period

box:send_stimulation(1, OVTK_StimulationId_RestStart, t, 0)

t = t + rest_duration


-- end of rest and
box:send_stimulation(1, OVTK_StimulationId_VisualStimulationStop, t, 0)

box:send_stimulation(1, OVTK_StimulationId_RestStop, t, 0)
box:send_stimulation(1, OVTK_GDF_End_Of_Trial, t, 0)

t = t + post_end_duration

end


-- send end for completeness
box:send_stimulation(1, OVTK_GDF_End_Of_Session, t, 0)

t = t + 5


-- used to cause the acquisition scenario to stop and denote final end of file


box:send_stimulation(1, OVTK_StimulationId_ExperimentStop, t, 0)


end


I will keep the other solutions in mind in case I need it in future. Thank You again.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Americanized by Maƫl Soucaze.