Example #1
0
# At the moment we are just interested in the first (current) data block (made up of <example_bci.numof_samples> 
# samples for each of the <numof_channels> channels).
# Unlike the <get_data>-function, <get_datablock> has no impemented security_mode, so if you want to use it (and it is not
# switched on in the config file) you have to do that manually. In that case, make sure to reset the counters, otherwise
# you'll probably get a warning.

example_bci.set_security_mode(True)
example_bci.reset_security_mode()
example_datablock = example_bci.get_datablock()
example_bci.set_security_mode(False)

# Just to show that this is possible (it may save time if you set <saving_mode> to False and write the data after
# collecting it) we call the saving function from 'externally'.
# In the <get_data>-function it is implemented if you set <saving_mode> to True.

example_bci.save_data(example_blockfile, 'plain', example_datablock)   
example_blockfile.close()     # In this case we have to close the file manually.


# Now let's get a bit more data. Therefore...
# ...we choose a larger trigger and show a sign for 500 ms, this time by a triangle...
example_bci.trigger_sign('triangle', 0.7, 500)   

# ...and request data for the next 10 seconds, with a <security_mode>, that gives us a warning if the number
# of returned blocks is not equal to the read (that is, 'incoming') ones.
# Also, we are not sure what may happen during these 10 seconds, so we'll switch on the <supervision_mode>
# (although both modes are switched on by default, anyway) to get the data collection restarted for 10 seconds
# if the Brain Recorder is stopped while collecting the data.
# Please note that the order of the channels in the data array is the one the channels are listed
# in <channels>.