示例#1
0
    def test_mixed(self):

        t = np.arange(15, dtype="<f8")

        s1 = Signal(
            np.frombuffer(b"\x00\x00\x00\x02" * 15, dtype=">u4"), t, name="Motorola"
        )

        s2 = Signal(
            np.frombuffer(b"\x04\x00\x00\x00" * 15, dtype="<u4"), t, name="Intel"
        )

        for version in ("3.30", "4.10"):
            mdf = MDF(version=version)
            mdf.append([s1, s2], common_timebase=True)
            outfile = mdf.save(
                Path(TestEndianess.tempdir.name) / f"out", overwrite=True
            )
            mdf.close()

            with MDF(outfile) as mdf:
                self.assertTrue(np.array_equal(mdf.get("Motorola").samples, [2] * 15))
                self.assertTrue(np.array_equal(mdf.get("Intel").samples, [4] * 15))

        for version in ("3.30", "4.10"):
            mdf = MDF(version=version)
            mdf.append([s2, s1], common_timebase=True)
            outfile = mdf.save(
                Path(TestEndianess.tempdir.name) / f"out", overwrite=True
            )
            mdf.close()

            with MDF(outfile) as mdf:
                self.assertTrue(np.array_equal(mdf.get("Motorola").samples, [2] * 15))
                self.assertTrue(np.array_equal(mdf.get("Intel").samples, [4] * 15))
示例#2
0
    def test_mixed(self):

        t = np.arange(15, dtype='<f8')

        s1 = Signal(
            np.frombuffer(b'\x00\x00\x00\x02' * 15, dtype='>u4'),
            t,
            name='Motorola'
        )

        s2 = Signal(
            np.frombuffer(b'\x04\x00\x00\x00' * 15, dtype='<u4'),
            t,
            name='Intel'
        )

        for version in ('3.30', '4.10'):
            mdf = MDF(version=version)
            mdf.append([s1, s2], common_timebase=True)
            outfile = mdf.save(
                Path(TestEndianess.tempdir.name) / f"out",
                overwrite=True,
            )
            mdf.close()

            with MDF(outfile) as mdf:
                self.assertTrue(
                    np.array_equal(
                        mdf.get('Motorola').samples, [2,] * 15
                    )
                )
                self.assertTrue(
                    np.array_equal(
                        mdf.get('Intel').samples, [4,] * 15
                    )
                )

        for version in ('3.30', '4.10'):
            mdf = MDF(version=version)
            mdf.append([s2, s1], common_timebase=True)
            outfile = mdf.save(
                Path(TestEndianess.tempdir.name) / f"out",
                overwrite=True,
            )
            mdf.close()

            with MDF(outfile) as mdf:
                self.assertTrue(
                    np.array_equal(
                        mdf.get('Motorola').samples, [2,] * 15
                    )
                )
                self.assertTrue(
                    np.array_equal(
                        mdf.get('Intel').samples, [4,] * 15
                    )
                )
示例#3
0
def get_all_mdf3(output, fmt):

    x = MDF(r"test.mdf")
    with Timer("Get all channels", f"asammdf {asammdf_version} mdfv3",
               fmt) as timer:
        for i, gp in enumerate(x.groups):
            for j in range(len(gp["channels"])):
                x.get(group=i, index=j, samples_only=True)
    output.send([timer.output, timer.error])
示例#4
0
文件: bench.py 项目: suertang/asammdf
def get_all_mdf4_nodata(path, output, fmt):
    os.chdir(path)
    x = MDF(r'test.mf4', load_measured_data=False)
    with Timer('Get all channels',
               'asammdf {} nodata mdfv4'.format(asammdf_version),
               fmt) as timer:
        for i, gp in enumerate(x.groups):
            for j in range(len(gp['channels'])):
                x.get(group=i, index=j, samples_only=True)
    output.send([timer.output, timer.error])
示例#5
0
def get_all_mdf4(output, fmt, memory):

    x = MDF(r'test.mf4', memory=memory,)
    with Timer('Get all channels',
               'asammdf {} {} mdfv4'.format(asammdf_version, memory),
               fmt) as timer:
        for i, gp in enumerate(x.groups):
            for j in range(len(gp['channels'])):
                x.get(group=i, index=j, samples_only=True)
    output.send([timer.output, timer.error])
示例#6
0
文件: bench.py 项目: suertang/asammdf
def get_all_mdf3(path, output, fmt):
    os.chdir(path)
    x = MDF(r'test.mdf')
    with Timer('Get all channels',
               'asammdf {} mdfv3'.format(asammdf_version),
               fmt) as timer:
        for i, gp in enumerate(x.groups):
            for j in range(len(gp['channels'])):
                x.get(group=i, index=j, samples_only=True)
    output.send([timer.output, timer.error])
示例#7
0
def fun():
    mf = MDF('./GAC_A18_2020-06-26_15-01_11_0016.MF4')
    file_name = 'GAC_A18_2020-06-26_15-01_11_0016.json'
    signal_list = []
    data_dict = {}
    with open('./Book1.txt', 'r') as f:
        for line in f.readlines():
            signal_list.append(line[:-1])
    while True:
        try:
            signal = signal_list.pop()
        except IndexError:
            break
        else:
            try:
                data = mf.get(signal)
            except Exception:
                continue
            else:
                data_dict[signal] = {
                    'samples': data.samples.tolist(),
                    'timestamps': data.timestamps.tolist()
                }
    with open('./data.josn', 'w') as f:
        json.dump(data_dict, f, cls=MyEncoder, ensure_ascii=False)
示例#8
0
def get_all_mdf4_nodata():
    os.chdir(path)
    x = MDF(r'test.mf4', load_measured_data=False)
    with Timer('asammdf {} nodata mdfv4'.format(asammdf_version)):
        for i, gp in enumerate(x.groups):
            for j in range(len(gp['channels'])):
                y = x.get(group=i, index=j, samples_only=True)
示例#9
0
文件: bench.py 项目: GeCr1988/asammdf
def get_all_mdf4():
    os.chdir(path)
    x = MDF(r'test.mf4')
    with Timer('asammdf {} mdfv4'.format(asammdf_version)):
        for i, gp in enumerate(x.groups):
            for j in range(len(gp['channels'])):
                y = x.get(group=i, index=j)
