diff --git a/Dockerfile b/Dockerfile index a92e16b..e5389a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,9 @@ FROM debian:bullseye-20210111 USER root RUN apt-get update && apt-get install -y \ - build-essential git \ + build-essential git vim \ python3 python3-pip +RUN python3 -m pip install cython RUN g++ -v @@ -15,6 +16,6 @@ COPY ./ /IMCtermite/ RUN cd /IMCtermite && ls -lh && make install && ls -lh /usr/local/bin/imctermite # install Python module -# RUN cd /tdm_ripper && ls -lh && make cython-requirements && make cython-install +RUN cd /IMCtermite && ls -lh && make cython-install -CMD ["sleep","inifity"] +CMD ["sleep","infinity"] diff --git a/cython/imc_termite.pxd b/cython/imc_termite.pxd index 7ee3375..ccd65e9 100644 --- a/cython/imc_termite.pxd +++ b/cython/imc_termite.pxd @@ -16,3 +16,4 @@ cdef extern from "imc_raw.hpp" namespace "imc": vector[string] get_channels(bool json, bool data) except + # print all channels void print_channels(string outputdir) except + + void print_table(string outputfile) except + diff --git a/cython/py_imc_termite.pyx b/cython/py_imc_termite.pyx index af62123..fc78641 100644 --- a/cython/py_imc_termite.pyx +++ b/cython/py_imc_termite.pyx @@ -24,6 +24,18 @@ cdef class imctermite: chnlstjn = [jn.loads(chn.decode()) for chn in chnlst] return chnlstjn - # print a channels + # print channels def print_channels(self, string outputdir): self.cpp_imc.print_channels(outputdir) + + # print table including channels + def print_table(self, string outputfile): + chnlst = self.cpp_imc.get_channels(True,True) + chnlstjn = [jn.loads(chn.decode()) for chn in chnlst] + with open(outputfile,'w') as fout: + for chn in chnlstjn: + fout.write(str(chn['yname']).rjust(20)+str(chn['xname']).rjust(20)+'\n') + fout.write(str(chn['yunit']).rjust(20)+str(chn['xunit']).rjust(20)+'\n') + for n in range(0,len(chn['ydata'])): + fout.write(str(chn['ydata'][n]).rjust(20)+ + str(chn['ydata'][n]).rjust(20)+'\n') diff --git a/python/usage.py b/python/usage.py index cca1ed0..2efe44a 100644 --- a/python/usage.py +++ b/python/usage.py @@ -23,3 +23,6 @@ print(len(chnxdata)) # print the channels into a specific directory imcraw.print_channels(b"./") + +# print all channels in single file +imcraw.print_table(b"./allchannels.csv")