def get_info(): """Extract information from Siemens binary physiological data file: get information from global memory structure. """ descriptor = [ { 'name': 'n_samples_breathing', 'type': 'uint', 'value': None }, { 'name': 'n_samples_ecg_I', 'type': 'uint', 'value': None }, { 'name': 'n_samples_ecg_aVF', 'type': 'uint', 'value': None }, { 'name': 'n_samples_pulse_ox', 'type': 'uint', 'value': None }, { 'name': 'n_samples_external', 'type': 'uint', 'value': None }, ] r = call_c_function(physiological_c.get_info, descriptor) if not r.status == status_success(): raise ErrorInCFunction("The execution of get_info was unsuccesful.", r.status, 'get_info') return r.dictionary
def status_unhandled_error(): """Returns the value returned by the function calls to the library in case of unhandled error. """ r = call_c_function(physiological_c.status_unhandled_error, [{ 'name': 'return_value', 'type': 'int', 'value': None }]) return r.return_value
def status_decode_error(): """Returns the value returned by the function calls to the library in case of error decoding a file. """ r = call_c_function(physiological_c.status_decode_error, [{ 'name': 'return_value', 'type': 'int', 'value': None }]) return r.return_value
def status_success(): """Returns the value returned by the function calls to the library in case of success. """ r = call_c_function(physiological_c.status_success, [{ 'name': 'return_value', 'type': 'int', 'value': None }]) return r.return_value
def load_data(filename): """Extract information from Siemens binary physiological data file: load data to global memory structure """ descriptor = [ { 'name': 'filename', 'type': 'string', 'value': filename, 'size': len(filename) }, ] r = call_c_function(physiological_c.load_data, descriptor) if not r.status == status_success(): raise ErrorInCFunction("The execution of load_data was unsuccesful.", r.status, 'load_data') return r.dictionary
def test_library(): """Test whether the C library responds. Used in the package testing. """ number = 134 # a (lucky) number descriptor = [ { 'name': 'input', 'type': 'int', 'value': number }, { 'name': 'output', 'type': 'int', 'value': None }, ] r = call_c_function(physiological_c.echo, descriptor) return r.output == number
def get_data(n_samples_breathing, n_samples_ecg_I, n_samples_ecg_aVF, n_samples_pulse_ox, n_samples_external): """Extract information from Siemens binary physiological data file: get data from global memory strucutre. """ descriptor = [ { 'name': 'n_samples_breathing', 'type': 'uint', 'value': n_samples_breathing }, { 'name': 'n_samples_ecg_I', 'type': 'uint', 'value': n_samples_ecg_I }, { 'name': 'n_samples_ecg_aVF', 'type': 'uint', 'value': n_samples_ecg_aVF }, { 'name': 'n_samples_pulse_ox', 'type': 'uint', 'value': n_samples_pulse_ox }, { 'name': 'n_samples_external', 'type': 'uint', 'value': n_samples_external }, { 'name': 'samples_breathing', 'type': 'array', 'value': None, 'dtype': uint16, 'size': (n_samples_breathing) }, { 'name': 'samples_ecg_I', 'type': 'array', 'value': None, 'dtype': uint16, 'size': (n_samples_ecg_I) }, { 'name': 'samples_ecg_aVF', 'type': 'array', 'value': None, 'dtype': uint16, 'size': (n_samples_ecg_aVF) }, { 'name': 'samples_pulse_ox', 'type': 'array', 'value': None, 'dtype': uint16, 'size': (n_samples_pulse_ox) }, { 'name': 'samples_external', 'type': 'array', 'value': None, 'dtype': uint16, 'size': (n_samples_external) }, { 'name': 'triggers_breathing', 'type': 'array', 'value': None, 'dtype': uint16, 'size': (n_samples_breathing) }, { 'name': 'triggers_ecg_I', 'type': 'array', 'value': None, 'dtype': uint16, 'size': (n_samples_ecg_I) }, { 'name': 'triggers_ecg_aVF', 'type': 'array', 'value': None, 'dtype': uint16, 'size': (n_samples_ecg_aVF) }, { 'name': 'triggers_pulse_ox', 'type': 'array', 'value': None, 'dtype': uint16, 'size': (n_samples_pulse_ox) }, { 'name': 'triggers_external', 'type': 'array', 'value': None, 'dtype': uint16, 'size': (n_samples_external) }, ] r = call_c_function(physiological_c.get_data, descriptor) if not r.status == status_success(): raise ErrorInCFunction("The execution of get_data was unsuccesful.", r.status, 'get_data') return r.dictionary