* cython/py_imc_termite.pyx: json loads take care of floats, fix column assignment
* imc_channel.hpp: fix floating precision for get_channel() * extend/include advanced usage in examples
This commit is contained in:
@@ -25,4 +25,4 @@ print(len(chnxdata))
|
||||
imcraw.print_channels(b"./")
|
||||
|
||||
# print all channels in single file
|
||||
# imcraw.print_table(b"./allchannels.csv")
|
||||
imcraw.print_table(b"./allchannels.csv")
|
||||
|
@@ -2,6 +2,7 @@
|
||||
import imc_termite
|
||||
import json
|
||||
import glob
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# list files in sample directory
|
||||
@@ -12,29 +13,20 @@ print(rawlist1)
|
||||
|
||||
for fl in rawlist1:
|
||||
|
||||
print("converting " + str(fl))
|
||||
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 :
|
||||
print("failed to load/parse raw-file: " + str(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))
|
||||
|
||||
# # obtain data of first channel (with data)
|
||||
# channelsdata = imcraw.get_channels(True)
|
||||
# if len(channelsdata) > 0 :
|
||||
# chnydata = channelsdata[0]['ydata']
|
||||
# chnxdata = channelsdata[0]['xdata']
|
||||
#
|
||||
# print(len(chnydata))
|
||||
# print(len(chnxdata))
|
||||
#
|
||||
# # print the channels into a specific directory
|
||||
# imcraw.print_channels(b"./")
|
||||
# print the channels into a specific directory
|
||||
imcraw.print_channels(b"./")
|
||||
|
||||
# print all channels in single file
|
||||
# imcraw.print_table(b"./allchannels.csv")
|
||||
# print all channels in single file
|
||||
imcraw.print_table(("./"+str(os.path.basename(fl).split('.')[0])+"_allchannels.csv").encode())
|
||||
|
Reference in New Issue
Block a user