complete cython interface, python example usage.py
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
# distutils: language = c++
|
||||
|
||||
from tdm_reaper cimport tdm_reaper
|
||||
# import numpy as np
|
||||
import json as jsn
|
||||
import numpy as np
|
||||
# import re
|
||||
# import os
|
||||
|
||||
@@ -14,6 +15,26 @@ cdef class tdmreaper:
|
||||
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)
|
||||
def get_channelgroup_info(self, string id):
|
||||
return self.cpp_tdm.get_channelgroup_info(id)
|
||||
def get_channel_info(self, string id):
|
||||
return self.cpp_tdm.get_channel_info(id)
|
||||
|
||||
# def set_file(self, string rawfile):
|
||||
# if not os.path.isfile(rawfile) :
|
||||
# raise ValueError("'" + str(rawfile) + "' does not exist")
|
||||
|
@@ -2,8 +2,8 @@
|
||||
|
||||
# use some C++ STL libraries
|
||||
from libcpp.string cimport string
|
||||
# from libcpp.vector cimport vector
|
||||
# from libcpp cimport bool
|
||||
from libcpp.vector cimport vector
|
||||
from libcpp cimport bool
|
||||
|
||||
cdef extern from "tdm_reaper.cpp":
|
||||
pass
|
||||
@@ -13,7 +13,17 @@ cdef extern from "tdm_reaper.hpp":
|
||||
# constructor(s)
|
||||
tdm_reaper() except +
|
||||
tdm_reaper(string tdmfile, string tdxfile) except +
|
||||
# set new file for decoding
|
||||
# provide TDM files
|
||||
void submit_files(string tdmfile, string tdxfile) except+
|
||||
# get list of channel(-group) ids
|
||||
vector[string] get_channelgroup_ids() except+
|
||||
vector[string] get_channel_ids() except+
|
||||
# get data of specific channel
|
||||
vector[double] get_channel_as_double(string id) except+
|
||||
# get meta-data
|
||||
string get_channelgroup_info(string id) except+
|
||||
string get_channel_info(string id) except+
|
||||
|
||||
# void set_file(string)
|
||||
# # perform conversion (pass any C++ exceptions to Python)
|
||||
# void setup_and_conversion() except +
|
||||
|
Reference in New Issue
Block a user