Accept StringIO for Annotation-Files
Heyho, I'm currently working my way through #26 to apply different spindle detection methods on our dataset. Our data is in EDF+ and simple csv files for sleep scoring.
I want to avoid having to create everything in XML files and was thinking about supplying files on-the-fly and passing them as StringIO/BytesIO or lists/np.arrays. Is there any possibly to supply the Annotations and all the other information as lists or StringIO?
When not using the GUI its a bit difficult to understand how to call the functions and what the functions expect. E.g. it took me some time to find out I can simply call the Detection class (i.e. that the class itself is a method and implements a __call__), and that there is no method defined that is called detection.run(data) .
I think this package is really awesome and has great potential, some more tutorials on non-GUI-use and it would be perfect!
Hey, thanks for your feedback !
Regarding your question about eschewing Annotation files, you can do so if you know the start and end times of the target signal in your data record:
method = 'Lacourse2018'
records_list = ['Subject1.edf', 'Subject2.edf', ...]
start_end_times = [(0, 3000), (5656, 8901), ...]
rater = 'rater_name_here'
chan = ['Cz']
event_name = 'event_name_here'
detector =DetectSpindle(method)
for rec_file, (beg, end) in zip(records_list, start_end_times):
dset = Dataset(rec_file)
data = dset.read_data(chan=chan, begtime=beg, endtime=end)
spindles = detector(data)
Note that this method does not offer re-referencing of channels, and you lose the stage selection functionality.
But it does allow you to forgo Annotation files altogether, and just pass time tuples instead.
Hope this helps.