示例#10
0
文件: bench.py 项目: GeCr1988/asammdf
def get_all_mdf3_compressed():
    os.chdir(path)
    x = MDF(r'test.mdf', compression=True)
    with Timer('asammdf {} compression mdfv3'.format(asammdf_version)):
        for i, gp in enumerate(x.groups):
            for j in range(len(gp['channels'])):
                y = x.get(group=i, index=j)
示例#11
0
def all_mdf4():
    os.chdir(path)
    with Timer('asammdf {} mdfv4'.format(asammdf_version)):
        x = MDF(r'test.mf4')
        for i, gp in enumerate(x.groups):
            for j in range(len(gp['channels'])):
                y = x.get(group=i, index=j, samples_only=True)
        x.save(r'x.mf4', overwrite=True)
示例#12
0
def all_mdf3_nodata():
    os.chdir(path)
    with Timer('asammdf {} mdfv3 nodata'.format(asammdf_version)):
        x = MDF(r'test.mdf', load_measured_data=False)
        for i, gp in enumerate(x.groups):
            for j in range(len(gp['channels'])):
                y = x.get(group=i, index=j, samples_only=True)
        x.save(r'x.mdf', overwrite=True)
示例#13
0
def get_all_mdf4_column(output, fmt):

    x = MDF(r"test_column.mf4")
    with Timer("Get all channels", f"asammdf {asammdf_version} column mdfv4",
               fmt) as timer:
        t = perf_counter()
        counter = 0
        to_break = False
        for i, gp in enumerate(x.groups):
            if to_break:
                break
            for j in range(len(gp["channels"])):
                t2 = perf_counter()
                if t2 - t > 60:
                    timer.message += " {}/s".format(counter / (t2 - t))
                    to_break = True
                    break
                x.get(group=i, index=j, samples_only=False)
                counter += 1
    output.send([timer.output, timer.error])
示例#14
0
文件: bench.py 项目: sgd218/asammdf
def get_all_mdf4(output, fmt):

    x = MDF(r'test.mf4')
    with Timer('Get all channels', f'asammdf {asammdf_version} mdfv4',
               fmt) as timer:
        t = perf_counter()
        counter = 0
        to_break = False
        for i, gp in enumerate(x.groups):
            if to_break:
                break
            for j in range(len(gp['channels'])):
                t2 = perf_counter()
                if t2 - t > 60:
                    timer.message += ' {}/s'.format(counter / (t2 - t))
                    to_break = True
                    break
                x.get(group=i, index=j, samples_only=True)
                counter += 1
    output.send([timer.output, timer.error])
示例#15
0
def get_km(trips, id, dir, revert):
    if revert:
        trips.reverse()
    for t in trips:
        file = os.path.join(dir, '%s_%s.mf4' % (t, id))
        mdf = MDF(file)
        sig = mdf.get('can0_KBI_Kilometerstand_2')
        for s in list(sig.samples):
            if s != 0:
                if s < 100000:
                    return s
示例#16
0
文件: bench.py 项目: sgd218/asammdf
def filter_asam(output, fmt):
    with Timer('Filter file', f'asammdf {asammdf_version} mdfv4',
               fmt) as timer:
        x = MDF(r'test.mf4').filter(
            [f'Channel_{i}_{j}5' for i in range(10) for j in range(1, 20)])
        t = perf_counter()
        counter = 0
        to_break = False
        for i, gp in enumerate(x.groups):
            if to_break:
                break
            for j in range(len(gp['channels'])):
                t2 = perf_counter()
                if t2 - t > 60:
                    timer.message += ' {}/s'.format(counter / (t2 - t))
                    to_break = True
                    break
                x.get(group=i, index=j, samples_only=True)
                counter += 1
    output.send([timer.output, timer.error])
示例#17
0
def filter_asam(output, fmt):
    with Timer("Filter file", f"asammdf {asammdf_version} mdfv4",
               fmt) as timer:
        x = MDF(r"test.mf4").filter([(None, i, int(f'{j}5'))
                                     for i in range(10, 20)
                                     for j in range(1, 20)])
        t = perf_counter()
        counter = 0
        to_break = False
        for i, gp in enumerate(x.groups):
            if to_break:
                break
            for j in range(len(gp["channels"])):
                t2 = perf_counter()
                if t2 - t > 60:
                    timer.message += " {}/s".format(counter / (t2 - t))
                    to_break = True
                    break
                x.get(group=i, index=j, samples_only=True)
                counter += 1
    output.send([timer.output, timer.error])
示例#18
0
def filter_mdf(file, signals):
    mdf_file = MDF(file)
    # Lenkradwinkel
    lenkradwinkel = mdf_file.get('can0_LWI_Lenkradwinkel')
    samples = list(lenkradwinkel.samples)
    vz_samples = list(mdf_file.get('can0_LWI_VZ_Lenkradwinkel').samples)
    for i in range(0, len(samples)):
        if not int(vz_samples[i]):
            samples[i] = samples[i] * -1
    lenkradwinkel.samples = np.asarray(samples)

    # Lenkradwinkel geschw.
    lenkrad_gesch = mdf_file.get('can0_LWI_Lenkradw_Geschw')
    samples = list(lenkrad_gesch.samples)
    vz_samples = list(mdf_file.get('can0_LWI_VZ_Lenkradw_Geschw').samples)
    for i in range(0, len(samples)):
        if not int(vz_samples[i]):
            samples[i] = samples[i] * -1
    lenkrad_gesch.samples = np.asarray(samples)

    # Gierrate
    gierrate = mdf_file.get('can0_ESP_Gierrate')
    samples = list(gierrate.samples)
    vz_samples = list(mdf_file.get('can0_ESP_VZ_Gierrate').samples)
    for i in range(0, len(samples)):
        if not int(vz_samples[i]):
            samples[i] = samples[i] * -1
    gierrate.samples = np.asarray(samples)

    # filter file with VZ signals
    filtered_mdf = mdf_file.filter(signals)
    return filtered_mdf
