Skip to content

How to remove the limit on the number of annotations? #187

@Sruthi-sk

Description

@Sruthi-sk

I have markers which I am trying to save as annotations in an edf file

marker_signal = recorded_data[marker_channel].reshape(1,-1)
    
signal_names = eeg_channel_names + ['marker']
signals = np.append(eeg_signals,marker_signal,axis=0) 
# signal_names = eeg_channel_names
# signals = eeg_signals

pmin, pmax = signals.min(), signals.max()  
channel_info = pyedflib.highlevel.make_signal_headers(signal_names, sample_frequency=sf,
                                          physical_min=pmin, physical_max=pmax,dimension='uV') # 

# Annotation format [ [timepoint, duration, description ],[...] ]
marker_timepoints = np.where(marker_data!=0)[0] # nonzero(marker_signal != 0)[0]
annotations = []
for j in range(len(marker_timepoints)):    
    annotations.append([marker_timepoints[j]/sf,
                        0,
                        str(int( marker_data[ marker_timepoints[j] ] ))
                        ])

# main_header = pyedflib.highlevel.make_header(equipment = device)
header = {'annotations':annotations,'equipment': device}

pyedflib.highlevel.write_edf(edf_file_name, signals = signals, 
                             signal_headers=channel_info, header = header, 
                             file_type=-1)

missing_annotations

As I understand it, the limit on the number of annotations is the number of seconds of data. I thought of using pyedflib.edfwriter.set_number_of_annotation_signals to increase this number but the documentation says the maximum is 64, while I need over 300 in 1 minute.
I understand the alternate solution is to just send the marker channel as I have in the above image, but I wanted to know if there's another way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions