src/p/y/py_examples-HEAD/opencv/CVtypes.py py_examples(Download)
import ctypes, os from ctypes import Structure, Union, POINTER, SetPointerType, CFUNCTYPE, cdll, byref from ctypes import c_char_p, c_double, c_float, c_byte, c_ubyte, c_int, c_void_p, c_ulong from ctypes import c_uint32, c_short, c_char, c_longlong # ----Load the DLLs ----------------------------------------------------------
src/d/a/DAQpy-HEAD/examples/test_system.py DAQpy(Download)
def test_singlepoint(channel, samples):
with daqmx.create_scoped_task("") as taskHandle:
c_daqmx.DAQmxCreateAIVoltageChan(taskHandle, channel, "", c_daqmx.DAQmx_Val_Cfg_Default, -10.0, 10.0, c_daqmx.DAQmx_Val_Volts, None)
with daqmx.start_task(taskHandle):
value = ctypes.c_double()
for i in xrange(samples):
c_daqmx.DAQmxCfgSampClkTiming(taskHandle, "", 1000.0, c_daqmx.DAQmx_Val_Rising, c_daqmx.DAQmx_Val_HWTimedSinglePoint, samples) with daqmx.start_task(taskHandle): value = ctypes.c_double() isLate = ctypes.c_uint32() for i in xrange(samples): c_daqmx.DAQmxReadAnalogScalarF64(taskHandle, 10.0, ctypes.byref(value), None)
src/s/h/shapely-3k-HEAD/shapely/geometry/point.py shapely-3k(Download)
"""
Points.
"""
from ctypes import string_at, create_string_buffer, \
c_char_p, c_double, c_float, c_int, c_uint, c_size_t, c_ubyte, \
c_void_p, byref
cdata = array['data'][0]
cp = cast(cdata, POINTER(c_double))
dx = c_double(cp[0])
dy = c_double(cp[1])
dz = None
if n == 3:
dz = c_double(cp[2])
else:
coords = ob
n = len(coords)
dx = c_double(coords[0])
dy = c_double(coords[1])
dz = None
if n == 3:
dz = c_double(coords[2])
def x(self):
"""Return x coordinate."""
cs = lgeos.GEOSGeom_getCoordSeq(self._geom)
d = c_double()
lgeos.GEOSCoordSeq_getX(cs, 0, byref(d))
return d.value
@property
@exceptNull
def y(self):
"""Return y coordinate."""
cs = lgeos.GEOSGeom_getCoordSeq(self._geom)
d = c_double()
def z(self):
"""Return z coordinate."""
if self._ndim != 3:
raise DimensionError("This point has no z coordinate.")
cs = lgeos.GEOSGeom_getCoordSeq(self._geom)
d = c_double()
lgeos.GEOSCoordSeq_getZ(cs, 0, byref(d))
def bounds(self):
cs = lgeos.GEOSGeom_getCoordSeq(self._geom)
x = c_double()
y = c_double()
lgeos.GEOSCoordSeq_getX(cs, 0, byref(x))
lgeos.GEOSCoordSeq_getY(cs, 0, byref(y))
return (x.value, y.value, x.value, y.value)
src/l/a/LabJackPython-HEAD/src/LabJackPython.py LabJackPython(Download)
if os.name == 'nt':
staticLib = ctypes.windll.LoadLibrary("labjackud")
v = ctypes.c_double(Value)
ud = ctypes.c_double(UserData)
ec = staticLib.AddRequest(Handle, IOType, Channel, v, x1, ud)
if os.name == 'nt':
staticLib = ctypes.windll.LoadLibrary("labjackud")
v = ctypes.c_double(Value)
ud = ctypes.c_double(UserData)
ec = staticLib.AddRequestS(Handle, pIOType, Channel,
if os.name == 'nt':
staticLib = ctypes.windll.LoadLibrary("labjackud")
v = ctypes.c_double(Value)
ud = ctypes.c_double(UserData)
ec = staticLib.AddRequestSS(Handle, pIOType, pChannel,
"""
if os.name == 'nt':
staticLib = ctypes.windll.LoadLibrary("labjackud")
pv = ctypes.c_double(pValue)
#ppv = ctypes.pointer(pv)
ec = staticLib.eGet(Handle, IOType, Channel, ctypes.byref(pv), x1)
#staticLib.eGet.argtypes = [ctypes.c_long, ctypes.c_long, ctypes.c_long, ctypes.c_double, ctypes.c_long]
x1Type = "int"
if os.name == 'nt':
digitalConst = [35, 36, 37, 45]
pv = ctypes.c_double(pValue)
#If IOType is digital then call eget with x1 as a long
if IOType in digitalConst:
x1Type = "float"
newA = (ctypes.c_double*len(x1))()
for i in range(0, len(x1), 1):
newA[i] = ctypes.c_double(x1[i])
ec = staticLib.eGet(Handle, IOType, Channel, ctypes.byref(pv), ctypes.byref(newA))
"""
if os.name == 'nt':
staticLib = ctypes.windll.LoadLibrary("labjackud")
pv = ctypes.c_double(pValue)
ec = staticLib.eGetS(Handle, pIOType, Channel, ctypes.byref(pv), x1)
if ec != 0: raise LabJackException(ec)
"""
if os.name == 'nt':
staticLib = ctypes.windll.LoadLibrary("labjackud")
pv = ctypes.c_double(pValue)
ec = staticLib.eGetSS(Handle, pIOType, pChannel, ctypes.byref(pv), x1)
if ec != 0: raise LabJackException(ec)
"""
if os.name == 'nt':
staticLib = ctypes.windll.LoadLibrary("labjackud")
pv = ctypes.c_double(Value)
ec = staticLib.ePut(Handle, IOType, Channel, pv, x1)
if ec != 0: raise LabJackException(ec)
if os.name == 'nt':
staticLib = ctypes.windll.LoadLibrary("labjackud")
pv = ctypes.c_double(Value)
ec = staticLib.ePutS(Handle, pIOType, Channel, pv, x1)
if ec != 0: raise LabJackException(ec)
if os.name == 'nt':
staticLib = ctypes.windll.LoadLibrary("labjackud")
pv = ctypes.c_double(Value)
ec = staticLib.ePutSS(Handle, pIOType, pChannel, pv, x1)
if ec != 0: raise LabJackException(ec)
"""
if os.name == 'nt':
staticLib = ctypes.windll.LoadLibrary("labjackud")
pv = ctypes.c_double()
ec = staticLib.GetResult(Handle, IOType, Channel, ctypes.byref(pv))
if ec != 0: raise LabJackException(ec)
"""
if os.name == 'nt':
staticLib = ctypes.windll.LoadLibrary("labjackud")
pv = ctypes.c_double()
ec = staticLib.GetResultS(Handle, pIOType, Channel, ctypes.byref(pv))
if ec != 0: raise LabJackException(ec)
"""
if os.name == 'nt':
staticLib = ctypes.windll.LoadLibrary("labjackud")
pv = ctypes.c_double()
ec = staticLib.GetResultS(Handle, pIOType, pChannel, ctypes.byref(pv))
if ec != 0: raise LabJackException(ec)
staticLib = ctypes.windll.LoadLibrary("labjackud")
pio = ctypes.c_long()
pchan = ctypes.c_long()
pv = ctypes.c_double()
px = ctypes.c_long()
pud = ctypes.c_double()
ec = staticLib.GetFirstResult(Handle, ctypes.byref(pio),
staticLib = ctypes.windll.LoadLibrary("labjackud")
pio = ctypes.c_long()
pchan = ctypes.c_long()
pv = ctypes.c_double()
px = ctypes.c_long()
pud = ctypes.c_double()
ec = staticLib.GetNextResult(Handle, ctypes.byref(pio),
"""
if os.name == 'nt':
staticLib = ctypes.windll.LoadLibrary("labjackud")
pTCTempK = ctypes.c_double()
ec = staticLib.TCVoltsToTemp(ctypes.c_long(TCType), ctypes.c_double(TCVolts),
ctypes.c_double(CJTempK), ctypes.byref(pTCTempK))
src/p/y/pysces-HEAD/trunk/pysces_pysundials/pysundials/ida.py pysces(Download)
def IDAGetLastStep(ida_mem):
hlast = ctypes.c_double(0.0)
ret = ida.IDAGetLastStep(ida_mem.obj, ctypes.byref(hlast))
if ret < 0:
raise AssertionError("SUNDIALS ERROR: IDAGetLastStep() failed with flag %i"%(ret))
return hlast.value
ida.IDAGetLastStep.argtypes = [ctypes.c_void_p, ctypes.POINTER(realtype )]
ida.IDAGetLastStep.restype = ctypes.c_int
def IDAGetCurrentStep(ida_mem):
hcur = ctypes.c_double(0.0)
def IDAGetCurrentTime(ida_mem):
tcur = ctypes.c_double(0.0)
ret = ida.IDAGetCurrentTime(ida_mem.obj, ctypes.byref(tcur))
if ret < 0:
raise AssertionError("SUNDIALS ERROR: IDAGetCurrentTime() failed with flag %i"%(ret))
return tcur.value
ida.IDAGetCurrentTime.argtypes = [ctypes.c_void_p, ctypes.POINTER(realtype )]
ida.IDAGetCurrentTime.restype = ctypes.c_int
def IDAGetTolScaleFactor(ida_mem):
tolsfact = ctypes.c_double(0.0)
src/p/y/pysces-HEAD/pysces_pysundials/pysundials/ida.py pysces(Download)
def IDAGetLastStep(ida_mem):
hlast = ctypes.c_double(0.0)
ret = ida.IDAGetLastStep(ida_mem.obj, ctypes.byref(hlast))
if ret < 0:
raise AssertionError("SUNDIALS ERROR: IDAGetLastStep() failed with flag %i"%(ret))
return hlast.value
ida.IDAGetLastStep.argtypes = [ctypes.c_void_p, ctypes.POINTER(realtype )]
ida.IDAGetLastStep.restype = ctypes.c_int
def IDAGetCurrentStep(ida_mem):
hcur = ctypes.c_double(0.0)
def IDAGetCurrentTime(ida_mem):
tcur = ctypes.c_double(0.0)
ret = ida.IDAGetCurrentTime(ida_mem.obj, ctypes.byref(tcur))
if ret < 0:
raise AssertionError("SUNDIALS ERROR: IDAGetCurrentTime() failed with flag %i"%(ret))
return tcur.value
ida.IDAGetCurrentTime.argtypes = [ctypes.c_void_p, ctypes.POINTER(realtype )]
ida.IDAGetCurrentTime.restype = ctypes.c_int
def IDAGetTolScaleFactor(ida_mem):
tolsfact = ctypes.c_double(0.0)
src/p/y/pysundials-HEAD/2.3.0/src/ida.py pysundials(Download)
def IDAGetLastStep(ida_mem):
hlast = ctypes.c_double(0.0)
ret = ida.IDAGetLastStep(ida_mem.obj, ctypes.byref(hlast))
if ret < 0:
raise AssertionError("SUNDIALS ERROR: IDAGetLastStep() failed with flag %i"%(ret))
return hlast.value
ida.IDAGetLastStep.argtypes = [ctypes.c_void_p, ctypes.POINTER(realtype )]
ida.IDAGetLastStep.restype = ctypes.c_int
def IDAGetCurrentStep(ida_mem):
hcur = ctypes.c_double(0.0)
def IDAGetCurrentTime(ida_mem):
tcur = ctypes.c_double(0.0)
ret = ida.IDAGetCurrentTime(ida_mem.obj, ctypes.byref(tcur))
if ret < 0:
raise AssertionError("SUNDIALS ERROR: IDAGetCurrentTime() failed with flag %i"%(ret))
return tcur.value
ida.IDAGetCurrentTime.argtypes = [ctypes.c_void_p, ctypes.POINTER(realtype )]
ida.IDAGetCurrentTime.restype = ctypes.c_int
def IDAGetTolScaleFactor(ida_mem):
tolsfact = ctypes.c_double(0.0)
src/f/o/Fos-HEAD/fos/lib/pyglet/app/carbon.py Fos(Download)
def notify(self):
carbon.SetEventLoopTimerNextFireTime(
self._timer, ctypes.c_double(0.0))
def start(self):
# Create timer
timer = self._timer
carbon.InstallEventLoopTimer(self._event_loop,
ctypes.c_double(0.1), #?
ctypes.c_double(kEventDurationForever),
timeout = kEventDurationForever
self._is_running.set()
# XXX should spin on multiple events after first timeout
if carbon.ReceiveNextEvent(0, None, ctypes.c_double(timeout),
True, ctypes.byref(e)) == 0:
carbon.SendEventToEventTarget(e, event_dispatcher)
carbon.ReleaseEvent(e)
def set_timer(self, func, interval):
if interval is None or func is None:
interval = kEventDurationForever
self._timer_func = func
carbon.SetEventLoopTimerNextFireTime(self._timer,
ctypes.c_double(interval))
src/s/h/shapely-3k-HEAD/shapely/geometry/linestring.py shapely-3k(Download)
""" Line strings. """ from ctypes import byref, c_double, c_int, cast, POINTER, pointer from ctypes import ArgumentError
# add to coordinate sequence
for i in range(m):
dx = c_double(cp[n*i])
dy = c_double(cp[n*i+1])
dz = None
if n == 3:
try:
dz = c_double(cp[n*i+2])
# add to coordinate sequence
for i in range(m):
coords = ob[i]
dx = c_double(coords[0])
dy = c_double(coords[1])
dz = None
if n == 3:
try:
dz = c_double(coords[2])
src/s/h/shapely-HEAD/shapely/geometry/point.py shapely(Download)
"""Points and related utilities """ from ctypes import c_double from ctypes import cast, POINTER from shapely.geos import lgeos, DimensionError
if type(da) == type((0,)):
cdata = da[0]
cp = cast(cdata, POINTER(c_double))
dx = c_double(cp[0])
dy = c_double(cp[1])
if n == 3:
dz = c_double(cp[2])
else:
coords = ob
n = len(coords)
dx = c_double(coords[0])
dy = c_double(coords[1])
dz = None
if n == 3:
dz = c_double(coords[2])
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next