Проверьте логику сигнальной полосы ЭКГ для данных MIT BIH.

Я пытаюсь создать полосы из данных https://physionet.org/content/mitdb/1.0.0/ MIT BIH Strip. В какой-то мере эта логика полосы кажется проблемой. Любой, кто имеет опыт работы с данными MIT BIH, может помочь мне проверить логику

      def strip_validate(strip, pre_aux):
    sym_list = list(set(strip['symbol']))
#     print(sym_list)
    aux_note_list = list(set(strip['aux_note']))
    aux_note_list = list(filter(None,aux_note_list))
    curr_aux = pre_aux # ''
    if len(aux_note_list) > 0:
#         print("start")
        if 'AFIB' in aux_note_list:
            curr_aux = 'AFIB'
#             print("curr_aux_previous_1 = ", curr_aux)
        elif 'AFL' in aux_note_list:
            curr_aux = 'AFL'
#             print("curr_aux_previous_2 = ", curr_aux)
        elif 'N' in aux_note_list:
            curr_aux = 'N'
#             print("curr_aux_previous_3 = ", curr_aux)
        elif len(aux_note_list) == 1:
            curr_aux = aux_note_list[0]
    else:
        curr_aux = pre_aux # replace " " with curr_aux
    if curr_aux != 'AFIB' and curr_aux != 'AFL' :
        other_symbols = pd.Series(sym_list)
        flag = sum(other_symbols!='N')
        if flag > 0:
            other_symbols = other_symbols[other_symbols!='N']
            other_symbols = other_symbols[other_symbols!='+']
            if len(other_symbols)>0:
                curr_aux = curr_aux  ### Issue curr_aux = other_symbols.values[0],  change: (= curr_aux)
        else:
            curr_aux = curr_aux      ### Issue curr_aux = other_symbols.values[0],  change: (= curr_aux)
     
    if curr_aux == "AFIB":
        curr_aux = curr_aux.replace("AFIB", "A" )
    elif curr_aux == "AFL":
        curr_aux = curr_aux.replace("AFL", "A" )
    return curr_aux,flag  

0 ответов

Другие вопросы по тегам