-
Notifications
You must be signed in to change notification settings - Fork 3
/
callQC.py
51 lines (42 loc) · 1.22 KB
/
callQC.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import warnings
import numpy as np
import random
from zugbruecke import CtypesSession
warnings.simplefilter("ignore")
ctypes = CtypesSession(arch = 'win64')
dll = ctypes.windll.LoadLibrary('QuantCorrDLL64.dll')
_qc = dll.qc
_qc.argtypes = (
ctypes.c_double, # XmonL
ctypes.c_double, # XmonH
ctypes.c_double, # YmonL
ctypes.c_double, # YmonH
ctypes.POINTER(ctypes.c_double), # XYin
ctypes.c_int, # nElem
ctypes.POINTER(ctypes.c_double)) # XYqc
_qc.restype = ctypes.c_int
_qc.memsync = [
dict(
pointer = [4],
length = [5],
type = ctypes.c_double
),
dict(
pointer = [6],
length = [5],
type = ctypes.c_double
)
]
_relpower = dll.relpower
_relpower.argtypes = (ctypes.c_double, ctypes.c_double)
_relpower.restype = ctypes.c_double
def relpower(monL, monH):
return _relpower(monL, monH)
def qc(XmonL, XmonH, YmonL, YmonH, XY):
nElem = len(XY)
XYin = (ctypes.c_double * nElem)()
XYout = (ctypes.c_double * nElem)()
for i in range(0,nElem):
XYin[i] = XY[i]
_qc(XmonL, XmonH, YmonL, YmonH, XYin, nElem, XYout)
return [value for value in XYout]