示例#19
0
    def test_filter(self):
        print("MDF filter tests")

        for input_file in Path(TestMDF.tempdir_demo.name).iterdir():

            if MDF(input_file).version <= "2.00":
                # if MDF(input_file, memory=memory).version < '4.00':
                continue

            channels_nr = np.random.randint(1, len(CHANNELS_DEMO) + 1)

            channel_list = random.sample(list(CHANNELS_DEMO), channels_nr)

            filtered_mdf = MDF(input_file).filter(channel_list)

            target = set(k for k in filtered_mdf.channels_db
                         if not k.endswith("[0]") and not k.startswith("DI")
                         and "\\" not in k)

            self.assertTrue((target - {"t", "time"}) == set(channel_list))

            equal = True

            with MDF(input_file) as mdf:
                print(input_file)
                names = list(channel_list)
                for name in channel_list:
                    self.assertTrue(name in mdf)

                names = [name + '_' for name in names]
                for name in names:
                    self.assertFalse(name in mdf)

                names = [name[:-3] for name in names]
                for name in names:
                    self.assertFalse(name in mdf)

                for name in channel_list:
                    original = mdf.get(name)
                    filtered = filtered_mdf.get(name)
                    if not np.array_equal(original.samples, filtered.samples):
                        equal = False
                    if not np.array_equal(original.timestamps,
                                          filtered.timestamps):
                        equal = False

            self.assertTrue(equal)
示例#20
0
    def test_filter(self):
        print("MDF filter tests")

        for mdfname in os.listdir("tmpdir_demo"):
            for memory in MEMORY:
                input_file = os.path.join("tmpdir_demo", mdfname)

                if MDF(input_file, memory=memory).version <= "2.00":
                    # if MDF(input_file, memory=memory).version < '4.00':
                    continue

                channels_nr = np.random.randint(1, len(CHANNELS_DEMO) + 1)

                channel_list = random.sample(list(CHANNELS_DEMO), channels_nr)

                filtered_mdf = MDF(input_file,
                                   memory=memory).filter(channel_list,
                                                         memory=memory)

                target = set(k for k in filtered_mdf.channels_db
                             if not k.endswith("[0]")
                             and not k.startswith("DI") and "\\" not in k)

                self.assertTrue((target - {"t", "time"}) == set(channel_list))

                equal = True

                with MDF(input_file, memory=memory) as mdf:
                    print(input_file, memory)

                    for name in channel_list:
                        original = mdf.get(name)
                        filtered = filtered_mdf.get(name)
                        if not np.array_equal(original.samples,
                                              filtered.samples):
                            equal = False
                        if not np.array_equal(original.timestamps,
                                              filtered.timestamps):
                            equal = False

                self.assertTrue(equal)
        cleanup_files()
示例#21
0
    def test_filter(self):
        print("MDF filter tests")

        for mdfname in os.listdir('tmpdir_demo'):
            for memory in MEMORY:
                input_file = os.path.join('tmpdir_demo', mdfname)

                if MDF(input_file, memory=memory).version <= '2.00':
                    # if MDF(input_file, memory=memory).version < '4.00':
                    continue

                channels_nr = np.random.randint(1, len(CHANNELS_DEMO) + 1)

                channel_list = random.sample(list(CHANNELS_DEMO), channels_nr)

                filtered_mdf = MDF(input_file,
                                   memory=memory).filter(channel_list,
                                                         memory=memory)

                self.assertTrue((set(filtered_mdf.channels_db) -
                                 {'t', 'time'}) == set(channel_list))

                equal = True

                with MDF(input_file, memory=memory) as mdf:
                    print(input_file, memory)

                    for name in channel_list:
                        original = mdf.get(name)
                        filtered = filtered_mdf.get(name)
                        if not np.array_equal(original.samples,
                                              filtered.samples):
                            equal = False
                        if not np.array_equal(original.timestamps,
                                              filtered.timestamps):
                            equal = False

                self.assertTrue(equal)
        cleanup_files()
示例#22
0
class MainWin(QMainWindow, mainwin.Ui_MainWindow):
    def __init__(self):
        super(MainWin, self).__init__()
        self.setupUi(self)
        self.init()

    def init(self):
        # self.treeView.setFixedWidth(80)
        # self.treeView.setMaximumWidth(200)
        # self.listView.setMaximumHeight(100)
        # self.treeView.width = 30
        # self.listView.height = 50
        # self.graphicsView.setFixedSize(400,300)
        self.init_tree()

    def plot(self, sig):
        self.graphicsView.plotItem.clear()
        self.graphicsView.plotItem.plot(sig.samples, pen='r')
        # x = np.random.random(50)
        # pItem = self.graphicsView.addItem(title='graph view')
        # pItem.plot(x)

    def init_tree(self):
        # signals = ["EngineSpeed","VehSpeed","OutputSpeedAccel"]
        self.__model = QStandardItemModel(self.treeView)
        self.__model.setHorizontalHeaderLabels(["Name", "Discription"])
        self.__rwmdf = MDF(r'D:/TestData/DataSpySampleDataFile.mf4')

        chs = self.__rwmdf.channels_db
        for _ch in chs.keys():
            sig = self.__rwmdf.get(_ch)
            cmt = sig.comment
            cmt = "" if cmt.find("\n") != -1 else cmt
            # self.__model.appendRow([QStandardItem(sig.name),QStandardItem("")])
            self.__model.insertRow(0, QStandardItem(sig.name))
            self.__model.insertRow(1, QStandardItem(cmt))

        self.treeView.setModel(self.__model)
        self.treeView.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.treeView.setSortingEnabled(True)
        self.treeView.header().setSectionResizeMode(
            QHeaderView.ResizeToContents)

        self.init_list_view([])

    def init_list_view(self, lst):
        self.__lstmodel = QStringListModel()
        _sig = self.__rwmdf.get('EngineSpeed')
        _lst = []
        for val in _sig.samples:
            _lst.append(str(val))
        self.__lstmodel.setStringList(_lst)
        self.listView.setModel(self.__lstmodel)

    def on_tree_view_db_clicked(self, q_index):
        try:
            print("on_tree_view_db_clicked...")
            # q_it = self.__model.itemFromIndex(q_index)
            # print(q_index.column(), q_it.text())
            # if q_index.column() == 0:
            #     q_it = self.__model.itemFromIndex(q_index)
            #     sig = self.__rwmdf._mdf.get(q_it.text())
            #     if sig:
            #         self.plot(sig)
            # self.initListView(sig.samples)
        except Exception as err:
            print(err)
