* cython/*_imc_termite.*: introduce both print_channel/print_channels

methods featuring csv delimiter option
* imc_raw.hpp: add print_channel()
* python/{example.py,usage.py}: adjust to existing sample file names,
  add print_channel() example
* src/main.cpp: add --delimiter option, additional CLI option checks
This commit is contained in:
Mario Fink
2021-06-28 16:26:07 +02:00
parent bafc018566
commit 234876c5a9
6 changed files with 90 additions and 30 deletions

View File

@@ -7,16 +7,16 @@ import pyarrow as pa
import pyarrow.parquet as pq
from pathlib import Path
fileobj1 = Path("smp/Rangerover_Evoque_F-RR534_2019-05-07/").rglob("*.raw")
fileobj1 = Path("samples/datasetA/").rglob("*.raw")
rawlist1 = [str(fl) for fl in fileobj1]
fileobj2 = Path("smp/Mercedes_E-Klasse-2019-08-08/").rglob("*.raw")
fileobj2 = Path("samples/datasetB/").rglob("*.raw")
rawlist2 = [str(fl) for fl in fileobj2]
rawlist = rawlist1 #[rawlist1[0],rawlist1[4],rawlist2[0],rawlist2[6]]
for fil in rawlist2 :
rawlist.append(fil)
rawlist.append("smp/pressure_Vacuum.asc")
rawlist.append("./README.md")
print("")
print(rawlist)

View File

@@ -1,10 +1,11 @@
import imc_termite
import json
import os
# declare and initialize instance of "imctermite" by passing a raw-file
try :
imcraw = imc_termite.imctermite(b"samples/sampleA.raw")
imcraw = imc_termite.imctermite(b"samples/exampleB.raw")
except RuntimeError as e :
raise Exception("failed to load/parse raw-file: " + str(e))
@@ -22,7 +23,16 @@ print(len(chnydata))
print(len(chnxdata))
# print the channels into a specific directory
imcraw.print_channels(b"./")
imcraw.print_channels(b"./data",ord(','))
# print all channels separately
idx = 0
for chn in channels :
print(str(idx)+" : "+chn['name']+" : "+chn['uuid'])
filname = os.path.join("./data",str(idx) + "_" + chn['name']+".csv")
print(filname)
imcraw.print_channel(chn['uuid'].encode(),filname.encode(),ord(','))
idx = idx + 1
# print all channels in single file
imcraw.print_table(b"./allchannels.csv")
# imcraw.print_table(b"./data/allchannels.csv")