* imc_object: asc_time, localtime: make threadsafe * imc_datatype: satisfy 'rule of two' * python: remove all unused imports
31 lines
955 B
Python
31 lines
955 B
Python
|
|
import imc_termite
|
|
import json
|
|
import os
|
|
|
|
# list files in sample directory
|
|
# fileobj1 = Path("samples/").rglob("*.raw")
|
|
# rawlist1 = [str(fl) for fl in fileobj1]
|
|
rawlist1 = ["samples/datasetB/datasetB_29.raw"]
|
|
print(rawlist1)
|
|
|
|
for fl in rawlist1:
|
|
|
|
print("converting " + str(fl) + " : " + str(os.path.basename(fl)) )
|
|
|
|
# declare and initialize instance of "imctermite" by passing a raw-file
|
|
try :
|
|
imcraw = imc_termite.imctermite(fl.encode())
|
|
except RuntimeError as e :
|
|
raise Exception("failed to load/parse raw-file: " + str(e))
|
|
|
|
# obtain list of channels as list of dictionaries (without data)
|
|
channels = imcraw.get_channels(False)
|
|
print(json.dumps(channels,indent=4, sort_keys=False))
|
|
|
|
# print the channels into a specific directory
|
|
imcraw.print_channels(b"./")
|
|
|
|
# print all channels in single file
|
|
imcraw.print_table(("./"+str(os.path.basename(fl).split('.')[0])+"_allchannels.csv").encode())
|