示例#23
0
    choice_1 = input("Do you want to add a signal?(y/n)\n")
    if choice_1 == "n":
        if len(sig_list) > 0:
            filter = mdf.filter(sig_list)
            file_name = input("Enter the file name to be saved\n")
            filter.convert('4.10').save(file_name + '.mf4')
            mdf_new = MDF((file_name + '.mf4'), memory='full')
            data_frame = mdf_new.export('pandas', filename=file_name)
            data_frame.to_csv(file_name + '.csv')
            print("CSV and mf4 file created.\n")
            choice_2 = input("Do you want to plot the signal(s)?(y/n)\n")
            if choice_2 == "y":
                for i in range(len(sig_list)):
                    plt.figure(i)
                    plt.xlabel('Time [s]')
                    plt.ylabel('[{}]'.format(mdf.get(sig_list[i]).unit))
                    plt.plot(
                        mdf.get(sig_list[i]).timestamps,
                        mdf.get(sig_list[i]).samples, 'b')
                    plt.plot(
                        mdf.get(sig_list[i]).timestamps,
                        mdf.get(sig_list[i]).samples, 'b.')
                    plt.grid(True)
        break
    elif choice_1 == "y":
        sig_name = input("Enter exact Signal name\n")
        sig_list.append(sig_name)

plt.show()
print("Complete")
# print(sig_list)
示例#24
0
def main():

    my_parser = argparse.ArgumentParser(
        description='Transform signals with sign')
    my_parser.add_argument('-i',
                           '--input',
                           action='store',
                           metavar='mf4_input',
                           type=str,
                           required=True,
                           help='Input directory with source mf4 files')

    my_parser.add_argument('-o',
                           '--output',
                           action='store',
                           metavar='mf4_output',
                           type=str,
                           required=True,
                           help='Output directory')

    # Execute the parse_args() method
    args = my_parser.parse_args()

    mf4_input = args.input
    mf4_output = args.output

    if not os.path.isdir(mf4_input):
        print('The mf4 input path specified is not a directory')
        sys.exit()

    if not os.path.isdir(mf4_output):
        print('The mf4 ouput path specified is not a directory')
        sys.exit()

    for file in os.listdir(mf4_input):
        if not file.endswith('.mf4'):
            continue
        print('process %s' % file)
        mdf_file = MDF(os.path.join(mf4_input, file))

        # Lenkradwinkel
        lenkradwinkel = mdf_file.get('can0_LWI_Lenkradwinkel')
        samples = list(lenkradwinkel.samples)
        vz_samples = list(mdf_file.get('can0_LWI_VZ_Lenkradwinkel').samples)
        for i in range(0, len(samples)):
            if not int(vz_samples[i]):
                samples[i] = samples[i] * -1
        lenkradwinkel.samples = np.asarray(samples)

        # Lenkradwinkel geschw.
        lenkradwinkel = mdf_file.get('can0_LWI_Lenkradw_Geschw')
        samples = list(lenkradwinkel.samples)
        vz_samples = list(mdf_file.get('can0_LWI_VZ_Lenkradw_Geschw').samples)
        for i in range(0, len(samples)):
            if not int(vz_samples[i]):
                samples[i] = samples[i] * -1
        lenkradwinkel.samples = np.asarray(samples)

        # Gierrate
        lenkradwinkel = mdf_file.get('can0_ESP_Gierrate')
        samples = list(lenkradwinkel.samples)
        vz_samples = list(mdf_file.get('can0_ESP_VZ_Gierrate').samples)
        for i in range(0, len(samples)):
            if not int(vz_samples[i]):
                samples[i] = samples[i] * -1
        lenkradwinkel.samples = np.asarray(samples)

        # filter file with VZ signals
        filtered_mdf = mdf_file.filter(interesting_signals)
        filtered_mdf.save(os.path.join(mf4_output, file))
示例#25
0
#!/usr/bin/python3
# -*- coding: UTF-8 -*-

from asammdf import MDF, signal
import pandas as pd
import matplotlib.pyplot as plt
#import numpy as np

file = 'ACC6.mdf'
signal = 'MeasList-AccMod_7C_CAN0'
gap = 3
start = 3

#read file and creat SeriersS
mdf = MDF(file)
sig_raw = mdf.get(signal)
sig1 = pd.Series(sig_raw.samples)
plt.plot(sig1)
plt.show()
示例#26
0
from asammdf import MDF, Signal
from pandas import Series, DataFrame
import pandas as pd
import numpy as np

pd.options.display.max_rows = 10

file = 'ACC6.mdf'
signal = 'MeasList-AccMod_7C_CAN0'
gap = 3
start = 3

#read file and creat Seriers
mdf = MDF(file)
sig1_raw = mdf.get(signal)
sig1 = pd.Series(sig1_raw.samples)

#filte by change point
sig1_point_A = pd.Series(np.arange(len(sig1)))
for i in range(len(sig1) - 1):
    sig1_point_A[i] = sig1[i + 1] - sig1[i]

#filte by change point's step size 'gap'
sig1_point_G = sig1_point_A[(sig1_point_A == gap)].index.tolist()
sig1_point_G_counts = len(sig1_point_G)

#filte by previous value 'start'
sig1_point_1 = []
for i in range(len(sig1_point_G)):
    if sig1[sig1_point_G[i]] == start:
示例#27
0
    8: 'LaCurvOfflim',
    16: 'LatAccOffLim',
    32: 'LatSpdOfflim',
    64: 'DispSpdOfflim',
    128: 'LongAccOfflim',
    256: 'YawRateOfflim',
    512: 'ActrNotAvl',
    1024: 'Handsoff',
    2048: 'TurnIdctrOn',
    4096: 'RwrdGear',
    8192: 'HPPLowConf',
    16384: 'LineIntersect'
}

mdf = MDF(file + '.mf4')
sig1_raw = mdf.get(signal1)
sig1 = pd.Series(sig1_raw.samples)
sig2_raw = mdf.get(signal2)
sig2 = pd.Series(sig2_raw.samples)

starttime = datetime.strptime(file[-15:], '%Y%m%dT%H%M%S')
tagtime = datetime.strptime(tag, '%Y%m%dT%H%M%S')
diftime = tagtime - starttime
tagseconds = diftime.seconds
print("\n起始时间:{}\nTag时间:{}".format(starttime, tagtime))

