45 lines
1.4 KiB
Cython
45 lines
1.4 KiB
Cython
# distutils: language = c++
|
|
|
|
from tdm_reaper cimport tdm_reaper
|
|
import json as jn
|
|
import numpy as np
|
|
|
|
cdef class tdmreaper:
|
|
|
|
# C++ instance of class => stack allocated (requires nullary constructor!)
|
|
cdef tdm_reaper cpp_tdm
|
|
|
|
# constructor
|
|
def __cinit__(self, string tdmfile, string tdxfile):
|
|
self.cpp_tdm = tdm_reaper(tdmfile,tdxfile)
|
|
|
|
# provide TDM files
|
|
def submit_files(self,string tdmfile, string tdxfile):
|
|
self.cpp_tdm.submit_files(tdmfile,tdxfile)
|
|
|
|
# get list of channel(-group) ids
|
|
def get_channelgroup_ids(self):
|
|
return self.cpp_tdm.get_channelgroup_ids()
|
|
def get_channel_ids(self):
|
|
return self.cpp_tdm.get_channel_ids()
|
|
|
|
# get data of specific channel
|
|
def get_channel(self, string id):
|
|
return self.cpp_tdm.get_channel_as_double(id)
|
|
|
|
# get meta-data of channel(-group) (as dictionary)
|
|
def get_channelgroup_info(self, string id):
|
|
grpstr = self.cpp_tdm.get_channelgroup_info(id)
|
|
return jn.loads(grpstr.decode())
|
|
def get_channel_info(self, string id):
|
|
chnstr = self.cpp_tdm.get_channel_info(id)
|
|
return jn.loads(chnstr.decode())
|
|
|
|
# print a channel(-group)
|
|
def print_channelgroup(self, string id, const char* filename,
|
|
bool include_meta, char delimiter):
|
|
self.cpp_tdm.print_group(id,filename,include_meta,delimiter)
|
|
def print_channel(self, string id, const char* filename,
|
|
bool include_meta):
|
|
self.cpp_tdm.print_channel(id,filename,include_meta)
|