Exemplo n.º 1
0
# -*- coding: utf8 -*-
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import ctypes
try:
    from .lib_names import get_lib_path
except ImportError:
    from lib_names import get_lib_path

lib_map_project = ctypes.CDLL(get_lib_path('lib_map_project'))

lib_map_project.get_transform.argtypes = [ctypes.c_int, ctypes.c_char_p]

lib_map_project.latlon2rect.argtypes = [
    ctypes.c_int,
    ctypes.c_double,
    ctypes.c_double,
    ctypes.POINTER(ctypes.c_double),
    ctypes.POINTER(ctypes.c_double),
]

lib_map_project.rect2latlon.argtypes = [
    ctypes.c_int,
    ctypes.c_double,
    ctypes.c_double,
    ctypes.POINTER(ctypes.c_double),
    ctypes.POINTER(ctypes.c_double),
]

Exemplo n.º 2
0
# -*- coding: utf8 -*-
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import numpy as np
from ctypes import CDLL, c_int, c_float, c_double, c_void_p, POINTER, byref
from numpy.ctypeslib import ndpointer
try:
    from .lib_names import get_lib_path
except (ImportError, ValueError):
    from lib_names import get_lib_path

lib_rec_rms = CDLL(get_lib_path('lib_rec_rms'))
lib_rec_rms._recursive_rms.argtypes = [
    ndpointer(dtype=np.float64),  # signal
    ndpointer(dtype=np.float64),  # rms_signal
    c_int,  # npts
    c_float,  # C_WIN
    POINTER(c_double),  # mean_sq
    c_int,  # memory_sample
    c_int  # initialize
]
lib_rec_rms._recursive_rms.restype = c_void_p


def recursive_rms(signal, C_WIN, rec_memory=None):
    signal = np.array(signal, dtype=np.float64)
    rms_signal = np.zeros(len(signal))

    if rec_memory is not None:
        mean_sq = rec_memory.mean_sq
Exemplo n.º 3
0
# (c) 2014 - Claudio Satriano <*****@*****.**>,
#            Pierre Romanet <*****@*****.**>
# (c) 2014 - 2018 Claudio Satriano <*****@*****.**>
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import numpy as np
from ctypes import CDLL, c_int, c_float, c_char, c_void_p
from numpy.ctypeslib import ndpointer
from future.utils import PY2
try:
    from .lib_names import get_lib_path
except ImportError:
    from lib_names import get_lib_path

lib_rosenberger = CDLL(get_lib_path('lib_rosenberger'))
lib_rosenberger.rosenberger.argtypes = [
    ndpointer(dtype=np.float64),  # dataX
    ndpointer(dtype=np.float64),  # dataY
    ndpointer(dtype=np.float64),  # dataZ
    ndpointer(dtype=np.float64),  # pol_filter
    c_int,  # npts
    c_float,  # lambda
    c_float,  # delta
    c_char,  # proj
    c_char  # rl_filter
]
lib_rosenberger.rosenberger.restype = c_void_p


def rosenberger(dataX,
Exemplo n.º 4
0
# -*- coding: utf8 -*-
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import numpy as np
from ctypes import CDLL, c_int, c_double, c_void_p
from numpy.ctypeslib import ndpointer
try:
    from .lib_names import get_lib_path
except ImportError:
    from lib_names import get_lib_path

lib_rec_cc = CDLL(get_lib_path('lib_rec_cc'))
lib_rec_cc._Gaussian1D.argtypes = [
    ndpointer(dtype=np.float64),  # signal
    c_int,  # npts
    c_double  # sigma
]
lib_rec_cc._Gaussian1D.restype = c_void_p


def recursive_gauss_filter(signal, sigma):
    filt_signal = np.array(signal, dtype=np.float64)
    lib_rec_cc._Gaussian1D(filt_signal, filt_signal.size, sigma)
    return filt_signal


if __name__ == '__main__':
    import matplotlib.pyplot as plt
    signal = np.zeros(1001)
    signal[500] = 1
Exemplo n.º 5
0
# -*- coding: utf8 -*-
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import numpy as np
from ctypes import CDLL, c_int, c_float, c_double, c_void_p, POINTER, byref
from numpy.ctypeslib import ndpointer
try:
    from .lib_names import get_lib_path
except (ImportError, ValueError):
    from lib_names import get_lib_path

lib_rec_filter = CDLL(get_lib_path('lib_rec_filter'))
lib_rec_filter._recursive_filter.argtypes = [
    ndpointer(dtype=np.float64),  # signal
    ndpointer(dtype=np.float64),  # filt_signal
    c_int,  # npts
    c_float,  # C_HP
    c_float,  # C_LP
    c_int,  # npoles
    ndpointer(dtype=np.float64),  # filterH
    ndpointer(dtype=np.float64),  # filterL
    POINTER(c_double),  # prev_sample_value
    c_int  # memory_sample
]
lib_rec_filter._recursive_filter.restype = c_void_p


def recursive_filter(signal, C_HP, C_LP=None, npoles=2, rec_memory=None):
    signal = np.array(signal, dtype=np.float64)
    filt_signal = np.zeros(len(signal))
Exemplo n.º 6
0
#                 Claudio Satriano <*****@*****.**>
# (c) 2013-2014 - Natalia Poiata <*****@*****.**>,
#                 Claudio Satriano <*****@*****.**>,
#                 Pierre Romanet <*****@*****.**>
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import numpy as np
from ctypes import CDLL, c_int, c_float, c_double, c_void_p, POINTER, byref
from numpy.ctypeslib import ndpointer
try:
    from .lib_names import get_lib_path
except (ImportError, ValueError):
    from lib_names import get_lib_path

lib_rec_hos = CDLL(get_lib_path('lib_rec_hos'))
lib_rec_hos._recursive_hos.argtypes = [
    ndpointer(dtype=np.float64),  # signal
    ndpointer(dtype=np.float64),  # hos_signal
    c_int,  # npts
    c_float,  # sigma_min
    c_float,  # C_WIN
    c_int,  # order
    POINTER(c_double),  # mean
    POINTER(c_double),  # var
    POINTER(c_double),  # hos
    c_int,  # memory_sample
    c_int  # initialize
]
lib_rec_hos._recursive_hos.restype = c_void_p