t3occurtime = []
t3seconds = []
t3Spr = []
t1occurtime = []
t1seconds = []
示例#28
0
        mf4_data = MDF(srcFiles[files])
        csvname = srcFiles[files].name
        outfilename_Comment = srcFiles[0].parent.as_posix().replace(
            '/', '\\') + '\\' + csvname + '_Comments.csv'
        outfilename_Gps = srcFiles[0].parent.as_posix().replace(
            '/', '\\') + '\\' + csvname + '_GPS.csv'
        outfilename_merged = srcFiles[0].parent.as_posix().replace(
            '/', '\\') + '\\' + srcFiles[0].parts[-2] + '_Merged.csv'

        filtered = mf4_data.filter(['Comment'])
        sdata = filtered.get('Comment')
        commentSignals.append(sdata)
        comment = sdata.samples.astype(str).tolist()
        timestamp = sdata.timestamps.tolist()
        fname = [srcFiles[files].name] * len(comment)
        gpsLatitude = mf4_data.get('GPSLatitude')
        gpsLongitude = mf4_data.get('GPSLongitude')
        gpsTs = gpsLatitude.timestamps.tolist()
        gpsLat = gpsLatitude.samples.tolist()
        gpsLon = gpsLongitude.samples.tolist()

        gpsLatwgs = [(Lat / 1000000) - 90 for Lat in gpsLat]
        gpsLonwgs = [(Lon / 1000000) - 180 for Lon in gpsLon]
        gpsList = {'ts': gpsTs, 'lat': gpsLatwgs, 'lon': gpsLonwgs}
        gpsFrame = pd.DataFrame(gpsList).to_csv(outfilename_Gps)

        videoTsSec = [int(ts % 180) for ts in timestamp]
        videoTsmin = [
            str(ts // 60) + 'min ' + str(ts % 60) + 'sec' for ts in videoTsSec
        ]
示例#29
0
class openMDF:
    def __init__(self, path, roadtype=0):
        self.filename = path.split('/')[-1].split('.')[0]
        self.roadType = roadtype
        if self.filename not in loser_file_data:
            self.open_file(path)
            self.task_1()
    def open_file(self, path):
        print('开启mf4文件')
        self.mf = MDF(path)
    def close_file(self):
        print('关闭mf4文件')
        self.mf.close()

    # 统计转向灯开启时间
    def task_1(self):
        signal_left = '_g_PL_AD_fw_PL_AD_FCT_RunnableSppHmi_RunnableSppHmi_m_sppHmiInput_out_local.TChangeableMemPool._._._m_arrayPool._0_._elem._m_dirIndL'
        signal_right = '_g_PL_AD_fw_PL_AD_FCT_RunnableSppHmi_RunnableSppHmi_m_sppHmiInput_out_local.TChangeableMemPool._._._m_arrayPool._0_._elem._m_dirIndR'
        signal_speed = '_g_PL_AD_fw_PL_AD_FCT_RunnableFsm_RunnableFsm._m_fsmController._m_fip._m_displayedSpeedCalculator._m_displaySpeed._m_value'
        # 轮端转角
        signal_RoadWheelAngle = '_g_PL_AD_fw_VMC_VMC_FW_MvpVse_VseSes_VseSes_m_portVehicleStateEstimation_local.TChangeableMemPool._._._m_arrayPool._0_._elem._m_estimation_RoadWheelAngle_Front._m_value'
        # 左航向角
        Left_heading_angle_signal = '_g_GAC_A18_NET_net_apl_g_netRunnable_rbCanRxLD_serializer_m_CNetVFC_Line_SenderPort_1_local.TChangeableMemPool._._._m_arrayPool._0_._elem._m_vfc_lineInformation._0_._VFC_Line_HeadingAngle'
        # 左侧车道线
        Left_lane_line_signal = '_g_GAC_A18_NET_net_apl_g_netRunnable_rbCanRxLD_serializer_m_CNetVFC_Line_SenderPort_1_local.TChangeableMemPool._._._m_arrayPool._0_._elem._m_vfc_lineInformation._0_._VFC_Line_Dy'
        # 右航向角
        Right_heading_angle_signal = '_g_GAC_A18_NET_net_apl_g_netRunnable_rbCanRxLD_serializer_m_CNetVFC_Line_SenderPort_1_local.TChangeableMemPool._._._m_arrayPool._0_._elem._m_vfc_lineInformation._1_._VFC_Line_HeadingAngle'
        # 右侧车道线
        Right_lane_line_signal = '_g_GAC_A18_NET_net_apl_g_netRunnable_rbCanRxLD_serializer_m_CNetVFC_Line_SenderPort_1_local.TChangeableMemPool._._._m_arrayPool._0_._elem._m_vfc_lineInformation._1_._VFC_Line_Dy'
        # vxvRef
        vxvRef_signal = '_g_PL_AD_fw_DACoreCyclic_HV_PerPmeRunnable_PerPmeRunnable_m_pmePort_out_local.TChangeableMemPool._._._m_arrayPool._0_._elem._vxvRef_sw'
        odometer_signal = 'ICM_TotalOdometer'


        # Line ID    255
        left_line_signal = 'VFC_Line01_LineID'
        right_line_signal = 'VFC_Line02_LineID'

        if self.mf:
            try:
                left = self.mf.get(signal_left)
                right = self.mf.get(signal_right)
                speed = self.mf.get(signal_speed)
                RoadWheelAngle = self.mf.get(signal_RoadWheelAngle).samples.tolist()
                Left_heading_angle = self.mf.get(Left_heading_angle_signal).samples.tolist()
                Left_lane_line = self.mf.get(Left_lane_line_signal).samples.tolist()
                print(len(Left_lane_line))
                print(len(left.samples.tolist()))
                Right_heading_angle = self.mf.get(Right_heading_angle_signal).samples.tolist()
                Right_lane_line = self.mf.get(Right_lane_line_signal).samples.tolist()
                vxvRef = self.mf.get(vxvRef_signal)
                odometer = self.mf.get(odometer_signal)
                left_line = self.mf.get(left_line_signal).samples.tolist()
                right_line = self.mf.get(right_line_signal).samples.tolist()
            except Exception as e:
                print(e)
                loser_file_data.append(self.filename)
            else:
                def func(data):
                    num = data.samples.tolist()[0]
                    index_list = [0]
                    for index in range(len(data.samples.tolist())):
                        if num != data.samples.tolist()[index]:
                            num = data.samples.tolist()[index]
                            index_list.append(index)
                    if len(data.samples.tolist())-1 not in index_list:
                        index_list.append(len(data.samples.tolist())-1)
                    return index_list
                # 处理数据长度问题  speed, vxvRef
                st = speed.timestamps.tolist()
                start_time = 0
                stop_time = -2
                # 计算差值
                left_data = []
                left_time = left.timestamps.tolist()

                old_spd = speed.samples.tolist()
                old_vxv = vxvRef.samples.tolist()
                old_spd_time = speed.timestamps.tolist()
                old_vxvRef = vxvRef.samples.tolist()
                new_spd = ['' for x in left_time]
                new_vxvRef = ['' for x in left_time]
                for tt in range(len(old_spd_time)):
                    this_index = index_number(left_time, old_spd_time[tt])
                    new_spd[this_index] = old_spd[tt]
                    new_vxvRef[this_index] = old_vxvRef[tt]
                for i in range(len(new_spd)):
                    if new_spd[i] == '':
                        if i==0:
                            if new_spd[i+1] != 0:
                                new_spd[i] = new_spd[i+1]
                            else:
                                new_spd[i] = 0
                        else:
                            new_spd[i] = new_spd[i-1]
                    if new_vxvRef[i] == '':
                        if i==0:
                            if new_vxvRef[i+1] != 0:
                                new_vxvRef[i] = new_vxvRef[i+1]
                            else:
                                new_vxvRef[i] = 0
                        else:
                            new_vxvRef[i] = new_vxvRef[i-1]
                left_index_list = func(left)
                right_index_list = func(right)
                if left_index_list == [] and right_index_list == []:
                    self.close_file()
                    return False
                new_data = {
                    'left': [],
                    'left_time': [],
                    'right': [],
                    'right_time': [],
                    'spd': [],
                    'wheel': [],
                    'Left_heading_angle': [],
                    'left_lane': [],
                    'Right_heading_angle': [],
                    'right_lane': [],
                    'vxvRef': [],
                    'left_line': [],
                    'right_line': []
                }
                # 
                for index in range(len(left_index_list)-1):
                    new_data['left'].append(left.samples.tolist()[left_index_list[index]:left_index_list[index+1]])
                    new_data['left_time'].append(left.timestamps.tolist()[left_index_list[index]:left_index_list[index+1]])
                    new_data['right'].append([])
                    new_data['right_time'].append([])
                    new_data['spd'].append(new_spd[left_index_list[index]:left_index_list[index+1]])
                    new_data['wheel'].append(RoadWheelAngle[left_index_list[index]:left_index_list[index+1]])

                    new_data['Left_heading_angle'].append(Left_heading_angle[left_index_list[index]:left_index_list[index+1]])
                    new_data['left_lane'].append(Left_lane_line[left_index_list[index]:left_index_list[index+1]])
                    new_data['Right_heading_angle'].append(Right_heading_angle[left_index_list[index]:left_index_list[index+1]])
                    new_data['right_lane'].append(Right_lane_line[left_index_list[index]:left_index_list[index+1]])
                    new_data['vxvRef'].append(new_vxvRef[left_index_list[index]:left_index_list[index+1]])
                    new_data['left_line'].append(left_line[left_index_list[index]:left_index_list[index+1]])
                    new_data['right_line'].append([])
                for index in range(len(right_index_list)-1):
                    new_data['left'].append([])
                    new_data['left_time'].append([])
                    new_data['right'].append(right.samples.tolist()[right_index_list[index]:right_index_list[index+1]])
                    new_data['right_time'].append(right.timestamps.tolist()[right_index_list[index]:right_index_list[index+1]])
                    new_data['spd'].append(new_spd[right_index_list[index]:right_index_list[index+1]])
                    new_data['wheel'].append(RoadWheelAngle[right_index_list[index]:right_index_list[index+1]])

                    new_data['Left_heading_angle'].append(Left_heading_angle[right_index_list[index]:right_index_list[index+1]])
                    new_data['left_lane'].append(Left_lane_line[right_index_list[index]:right_index_list[index+1]])
                    new_data['Right_heading_angle'].append(Right_heading_angle[right_index_list[index]:right_index_list[index+1]])
                    new_data['right_lane'].append(Right_lane_line[right_index_list[index]:right_index_list[index+1]])
                    new_data['vxvRef'].append(new_vxvRef[right_index_list[index]:right_index_list[index+1]])
                    new_data['left_line'].append([])
                    new_data['right_line'].append(right_line[right_index_list[index]:right_index_list[index+1]])
                # for key,value in new_data.items():
                #     print(len(value))
                # 车道线判断逻辑函数
                def func2(i,direction,speed,max_spd,min_spd):
                    print(direction)
                    return_data = 0
                    lane_list = []
                    overrun = []
                    for lane_line in range(len(new_data[f'{direction}_lane'][i])-1):
                        if new_data[f'{direction}_lane'][i][lane_line] == 2048:
                            print('无信号')
                            continue
                        this_num = new_data[f'{direction}_lane'][i][lane_line] * 0.015625 - 32
                        next_num = new_data[f'{direction}_lane'][i][lane_line + 1] * 0.015625 - 32
                        print(next_num - this_num)
                        if abs(next_num - this_num) >= 2.4:
                            lane_list.append(lane_line)
                    print(lane_list)
                    if lane_list != []:
                        if len(lane_list) > 1:
                            print('多次变道, 不做计算')
                        else:
                            print(f'单次变道{direction}')
                            new_lane = new_data[f'{direction}_lane'][i][lane_list[0]+1:]
                            this_len = int(len(new_lane)/5)
                            new_list = [sum(new_lane[:this_len])/len(new_lane[:this_len]),sum(new_lane[this_len:this_len*2])/len(new_lane[this_len:this_len*2]),sum(new_lane[this_len*2:this_len*3])/len(new_lane[this_len*2:this_len*3]),sum(new_lane[this_len*3:this_len*4])/len(new_lane[this_len*3:this_len*4]),sum(new_lane[this_len*4:])/len(new_lane[this_len*4:])]
                            if new_list[0] > new_list[1] > new_list[2] > new_list[3] > new_list[4]:
                                # 变道到车轮压线时间
                                Time_from_lighting_to_pressing_line = new_data[f'{direction}_time'][i][lane_list[0]] - new_data[f'{direction}_time'][i][0]
                                Line_pressing_data = [self.filename,speed,max_spd,min_spd,Time_from_lighting_to_pressing_line, self.roadType]
                                if Line_pressing_data not in Line_pressing:
                                    Line_pressing.append(Line_pressing_data)
                                    return_data = 1
                    else:
                        this_len = int(len(new_data[f'{direction}_lane'][i])/5)
                        new_list = [
                            sum(new_data[f'{direction}_lane'][i][:this_len])/len(new_data[f'{direction}_lane'][i][:this_len]),
                            sum(new_data[f'{direction}_lane'][i][this_len:this_len*2])/len(new_data[f'{direction}_lane'][i][this_len:this_len*2]),
                            sum(new_data[f'{direction}_lane'][i][this_len*2:this_len*3])/len(new_data[f'{direction}_lane'][i][this_len*2:this_len*3]),
                            sum(new_data[f'{direction}_lane'][i][this_len*3:this_len*4])/len(new_data[f'{direction}_lane'][i][this_len*3:this_len*4]),
                            sum(new_data[f'{direction}_lane'][i][this_len*4:])/len(new_data[f'{direction}_lane'][i][this_len*4:])]
                        if min(new_list) == new_list[-1] and new_data[f'{direction}_lane'][i] != new_data[f'{direction}_lane'][-1]:
                            this_lane_list = new_data[f'{direction}_lane'][i][this_len*4:]
                            if len(new_data[f'{direction}_lane'][i+1]) >= 200:
                                this_lane_list.extend(new_data[f'{direction}_lane'][i+1][:200])
                            else:
                                this_lane_list.extend(new_data[f'{direction}_lane'][i+1])
                            for lane_line in range(len(this_lane_list)-1):
                                if this_lane_list[lane_line] == 2048:
                                    print('无信号')
                                    continue
                                this_num = this_lane_list[lane_line] * 0.015625 - 32
                                next_num = this_lane_list[lane_line + 1] * 0.015625 - 32
                                print(next_num - this_num)
                                if abs(next_num - this_num) >= 2.4:
                                    lane_list.append(lane_line)
                            if lane_list != []:
                                if len(lane_list) > 1:
                                    print('多次变道, 不做计算')
                                else:
                                    print(f'单次变道{direction}')
                                    new_lane = new_data[f'{direction}_lane'][i][lane_list[0]+1:]
                                    this_len = int(len(new_lane)/5)
                                    new_list = [sum(new_lane[:this_len])/len(new_lane[:this_len]),sum(new_lane[this_len:this_len*2])/len(new_lane[this_len:this_len*2]),sum(new_lane[this_len*2:this_len*3])/len(new_lane[this_len*2:this_len*3]),sum(new_lane[this_len*3:this_len*4])/len(new_lane[this_len*3:this_len*4]),sum(new_lane[this_len*4:])/len(new_lane[this_len*4:])]
                                    if new_list[0] > new_list[1] > new_list[2] > new_list[3] > new_list[4]:
                                        # 变道到车轮压线时间
                                        Time_from_lighting_to_pressing_line = new_data[f'{direction}_time'][i][lane_list[0]] - new_data[f'{direction}_time'][i][0]
                                        Line_pressing_data = [self.filename,speed,max_spd,min_spd,Time_from_lighting_to_pressing_line, self.roadType]
                                        if Line_pressing_data not in Line_pressing:
                                            Line_pressing.append(Line_pressing_data)
                                            return_data = 1
                    return return_data
                    
                    
                def func3(key,i,speed,max_spd,min_spd,direction):
                    result_dict[key][direction][0] += 1
                    this_time = new_data['{}_time'.format(direction)][i][-1] - new_data['{}_time'.format(direction)][i][0]
                    #################################
                    this_index = index_number(time_1,this_time)
                    new_result_dict[key][this_index] += 1
                    #################################
                    mysql_data_sql = [self.filename,direction, speed,max_spd,min_spd, this_time, self.roadType]
                    if mysql_data_sql not in mysql_data:
                        mysql_data.append(mysql_data_sql)
                    #################################
                    result_dict[key][direction][1].append(this_time)
                # 数据规整完成, 长度一致,无变化
                for i in range(len(new_data['spd'])):
                    judgment_basis = 0
                    for j in new_data['wheel'][i]:
                        if j > 0.1:
                            judgment_basis = 1
                            break
                    if judgment_basis == 0:
                        try:
                            # 车速计算
                            speed = int(sum(new_data['spd'][i]))/len(new_data['spd'][i]) * 3.6
                            # 最大车速留档
                            max_spd = int(max(new_data['spd'][i])) * 3.6
                            # 最小车速留档
                            min_spd = int(min(new_data['spd'][i])) * 3.6
                        except IndexError:
                            break
                        else:
                            if speed >=80:
                                if 1 in new_data['left'][i] and 1 not in new_data['right'][i]:
                                    # 判断车道线情况
                                    # Time_from_lighting_to_pressing_line 为开启变道灯到压线的时间
                                    # 这里的判断逻辑需要重新计算, 考虑变道中跳变仅存在一次,并且确实变道完成
                                    # 如:
                                    # 1.跨过车道线完成跳变之后, 继续变动完成变道操作
                                    # 2.跨过车到线之后的数据迅速达到正常车位, 即车道线扣除车身之后最大值应该为60公分,否则视为未变道成功, 需要继续查看后续数据来判断
                                    lane = func2(i,'left',speed,max_spd,min_spd)
                                    # 车道线检测
                                    if lane == 1:
                                        func3('80-100',i,speed,max_spd,min_spd,'left')
                                elif 1 not in new_data['left'][i] and 1 in new_data['right'][i]:
                                    lane = func2(i,'right',speed,max_spd,min_spd)
                                    if lane == 1:
                                        
                                        func3('80-100',i,speed,max_spd,min_spd,'right')
                                else:
                                    continue
                            elif speed >=60:
                                if 1 in new_data['left'][i] and 1 not in new_data['right'][i]:
                                    # 判断车道线情况
                                    lane = func2(i,'left',speed,max_spd,min_spd)
                                    if lane == 1:
                                        func3('60-80',i,speed,max_spd,min_spd,'left')
                                elif 1 not in new_data['left'][i] and 1 in new_data['right'][i]:
                                    # 判断车道线情况
                                    lane = func2(i,'right',speed,max_spd,min_spd)
                                    if lane == 1:
                                        func3('60-80',i,speed,max_spd,min_spd,'right')
                                else:
                                    continue
                            elif speed >=40:
                                if 1 in new_data['left'][i] and 1 not in new_data['right'][i]:
                                    # 判断车道线情况
                                    lane = func2(i,'left',speed,max_spd,min_spd)
                                    if lane == 1:
                                        func3('40-60',i,speed,max_spd,min_spd,'left')
                                elif 1 not in new_data['left'][i] and 1 in new_data['right'][i]:
                                    # 判断车道线情况
                                    lane = func2(i,'right',speed,max_spd,min_spd)
                                    if lane == 1:
                                        func3('40-60',i,speed,max_spd,min_spd,'right')
                                else:
                                    continue
                            elif speed > 0:
                                if 1 in new_data['left'][i] and 1 not in new_data['right'][i]:
                                    # 判断车道线情况
                                    lane = func2(i,'left',speed,max_spd,min_spd)
                                    if lane == 1:
                                        func3('0~40',i,speed,max_spd,min_spd,'left')
                                elif 1 not in new_data['left'][i] and 1 in new_data['right'][i]:
                                    # 判断车道线情况
                                    lane = func2(i,'right',speed,max_spd,min_spd)
                                    if lane == 1:
                                        func3('0~40',i,speed,max_spd,min_spd,'right')
                                        # result_dict['0~40']['right'][1].append(this_time)
                                else:
                                    continue
                            else:
                                continue
                            
                            this_odometer = odometer.samples.tolist()
                            this_time = odometer.timestamps.tolist()
                            odo = this_odometer[-1] - this_odometer[0]
                            t = this_time[-1] - this_time[0]
                            global all_odometer
                            all_odometer += odo
                            global all_time
                            all_time += t
                self.close_file()
                return new_result_dict
            finally:
                self.close_file()
示例#30
0
class openMDF:
    def __init__(self, path, roadtype=0):
        self.filename = path.split('/')[-1].split('.')[0]
        self.roadType = roadtype
        if self.filename not in loser_file_data:
            self.open_file(path)
            self.task_1()

    def open_file(self, path):
        print('开启mf4文件')
        self.mf = MDF(path)

    def close_file(self):
        print('关闭mf4文件')
        self.mf.close()

    # 统计转向灯开启时间
    def task_1(self):
        signal_left = '_g_PL_AD_fw_PL_AD_FCT_RunnableSppHmi_RunnableSppHmi_m_sppHmiInput_out_local.TChangeableMemPool._._._m_arrayPool._0_._elem._m_dirIndL'
        signal_right = '_g_PL_AD_fw_PL_AD_FCT_RunnableSppHmi_RunnableSppHmi_m_sppHmiInput_out_local.TChangeableMemPool._._._m_arrayPool._0_._elem._m_dirIndR'
        signal_speed = '_g_PL_AD_fw_PL_AD_FCT_RunnableFsm_RunnableFsm._m_fsmController._m_fip._m_displayedSpeedCalculator._m_displaySpeed._m_value'
        # 轮端转角
        signal_RoadWheelAngle = '_g_PL_AD_fw_VMC_VMC_FW_MvpVse_VseSes_VseSes_m_portVehicleStateEstimation_local.TChangeableMemPool._._._m_arrayPool._0_._elem._m_estimation_RoadWheelAngle_Front._m_value'
        # 左航向角
        Left_heading_angle_signal = '_g_GAC_A18_NET_net_apl_g_netRunnable_rbCanRxLD_serializer_m_CNetVFC_Line_SenderPort_1_local.TChangeableMemPool._._._m_arrayPool._0_._elem._m_vfc_lineInformation._0_._VFC_Line_HeadingAngle'
        # 左侧车道线
        Left_lane_line_signal = '_g_GAC_A18_NET_net_apl_g_netRunnable_rbCanRxLD_serializer_m_CNetVFC_Line_SenderPort_1_local.TChangeableMemPool._._._m_arrayPool._0_._elem._m_vfc_lineInformation._0_._VFC_Line_Dy'
        # 右航向角
        Right_heading_angle_signal = '_g_GAC_A18_NET_net_apl_g_netRunnable_rbCanRxLD_serializer_m_CNetVFC_Line_SenderPort_1_local.TChangeableMemPool._._._m_arrayPool._0_._elem._m_vfc_lineInformation._1_._VFC_Line_HeadingAngle'
        # 右侧车道线
        Right_lane_line_signal = '_g_GAC_A18_NET_net_apl_g_netRunnable_rbCanRxLD_serializer_m_CNetVFC_Line_SenderPort_1_local.TChangeableMemPool._._._m_arrayPool._0_._elem._m_vfc_lineInformation._1_._VFC_Line_Dy'
        # vxvRef
        vxvRef_signal = '_g_PL_AD_fw_DACoreCyclic_HV_PerPmeRunnable_PerPmeRunnable_m_pmePort_out_local.TChangeableMemPool._._._m_arrayPool._0_._elem._vxvRef_sw'
        odometer_signal = 'ICM_TotalOdometer'

        # Line ID    255
        left_line_signal = 'VFC_Line01_LineID'
        right_line_signal = 'VFC_Line02_LineID'

        if self.mf:
            try:
                left = self.mf.get(signal_left)
                right = self.mf.get(signal_right)
                speed = self.mf.get(signal_speed)
                RoadWheelAngle = self.mf.get(
                    signal_RoadWheelAngle).samples.tolist()
                Left_heading_angle = self.mf.get(
                    Left_heading_angle_signal).samples.tolist()
                Left_lane_line = self.mf.get(
                    Left_lane_line_signal).samples.tolist()
                Right_heading_angle = self.mf.get(
                    Right_heading_angle_signal).samples.tolist()
                Right_lane_line = self.mf.get(
                    Right_lane_line_signal).samples.tolist()
                vxvRef = self.mf.get(vxvRef_signal)
                odometer = self.mf.get(odometer_signal)
                left_line = self.mf.get(left_line_signal).samples.tolist()
                right_line = self.mf.get(right_line_signal).samples.tolist()
            except Exception as e:
                print(e)
                loser_file_data.append(self.filename)
            else:
                lane = 0
                for i in range(len(Left_lane_line) - 1):
                    if abs((Left_lane_line[i] - Left_lane_line[i + 1]) *
                           0.015625 - 32) >= 2.4:
                        lane = 1
                        break
                if lane == 0:
                    return
                else:

                    def func(data):
                        num = data.samples.tolist()[0]
                        index_list = [0]
                        for index in range(len(data.samples.tolist())):
                            if num != data.samples.tolist()[index]:
                                num = data.samples.tolist()[index]
                                index_list.append(index)
                        if len(data.samples.tolist()) - 1 not in index_list:
                            index_list.append(len(data.samples.tolist()) - 1)
                        return index_list