Exemplo n.º 1
0
from CrashDiag.Preproc.SegDatabase import iterSegments, SegDatabase
import CrashDiag as cd
import matplotlib.pyplot as plt
from CrashDiag.Detection import label, Events
from CrashDiag.Preproc.Segmentation import plot_segments
import os

db = SegDatabase()
event_list = [
    'Yaw drastic change', 'Battery Voltage drop', 'Pretended Yaw movement',
    'Motor Failure', 'Magnetometer Error', 'Yaw Error High', 'Altitude Drop'
]

results = cd.data.detected_events
defined_events = Events.function_dict(event_list)
subcomponents = Events.get_required_subcomponents(defined_events)
final_event = 'Yaw drastic change'

log_list = []
i = 0
for file_name in results:
    result = results[file_name]

    if 'Yaw drastic change' in result:
        j = 0
        for event in result:
            if len(result[event]) > 0:
                j += 1
        if j == 4:
            i += 1
            log_list.append(file_name)
Exemplo n.º 2
0
from CrashDiag.Preproc.SegDatabase import iterSegments, SegDatabase
from CrashDiag.Preproc.Segmentation import plot_segments
import matplotlib.pyplot as plt
from CrashDiag.Detection import label

seg_db = SegDatabase('Segments')

subcomponents = ['ATT_Yaw', 'ATT_ErrYaw', 'RCOU_Yaw', 'RCIN_C4']

for file_name, file in iterSegments(seg_db, subcomponents, querytype='and'):
    print(file_name)

    ATT_Yaw = label.change(file['ATT_Yaw'],
                           gradient=50,
                           height=200,
                           plot=False)
    if label.no_targets(ATT_Yaw):
        continue

    RCOU_Yaw = label.higher_than(
        file['RCOU_Yaw'], threshold=100,
        plot=False)  # Hier ebenfalls, evtl auf 100 oder sogar 150 erhöhen
    if label.no_targets(RCOU_Yaw):
        continue

    ATT_ErrYaw = label.higher_than(
        file['ATT_ErrYaw'], threshold=10, plot=False
    )  # Threshold muss viel höher sein. 10 oder so. Normaler error bis max 1 Grad denk ich
    if label.no_targets(ATT_ErrYaw):
        continue
Exemplo n.º 3
0
from CrashDiag.Preproc.SegDatabase import iterSegments, SegDatabase
from CrashDiag.Preproc.Segmentation import plot_segments
import matplotlib.pyplot as plt

seg_db = SegDatabase('SampleSegments')

subcomponents = ['ATT_Yaw', 'ATT_ErrYaw', 'RCOU_Yaw', 'RCIN_C4']


for file_name, file in iterSegments(seg_db, subcomponents, querytype='and'):

    plot_segments(file['RCOU_Yaw'])
    plot_segments(file['ATT_Yaw'])
    plt.show()
Exemplo n.º 4
0
from CrashDiag.Preproc.SegDatabase import SegDatabase as Segdb
from CrashDiag.Preproc.Database import Database
import CrashDiag as cd

db = Database()

#subcomponents = cd.data.top100seg

#subcomponents = ['ATT_YawDiff']
subcomponents = [
    'ATT_DesYaw', 'ATT_Yaw', 'ATT_ErrYaw', 'ATT_YawDiff', 'CTUN_Alt',
    'CURR_Volt', 'ERR_Subsys', 'MODE_Mode', 'IMU_AccZ', 'RCIN_C1', 'RCIN_C2',
    'RCIN_C4'
]

Segdb.segment_and_pickle_all_logs(db,
                                  subcomponents,
                                  multiprocessing=True,
                                  querytype='or',
                                  chunksize=100)

#Segdb.segment_and_pickle_all_logs(db, ['ATT_Yaw'])
Exemplo n.º 5
0
from CrashDiag.Preproc.SegDatabase import iterSegments, SegDatabase

seg_db = SegDatabase()

subcomponents = ['ERR_Subsys']

i = 0
for file_name, file in iterSegments(seg_db, subcomponents, querytype='and'):
    print(file_name)
    i +=1

print(i)