From c5dbb6a88447b0b71fd6150969334bebf467035f Mon Sep 17 00:00:00 2001 From: chuan Date: Thu, 4 Dec 2025 17:17:09 +0800 Subject: [PATCH] 1 --- .gitignore | 728 +++ andor-test/01_init_and_discover.py | 202 +- pylablib/Andor/AndorSDK2.py | 1091 ---- pylablib/Andor/AndorSDK3.py | 832 --- pylablib/Andor/Shamrock.py | 560 -- pylablib/Andor/ShamrockCIF_defs.py | 518 -- pylablib/Andor/ShamrockCIF_lib.py | 254 - pylablib/Andor/__init__.py | 6 - pylablib/Andor/atcore_defs.py | 266 - pylablib/Andor/atcore_features.py | 171 - pylablib/Andor/atcore_lib.py | 238 - pylablib/Andor/atmcd32d_defs.py | 2070 -------- pylablib/Andor/atmcd32d_lib.py | 709 --- pylablib/Andor/base.py | 10 - pylablib/Andor/utils.c | 7747 ---------------------------- pylablib/Andor/utils.pyx | 43 - 16 files changed, 884 insertions(+), 14561 deletions(-) delete mode 100644 pylablib/Andor/AndorSDK2.py delete mode 100644 pylablib/Andor/AndorSDK3.py delete mode 100644 pylablib/Andor/Shamrock.py delete mode 100644 pylablib/Andor/ShamrockCIF_defs.py delete mode 100644 pylablib/Andor/ShamrockCIF_lib.py delete mode 100644 pylablib/Andor/__init__.py delete mode 100644 pylablib/Andor/atcore_defs.py delete mode 100644 pylablib/Andor/atcore_features.py delete mode 100644 pylablib/Andor/atcore_lib.py delete mode 100644 pylablib/Andor/atmcd32d_defs.py delete mode 100644 pylablib/Andor/atmcd32d_lib.py delete mode 100644 pylablib/Andor/base.py delete mode 100644 pylablib/Andor/utils.c delete mode 100644 pylablib/Andor/utils.pyx diff --git a/.gitignore b/.gitignore index f96cfe9..90a35cc 100644 --- a/.gitignore +++ b/.gitignore @@ -299,3 +299,731 @@ test.xml /docs/source/05_reference/_autosummary /docs/source/05_reference/_autosummary codex.md +pylablib/.gitignore +pylablib/.pylintdict +pylablib/.pylintrc +pylablib/.readthedocs.yaml +pylablib/build_distrib.py +pylablib/LICENSE +pylablib/MANIFEST.in +pylablib/README.md +pylablib/setup.py +pylablib/tox.ini +pylablib/Andor/__init__.py +pylablib/Andor/AndorSDK2.py +pylablib/Andor/AndorSDK3.py +pylablib/Andor/atcore_defs.py +pylablib/Andor/atcore_features.py +pylablib/Andor/atcore_lib.py +pylablib/Andor/atmcd32d_defs.py +pylablib/Andor/atmcd32d_lib.py +pylablib/Andor/base.py +pylablib/Andor/Shamrock.py +pylablib/Andor/ShamrockCIF_defs.py +pylablib/Andor/ShamrockCIF_lib.py +pylablib/Andor/utils.c +pylablib/Andor/utils.pyx +pylablib/docs/.autodoc_ignore +pylablib/docs/.skipped_apidoc +pylablib/docs/.sphinxdict +pylablib/docs/apidoc_noautogen.py +pylablib/docs/changelog.rst +pylablib/docs/conf.py +pylablib/docs/dataproc.rst +pylablib/docs/index.rst +pylablib/docs/install.rst +pylablib/docs/make-sphinx.py +pylablib/docs/misc_utils.rst +pylablib/docs/requirements-rtd.txt +pylablib/docs/storage.rst +pylablib/docs/.apidoc/modules.rst +pylablib/docs/.apidoc/pylablib.core.dataproc.rst +pylablib/docs/.apidoc/pylablib.core.devio.rst +pylablib/docs/.apidoc/pylablib.core.fileio.rst +pylablib/docs/.apidoc/pylablib.core.gui.rst +pylablib/docs/.apidoc/pylablib.core.gui.widgets.rst +pylablib/docs/.apidoc/pylablib.core.rst +pylablib/docs/.apidoc/pylablib.core.thread.rst +pylablib/docs/.apidoc/pylablib.core.utils.rst +pylablib/docs/.apidoc/pylablib.devices.Agilent.rst +pylablib/docs/.apidoc/pylablib.devices.AlliedVision.rst +pylablib/docs/.apidoc/pylablib.devices.Andor.rst +pylablib/docs/.apidoc/pylablib.devices.Arcus.rst +pylablib/docs/.apidoc/pylablib.devices.Arduino.rst +pylablib/docs/.apidoc/pylablib.devices.Attocube.rst +pylablib/docs/.apidoc/pylablib.devices.AWG.rst +pylablib/docs/.apidoc/pylablib.devices.Basler.rst +pylablib/docs/.apidoc/pylablib.devices.BitFlow.rst +pylablib/docs/.apidoc/pylablib.devices.Conrad.rst +pylablib/docs/.apidoc/pylablib.devices.Cryocon.rst +pylablib/docs/.apidoc/pylablib.devices.Cryomagnetics.rst +pylablib/docs/.apidoc/pylablib.devices.DCAM.rst +pylablib/docs/.apidoc/pylablib.devices.ElektroAutomatik.rst +pylablib/docs/.apidoc/pylablib.devices.HighFinesse.rst +pylablib/docs/.apidoc/pylablib.devices.Hubner.rst +pylablib/docs/.apidoc/pylablib.devices.IMAQ.rst +pylablib/docs/.apidoc/pylablib.devices.IMAQdx.rst +pylablib/docs/.apidoc/pylablib.devices.interface.rst +pylablib/docs/.apidoc/pylablib.devices.Keithley.rst +pylablib/docs/.apidoc/pylablib.devices.KJL.rst +pylablib/docs/.apidoc/pylablib.devices.Lakeshore.rst +pylablib/docs/.apidoc/pylablib.devices.LaserQuantum.rst +pylablib/docs/.apidoc/pylablib.devices.Leybold.rst +pylablib/docs/.apidoc/pylablib.devices.LighthousePhotonics.rst +pylablib/docs/.apidoc/pylablib.devices.Lumel.rst +pylablib/docs/.apidoc/pylablib.devices.M2.rst +pylablib/docs/.apidoc/pylablib.devices.Mightex.rst +pylablib/docs/.apidoc/pylablib.devices.Modbus.rst +pylablib/docs/.apidoc/pylablib.devices.Newport.rst +pylablib/docs/.apidoc/pylablib.devices.NI.rst +pylablib/docs/.apidoc/pylablib.devices.NKT.rst +pylablib/docs/.apidoc/pylablib.devices.Omron.rst +pylablib/docs/.apidoc/pylablib.devices.Ophir.rst +pylablib/docs/.apidoc/pylablib.devices.OZOptics.rst +pylablib/docs/.apidoc/pylablib.devices.PCO.rst +pylablib/docs/.apidoc/pylablib.devices.Pfeiffer.rst +pylablib/docs/.apidoc/pylablib.devices.Photometrics.rst +pylablib/docs/.apidoc/pylablib.devices.PhotonFocus.rst +pylablib/docs/.apidoc/pylablib.devices.PhysikInstrumente.rst +pylablib/docs/.apidoc/pylablib.devices.PrincetonInstruments.rst +pylablib/docs/.apidoc/pylablib.devices.Rigol.rst +pylablib/docs/.apidoc/pylablib.devices.rst +pylablib/docs/.apidoc/pylablib.devices.SiliconSoftware.rst +pylablib/docs/.apidoc/pylablib.devices.Sirah.rst +pylablib/docs/.apidoc/pylablib.devices.SmarAct.rst +pylablib/docs/.apidoc/pylablib.devices.Standa.rst +pylablib/docs/.apidoc/pylablib.devices.Tektronix.rst +pylablib/docs/.apidoc/pylablib.devices.Thorlabs.rst +pylablib/docs/.apidoc/pylablib.devices.Toptica.rst +pylablib/docs/.apidoc/pylablib.devices.Trinamic.rst +pylablib/docs/.apidoc/pylablib.devices.uc480.rst +pylablib/docs/.apidoc/pylablib.devices.utils.rst +pylablib/docs/.apidoc/pylablib.devices.Voltcraft.rst +pylablib/docs/.apidoc/pylablib.devices.Windows.rst +pylablib/docs/.apidoc/pylablib.rst +pylablib/docs/devices/Agilent.rst +pylablib/docs/devices/all_devices_list.txt +pylablib/docs/devices/AlliedVision.rst +pylablib/docs/devices/Andor.rst +pylablib/docs/devices/AndorShamrock.rst +pylablib/docs/devices/Arcus_performax.rst +pylablib/docs/devices/Attocube.rst +pylablib/docs/devices/basic_lasers.rst +pylablib/docs/devices/basic_sensors_basics.rst +pylablib/docs/devices/basic_sensors_list.txt +pylablib/docs/devices/basic_sensors_root.rst +pylablib/docs/devices/Basler.rst +pylablib/docs/devices/BitFlow.rst +pylablib/docs/devices/cameras_basics.rst +pylablib/docs/devices/cameras_list.txt +pylablib/docs/devices/cameras_root.rst +pylablib/docs/devices/Cryocon.rst +pylablib/docs/devices/Cryomagnetics.rst +pylablib/docs/devices/DCAM.rst +pylablib/docs/devices/devices_basics.rst +pylablib/docs/devices/devices_root.rst +pylablib/docs/devices/ElektroAutomatik.rst +pylablib/docs/devices/generic_awgs.rst +pylablib/docs/devices/HighFinesse.rst +pylablib/docs/devices/Hubner.rst +pylablib/docs/devices/IMAQ.rst +pylablib/docs/devices/IMAQdx.rst +pylablib/docs/devices/Keithley.rst +pylablib/docs/devices/KJL.rst +pylablib/docs/devices/Lakeshore.rst +pylablib/docs/devices/Leybold.rst +pylablib/docs/devices/Lumel.rst +pylablib/docs/devices/M2.rst +pylablib/docs/devices/Mightex.rst +pylablib/docs/devices/misc_devices.rst +pylablib/docs/devices/Newport_picomotor.rst +pylablib/docs/devices/nidaq.rst +pylablib/docs/devices/NKT.rst +pylablib/docs/devices/Omron.rst +pylablib/docs/devices/Ophir.rst +pylablib/docs/devices/OZOptics.rst +pylablib/docs/devices/PCO_SC2.rst +pylablib/docs/devices/Pfeiffer.rst +pylablib/docs/devices/PhotonFocus.rst +pylablib/docs/devices/PhysikInstrumente.rst +pylablib/docs/devices/Picam.rst +pylablib/docs/devices/protocols.rst +pylablib/docs/devices/Pvcam.rst +pylablib/docs/devices/Rigol.rst +pylablib/docs/devices/SiliconSoftware.rst +pylablib/docs/devices/Sirah.rst +pylablib/docs/devices/SmarAct.rst +pylablib/docs/devices/stages_basics.rst +pylablib/docs/devices/stages_list.txt +pylablib/docs/devices/stages_root.rst +pylablib/docs/devices/Standa.rst +pylablib/docs/devices/Tektronix.rst +pylablib/docs/devices/Thorlabs_elliptec.rst +pylablib/docs/devices/Thorlabs_kinesis.rst +pylablib/docs/devices/Thorlabs_misc.rst +pylablib/docs/devices/Thorlabs_pm.rst +pylablib/docs/devices/Thorlabs_TLCamera.rst +pylablib/docs/devices/Toptica.rst +pylablib/docs/devices/Trinamic.rst +pylablib/docs/devices/uc480.rst +pylablib/docs/devices/Voltcraft.rst +pylablib/docs/devices/Windows.rst +pylablib/pylablib/__init__.py +pylablib/pylablib/__main__.py +pylablib/pylablib/aux_libs.py +pylablib/pylablib/widgets.py +pylablib/pylablib/core/__init__.py +pylablib/pylablib/core/dataproc/__export__.py +pylablib/pylablib/core/dataproc/__init__.py +pylablib/pylablib/core/dataproc/callable.py +pylablib/pylablib/core/dataproc/ctransform_fallback.py +pylablib/pylablib/core/dataproc/ctransform.c +pylablib/pylablib/core/dataproc/ctransform.pyx +pylablib/pylablib/core/dataproc/feature.py +pylablib/pylablib/core/dataproc/filters.py +pylablib/pylablib/core/dataproc/fitting.py +pylablib/pylablib/core/dataproc/fourier.py +pylablib/pylablib/core/dataproc/iir_transform.py +pylablib/pylablib/core/dataproc/image.py +pylablib/pylablib/core/dataproc/interpolate.py +pylablib/pylablib/core/dataproc/specfunc.py +pylablib/pylablib/core/dataproc/table_wrap.py +pylablib/pylablib/core/dataproc/transform.py +pylablib/pylablib/core/dataproc/utils.py +pylablib/pylablib/core/devio/__export__.py +pylablib/pylablib/core/devio/__init__.py +pylablib/pylablib/core/devio/backend_logger.py +pylablib/pylablib/core/devio/base.py +pylablib/pylablib/core/devio/comm_backend.py +pylablib/pylablib/core/devio/data_format.py +pylablib/pylablib/core/devio/hid_base.py +pylablib/pylablib/core/devio/hid_lib.py +pylablib/pylablib/core/devio/hid.py +pylablib/pylablib/core/devio/interface.py +pylablib/pylablib/core/devio/SCPI.py +pylablib/pylablib/core/fileio/__export__.py +pylablib/pylablib/core/fileio/__init__.py +pylablib/pylablib/core/fileio/bin_transform.py +pylablib/pylablib/core/fileio/datafile.py +pylablib/pylablib/core/fileio/dict_entry.py +pylablib/pylablib/core/fileio/loadfile_utils.py +pylablib/pylablib/core/fileio/loadfile.py +pylablib/pylablib/core/fileio/location.py +pylablib/pylablib/core/fileio/parse_csv.py +pylablib/pylablib/core/fileio/savefile.py +pylablib/pylablib/core/fileio/table_stream.py +pylablib/pylablib/core/gui/__export__.py +pylablib/pylablib/core/gui/__init__.py +pylablib/pylablib/core/gui/formatter.py +pylablib/pylablib/core/gui/limiter.py +pylablib/pylablib/core/gui/utils.py +pylablib/pylablib/core/gui/value_handling.py +pylablib/pylablib/core/gui/widgets/__export__.py +pylablib/pylablib/core/gui/widgets/__init__.py +pylablib/pylablib/core/gui/widgets/button_selector.py +pylablib/pylablib/core/gui/widgets/button.py +pylablib/pylablib/core/gui/widgets/combo_box.py +pylablib/pylablib/core/gui/widgets/container.py +pylablib/pylablib/core/gui/widgets/edit.py +pylablib/pylablib/core/gui/widgets/label.py +pylablib/pylablib/core/gui/widgets/layout_manager.py +pylablib/pylablib/core/gui/widgets/param_table.py +pylablib/pylablib/core/thread/__export__.py +pylablib/pylablib/core/thread/__init__.py +pylablib/pylablib/core/thread/callsync.py +pylablib/pylablib/core/thread/controller.py +pylablib/pylablib/core/thread/multicast_pool.py +pylablib/pylablib/core/thread/notifier.py +pylablib/pylablib/core/thread/profile.py +pylablib/pylablib/core/thread/synchronizing.py +pylablib/pylablib/core/thread/threadprop.py +pylablib/pylablib/core/thread/utils.py +pylablib/pylablib/core/utils/__export__.py +pylablib/pylablib/core/utils/__init__.py +pylablib/pylablib/core/utils/array_utils.py +pylablib/pylablib/core/utils/cext_tools.py +pylablib/pylablib/core/utils/crc.py +pylablib/pylablib/core/utils/ctypes_tools.py +pylablib/pylablib/core/utils/ctypes_wrap.py +pylablib/pylablib/core/utils/dictionary.py +pylablib/pylablib/core/utils/files.py +pylablib/pylablib/core/utils/funcargparse.py +pylablib/pylablib/core/utils/functions.py +pylablib/pylablib/core/utils/general.py +pylablib/pylablib/core/utils/indexing.py +pylablib/pylablib/core/utils/ipc.py +pylablib/pylablib/core/utils/library_parameters.py +pylablib/pylablib/core/utils/module.py +pylablib/pylablib/core/utils/nbtools.py +pylablib/pylablib/core/utils/net.py +pylablib/pylablib/core/utils/numerical.py +pylablib/pylablib/core/utils/observer_pool.py +pylablib/pylablib/core/utils/py3.py +pylablib/pylablib/core/utils/rpyc_utils.py +pylablib/pylablib/core/utils/strdump.py +pylablib/pylablib/core/utils/string.py +pylablib/pylablib/core/utils/strpack.py +pylablib/pylablib/core/utils/units.py +pylablib/pylablib/devices/__init__.py +pylablib/pylablib/devices/AWG/__init__.py +pylablib/pylablib/devices/AWG/generic.py +pylablib/pylablib/devices/AWG/specific.py +pylablib/pylablib/devices/Agilent/__init__.py +pylablib/pylablib/devices/Agilent/base.py +pylablib/pylablib/devices/Agilent/pressure.py +pylablib/pylablib/devices/Agilent/vna.py +pylablib/pylablib/devices/AlliedVision/__init__.py +pylablib/pylablib/devices/AlliedVision/Bonito.py +pylablib/pylablib/devices/Andor/__init__.py +pylablib/pylablib/devices/Andor/AndorSDK2.py +pylablib/pylablib/devices/Andor/AndorSDK3.py +pylablib/pylablib/devices/Andor/atcore_defs.py +pylablib/pylablib/devices/Andor/atcore_features.py +pylablib/pylablib/devices/Andor/atcore_lib.py +pylablib/pylablib/devices/Andor/atmcd32d_defs.py +pylablib/pylablib/devices/Andor/atmcd32d_lib.py +pylablib/pylablib/devices/Andor/base.py +pylablib/pylablib/devices/Andor/Shamrock.py +pylablib/pylablib/devices/Andor/ShamrockCIF_defs.py +pylablib/pylablib/devices/Andor/ShamrockCIF_lib.py +pylablib/pylablib/devices/Andor/utils.c +pylablib/pylablib/devices/Andor/utils.pyx +pylablib/pylablib/devices/Arcus/__init__.py +pylablib/pylablib/devices/Arcus/ArcusPerformaxDriver_defs.py +pylablib/pylablib/devices/Arcus/ArcusPerformaxDriver_lib.py +pylablib/pylablib/devices/Arcus/base.py +pylablib/pylablib/devices/Arcus/performax.py +pylablib/pylablib/devices/Arduino/__init__.py +pylablib/pylablib/devices/Arduino/base.py +pylablib/pylablib/devices/Attocube/__init__.py +pylablib/pylablib/devices/Attocube/anc300.py +pylablib/pylablib/devices/Attocube/anc350.py +pylablib/pylablib/devices/Attocube/base.py +pylablib/pylablib/devices/Basler/__init__.py +pylablib/pylablib/devices/Basler/pylon.py +pylablib/pylablib/devices/Basler/pylonC_defs.py +pylablib/pylablib/devices/Basler/pylonC_lib.py +pylablib/pylablib/devices/Basler/utils.c +pylablib/pylablib/devices/Basler/utils.pyx +pylablib/pylablib/devices/BitFlow/__init__.py +pylablib/pylablib/devices/BitFlow/BitFlow.py +pylablib/pylablib/devices/Conrad/__init__.py +pylablib/pylablib/devices/Conrad/base.py +pylablib/pylablib/devices/Cryocon/__init__.py +pylablib/pylablib/devices/Cryocon/base.py +pylablib/pylablib/devices/Cryomagnetics/__init__.py +pylablib/pylablib/devices/Cryomagnetics/base.py +pylablib/pylablib/devices/DCAM/__init__.py +pylablib/pylablib/devices/DCAM/DCAM.py +pylablib/pylablib/devices/DCAM/dcamapi4_defs.py +pylablib/pylablib/devices/DCAM/dcamapi4_lib.py +pylablib/pylablib/devices/DCAM/dcamprop_defs.py +pylablib/pylablib/devices/ElektroAutomatik/__init__.py +pylablib/pylablib/devices/ElektroAutomatik/base.py +pylablib/pylablib/devices/HighFinesse/__init__.py +pylablib/pylablib/devices/HighFinesse/wlm.py +pylablib/pylablib/devices/HighFinesse/wlmData_defs.py +pylablib/pylablib/devices/HighFinesse/wlmData_lib.py +pylablib/pylablib/devices/Hubner/__init__.py +pylablib/pylablib/devices/Hubner/base.py +pylablib/pylablib/devices/Hubner/Cobolt.py +pylablib/pylablib/devices/IMAQ/__init__.py +pylablib/pylablib/devices/IMAQ/IMAQ.py +pylablib/pylablib/devices/IMAQ/niimaq_attrtypes.py +pylablib/pylablib/devices/IMAQ/niimaq_defs.py +pylablib/pylablib/devices/IMAQ/niimaq_lib.py +pylablib/pylablib/devices/IMAQdx/__init__.py +pylablib/pylablib/devices/IMAQdx/IMAQdx.py +pylablib/pylablib/devices/IMAQdx/NIIMAQdx_defs.py +pylablib/pylablib/devices/IMAQdx/NIIMAQdx_lib.py +pylablib/pylablib/devices/IMAQdx/nivision_defs.py +pylablib/pylablib/devices/IMAQdx/utils.c +pylablib/pylablib/devices/IMAQdx/utils.pyx +pylablib/pylablib/devices/KJL/__init__.py +pylablib/pylablib/devices/KJL/base.py +pylablib/pylablib/devices/Keithley/__init__.py +pylablib/pylablib/devices/Keithley/base.py +pylablib/pylablib/devices/Keithley/multimeter.py +pylablib/pylablib/devices/Lakeshore/__init__.py +pylablib/pylablib/devices/Lakeshore/base.py +pylablib/pylablib/devices/LaserQuantum/__init__.py +pylablib/pylablib/devices/LaserQuantum/base.py +pylablib/pylablib/devices/Leybold/__init__.py +pylablib/pylablib/devices/Leybold/base.py +pylablib/pylablib/devices/LighthousePhotonics/__init__.py +pylablib/pylablib/devices/LighthousePhotonics/base.py +pylablib/pylablib/devices/Lumel/__init__.py +pylablib/pylablib/devices/Lumel/base.py +pylablib/pylablib/devices/M2/__init__.py +pylablib/pylablib/devices/M2/base.py +pylablib/pylablib/devices/M2/emm.py +pylablib/pylablib/devices/M2/solstis.py +pylablib/pylablib/devices/Mightex/__init__.py +pylablib/pylablib/devices/Mightex/base.py +pylablib/pylablib/devices/Mightex/MightexSSeries.py +pylablib/pylablib/devices/Mightex/NewClassic_USBCamera_SDK_defs.py +pylablib/pylablib/devices/Mightex/NewClassic_USBCamera_SDK_lib.py +pylablib/pylablib/devices/Modbus/__init__.py +pylablib/pylablib/devices/Modbus/modbus.py +pylablib/pylablib/devices/NI/__init__.py +pylablib/pylablib/devices/NI/daq.py +pylablib/pylablib/devices/NKT/__init__.py +pylablib/pylablib/devices/NKT/interbus.py +pylablib/pylablib/devices/Newport/__init__.py +pylablib/pylablib/devices/Newport/base.py +pylablib/pylablib/devices/Newport/picomotor.py +pylablib/pylablib/devices/OZOptics/__init__.py +pylablib/pylablib/devices/OZOptics/base.py +pylablib/pylablib/devices/Omron/__init__.py +pylablib/pylablib/devices/Omron/base.py +pylablib/pylablib/devices/Ophir/__init__.py +pylablib/pylablib/devices/Ophir/base.py +pylablib/pylablib/devices/PCO/__init__.py +pylablib/pylablib/devices/PCO/PCO_err_defs.py +pylablib/pylablib/devices/PCO/sc2_camexport_defs.py +pylablib/pylablib/devices/PCO/sc2_camexport_lib.py +pylablib/pylablib/devices/PCO/sc2_defs_defs.py +pylablib/pylablib/devices/PCO/sc2_sdkstructures_defs.py +pylablib/pylablib/devices/PCO/SC2.py +pylablib/pylablib/devices/PCO/utils.c +pylablib/pylablib/devices/PCO/utils.pyx +pylablib/pylablib/devices/Pfeiffer/__init__.py +pylablib/pylablib/devices/Pfeiffer/base.py +pylablib/pylablib/devices/Photometrics/__init__.py +pylablib/pylablib/devices/Photometrics/pvcam_defs.py +pylablib/pylablib/devices/Photometrics/pvcam_lib.py +pylablib/pylablib/devices/Photometrics/pvcam.py +pylablib/pylablib/devices/PhotonFocus/__init__.py +pylablib/pylablib/devices/PhotonFocus/pfcam_defs.py +pylablib/pylablib/devices/PhotonFocus/pfcam_lib.py +pylablib/pylablib/devices/PhotonFocus/PhotonFocus.py +pylablib/pylablib/devices/PhysikInstrumente/__init__.py +pylablib/pylablib/devices/PhysikInstrumente/base.py +pylablib/pylablib/devices/PrincetonInstruments/__init__.py +pylablib/pylablib/devices/PrincetonInstruments/picam_defs.py +pylablib/pylablib/devices/PrincetonInstruments/picam_lib.py +pylablib/pylablib/devices/PrincetonInstruments/picam.py +pylablib/pylablib/devices/Rigol/__init__.py +pylablib/pylablib/devices/Rigol/base.py +pylablib/pylablib/devices/Rigol/power_supply.py +pylablib/pylablib/devices/SiliconSoftware/__init__.py +pylablib/pylablib/devices/SiliconSoftware/fgrab_define_defs.py +pylablib/pylablib/devices/SiliconSoftware/fgrab_prototyp_defs.py +pylablib/pylablib/devices/SiliconSoftware/fgrab_prototyp_lib.py +pylablib/pylablib/devices/SiliconSoftware/fgrab.py +pylablib/pylablib/devices/SiliconSoftware/utils.c +pylablib/pylablib/devices/SiliconSoftware/utils.pyx +pylablib/pylablib/devices/Sirah/__init__.py +pylablib/pylablib/devices/Sirah/base.py +pylablib/pylablib/devices/Sirah/Matisse.py +pylablib/pylablib/devices/Sirah/tuner.py +pylablib/pylablib/devices/SmarAct/__init__.py +pylablib/pylablib/devices/SmarAct/base.py +pylablib/pylablib/devices/SmarAct/MCS2.py +pylablib/pylablib/devices/SmarAct/scu3d.py +pylablib/pylablib/devices/SmarAct/SCU3DControl_defs.py +pylablib/pylablib/devices/SmarAct/SCU3DControl_lib.py +pylablib/pylablib/devices/SmarAct/SmarActControl_defs.py +pylablib/pylablib/devices/SmarAct/SmarActControl_lib.py +pylablib/pylablib/devices/Standa/__init__.py +pylablib/pylablib/devices/Standa/base.py +pylablib/pylablib/devices/Tektronix/__init__.py +pylablib/pylablib/devices/Tektronix/base.py +pylablib/pylablib/devices/Thorlabs/__init__.py +pylablib/pylablib/devices/Thorlabs/base.py +pylablib/pylablib/devices/Thorlabs/elliptec.py +pylablib/pylablib/devices/Thorlabs/kinesis.py +pylablib/pylablib/devices/Thorlabs/misc.py +pylablib/pylablib/devices/Thorlabs/serial.py +pylablib/pylablib/devices/Thorlabs/tl_camera_sdk_defs.py +pylablib/pylablib/devices/Thorlabs/tl_camera_sdk_lib.py +pylablib/pylablib/devices/Thorlabs/TLCamera.py +pylablib/pylablib/devices/Toptica/__init__.py +pylablib/pylablib/devices/Toptica/base.py +pylablib/pylablib/devices/Toptica/ibeam.py +pylablib/pylablib/devices/Trinamic/__init__.py +pylablib/pylablib/devices/Trinamic/base.py +pylablib/pylablib/devices/Voltcraft/__init__.py +pylablib/pylablib/devices/Voltcraft/base.py +pylablib/pylablib/devices/Voltcraft/multimeter.py +pylablib/pylablib/devices/Windows/__init__.py +pylablib/pylablib/devices/Windows/joystick.py +pylablib/pylablib/devices/Windows/winmm_lib.py +pylablib/pylablib/devices/interface/__init__.py +pylablib/pylablib/devices/interface/camera.py +pylablib/pylablib/devices/interface/stage.py +pylablib/pylablib/devices/uc480/__init__.py +pylablib/pylablib/devices/uc480/uc480_defs.py +pylablib/pylablib/devices/uc480/uc480_lib.py +pylablib/pylablib/devices/uc480/uc480.py +pylablib/pylablib/devices/utils/__init__.py +pylablib/pylablib/devices/utils/color.py +pylablib/pylablib/devices/utils/load_lib.py +pylablib/pylablib/gui/__init__.py +pylablib/pylablib/gui/widgets/__export__.py +pylablib/pylablib/gui/widgets/__init__.py +pylablib/pylablib/gui/widgets/highlighter.py +pylablib/pylablib/gui/widgets/range_controls.py +pylablib/pylablib/gui/widgets/plotters/__init__.py +pylablib/pylablib/gui/widgets/plotters/image_plotter.py +pylablib/pylablib/gui/widgets/plotters/line_plotter.py +pylablib/pylablib/gui/widgets/plotters/mpl_plotter.py +pylablib/pylablib/gui/widgets/plotters/trace_plotter.py +pylablib/pylablib/legacy/__init__.py +pylablib/pylablib/legacy/deploy.py +pylablib/pylablib/legacy/aux_libs/__init__.py +pylablib/pylablib/legacy/aux_libs/devices/__init__.py +pylablib/pylablib/legacy/aux_libs/devices/AgilentElectronics.py +pylablib/pylablib/legacy/aux_libs/devices/AgilentLasers.py +pylablib/pylablib/legacy/aux_libs/devices/Andor_lib.py +pylablib/pylablib/legacy/aux_libs/devices/Andor.py +pylablib/pylablib/legacy/aux_libs/devices/AndorSDK3_lib.py +pylablib/pylablib/legacy/aux_libs/devices/AndorShamrock_lib.py +pylablib/pylablib/legacy/aux_libs/devices/AndorShamrock.py +pylablib/pylablib/legacy/aux_libs/devices/Arcus.py +pylablib/pylablib/legacy/aux_libs/devices/Arduino.py +pylablib/pylablib/legacy/aux_libs/devices/Attocube.py +pylablib/pylablib/legacy/aux_libs/devices/Cryomagnetics.py +pylablib/pylablib/legacy/aux_libs/devices/DCAM_lib_const.py +pylablib/pylablib/legacy/aux_libs/devices/DCAM_lib.py +pylablib/pylablib/legacy/aux_libs/devices/DCAM.py +pylablib/pylablib/legacy/aux_libs/devices/device_manager.py +pylablib/pylablib/legacy/aux_libs/devices/HighFinesse.py +pylablib/pylablib/legacy/aux_libs/devices/IMAQ_lib_const.py +pylablib/pylablib/legacy/aux_libs/devices/IMAQ_lib.py +pylablib/pylablib/legacy/aux_libs/devices/IMAQ.py +pylablib/pylablib/legacy/aux_libs/devices/IMAQdx_lib.py +pylablib/pylablib/legacy/aux_libs/devices/IMAQdx.py +pylablib/pylablib/legacy/aux_libs/devices/interfaces.py +pylablib/pylablib/legacy/aux_libs/devices/Lakeshore.py +pylablib/pylablib/legacy/aux_libs/devices/LaserQuantum.py +pylablib/pylablib/legacy/aux_libs/devices/LighthousePhotonics.py +pylablib/pylablib/legacy/aux_libs/devices/M2.py +pylablib/pylablib/legacy/aux_libs/devices/misc.py +pylablib/pylablib/legacy/aux_libs/devices/MKS.py +pylablib/pylablib/legacy/aux_libs/devices/NI.py +pylablib/pylablib/legacy/aux_libs/devices/NuPhoton.py +pylablib/pylablib/legacy/aux_libs/devices/Ophir.py +pylablib/pylablib/legacy/aux_libs/devices/OZOptics.py +pylablib/pylablib/legacy/aux_libs/devices/PCO_SC2_lib.py +pylablib/pylablib/legacy/aux_libs/devices/PCO_SC2.py +pylablib/pylablib/legacy/aux_libs/devices/pfcam_lib.py +pylablib/pylablib/legacy/aux_libs/devices/Pfeiffer.py +pylablib/pylablib/legacy/aux_libs/devices/PhotonFocus.py +pylablib/pylablib/legacy/aux_libs/devices/PurePhotonics.py +pylablib/pylablib/legacy/aux_libs/devices/Rigol.py +pylablib/pylablib/legacy/aux_libs/devices/Sirah.py +pylablib/pylablib/legacy/aux_libs/devices/SmarAct.py +pylablib/pylablib/legacy/aux_libs/devices/Tektronix.py +pylablib/pylablib/legacy/aux_libs/devices/Thorlabs.py +pylablib/pylablib/legacy/aux_libs/devices/Trinamic.py +pylablib/pylablib/legacy/aux_libs/devices/Vaunix.py +pylablib/pylablib/legacy/aux_libs/devices/ZurichInstruments.py +pylablib/pylablib/legacy/aux_libs/devices/libs/x32/place-32-bit-dlls-here.txt +pylablib/pylablib/legacy/aux_libs/devices/libs/x64/place-64-bit-dlls-here.txt +pylablib/pylablib/legacy/aux_libs/file_formats/__init__.py +pylablib/pylablib/legacy/aux_libs/file_formats/cam.py +pylablib/pylablib/legacy/aux_libs/file_formats/ecam.py +pylablib/pylablib/legacy/aux_libs/file_formats/waveguide.py +pylablib/pylablib/legacy/aux_libs/file_formats/zi.py +pylablib/pylablib/legacy/aux_libs/gui/__init__.py +pylablib/pylablib/legacy/aux_libs/gui/device_thread.py +pylablib/pylablib/legacy/aux_libs/gui/gui_contoller.py +pylablib/pylablib/legacy/aux_libs/gui/helpers.py +pylablib/pylablib/legacy/aux_libs/gui/script_thread.py +pylablib/pylablib/legacy/aux_libs/gui/widgets/__init__.py +pylablib/pylablib/legacy/aux_libs/gui/widgets/custom_controls.py +pylablib/pylablib/legacy/aux_libs/gui/widgets/image_plotter.py +pylablib/pylablib/legacy/aux_libs/gui/widgets/line_plotter.py +pylablib/pylablib/legacy/aux_libs/gui/widgets/param_table.py +pylablib/pylablib/legacy/aux_libs/gui/widgets/trace_plotter.py +pylablib/pylablib/legacy/core/__init__.py +pylablib/pylablib/legacy/core/version.py +pylablib/pylablib/legacy/core/dataproc/__init__.py +pylablib/pylablib/legacy/core/dataproc/callable.py +pylablib/pylablib/legacy/core/dataproc/feature.py +pylablib/pylablib/legacy/core/dataproc/filters.py +pylablib/pylablib/legacy/core/dataproc/fitting.py +pylablib/pylablib/legacy/core/dataproc/fourier.py +pylablib/pylablib/legacy/core/dataproc/iir_transform.py +pylablib/pylablib/legacy/core/dataproc/image.py +pylablib/pylablib/legacy/core/dataproc/interpolate.py +pylablib/pylablib/legacy/core/dataproc/specfunc.py +pylablib/pylablib/legacy/core/dataproc/waveforms.py +pylablib/pylablib/legacy/core/datatable/__init__.py +pylablib/pylablib/legacy/core/datatable/column.py +pylablib/pylablib/legacy/core/datatable/datatable_utils.py +pylablib/pylablib/legacy/core/datatable/indexing.py +pylablib/pylablib/legacy/core/datatable/table_storage.py +pylablib/pylablib/legacy/core/datatable/table.py +pylablib/pylablib/legacy/core/datatable/wrapping.py +pylablib/pylablib/legacy/core/devio/__init__.py +pylablib/pylablib/legacy/core/devio/backend.py +pylablib/pylablib/legacy/core/devio/data_format.py +pylablib/pylablib/legacy/core/devio/interface.py +pylablib/pylablib/legacy/core/devio/SCPI.py +pylablib/pylablib/legacy/core/devio/units.py +pylablib/pylablib/legacy/core/fileio/__init__.py +pylablib/pylablib/legacy/core/fileio/binio.py +pylablib/pylablib/legacy/core/fileio/datafile.py +pylablib/pylablib/legacy/core/fileio/dict_entry.py +pylablib/pylablib/legacy/core/fileio/loadfile.py +pylablib/pylablib/legacy/core/fileio/location.py +pylablib/pylablib/legacy/core/fileio/logfile.py +pylablib/pylablib/legacy/core/fileio/parse_csv.py +pylablib/pylablib/legacy/core/fileio/savefile.py +pylablib/pylablib/legacy/core/gui/__init__.py +pylablib/pylablib/legacy/core/gui/format.py +pylablib/pylablib/legacy/core/gui/limit.py +pylablib/pylablib/legacy/core/gui/qt/__init__.py +pylablib/pylablib/legacy/core/gui/qt/utils.py +pylablib/pylablib/legacy/core/gui/qt/values.py +pylablib/pylablib/legacy/core/gui/qt/thread/__init__.py +pylablib/pylablib/legacy/core/gui/qt/thread/callsync.py +pylablib/pylablib/legacy/core/gui/qt/thread/controller.py +pylablib/pylablib/legacy/core/gui/qt/thread/mthread.py +pylablib/pylablib/legacy/core/gui/qt/thread/signal_pool.py +pylablib/pylablib/legacy/core/gui/qt/thread/synchronizing.py +pylablib/pylablib/legacy/core/gui/qt/thread/threadprop.py +pylablib/pylablib/legacy/core/gui/qt/widgets/__init__.py +pylablib/pylablib/legacy/core/gui/qt/widgets/edit.py +pylablib/pylablib/legacy/core/gui/qt/widgets/label.py +pylablib/pylablib/legacy/core/gui/qt/widgets/plot.py +pylablib/pylablib/legacy/core/mthread/__init__.py +pylablib/pylablib/legacy/core/mthread/controller.py +pylablib/pylablib/legacy/core/mthread/message_queue.py +pylablib/pylablib/legacy/core/mthread/message.py +pylablib/pylablib/legacy/core/mthread/notifier.py +pylablib/pylablib/legacy/core/mthread/sync_primitives.py +pylablib/pylablib/legacy/core/mthread/tag_queue.py +pylablib/pylablib/legacy/core/mthread/threadprop.py +pylablib/pylablib/legacy/core/utils/__init__.py +pylablib/pylablib/legacy/core/utils/ctypes_wrap.py +pylablib/pylablib/legacy/core/utils/dictionary.py +pylablib/pylablib/legacy/core/utils/files.py +pylablib/pylablib/legacy/core/utils/funcargparse.py +pylablib/pylablib/legacy/core/utils/functions.py +pylablib/pylablib/legacy/core/utils/general.py +pylablib/pylablib/legacy/core/utils/ipc.py +pylablib/pylablib/legacy/core/utils/iterator.py +pylablib/pylablib/legacy/core/utils/library_parameters.py +pylablib/pylablib/legacy/core/utils/log.py +pylablib/pylablib/legacy/core/utils/module.py +pylablib/pylablib/legacy/core/utils/net.py +pylablib/pylablib/legacy/core/utils/numclass.py +pylablib/pylablib/legacy/core/utils/numerical.py +pylablib/pylablib/legacy/core/utils/observer_pool.py +pylablib/pylablib/legacy/core/utils/plotting.py +pylablib/pylablib/legacy/core/utils/pstorage.py +pylablib/pylablib/legacy/core/utils/py3.py +pylablib/pylablib/legacy/core/utils/rpyc.py +pylablib/pylablib/legacy/core/utils/serializable.py +pylablib/pylablib/legacy/core/utils/strdump.py +pylablib/pylablib/legacy/core/utils/string.py +pylablib/pylablib/legacy/core/utils/strpack.py +pylablib/pylablib/legacy/core/utils/thread.py +pylablib/pylablib/legacy/core/utils/versioning.py +pylablib/pylablib/misc/__init__.py +pylablib/pylablib/misc/file_formats/__init__.py +pylablib/pylablib/misc/file_formats/cam.py +pylablib/pylablib/thread/__init__.py +pylablib/pylablib/thread/device_thread.py +pylablib/pylablib/thread/script_thread.py +pylablib/pylablib/thread/settings_manager.py +pylablib/pylablib/thread/devices/__init__.py +pylablib/pylablib/thread/devices/Agilent/__init__.py +pylablib/pylablib/thread/devices/Agilent/pressure.py +pylablib/pylablib/thread/devices/AlliedVision/__init__.py +pylablib/pylablib/thread/devices/AlliedVision/Bonito.py +pylablib/pylablib/thread/devices/Andor/__init__.py +pylablib/pylablib/thread/devices/Andor/AndorSDK3.py +pylablib/pylablib/thread/devices/Andor/AndorSKD2.py +pylablib/pylablib/thread/devices/Andor/Shamrock.py +pylablib/pylablib/thread/devices/Arcus/__init__.py +pylablib/pylablib/thread/devices/Arcus/performax.py +pylablib/pylablib/thread/devices/Attocube/__init__.py +pylablib/pylablib/thread/devices/Attocube/anc300.py +pylablib/pylablib/thread/devices/Attocube/anc350.py +pylablib/pylablib/thread/devices/Basler/__init__.py +pylablib/pylablib/thread/devices/Basler/pylon.py +pylablib/pylablib/thread/devices/Cryocon/__init__.py +pylablib/pylablib/thread/devices/Cryocon/base.py +pylablib/pylablib/thread/devices/DCAM/__init__.py +pylablib/pylablib/thread/devices/DCAM/DCAM.py +pylablib/pylablib/thread/devices/ElektroAutomatik/__init__.py +pylablib/pylablib/thread/devices/ElektroAutomatik/base.py +pylablib/pylablib/thread/devices/HighFinesse/__init__.py +pylablib/pylablib/thread/devices/HighFinesse/wlm.py +pylablib/pylablib/thread/devices/Hubner/__init__.py +pylablib/pylablib/thread/devices/Hubner/Cobolt.py +pylablib/pylablib/thread/devices/IMAQdx/__init__.py +pylablib/pylablib/thread/devices/IMAQdx/IMAQdx.py +pylablib/pylablib/thread/devices/KJL/__init__.py +pylablib/pylablib/thread/devices/KJL/base.py +pylablib/pylablib/thread/devices/Keithley/__init__.py +pylablib/pylablib/thread/devices/Keithley/multimeter.py +pylablib/pylablib/thread/devices/Lakeshore/__init__.py +pylablib/pylablib/thread/devices/Lakeshore/base.py +pylablib/pylablib/thread/devices/LaserQuantum/__init__.py +pylablib/pylablib/thread/devices/LaserQuantum/base.py +pylablib/pylablib/thread/devices/Leybold/__init__.py +pylablib/pylablib/thread/devices/Leybold/base.py +pylablib/pylablib/thread/devices/LighthousePhotonics/__init__.py +pylablib/pylablib/thread/devices/LighthousePhotonics/base.py +pylablib/pylablib/thread/devices/Lumel/__init__.py +pylablib/pylablib/thread/devices/Lumel/base.py +pylablib/pylablib/thread/devices/M2/__init__.py +pylablib/pylablib/thread/devices/M2/emm.py +pylablib/pylablib/thread/devices/M2/solstis.py +pylablib/pylablib/thread/devices/Mightex/__init__.py +pylablib/pylablib/thread/devices/Mightex/MightexSSeries.py +pylablib/pylablib/thread/devices/Newport/__init__.py +pylablib/pylablib/thread/devices/Newport/picomotor.py +pylablib/pylablib/thread/devices/Omron/__init__.py +pylablib/pylablib/thread/devices/Omron/base.py +pylablib/pylablib/thread/devices/Ophir/__init__.py +pylablib/pylablib/thread/devices/Ophir/base.py +pylablib/pylablib/thread/devices/PCO/__init__.py +pylablib/pylablib/thread/devices/PCO/SC2.py +pylablib/pylablib/thread/devices/Pfeiffer/__init__.py +pylablib/pylablib/thread/devices/Pfeiffer/base.py +pylablib/pylablib/thread/devices/Photometrics/__init__.py +pylablib/pylablib/thread/devices/Photometrics/pvcam.py +pylablib/pylablib/thread/devices/PhotonFocus/__init__.py +pylablib/pylablib/thread/devices/PhotonFocus/PhotonFocus.py +pylablib/pylablib/thread/devices/PhysikInstrumente/__init__.py +pylablib/pylablib/thread/devices/PhysikInstrumente/base.py +pylablib/pylablib/thread/devices/PrincetonInstruments/__init__.py +pylablib/pylablib/thread/devices/PrincetonInstruments/picam.py +pylablib/pylablib/thread/devices/Rigol/__init__.py +pylablib/pylablib/thread/devices/Rigol/power_supply.py +pylablib/pylablib/thread/devices/Sirah/__init__.py +pylablib/pylablib/thread/devices/Sirah/Matisse.py +pylablib/pylablib/thread/devices/SmarAct/__init__.py +pylablib/pylablib/thread/devices/SmarAct/MCS2.py +pylablib/pylablib/thread/devices/SmarAct/scu3d.py +pylablib/pylablib/thread/devices/Standa/__init__.py +pylablib/pylablib/thread/devices/Standa/base.py +pylablib/pylablib/thread/devices/Thorlabs/__init__.py +pylablib/pylablib/thread/devices/Thorlabs/elliptec.py +pylablib/pylablib/thread/devices/Thorlabs/kinesis.py +pylablib/pylablib/thread/devices/Thorlabs/misc.py +pylablib/pylablib/thread/devices/Thorlabs/serial.py +pylablib/pylablib/thread/devices/Thorlabs/TLCamera.py +pylablib/pylablib/thread/devices/Toptica/__init__.py +pylablib/pylablib/thread/devices/Toptica/ibeam.py +pylablib/pylablib/thread/devices/Trinamic/__init__.py +pylablib/pylablib/thread/devices/Trinamic/base.py +pylablib/pylablib/thread/devices/Voltcraft/__init__.py +pylablib/pylablib/thread/devices/Voltcraft/multimeter.py +pylablib/pylablib/thread/devices/generic/__init__.py +pylablib/pylablib/thread/devices/generic/camera.py +pylablib/pylablib/thread/devices/generic/lasers.py +pylablib/pylablib/thread/devices/uc480/__init__.py +pylablib/pylablib/thread/devices/uc480/uc480.py +pylablib/pylablib/thread/stream/__init__.py +pylablib/pylablib/thread/stream/blockstream.py +pylablib/pylablib/thread/stream/frameproc.py +pylablib/pylablib/thread/stream/stream_manager.py +pylablib/pylablib/thread/stream/stream_message.py +pylablib/pylablib/thread/stream/table_accum.py diff --git a/andor-test/01_init_and_discover.py b/andor-test/01_init_and_discover.py index 0669816..6858c9c 100644 --- a/andor-test/01_init_and_discover.py +++ b/andor-test/01_init_and_discover.py @@ -1,58 +1,168 @@ +""" +Andor SDK3 Camera Discovery and Connection Test +Direct SDK usage without pylablib dependency +""" + import ctypes import os +import sys -# Type definitions -AT_H = ctypes.c_int -AT_64 = ctypes.c_longlong -AT_BOOL = ctypes.c_int - -# Constants -AT_SUCCESS = 0 -AT_HANDLE_SYSTEM = 1 - -# Load DLL -dll_dir = os.path.join(os.path.dirname(__file__), "libs") -old_path = os.environ.get("PATH", "") -os.environ["PATH"] = dll_dir + os.pathsep + old_path - +# Load the Andor SDK3 library try: - if hasattr(os, "add_dll_directory"): - with os.add_dll_directory(dll_dir): - lib = ctypes.windll.LoadLibrary("atcore.dll") - else: - lib = ctypes.windll.LoadLibrary(os.path.join(dll_dir, "atcore.dll")) -finally: - os.environ["PATH"] = old_path + # Try common installation paths + sdk_paths = [ + r"C:\Program Files\Andor SOLIS\atcore.dll", + r"C:\Program Files\Andor SDK3\atcore.dll", + "atcore.dll" # Try system PATH + ] -# Define functions -lib.AT_InitialiseLibrary.argtypes = [] + lib = None + for path in sdk_paths: + if os.path.exists(path) or path == "atcore.dll": + try: + lib = ctypes.WinDLL(path) + print(f" Loaded SDK from: {path}") + break + except OSError: + continue + + if lib is None: + raise OSError("Could not find atcore.dll. Please install Andor SDK3 or Andor SOLIS.") + +except Exception as e: + print(f" Failed to load Andor SDK3 library: {e}") + sys.exit(1) + +# Define function signatures lib.AT_InitialiseLibrary.restype = ctypes.c_int +lib.AT_InitialiseLibrary.argtypes = [] -lib.AT_GetInt.argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(AT_64)] -lib.AT_GetInt.restype = ctypes.c_int - -lib.AT_FinaliseLibrary.argtypes = [] lib.AT_FinaliseLibrary.restype = ctypes.c_int +lib.AT_FinaliseLibrary.argtypes = [] + +lib.AT_Open.restype = ctypes.c_int +lib.AT_Open.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)] + +lib.AT_Close.restype = ctypes.c_int +lib.AT_Close.argtypes = [ctypes.c_int] + +lib.AT_GetInt.restype = ctypes.c_int +lib.AT_GetInt.argtypes = [ctypes.c_int, ctypes.c_wchar_p, ctypes.POINTER(ctypes.c_longlong)] + +lib.AT_GetString.restype = ctypes.c_int +lib.AT_GetString.argtypes = [ctypes.c_int, ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_int] + +lib.AT_GetStringMaxLength.restype = ctypes.c_int +lib.AT_GetStringMaxLength.argtypes = [ctypes.c_int, ctypes.c_wchar_p, ctypes.POINTER(ctypes.c_int)] + +# Error checking +def check_error(code, func_name): + error_names = { + 0: "SUCCESS", + 1: "NOT_INITIALISED", + 2: "NOT_IMPLEMENTED", + 12: "INVALID_HANDLE", + 39: "DEVICE_NOT_FOUND" + } + if code != 0: + error = error_names.get(code, f"UNKNOWN({code})") + raise RuntimeError(f"{func_name} failed with error: {error}") + +# Helper functions +def get_int_feature(handle, feature): + value = ctypes.c_longlong() + code = lib.AT_GetInt(handle, feature, ctypes.byref(value)) + check_error(code, f"AT_GetInt({feature})") + return value.value + +def get_string_feature(handle, feature): + max_len = ctypes.c_int() + code = lib.AT_GetStringMaxLength(handle, feature, ctypes.byref(max_len)) + check_error(code, f"AT_GetStringMaxLength({feature})") + + buffer = ctypes.create_unicode_buffer(max_len.value) + code = lib.AT_GetString(handle, feature, buffer, max_len.value) + check_error(code, f"AT_GetString({feature})") + return buffer.value + +# Main test code +print("=" * 60) +print("Andor SDK3 Camera Discovery Test") +print("=" * 60) # Initialize library -print("Initializing library...") -ret = lib.AT_InitialiseLibrary() -if ret != AT_SUCCESS: - print(f"ERROR: Initialize failed, code: {ret}") - exit(1) -print("Initialize OK") +print("\n[1] Initializing Andor SDK3 library...") +code = lib.AT_InitialiseLibrary() +check_error(code, "AT_InitialiseLibrary") +print(" Library initialized successfully") -# Get device count -device_count = AT_64(0) -ret = lib.AT_GetInt(AT_HANDLE_SYSTEM, "DeviceCount", ctypes.byref(device_count)) -if ret != AT_SUCCESS: - print(f"ERROR: Get device count failed, code: {ret}") -else: - print(f"Device count: {device_count.value}") +try: + # Get number of cameras (using system handle = 1) + print("\n[2] Detecting cameras...") + num_cameras = get_int_feature(1, "DeviceCount") + print(f" Found {num_cameras} camera(s)") -# Finalize library -ret = lib.AT_FinaliseLibrary() -if ret != AT_SUCCESS: - print(f"ERROR: Finalize failed, code: {ret}") -else: - print("Finalize OK") + if num_cameras == 0: + print("\n  No cameras detected. Please check:") + print(" - Camera is powered on") + print(" - USB/PCIe connection is secure") + print(" - Drivers are installed correctly") + else: + # Open first camera + print(f"\n[3] Opening camera index 0...") + handle = ctypes.c_int() + code = lib.AT_Open(0, ctypes.byref(handle)) + check_error(code, "AT_Open") + print(f" Camera opened (handle: {handle.value})") + + try: + # Get camera information + print("\n[4] Reading camera information...") + print("-" * 60) + + camera_name = get_string_feature(handle.value, "CameraName") + print(f" Camera Name : {camera_name}") + + camera_model = get_string_feature(handle.value, "CameraModel") + print(f" Camera Model : {camera_model}") + + serial_number = get_string_feature(handle.value, "SerialNumber") + print(f" Serial Number : {serial_number}") + + firmware_ver = get_string_feature(handle.value, "FirmwareVersion") + print(f" Firmware Ver : {firmware_ver}") + + # Additional info + try: + sensor_width = get_int_feature(handle.value, "SensorWidth") + sensor_height = get_int_feature(handle.value, "SensorHeight") + print(f" Sensor Size : {sensor_width} x {sensor_height} pixels") + except: + pass + + try: + sensor_temp = lib.AT_GetFloat(handle.value, "SensorTemperature") + # Note: would need to define AT_GetFloat properly for this + except: + pass + + print("-" * 60) + print(" Camera information retrieved successfully") + + finally: + # Close camera + print("\n[5] Closing camera...") + code = lib.AT_Close(handle.value) + check_error(code, "AT_Close") + print(" Camera closed") + +finally: + # Finalize library + print("\n[6] Shutting down SDK library...") + code = lib.AT_FinaliseLibrary() + check_error(code, "AT_FinaliseLibrary") + print(" Library shutdown complete") + +print("\n" + "=" * 60) +print("Test completed successfully!") +print("=" * 60) diff --git a/pylablib/Andor/AndorSDK2.py b/pylablib/Andor/AndorSDK2.py deleted file mode 100644 index bd0289a..0000000 --- a/pylablib/Andor/AndorSDK2.py +++ /dev/null @@ -1,1091 +0,0 @@ -from .base import AndorError, AndorTimeoutError, AndorNotSupportedError -from . import atmcd32d_lib -from .atmcd32d_lib import wlib as lib, AndorSDK2LibError -from .atmcd32d_lib import DRV_STATUS -from .atmcd32d_lib import AC_ACQMODE, AC_READMODE, AC_TRIGGERMODE, AC_EMGAIN, AC_FEATURES, AC_GETFUNC, AC_SETFUNC -from .atmcd32d_lib import drAC_CAMERATYPE, AC_PIXELMODE -from .atmcd32d_defs import AT_VersionInfoId - -from ...core.utils import py3 -from ...core.devio import interface -from ..interface import camera -from ..utils import load_lib - -import numpy as np -import collections -import functools -import threading - - - -class LibraryController(load_lib.LibraryController): - def _do_uninit(self): - try: - self.lib.ShutDown() - except AndorSDK2LibError as e: - if e.code!=DRV_STATUS.DRV_NOT_INITIALIZED: - raise -libctl=LibraryController(lib) -def restart_lib(): - libctl.shutdown() - - -def get_SDK_version(): - """Get version of Andor SDK2""" - libctl.preinit() - return py3.as_str(lib.GetVersionInfo(AT_VersionInfoId.AT_SDKVersion)) -def get_cameras_number(): - """Get number of connected Andor cameras""" - libctl.preinit() - return lib.GetAvailableCameras() - - -TDeviceInfo=collections.namedtuple("TDeviceInfo",["controller_model","head_model","serial_number"]) -TCycleTimings=collections.namedtuple("TCycleTimings",["exposure","accum_cycle_time","kinetic_cycle_time"]) -TAcqProgress=collections.namedtuple("TAcqProgress",["frames_done","cycles_done"]) - -_camsel_lock=threading.RLock() -def _camfunc(*args, **kwargs): - if len(args)>0: - return _camfunc(**kwargs)(args[0]) - option=kwargs.get("option",[]) - if not isinstance(option,list): - option=[option] - sel=kwargs.get("sel",True) - setpar=kwargs.get("setpar",None) - getpar=kwargs.get("getpar",None) - defpar=kwargs.get("defpar",None) - par_lookup=(getpar is not None) and not option - if (setpar is not None) and (getpar is not None): - raise ValueError("a method is either a setpar or a getpar") - def wrapper(func): - @functools.wraps(func) - def wrapped(self, *args, **kwargs): - if par_lookup: - return self._cpar.get(getpar,defpar) - with _camsel_lock: - if sel: - self._select_camera() - for opt in option: - if not self._check_option(*opt): - return defpar - if getpar is not None: - return self._cpar.get(getpar,defpar) - else: - res=func(self,*args,**kwargs) - if setpar is not None: - self._cpar[setpar]=res - return res - return wrapped - return wrapper -class AndorSDK2Camera(camera.IBinROICamera, camera.IExposureCamera): - """ - Andor SDK2 camera. - - Due to the library features, the camera needs to set up all of the parameters to some default values upon connection. - Most of these parameters are chosen as reasonable defaults: full ROI, minimal exposure time, closed shutter, - internal trigger, fastest recommended verticals shift speed, no EMCCD gain. - However, some should be supplied during the connection: temperature setpoint (where appropriate), fan mode, and amplifier mode; - while there is still a possibility to have default values of these parameters, they might not be appropriate in some settings, and frequently need to be changed. - - Caution: the manufacturer DLL is designed such that if the camera is not closed on the program termination, the allocated resources are never released. - If this happens, these resources are blocked until the complete OS restart. - - Args: - idx(int): camera index (use :func:`get_cameras_number` to get the total number of connected cameras) - ini_path(str): path to .ini file, if required by the camera - temperature: initial temperature setpoint (in C); can also be ``None`` (select the bottom 20% of the whole range), - or ``"off"`` (turn the cooler off and set the maximal of the whole range) - fan_mode: initial fan mode - amp_mode: initial amplifier mode (a tuple like the one returned by :meth:`get_amp_mode`); - can also be ``None``, which selects the slowest, smallest gain mode - """ - _default_image_indexing="rcb" - Error=AndorError - TimeoutError=AndorTimeoutError - def __init__(self, idx=0, ini_path="", temperature=None, fan_mode="off", amp_mode=None): - super().__init__() - self.idx=idx - self.ini_path=ini_path - self.handle=None - self._opid=None - self.capabilities=None - self._minh=0 - self._minv=0 - self._cpar={} - self._start_temperature=temperature - self._start_fan_mode=fan_mode - self._start_amp_mode=amp_mode - self.open() - - self._device_var_ignore_error={"get":(AndorNotSupportedError,),"set":(AndorNotSupportedError,)} - self._add_info_variable("device_info",self.get_device_info) - self._add_info_variable("capabilities",self.get_capabilities,priority=-5) - self._add_info_variable("amp_modes",self.get_all_amp_modes,ignore_error=AndorSDK2LibError,priority=-2) - self._add_info_variable("vsspeeds",self.get_all_vsspeeds,ignore_error=AndorSDK2LibError,priority=-2) - self._add_info_variable("pixel_size",self.get_pixel_size) - self._add_settings_variable("temperature",self.get_temperature_setpoint,self.set_temperature) - self._add_status_variable("temperature_monitor",self.get_temperature,ignore_error=AndorSDK2LibError) - self._add_status_variable("temperature_status",self.get_temperature_status,ignore_error=AndorSDK2LibError) - self._add_info_variable("temperature_range",self.get_temperature_range,ignore_error=AndorSDK2LibError,priority=-2) - self._add_settings_variable("cooler",self.is_cooler_on,self.set_cooler,ignore_error=AndorSDK2LibError) - self._add_status_variable("amp_mode",self.get_amp_mode,ignore_error=AndorSDK2LibError) - self._add_settings_variable("channel",self.get_channel,lambda x:self.set_amp_mode(channel=x)) - self._add_settings_variable("oamp",self.get_oamp,lambda x:self.set_amp_mode(oamp=x)) - self._add_settings_variable("hsspeed",self.get_hsspeed,lambda x:self.set_amp_mode(hsspeed=x)) - self._add_settings_variable("preamp",self.get_preamp,lambda x:self.set_amp_mode(preamp=x),ignore_error=AndorSDK2LibError) - self._add_settings_variable("vsspeed",self.get_vsspeed,self.set_vsspeed,ignore_error=AndorSDK2LibError) - self._add_settings_variable("EMCCD_gain",self.get_EMCCD_gain,self.set_EMCCD_gain,ignore_error=AndorSDK2LibError) - self._add_settings_variable("shutter",self.get_shutter_parameters,self.setup_shutter,ignore_error=AndorSDK2LibError) - self._add_settings_variable("fan_mode",self.get_fan_mode,self.set_fan_mode,ignore_error=AndorSDK2LibError) - self._add_settings_variable("trigger_mode",self.get_trigger_mode,self.set_trigger_mode) - self._add_settings_variable("acq_parameters/accum",self.get_accum_mode_parameters,self.setup_accum_mode) - self._add_settings_variable("acq_parameters/kinetic",self.get_kinetic_mode_parameters,self.setup_kinetic_mode) - self._add_settings_variable("acq_parameters/fast_kinetic",self.get_fast_kinetic_mode_parameters,self.setup_fast_kinetic_mode) - self._add_settings_variable("acq_parameters/cont",self.get_cont_mode_parameters,self.setup_cont_mode) - self._add_settings_variable("acq_mode",self.get_acquisition_mode,self.set_acquisition_mode) - self._add_status_variable("acq_status",self.get_status) - self._add_settings_variable("frame_transfer",self.is_frame_transfer_enabled,self.enable_frame_transfer_mode,ignore_error=AndorSDK2LibError) - self._add_status_variable("cycle_timings",self.get_cycle_timings) - self._add_status_variable("readout_time",self.get_readout_time) - self._add_settings_variable("read_parameters/single_track",self.get_single_track_mode_parameters,self.setup_single_track_mode) - self._add_settings_variable("read_parameters/multi_track",self.get_multi_track_mode_parameters,self.setup_multi_track_mode) - self._add_settings_variable("read_parameters/random_track",self.get_random_track_mode_parameters,self.setup_random_track_mode) - self._add_settings_variable("read_parameters/image",self.get_image_mode_parameters,self.setup_image_mode) - self._add_settings_variable("read_mode",self.get_read_mode,self.set_read_mode) - self._update_device_variable_order("exposure") - self._add_settings_variable("frame_period",self.get_frame_period,self.set_frame_period) - - def _initial_setup_temperature(self): - if self._start_temperature=="off": - trng=self.get_temperature_range() - self.set_temperature(trng[1] if trng else 0,enable_cooler=False) - if self._start_temperature is None: - trng=self.get_temperature_range() - if trng: - self._start_temperature=trng[0]+int((trng[1]-trng[0])*0.2) - else: - self._start_temperature=0 - self.set_temperature(self._start_temperature,enable_cooler=True) - def _initial_setup_ext_trigger(self): - try: - lrng=self.get_trigger_level_limits() - level=(lrng[0]+lrng[1])/2 - except AndorNotSupportedError: - level=None - self.setup_ext_trigger(level,False,True) - def _setup_default_settings(self): - self.capabilities=self._get_capabilities_n() - self.device_info=self.get_device_info() - try: - self._strict_option_check=False - self._initial_setup_temperature() - self.init_amp_mode(mode=self._start_amp_mode) - self.set_fan_mode(self._start_fan_mode) - self.setup_shutter("closed") - self._initial_setup_ext_trigger() - self.set_trigger_mode("int") - self.set_exposure(0) - self.set_acquisition_mode("cont") - self.setup_accum_mode(1) - self.setup_kinetic_mode(1) - self.setup_fast_kinetic_mode(1) - self.setup_cont_mode() - self.enable_frame_transfer_mode(False) - self.setup_single_track_mode() - for (height,offset) in [(1,0),(2,0),(1,1),(2,1),(self.get_detector_size()[1],0),(self.get_detector_size()[1],1)]: - try: - self.setup_multi_track_mode(height=height,offset=offset) - break - except AndorSDK2LibError: - pass - self.setup_random_track_mode() - self._minh=self._find_min_roi_end("h") - self._minv=self._find_min_roi_end("v") - self.setup_image_mode() - self.setup_acquisition("single") # flush the buffers - self.setup_acquisition("cont") - self.clear_acquisition() - self._buffer_size=0 - finally: - self._strict_option_check=True - - def _select_camera(self): - if self.handle is None: - raise AndorError("camera is not opened") - if lib.GetCurrentCamera()!=self.handle: - lib.SetCurrentCamera(self.handle) - def _has_option(self, kind, option): - if kind=="acq": - opt=self.capabilities.ulAcqModes - elif kind=="read": - opt=self.capabilities.ulReadModes - elif kind=="trig": - opt=self.capabilities.ulTriggerModes - elif kind=="set": - opt=self.capabilities.ulSetFunctions - elif kind=="get": - opt=self.capabilities.ulGetFunctions - elif kind=="feat": - opt=self.capabilities.ulFeatures - else: - raise AndorError("unknown option kind: {}".format(kind)) - return bool(option&opt) - def _check_option(self, kind, option): - has_option=self._has_option(kind,option) - if (not has_option) and self._strict_option_check: - raise AndorNotSupportedError("option {}.{} is not supported by {}".format(kind,getattr(option,"name",option),self.device_info.head_model)) - return has_option - - def _get_connection_parameters(self): - return self.idx,self.ini_path - def open(self): - """Open connection to the camera""" - if self.handle is None: - ncams=get_cameras_number() - if self.idx>=ncams: - raise AndorError("camera index {} is not available ({} cameras exist)".format(self.idx,ncams)) - self.handle=lib.GetCameraHandle(self.idx) - with self._close_on_error(): - with _camsel_lock: - self._select_camera() - lib.Initialize(py3.as_builtin_bytes(self.ini_path)) - self._opid=libctl.open().opid - self._setup_default_settings() - def close(self): - """Close connection to the camera""" - if self.handle is not None: - try: - if self._opid is not None and self.capabilities is not None: - self.clear_acquisition() - try: - self._select_camera() - except AndorError: - pass - finally: - self.handle=None - libctl.close(self._opid) - self._opid=None - def is_opened(self): - """Check if the device is connected""" - return self.handle is not None - - @_camfunc - def get_device_info(self): - """ - Get camera device info. - - Return tuple ``(controller_mode, head_model, serial_number)``. - """ - control_model=py3.as_str(lib.GetControllerCardModel()) - head_model=py3.as_str(lib.GetHeadModel()) - serial_number=lib.GetCameraSerialNumber() - return TDeviceInfo(control_model,head_model,serial_number) - - - ### Generic controls ### - _p_status=interface.EnumParameterClass("status", - {"idle":DRV_STATUS.DRV_IDLE,"acquiring":DRV_STATUS.DRV_ACQUIRING,"temp_cycle":DRV_STATUS.DRV_TEMPCYCLE}) - @_camfunc(option=("feat",AC_FEATURES.AC_FEATURES_POLLING)) - @interface.use_parameters(_returns="status") - def get_status(self): - """ - Get camera status. - - Return either ``"idle"`` (no acquisition), ``"acquiring"`` (acquisition in progress) or ``"temp_cycle"`` (temperature cycle in progress). - """ - status=lib.GetStatus() - if status not in {DRV_STATUS.DRV_IDLE,DRV_STATUS.DRV_ACQUIRING,DRV_STATUS.DRV_TEMPCYCLE}: - raise AndorSDK2LibError("GetStatus",status) - return status - def acquisition_in_progress(self): - return self.get_status()=="acquiring" - def _int_to_enumlst(self, value, enums): - lst=[] - for k in enums: - if value&k: - lst.append(enums(k).name) - return lst - def _parse_capabilities(self, caps): - cap_dict={} - cap_dict["acq_mode"]=self._int_to_enumlst(caps.ulAcqModes,AC_ACQMODE) - cap_dict["read_mode"]=self._int_to_enumlst(caps.ulReadModes,AC_READMODE) - cap_dict["ft_read_mode"]=self._int_to_enumlst(caps.ulFTReadModes,AC_READMODE) - cap_dict["trig_mode"]=self._int_to_enumlst(caps.ulTriggerModes,AC_TRIGGERMODE) - cap_dict["set_func"]=self._int_to_enumlst(caps.ulSetFunctions,AC_SETFUNC) - cap_dict["get_func"]=self._int_to_enumlst(caps.ulGetFunctions,AC_GETFUNC) - cap_dict["features"]=self._int_to_enumlst(caps.ulFeatures,AC_FEATURES) - cap_dict["EM_gain"]=self._int_to_enumlst(caps.ulEMGainCapability,AC_EMGAIN) - cap_dict["pci_speed"]=int(caps.ulPCICard) - cap_dict["pix_mode"]=self._int_to_enumlst(caps.ulPixelMode&0xFFFF,AC_PIXELMODE),AC_PIXELMODE(caps.ulPixelMode&0xFFFF0000).name - cap_dict["cam_type"]=drAC_CAMERATYPE.get(caps.ulCameraType,"UNKNOWN") - return cap_dict - @_camfunc - def _get_capabilities_n(self): - """Get camera capabilities as a plain ``AndorCapabilities`` structure""" - return lib.GetCapabilities() - def get_capabilities(self): - """ - Get camera capabilities. - - For description of the structure, see Andor SDK manual. - """ - return self._parse_capabilities(self._get_capabilities_n()) - @_camfunc - def get_pixel_size(self): - """Get camera pixel size (in m)""" - return tuple([s*1E-6 for s in lib.GetPixelSize()]) - - ### Cooler controls ### - @_camfunc(option=("get",AC_SETFUNC.AC_SETFUNCTION_TEMPERATURE)) - def is_cooler_on(self): - """Check if the cooler is on""" - return bool(lib.IsCoolerOn()) - @_camfunc(option=("set",AC_GETFUNC.AC_GETFUNCTION_TEMPERATURE)) - def set_cooler(self, on=True): - """Set the cooler on or off""" - if on: - lib.CoolerON() - else: - lib.CoolerOFF() - return self.is_cooler_on() - - - _p_temp_status=interface.EnumParameterClass("temp_status",{ - "off":DRV_STATUS.DRV_TEMPERATURE_OFF, "not_reached":DRV_STATUS.DRV_TEMPERATURE_NOT_REACHED, "not_stabilized":DRV_STATUS.DRV_TEMPERATURE_NOT_STABILIZED, - "drifted":DRV_STATUS.DRV_TEMPERATURE_DRIFT, "stabilized":DRV_STATUS.DRV_TEMPERATURE_STABILIZED }) - @_camfunc(option=("get",AC_GETFUNC.AC_GETFUNCTION_TEMPERATURE)) - @interface.use_parameters(_returns="temp_status") - def get_temperature_status(self): - """ - Get temperature status. - - Can return ``"off"`` (cooler off), ``"not_reached"`` (cooling in progress), ``"not_stabilized"`` (reached but not stabilized yet), - ``"stabilized"`` (completely stabilized) or ``"drifted"``. - """ - return lib.GetTemperatureF()[0] - @_camfunc(option=("get",AC_GETFUNC.AC_GETFUNCTION_TEMPERATURE)) - def get_temperature(self): - """Get the current camera temperature (in C)""" - return lib.GetTemperatureF()[1] - @_camfunc(setpar="temperature_setpoint",option=[("get",AC_GETFUNC.AC_GETFUNCTION_TEMPERATURERANGE),("set",AC_SETFUNC.AC_SETFUNCTION_TEMPERATURE)]) - def set_temperature(self, temperature, enable_cooler=True): - """ - Change the temperature setpoint (in C). - - If ``enable_cooler==True``, turn the cooler on automatically if present. - """ - rng=lib.GetTemperatureRange() - temperature=max(temperature,rng[0]) - temperature=min(temperature,rng[1]) - temperature=int(temperature) - lib.SetTemperature(temperature) - if enable_cooler: - try: - self.set_cooler(True) - except AndorSDK2LibError: - pass - return temperature - @_camfunc(getpar="temperature_setpoint",option=[("set",AC_SETFUNC.AC_SETFUNCTION_TEMPERATURE)]) - def get_temperature_setpoint(self): - """Get the temperature setpoint (in C)""" - @_camfunc - def get_temperature_range(self): - """Return the available range of temperatures (in C)""" - return lib.GetTemperatureRange() - - ### Amplifiers/shift speeds controls ### - @_camfunc - def get_all_amp_modes(self): - """ - Get all available preamp modes. - - Each preamp mode is characterized by an AD channel index, amplifier index, channel speed (horizontal scan speed) index and preamp gain index. - Return list of tuples ``(channel, channel_bitdepth, oamp, oamp_kind, hsspeed, hsspeed_MHz, preamp, preamp_gain)``, - where ``channel``, ``oamp``, ``hsspeed`` and ``preamp`` are indices, while ``channel_bitdepth``, ``oamp_kind``, ``hsspeed_MHz`` and ``preamp_gain`` are descriptions. - """ - return lib.get_all_amp_modes() - @_camfunc - def get_max_vsspeed(self): - """Get maximal recommended vertical scan speed""" - return lib.GetFastestRecommendedVSSpeed()[0] - @_camfunc - def get_all_vsspeeds(self): - """ - Get all available vertical shift speeds modes. - - Return list of the vertical shift periods in microseconds for the corresponding indices (starting from 0). - """ - try: - nspeeds=lib.GetNumberVSSpeeds() - return [lib.GetVSSpeed(i) for i in range(nspeeds)] - except AndorSDK2LibError: - return [] - def _truncate_amp_mode(self, amp_mode): - all_amp_modes=self.get_all_amp_modes() - all_amp_modes=[(mode.channel,mode.oamp,mode.hsspeed,mode.preamp) for mode in all_amp_modes] - for i,v in enumerate(amp_mode): - if v is None: - continue - avs={mode[i] for mode in all_amp_modes} - if v not in avs: - lvs=[vv for vv in avs if vv0.1: - timeout=0.1 - try: - try: - _camsel_lock.release() - lib.WaitForAcquisitionByHandleTimeOut(self.handle,int(timeout*1E3)) - finally: - _camsel_lock.acquire() - except AndorSDK2LibError as e: - if e.code!=DRV_STATUS.DRV_NO_NEW_DATA: - raise - @_camfunc - def _read_frames(self, rng, return_info=False): - """ - Read and return frames given the range. - - The range is always a tuple with at least a single frame in it, and is guaranteed to already be valid. - Always return tuple ``(frames, infos)``; if ``return_info==False``, ``infos`` value is ignored, so it can be anything (e.g., ``None``). - """ - dim=self._get_data_dimensions_rc() - dt=np.dtype(self._default_image_dtype) - get_method=lib.GetImages16 if dt.itemsize<=2 else lib.GetImages - data,_,_=get_method(rng[0]+1,rng[1],dim[0]*dim[1]*(rng[1]-rng[0])) - data=self._convert_indexing(data.reshape((-1,dim[0],dim[1])),"rcb",axes=(1,2)) - return list(data),None - - def _get_grab_acquisition_parameters(self, nframes, buff_size): - return {"mode":"cont"} \ No newline at end of file diff --git a/pylablib/Andor/AndorSDK3.py b/pylablib/Andor/AndorSDK3.py deleted file mode 100644 index ecc848a..0000000 --- a/pylablib/Andor/AndorSDK3.py +++ /dev/null @@ -1,832 +0,0 @@ -from .base import AndorError, AndorTimeoutError, AndorFrameTransferError, AndorNotSupportedError -from .atcore_lib import wlib as lib, AndorSDK3LibError, feature_types, read_uint12 - -from ...core.utils import py3, dictionary, general, funcargparse -from ...core.devio import interface -from ...core.utils.ctypes_tools import funcaddressof, as_ctypes_array -from ..interface import camera -from ..utils import load_lib -from ...core.utils.cext_tools import try_import_cext -with try_import_cext(): - from .utils import looper, copyframes # pylint: disable=no-name-in-module - -import numpy as np -import collections -import ctypes -import threading - - - -class LibraryController(load_lib.LibraryController): - def _do_uninit(self): - self.lib.AT_FinaliseLibrary() -libctl=LibraryController(lib) -def restart_lib(): - libctl.shutdown() - - -def get_cameras_number(): - """Get number of connected Andor cameras""" - libctl.preinit() - lib.AT_InitialiseLibrary() - return lib.AT_GetInt(1,"DeviceCount") - - - - - -class AndorSDK3Attribute: - """ - Andor SDK3 camera attribute. - - Allows to query and set values and get additional information. - Usually created automatically by a Andor SDK3 camera instance, but could also be created manually. - - Args: - handle: Andor SDK3 camera handle - pid: attribute id - kind: attribute kind; can be ``"float"``, ``"int"``, ``"str"``, ``"bool"``, ``"enum"``, or ``"comm"`` (command); - can also be ``"auto"`` (default), in which case it is obtained from the stored feature table; - newer features might be missing, in which case kind needs to be supplied explicitly, or it raises an error - - Attributes: - name: attribute name - kind: attribute kind; can be ``"float"``, ``"int"``, ``"str"``, ``"bool"``, ``"enum"``, or ``"comm"`` (command) - implemented (bool): whether attribute is implemented - readable (bool): whether attribute is readable - writable (bool): whether attribute is writable - min (float or int): minimal attribute value (if applicable) - max (float or int): maximal attribute value (if applicable) - ivalues: list of possible integer values for enum attributes - values: list of possible text values for enum attributes - labels: dict ``{label: index}`` which shows all possible values of an enumerated attribute and their corresponding numerical values - ilabels: dict ``{index: label}`` which shows labels corresponding to numerical values of an enumerated attribute - is_command (bool): whether attribute is a command (same as ``kind=="comm"``) - """ - def __init__(self, handle, name, kind="auto"): - self.handle=handle - self.name=py3.as_str(name) - self.implemented=bool(lib.AT_IsImplemented(self.handle,self.name)) - if kind=="auto": - if self.name not in feature_types: - raise AndorError("can't determine feature kind: {}".format(self.name)) - kind=feature_types[self.name] - funcargparse.check_parameter_range(kind,"kind",{"float","int","str","bool","enum","comm"}) - self.kind=kind - self.is_command=self.kind=="comm" - self.readable=self.implemented and not self.is_command and bool(lib.AT_IsReadable(self.handle,self.name)) - self.writable=self.implemented and not self.is_command and bool(lib.AT_IsWritable(self.handle,self.name)) - self.min=None - self.max=None - self.values=[] - self.ivalues=[] - self.labels={} - self.ilabels={} - if self.kind in {"int","float"}: - try: - self.min,self.max=self.get_range() - except AndorError: - pass - elif self.kind=="enum": - try: - self._update_enum_limits() - except AndorError: - pass - def __repr__(self): - return "{}(name='{}', kind='{}')".format(self.__class__.__name__,self.name,self.kind) - - def update_properties(self): - """Update all attribute properties: implemented, readable, writable, limits""" - self.implemented=bool(lib.AT_IsImplemented(self.handle,self.name)) - self.readable=self.implemented and not self.is_command and bool(lib.AT_IsReadable(self.handle,self.name)) - self.writable=self.implemented and not self.is_command and bool(lib.AT_IsWritable(self.handle,self.name)) - try: - self.update_limits() - except AndorError: - pass - def get_value(self, enum_as_str=True, not_implemented_error=True, default=None): - """ - Get current value. - - If ``enum_as_str==True``, return enum values as strings; otherwise, return as indices. - If ``not_implemented_error==True`` and the feature is not implemented, raise :exc:`.AndorError`; - otherwise, return `default` if it is not implemented. - """ - if not self.implemented: - if not_implemented_error: - raise AndorError("feature is not implemented: {}".format(self.name)) - else: - return default - if not self.readable: - raise AndorError("feature is not readable: {}".format(self.name)) - if self.kind=="int": - return lib.AT_GetInt(self.handle,self.name) - if self.kind=="float": - return lib.AT_GetFloat(self.handle,self.name) - if self.kind=="str": - strlen=lib.AT_GetStringMaxLength(self.handle,self.name) - return lib.AT_GetString(self.handle,self.name,strlen) - if self.kind=="bool": - return bool(lib.AT_GetBool(self.handle,self.name)) - if self.kind=="enum": - val=lib.AT_GetEnumIndex(self.handle,self.name) - if enum_as_str: - val=lib.AT_GetEnumStringByIndex(self.handle,self.name,val,512) - return val - raise AndorError("can't read feature '{}' with kind '{}'".format(self.name,self.kind)) - def set_value(self, value, not_implemented_error=True): - """ - Set current value. - - If ``not_implemented_error==True`` and the feature is not implemented, raise :exc:`.AndorError`; otherwise, do nothing. - """ - if not self.implemented: - if not_implemented_error: - raise AndorError("feature is not implemented: {}".format(self.name)) - else: - return - if not self.writable: - raise AndorError("feature is not writable: {}".format(self.name)) - if self.kind=="int": - lib.AT_SetInt(self.handle,self.name,int(value)) - elif self.kind=="float": - lib.AT_SetFloat(self.handle,self.name,float(value)) - elif self.kind=="str": - lib.AT_SetString(self.handle,self.name,value) - elif self.kind=="bool": - lib.AT_SetBool(self.handle,self.name,bool(value)) - elif self.kind=="enum": - if isinstance(value,py3.anystring): - lib.AT_SetEnumString(self.handle,self.name,value) - else: - lib.AT_SetEnumIndex(self.handle,self.name,int(value)) - else: - raise AndorError("can't set feature '{}' with kind '{}'".format(self.name,self.kind)) - def call_command(self): - """Execute the given command""" - if not self.implemented: - raise AndorError("command is not implemented: {}".format(self.name)) - lib.AT_Command(self.handle,self.name) - def get_range(self, enum_as_str=True): - """ - Get allowed range of the given value. - - For ``"int"`` or ``"float"`` values return tuple ``(min, max)`` (inclusive); for ``"enum"`` return list of possible values - (if ``enum_as_str==True``, return list of string values, otherwise return list of indices). - For all other value kinds return ``None``. - """ - if not self.implemented: - raise AndorError("feature is not implemented: {}".format(self.name)) - if self.kind=="int": - return (lib.AT_GetIntMin(self.handle,self.name),lib.AT_GetIntMax(self.handle,self.name)) - if self.kind=="float": - return (lib.AT_GetFloatMin(self.handle,self.name),lib.AT_GetFloatMax(self.handle,self.name)) - if self.kind=="enum": - count=lib.AT_GetEnumCount(self.handle,self.name) - available=[i for i in range(count) if lib.AT_IsEnumIndexAvailable(self.handle,self.name,i)] - if enum_as_str: - available=[lib.AT_GetEnumStringByIndex(self.handle,self.name,i,512) for i in available] - return available - def _update_enum_limits(self): - self.values=self.get_range() - self.ivalues=self.get_range(enum_as_str=False) - self.labels=dict(zip(self.values,self.ivalues)) - self.ilabels=dict(zip(self.ivalues,self.values)) - def update_limits(self): - """Update minimal and maximal attribute limits and return tuple ``(min, max)``""" - if self.kind in {"int","float"}: - self.min,self.max=self.get_range() - return (self.min,self.max) - elif self.kind=="enum": - self._update_enum_limits() - def truncate_value(self, value): - """Limit value to lie within the allowed range""" - if self.kind in {"int","float"}: - vmin,vmax=self.update_limits() - value=min(max(value,vmin),vmax) - return value - - -TDeviceInfo=collections.namedtuple("TDeviceInfo",["camera_name","camera_model","serial_number","firmware_version","software_version"]) -TMissedFramesStatus=collections.namedtuple("TMissedFramesStatus",["skipped","overflows"]) -TFrameInfo=collections.namedtuple("TFrameInfo",["frame_index","timestamp_dev","size","pixeltype","stride"]) -class AndorSDK3Camera(camera.IBinROICamera, camera.IExposureCamera, camera.IAttributeCamera): - """ - Andor SDK3 camera. - - Args: - idx(int): camera index (use :func:`get_cameras_number` to get the total number of connected cameras) - """ - Error=AndorError - TimeoutError=AndorTimeoutError - FrameTransferError=AndorFrameTransferError - _TFrameInfo=TFrameInfo - _frameinfo_fields=general.make_flat_namedtuple(TFrameInfo,fields={"size":camera.TFrameSize})._fields - def __init__(self, idx=0): - super().__init__() - lib.initlib() - self.idx=idx - self.handle=None - self._opid=None - self._buffer_padding=10 - self._buffer_mgr=self.BufferManager(self) - self._reg_cb=None - self.open() - self._overflow_behavior="error" - self._overflows_counter=0 - - self._device_var_ignore_error={"get":(AndorNotSupportedError,),"set":(AndorNotSupportedError,)} - self._add_info_variable("device_info",self.get_device_info) - self._add_settings_variable("trigger_mode",self.get_trigger_mode,self.set_trigger_mode) - self._add_settings_variable("shutter",self.get_shutter,self.set_shutter) - self._add_settings_variable("temperature",self.get_temperature_setpoint,self.set_temperature) - self._add_status_variable("temperature_monitor",self.get_temperature) - self._add_settings_variable("cooler",self.is_cooler_on,self.set_cooler) - self._add_settings_variable("metadata_enabled",self.is_metadata_enabled,self.enable_metadata) - self._add_settings_variable("frame_period",self.get_frame_period,self.set_frame_period) - self._add_status_variable("missed_frames",self.get_missed_frames_status) - - - - def _get_connection_parameters(self): - return self.idx - def open(self): - """Open connection to the camera""" - self.close() - ncams=get_cameras_number() - if self.idx>=ncams: - raise AndorError("camera index {} is not available ({} cameras exist)".format(self.idx,ncams)) - self.handle=lib.AT_Open(self.idx) - self._opid=libctl.open().opid - self._update_attributes() - self._register_events() - self.clear_acquisition() - def close(self): - """Close connection to the camera""" - if self.handle is not None: - self.clear_acquisition() - self._unregister_events() - lib.AT_Close(self.handle) - libctl.close(self._opid) - self.handle=None - self._opid=None - def is_opened(self): - """Check if the device is connected""" - return self.handle is not None - - def _list_attributes(self): - return [AndorSDK3Attribute(self.handle,v) for v in feature_types] - def add_attribute(self, name, kind): - """ - Add a new attribute which is not currently present in the dictionary. - - `kind` can be ``"float"``, ``"int"``, ``"str"``, ``"bool"``, ``"enum"``, or ``"comm"`` (command). - """ - self.attributes[name]=AndorSDK3Attribute(self.handle,name,kind=kind) - def get_attribute(self, name, update_properties=False, error_on_missing=True): # pylint: disable=arguments-differ, arguments-renamed - """ - Get the camera attribute with the given name. - - If ``update_properties==True``, automatically update all attribute properties. - """ - att=super().get_attribute(name,error_on_missing=error_on_missing) - if att is not None and update_properties: - att.update_properties() - return att - def get_attribute_value(self, name, enum_as_str=True, update_properties=False, error_on_missing=True, default=None): # pylint: disable=arguments-differ, arguments-renamed - """ - Get value of an attribute with the given name. - - If ``update_properties==True``, automatically update all attribute properties before settings. - If the value doesn't exist or can not be read and ``error_on_missing==True``, raise error; otherwise, return `default`. - If `default` is not ``None``, assume that ``error_on_missing==False``. - """ - error_on_missing=error_on_missing and (default is None) - attr=self.get_attribute(name,update_properties=update_properties,error_on_missing=error_on_missing) - return default if attr is None else attr.get_value(not_implemented_error=error_on_missing,enum_as_str=enum_as_str,default=default) - def set_attribute_value(self, name, value, update_properties=True, error_on_missing=True): # pylint: disable=arguments-differ, arguments-renamed - """ - Set value of an attribute with the given name. - - If the value doesn't exist or can not be written and ``error_on_missing==True``, raise error; otherwise, do nothing. - If ``update_properties==True``, automatically update all attribute properties before settings. - """ - attr=self.get_attribute(name,update_properties=update_properties,error_on_missing=error_on_missing) - if attr is not None: - attr.set_value(value,not_implemented_error=error_on_missing) - def get_all_attribute_values(self, root="", enum_as_str=True, update_properties=False): # pylint: disable=arguments-differ, arguments-renamed, unused-argument - """ - Get values of all attributes. - - If ``update_properties==True``, automatically update all attribute properties before settings. - """ - values=dictionary.Dictionary() - for n,att in self.attributes.as_dict("flat").items(): - if update_properties: - att.update_properties() - if att.readable: - try: - values[n]=att.get_value(enum_as_str=enum_as_str) - except AndorSDK3LibError: # sometimes nominally implemented features still raise errors - pass - return values - def set_all_attribute_values(self, settings, update_properties=True): # pylint: disable=arguments-differ, arguments-renamed - """ - Set values of all attribute in the given dictionary. - - If ``update_properties==True``, automatically update all attribute properties before settings. - """ - settings=dictionary.as_dict(settings,style="flat",copy=False) - for k,v in settings.items(): - k=self._normalize_attribute_name(k) - attr=self.get_attribute(k,update_properties=update_properties,error_on_missing=False) - if attr is not None and attr.writable: - attr.set_value(v) - - def _get_feature(self, name, writable=False): - """ - Check if the feature is available and return the corresponding attribute. - - If ``writable==True``, also check if it's writable. - """ - if name in self.attributes: - attr=self.attributes[name] - attr.update_properties() - if attr.implemented and (attr.writable or not writable): - return attr - raise AndorNotSupportedError("feature {} is not supported by camera {}".format(name,self.get_device_info().camera_model)) - - def call_command(self, name): - """Execute the given command""" - self._get_feature(name).call_command() - - - def get_device_info(self): - """ - Get camera info. - - Return tuple ``(camera_name, camera_model, serial_number, firmware_version, software_version)``. - """ - camera_name=self.cav["CameraName"] - camera_model=self.cav["CameraModel"] - serial_number=self.cav["SerialNumber"] - firmware_version=self.cav["FirmwareVersion"] - strlen=lib.AT_GetStringMaxLength(1,"SoftwareVersion") - software_version=lib.AT_GetString(1,"SoftwareVersion",strlen) - return TDeviceInfo(camera_name,camera_model,serial_number,firmware_version,software_version) - - - _p_trigger_mode=interface.EnumParameterClass("trigger_mode", - {"int":"Internal","ext":"External","software":"Software","ext_start":"External Start","ext_exp":"External Exposure"}) - @interface.use_parameters(_returns="trigger_mode") - def get_trigger_mode(self): - """ - Get trigger mode. - - Can be ``"int"`` (internal), ``"ext"`` (external), ``"software"`` (software trigger), - ``"ext_start"`` (external start), or ``"ext_exp"`` (external exposure). - """ - return self.cav["TriggerMode"] - @camera.acqstopped - @interface.use_parameters(mode="trigger_mode") - def set_trigger_mode(self, mode): - """ - Set trigger mode. - - Can be ``"int"`` (internal), ``"ext"`` (external), or ``"software"`` (software trigger). - """ - self.cav["TriggerMode"]=mode - return self.get_trigger_mode() - - _p_shutter_mode=interface.EnumParameterClass("shutter_mode",{"open":"Open","closed":"Closed","auto":"Auto"}) - @interface.use_parameters(_returns="shutter_mode") - def get_shutter(self): - """Get current shutter mode""" - return self._get_feature("ShutterMode").get_value() - @interface.use_parameters(mode="shutter_mode") - def set_shutter(self, mode): - """ - Set trigger mode. - - Can be ``"open"``, ``"closed"``, or ``"auto"``. - """ - self._get_feature("ShutterMode").set_value(mode) - return self.get_shutter() - - def is_cooler_on(self): - """Check if the cooler is on""" - return self._get_feature("SensorCooling").get_value() - @camera.acqstopped - def set_cooler(self, on=True): - """Set the cooler on or off""" - self._get_feature("SensorCooling").set_value(on) - return self.is_cooler_on() - - def get_temperature(self): - """Get the current camera temperature""" - return self._get_feature("SensorTemperature").get_value() - def get_temperature_setpoint(self): - """Get current temperature setpoint""" - return self._get_feature("TargetSensorTemperature").get_value() - @camera.acqstopped - def set_temperature(self, temperature, enable_cooler=True): - """ - Change the temperature setpoint. - - If ``enable_cooler==True``, turn the cooler on automatically. - """ - p_target=self._get_feature("TargetSensorTemperature") - if p_target.get_value()!=temperature: - p_target.set_value(temperature) - if enable_cooler: - self.set_cooler(True) - return p_target.get_value() - - - def get_exposure(self): - """Get current exposure""" - return self._get_feature("ExposureTime").get_value() - def set_exposure(self, exposure): - """Set camera exposure""" - self.set_frame_period(0) - p_exposure=self._get_feature("ExposureTime") - exposure=p_exposure.truncate_value(exposure) - p_exposure.set_value(exposure) - return self.get_exposure() - def get_frame_period(self): - return 1./self.cav["FrameRate"] - def set_frame_period(self, frame_period): - """Set frame period (time between two consecutive frames in the internal trigger mode)""" - p_frame_rate=self.get_attribute("FrameRate",update_properties=True,error_on_missing=False) - if p_frame_rate is None or not p_frame_rate.writable: - return - ro_rng=1./p_frame_rate.max,1./p_frame_rate.min - frame_period=max(min(frame_period,ro_rng[1]),ro_rng[0]) - self.cav["FrameRate"]=1./frame_period - return self.get_frame_period() - def get_frame_timings(self): - return self._TAcqTimings(self.get_exposure(),self.get_frame_period()) - - def is_metadata_enabled(self): - """Check if the metadata enabled""" - return self.get_attribute_value("MetadataEnable",error_on_missing=False,default=False) - def enable_metadata(self, enable=True): - """Enable or disable metadata streaming""" - updated=self.get_attribute_value("MetadataEnable",error_on_missing=False,default=enable)!=enable - if updated: - with self.pausing_acquisition(clear=True): - self.set_attribute_value("MetadataEnable",enable,error_on_missing=False) - return self.is_metadata_enabled() - - ### Frame management ### - class BufferManager: - """ - Cython-based schedule loop manager. - - Runs the loop function and provides callback storage. - """ - def __init__(self, cam): - self.buffers=None - self.hbuffers=None - self.queued_buffers=0 - self.size=0 - self.overflow_detected=False - self.cam=cam - self._cnt_lock=threading.RLock() - self._buffer_loop_thread=None - self.evt=threading.Event() - self.looping=ctypes.c_ulong(0) - self.nread=ctypes.c_ulong(0) - def allocate_buffers(self, nbuff, size, queued_buffers=None): - """ - Allocate and queue buffers. - - `queued_buffers`` specifies number of allocated buffers to keep queued at a given time (by default, all of them) - """ - with self._cnt_lock: - self.deallocate_buffers() - self.buffers=[ctypes.create_string_buffer(size) for _ in range(nbuff)] - self.hbuffers=as_ctypes_array([ctypes.addressof(b) for b in self.buffers],ctypes.c_void_p) - self.queued_buffers=queued_buffers if queued_buffers is not None else len(self.buffers) - self.size=size - for b in self.buffers[:self.queued_buffers]: - lib.AT_QueueBuffer(self.cam.handle,ctypes.cast(b,ctypes.POINTER(ctypes.c_uint8)),self.size) - def deallocate_buffers(self): - """Deallocated buffers (flushing should be done manually)""" - with self._cnt_lock: - if self.buffers: - self.stop_loop() - self.buffers=None - self.hbuffers=None - self.size=0 - def readn(self, idx, n, size=None, off=0): - """Return `n` buffers starting from `idx`, taking `size` bytes from each""" - if size is None: - size=self.size - data=np.empty((n,size),dtype="u1") - copyframes(len(self.hbuffers),ctypes.addressof(self.hbuffers),int(size),idx%len(self.hbuffers),n,off,data.ctypes.data) - return data - def reset(self): - """Reset counter (on frame acquisition)""" - self.nread.value=0 - self.overflow_detected=False - def start_loop(self): - """Start loop serving the given buffer manager""" - self.stop_loop() - self.evt.clear() - self.looping.value=1 - self.nread.value=0 - self._buffer_loop_thread=threading.Thread(target=self._loop,daemon=True) - self._buffer_loop_thread.start() - self.evt.wait() - def stop_loop(self): - """Stop the loop thread""" - if self._buffer_loop_thread is not None: - self.looping.value=0 - self._buffer_loop_thread.join() - self._buffer_loop_thread=None - def _loop(self): - self.evt.set() - looper(self.cam.handle,len(self.hbuffers),ctypes.addressof(self.hbuffers),self.size,self.queued_buffers, - ctypes.addressof(self.looping),ctypes.addressof(self.nread), - funcaddressof(lib.lib.AT_WaitBuffer),funcaddressof(lib.lib.AT_QueueBuffer)) - def get_status(self): - """Get the current loop status, which is the tuple ``(acquired,)``""" - return (self.nread.value,) - def on_overflow(self): - """Process buffer overflow event""" - with self._cnt_lock: - self.overflow_detected=True - def new_overflow(self): - with self._cnt_lock: - return self.overflow_detected - def _register_events(self): - self._unregister_events() - if self.get_attribute_value("EventEnable",error_on_missing=False) is not None: - self.cav["EventSelector"]="BufferOverflowEvent" - self.cav["EventEnable"]=True - buff_cb=lib.AT_RegisterFeatureCallback(self.handle,"BufferOverflowEvent",lambda *args: self._buffer_mgr.on_overflow()) - self._reg_cb=buff_cb - self._buffer_mgr.reset() - def _unregister_events(self): - if self._reg_cb is not None: - lib.AT_UnregisterFeatureCallback(self.handle,"BufferOverflowEvent",self._reg_cb) - self.cav["EventSelector"]="BufferOverflowEvent" - self.cav["EventEnable"]=False - self._reg_cb=None - self._buffer_mgr.reset() - def _allocate_buffers(self, nframes): - """ - Create and set up a new ring buffer. - - If a ring buffer is already allocated, remove it and create a new one. - """ - self._deallocate_buffers() - frame_size=self.cav["ImageSizeBytes"] - self._buffer_mgr.allocate_buffers(nframes+self._buffer_padding,frame_size,queued_buffers=nframes) - def _deallocate_buffers(self): - """Remove the ring buffer and clean up the memory""" - lib.flush_buffers(self.handle) - self._buffer_mgr.deallocate_buffers() - - - @interface.use_parameters(mode="acq_mode") - def setup_acquisition(self, mode="sequence", nframes=100): # pylint: disable=arguments-differ - """ - Setup acquisition. - - `mode` can be either ``"snap"`` (single frame or a fixed number of frames) or ``"sequence"`` (continuous acquisition). - `nframes` determines number of frames to acquire in the single mode, or size of the ring buffer in the ``"sequence"`` mode (by default, 100). - """ - super().setup_acquisition(mode=mode,nframes=nframes) - def clear_acquisition(self): - self.stop_acquisition() - self._deallocate_buffers() - self.reset_overflows_counter() - super().clear_acquisition() - - def start_acquisition(self, *args, **kwargs): - self.stop_acquisition() - super().start_acquisition(*args,**kwargs) - nframes=self._acq_params["nframes"] - if self._acq_params["mode"]=="snap": - self.cav["CycleMode"]="Fixed" - self.cav["FrameCount"]=nframes - else: - # self.cav["CycleMode"]="Continuous" # Zyla bug doesn't allow continuous mode with >1000 FPS - self.cav["CycleMode"]="Fixed" - p_frame_count=self.get_attribute("FrameCount",update_properties=True) - p_frame_count.set_value(p_frame_count.max) - self._allocate_buffers(nframes) - self._frame_counter.reset(nframes) - self._buffer_mgr.reset() - self._buffer_mgr.start_loop() - self.call_command("AcquisitionStart") - def stop_acquisition(self): - if self.cav["CameraAcquiring"]: - self._frame_counter.update_acquired_frames(self._get_acquired_frames()) - self.call_command("AcquisitionStop") - self._buffer_mgr.stop_loop() - def acquisition_in_progress(self): - return self.cav["CameraAcquiring"] - - - - def _get_acquired_frames(self): - return self._buffer_mgr.get_status()[0] - def get_missed_frames_status(self): - """ - Get missed frames status. - - Return tuple ``(skipped, overflows)`` with the number skipped frames (sent from camera to the PC, but not read and overwritten) - and number of buffer overflows (events when the frame rate is too for the data transfer, so some unknown number of frames is skipped). - """ - skipped_frames=self.get_frames_status().skipped - return TMissedFramesStatus(skipped_frames,self._overflows_counter) - def reset_overflows_counter(self): - """Reset buffer overflows counter""" - self._overflows_counter=0 - _p_overflow_behavior=interface.EnumParameterClass("overflow_behavior",["error","restart","ignore"]) - @interface.use_parameters(behavior="overflow_behavior") - def set_overflow_behavior(self, behavior): - """ - Choose the camera behavior if buffer overflow is encountered when waiting for a new frame. - - Can be ``"error"`` (raise ``AndorFrameTransferError``), ``"restart"`` (restart the acquisition), or ``"ignore"`` (ignore the overflow, which will cause the wait to time out). - """ - self._overflow_behavior=behavior - - def _get_data_dimensions_rc(self): - return self.cav["AOIHeight"],self.cav["AOIWidth"] - def get_detector_size(self): - """Get camera detector size (in pixels) as a tuple ``(width, height)``""" - return int(self.cav["SensorWidth"]),int(self.cav["SensorHeight"]) - def get_roi(self): - """ - Get current ROI. - - Return tuple ``(hstart, hend, vstart, vend, hbin, vbin)``. - """ - hbin=int(self.get_attribute_value("AOIHBin",default=1)) - vbin=int(self.get_attribute_value("AOIVBin",default=1)) - hstart=int(self.cav["AOILeft"])-1 - hend=hstart+int(self.cav["AOIWidth"])*hbin - vstart=int(self.cav["AOITop"])-1 - vend=vstart+int(self.cav["AOIHeight"])*vbin - return (hstart,hend,vstart,vend,hbin,vbin) - @camera.acqcleared - def set_roi(self, hstart=0, hend=None, vstart=0, vend=None, hbin=1, vbin=1): - """ - Set current ROI. - - By default, all non-supplied parameters take extreme values. Binning is the same for both axes. - """ - hlim,vlim=self.get_roi_limits() - hbin=min(max(hbin,1),hlim.maxbin) - vbin=min(max(vbin,1),vlim.maxbin) - self.cav["AOILeft"]=1 - self.cav["AOITop"]=1 - self.cav["AOIWidth"]=hlim.min - self.cav["AOIHeight"]=vlim.min - self.set_attribute_value("AOIHBin",hbin,error_on_missing=False) - self.set_attribute_value("AOIVBin",vbin,error_on_missing=False) - hbin=int(self.get_attribute_value("AOIHBin",default=1)) - vbin=int(self.get_attribute_value("AOIVBin",default=1)) - hlim,vlim=self.get_roi_limits(hbin=hbin,vbin=vbin) - hstart,hend,_=self._truncate_roi_axis((hstart,hend,hbin),hlim) - vstart,vend,_=self._truncate_roi_axis((vstart,vend,vbin),vlim) - self.cav["AOIWidth"]=(hend-hstart)//hbin - self.cav["AOIHeight"]=(vend-vstart)//vbin - self.cav["AOILeft"]=hstart+1 - self.cav["AOITop"]=vstart+1 - return self.get_roi() - def get_roi_limits(self, hbin=1, vbin=1): - """ - Get the minimal and maximal ROI parameters. - - Return tuple ``(hlim, vlim)``, where each element is in turn a limit 5-tuple - ``(min, max, pstep, sstep, maxbin)`` with, correspondingly, minimal and maximal size, - position and size step, and the maximal binning. - - Note that the minimal ROI size depends on the current (not just supplied) binning settings. - For more accurate results, is it only after setting up the binning. - """ - wdet,hdet=self.get_detector_size() - try: - wmin=self._get_feature("AOIWidth").min or wdet - except AndorNotSupportedError: - wmin=wdet - try: - hmin=self._get_feature("AOIHeight").min or hdet - except AndorNotSupportedError: - hmin=hdet,hdet - try: - hbinmax=self._get_feature("AOIHBin").max or 1 - except AndorNotSupportedError: - hbinmax=1 - try: - vbinmax=self._get_feature("AOIVBin").max or 1 - except AndorNotSupportedError: - vbinmax=1 - hlim=camera.TAxisROILimit(wmin*hbin,wdet,1,hbin,hbinmax) - vlim=camera.TAxisROILimit(hmin*vbin,hdet,1,vbin,vbinmax) - return hlim,vlim - - def _check_buffer_overflow(self): - if self._buffer_mgr.new_overflow(): - self._overflows_counter+=1 - if self._overflow_behavior=="ignore": - return False - if self._overflow_behavior=="error": - self.stop_acquisition() - raise self.FrameTransferError("buffer overflow while waiting for a new frame") - self.start_acquisition() - return True - return False - def _wait_for_next_frame(self, timeout=20., idx=None): - if self._check_buffer_overflow(): - raise AndorTimeoutError("buffer overflow while waiting for a new frame") - super()._wait_for_next_frame(timeout=timeout,idx=idx) - def _frame_info_to_namedtuple(self, info): - return self._TFrameInfo(info[0],info[1],camera.TFrameSize(*info[2:4]),*info[4:]) - - _support_chunks=True - def _arrange_metadata(self, chunks, nframes): - metadata=np.zeros((nframes,6),dtype="i8")-1 - if 1 in chunks: - metadata[:,1]=chunks[1].view("i8")[:,0] - if 7 in chunks: - metadata[:,2]=chunks[7].view("size: - raise AndorError("unexpected section {} size: {}, larger than the remaining block size {}".format(cid,clen+4,size-read_len)) - chunks[cid]=self._buffer_mgr.readn(start,nframes,clen-4,off=size-read_len-4-clen).reshape((nframes,clen-4)) - read_len+=clen+4 - if 0 not in chunks: - raise AndorError("missing image data") - img=chunks.pop(0) - return img,self._arrange_metadata(chunks,nframes) - def _read_frames(self, rng, return_info=False): - height,width=self._get_data_dimensions_rc() - bpp=self.cav["BytesPerPixel"] - stride=self.cav["AOIStride"] - if bpp not in [1,1.5,2,4]: - raise ValueError("unexpected pixel byte size: {}".format(bpp)) - if strideexp_len+8+stride: # sometimes image size gets rounded to nearest 4/8/stride (CL) bytes - raise AndorError("unexpected image byte size: expected {}x{}={}, got {}".format(stride,height,exp_len,img.shaoe[1])) - img=img[:,:exp_len] - metadata[:,0]=np.arange(rng[0],rng[0]+nframes) - else: - img=self._buffer_mgr.readn(rng[0],nframes,size=height*stride) - metadata=None - if bpp==1.5: - img=read_uint12(img.reshape(-1,stride),width=width).reshape((nframes,height,width)) - else: - bpp=int(bpp) - dtype="=ncams: - raise AndorError("spectrograph index {} is not available ({} spectrograph exist)".format(self.idx,ncams)) - self._opid=libctl.open().opid - def close(self): - if self._opid is None: - return - libctl.close(self._opid) - self._opid=None - def is_opened(self): - return self._opid is not None - def _get_connection_parameters(self): - return (self.idx,) - - @_specfunc - def get_device_info(self): - """ - Get spectrograph device info. - - Return tuple ``(serial_number)``. - """ - serial_number=py3.as_str(lib.ShamrockGetSerialNumber(self.idx)) - return TDeviceInfo(serial_number) - @_specfunc - def get_optical_parameters(self): - """ - Get device optical parameters. - - Return tuple ``(focal_length, angular_deviation, focal_tilt)``. - """ - params=lib.ShamrockEepromGetOpticalParams(self.idx) - return TOpticalParameters(*params) - - - ### Grating control ### - @_specfunc - def get_gratings_number(self): - """Get number of gratings""" - return lib.ShamrockGetNumberGratings(self.idx) - def _check_grating(self, grating): - if grating is None: - return self.get_grating() - if grating<1 or grating>self.get_gratings_number(): - raise ValueError("incorrect grating index: {}; should be between 1 and {}".format(grating,self.get_gratings_number())) - return grating - @_specfunc - def get_grating(self): - """Get current grating index (counting from 1)""" - return lib.ShamrockGetGrating(self.idx) - @_specfunc - def set_grating(self, grating, force=False): - """ - Set current grating (counting from 1) - - Call blocks until the grating is exchanged (up to 10-20 seconds). - If ``force==False`` and the current grating index is the same as requested, skip the call; - otherwise, call the grating set command regardless (takes about a second in the grating is unchanged). - """ - grating=self._check_grating(grating) - if force or self.get_grating()!=grating: - lib.ShamrockSetGrating(self.idx,grating) - return self.get_grating() - @_specfunc - def get_grating_info(self, grating=None): - """ - Get info of a given grating (by default, current grating). - - Return tuple ``(lines, blaze_wavelength, home, offset)`` (blazing wavelength is in nm). - """ - grating=self._check_grating(grating) - lines,blaze_wavelength,home,offset=lib.ShamrockGetGratingInfo(self.idx,grating) - return TGratingInfo(lines,py3.as_str(blaze_wavelength),home,offset) - @_specfunc - def get_grating_offset(self, grating=None): - """Get grating offset (in steps) for a given grating (by default, current grating)""" - grating=self._check_grating(grating) - return lib.ShamrockGetGratingOffset(self.idx,grating) - @_specfunc - def set_grating_offset(self, offset, grating=None): - """Set grating offset (in steps) for a given grating (by default, current grating)""" - grating=self._check_grating(grating) - lib.ShamrockSetGratingOffset(self.idx,grating,offset) - return self.get_grating_offset(grating) - def _get_all_grating_offsets(self): - return [self.get_grating_offset(g) for g in range(1,self.get_gratings_number()+1)] - def _set_all_grating_offsets(self, offsets): - for g,o in enumerate(offsets,start=1): - if o is not None: - self.set_grating_offset(g,o) - @_specfunc - def get_detector_offset(self): - """Get detector offset (in steps)""" - return lib.ShamrockGetDetectorOffset(self.idx) - @_specfunc - def set_detector_offset(self, offset): - """Set detector offset (in steps)""" - lib.ShamrockSetDetectorOffset(self.idx,offset) - return self.get_detector_offset() - @_specfunc - def get_turret(self): - """Get turret""" - return lib.ShamrockGetTurret(self.idx) - @_specfunc - def set_turret(self, turret): - """Set turret""" - lib.ShamrockSetTurret(self.idx,turret) - return self.get_turret() - - - ### Wavelength control ### - @_specfunc - def is_wavelength_control_present(self): - """Check if wavelength control is present""" - return bool(lib.ShamrockWavelengthIsPresent(self.idx)) - def _check_wavelength(self): - if not self.is_wavelength_control_present(): - raise AndorNotSupportedError("wavelength control is not present") - @_specfunc - def get_wavelength(self): - """Get current central wavelength (in m)""" - self._check_wavelength() - return lib.ShamrockGetWavelength(self.idx)*1E-9 - @_specfunc - def set_wavelength(self, wavelength): - """Get current central wavelength (in m)""" - self._check_wavelength() - lib.ShamrockSetWavelength(self.idx,wavelength/1E-9) - return self.get_wavelength() - @_specfunc - def get_wavelength_limits(self, grating=None): - """Get wavelength limits (in m) for a given grating (by default, current grating)""" - self._check_wavelength() - grating=self._check_grating(grating) - lim=lib.ShamrockGetWavelengthLimits(self.idx,grating) - return lim[0]*1E-9,lim[1]*1E-9 - @_specfunc - def reset_wavelength(self): - """Reset current wavelength to 0 nm""" - self._check_wavelength() - lib.ShamrockWavelengthReset(self.idx) - return self.get_wavelength() - @_specfunc - def is_at_zero_order(self): - """Check if current grating is at zero order""" - self._check_wavelength() - return bool(lib.ShamrockAtZeroOrder(self.idx)) - @_specfunc - def goto_zero_order(self): - """Set current grating to zero order""" - self._check_wavelength() - lib.ShamrockGotoZeroOrder(self.idx) - return self.is_at_zero_order() - - - ### Slit control ### - _p_slit_index=interface.EnumParameterClass("slit_index", - {"input_side":SHAMROCK_CONST.SHAMROCK_INPUT_SLIT_SIDE,"input_direct":SHAMROCK_CONST.SHAMROCK_INPUT_SLIT_DIRECT, - "output_side":SHAMROCK_CONST.SHAMROCK_OUTPUT_SLIT_SIDE,"output_direct":SHAMROCK_CONST.SHAMROCK_OUTPUT_SLIT_DIRECT}) - @interface.use_parameters(slit="slit_index") - @_specfunc - def is_slit_present(self, slit): - """ - Check if the slit is present. - - `slit` cen be either a slit index (starting from 1), or one of the following: ``"input_side"``, ``"input_direct"``, ``"output_side"``, or ``"output_direct"``. - """ - return bool(lib.ShamrockAutoSlitIsPresent(self.idx,slit)) - def _check_slit(self, slit): - if not self.is_slit_present(slit): - raise AndorNotSupportedError("slit '{}' is not present".format(self._p_slit_index.i(slit))) - @interface.use_parameters(slit="slit_index") - @_specfunc - def get_slit_width(self, slit): - """ - Get slit width (in m). - - `slit` cen be either a slit index (starting from 1), or one of the following: ``"input_side"``, ``"input_direct"``, ``"output_side"``, or ``"output_direct"``. - """ - self._check_slit(slit) - return lib.ShamrockGetAutoSlitWidth(self.idx,slit)*1E-6 - @interface.use_parameters(slit="slit_index") - @_specfunc - def set_slit_width(self, slit, width): - """ - Set slit width (in m). - - `slit` cen be either a slit index (starting from 1), or one of the following: ``"input_side"``, ``"input_direct"``, ``"output_side"``, or ``"output_direct"``. - """ - self._check_slit(slit) - lib.ShamrockSetAutoSlitWidth(self.idx,slit,width/1E-6) - return self._wip.get_slit_width(slit) - def _get_all_slit_widths(self): - return [self.get_slit_width(s) if self.is_slit_present(s) else None for s in range(1,5)] - def _set_all_slit_widths(self, widths): - for s,w in enumerate(widths,start=1): - if w is not None: - self.set_slit_width(s,w) - @interface.use_parameters(slit="slit_index") - @_specfunc - def reset_slit(self, slit): - """ - Reset slit to the default width (10 um). - - `slit` cen be either a slit index (starting from 1), or one of the following: ``"input_side"``, ``"input_direct"``, ``"output_side"``, or ``"output_direct"``. - """ - self._check_slit(slit) - lib.ShamrockAutoSlitReset(self.idx,slit) - return self._wip.get_slit_width(slit) - - - ### Shutter control ### - @_specfunc - def is_shutter_present(self): - """Check if the shutter is present""" - return bool(lib.ShamrockShutterIsPresent(self.idx)) - def _check_shutter(self): - if not self.is_shutter_present(): - raise AndorNotSupportedError("shutter is not present") - _p_shutter_mode=interface.EnumParameterClass("shutter_mode",{"closed":0,"opened":1,"bnc":2,"not_set":-1}) - @interface.use_parameters(_returns="shutter_mode") - @_specfunc - def get_shutter(self): - """ - Get shutter mode. - - Can return ``"closed"``, ``"opened"``, ``"bnc"``, or ``"not_set"``. - """ - self._check_shutter() - return lib.ShamrockGetShutter(self.idx) - @interface.use_parameters(mode="shutter_mode") - @_specfunc - def is_shutter_mode_possible(self, mode): - """Check if the shutter mode (``"closed"``, ``"opened"``, or ``"bnc"``) is supported""" - self._check_shutter() - return mode>=0 and lib.ShamrockIsModePossible(self.idx,mode) - @interface.use_parameters(mode="shutter_mode") - @_specfunc - def set_shutter(self, mode): - """Set shutter mode (``"closed"`` or ``"opened"``)""" - self._check_shutter() - if not self._wip.is_shutter_mode_possible(mode): - raise AndorNotSupportedError("shutter mode '{}' is not supported".format(self._p_shutter_mode.i(mode))) - if mode!=-1: - lib.ShamrockSetShutter(self.idx,mode) - return self.get_shutter() - - - ### Filter control ### - @_specfunc - def is_filter_present(self): - """Check if the filter is present""" - return bool(lib.ShamrockFilterIsPresent(self.idx)) - def _check_filter(self): - if not self.is_filter_present(): - raise AndorNotSupportedError("filter is not present") - @_specfunc - def get_filter(self): - """Get current filter""" - self._check_filter() - return lib.ShamrockGetFilter(self.idx) - @_specfunc - def set_filter(self, flt): - """Set current filter""" - self._check_filter() - lib.ShamrockSetFilter(self.idx,flt) - return self.get_filter() - @_specfunc - def get_filter_info(self, flt): - """Get info of the given filter""" - self._check_filter() - return lib.ShamrockGetFilterInfo(self.idx,flt) - @_specfunc - def reset_filter(self): - """Reset filter to default position""" - self._check_filter() - lib.ShamrockFilterReset(self.idx) - return self.get_filter() - - - ### Flipper control ### - _p_flipper_index=interface.EnumParameterClass("flipper_index",{"input":1,"output":2}) - @interface.use_parameters(flipper="flipper_index") - @_specfunc - def is_flipper_present(self, flipper): - """ - Check if the flipper is present. - - `flipper` can be a flipper index (starting from 1), ``"input"``, or `"output"``. - """ - return bool(lib.ShamrockFlipperMirrorIsPresent(self.idx,flipper)) - def _check_flipper(self, flipper): - if not self.is_flipper_present(flipper): - raise AndorNotSupportedError("flipper {} is not present".format(flipper)) - _p_flipper_port=interface.EnumParameterClass("flipper_port",{"direct":0,"side":1}) - @interface.use_parameters(flipper="flipper_index",_returns="flipper_port") - @_specfunc - def get_flipper_port(self, flipper): - """ - Get flipper port. - - `flipper` can be a flipper index (starting from 1), ``"input"``, or `"output"``. - Return either ``"direct"`` or ``"side"``. - """ - self._check_flipper(flipper) - return lib.ShamrockGetFlipperMirror(self.idx,flipper) - @interface.use_parameters(flipper="flipper_index",port="flipper_port") - @_specfunc - def set_flipper_port(self, flipper, port): - """ - Set flipper port. - - `flipper` can be a flipper index (starting from 1), ``"input"``, or `"output"``. - Port can be ``"direct"`` or ``"side"``. - """ - self._check_flipper(flipper) - lib.ShamrockSetFlipperMirror(self.idx,flipper,port) - return self._wip.get_flipper_port(flipper) - def _get_all_flipper_ports(self): - return [self.get_flipper_port(f) if self.is_flipper_present(f) else None for f in range(1,3)] - def _set_all_flipper_ports(self, ports): - for f,p in enumerate(ports,start=1): - if p is not None: - self.set_flipper_port(f,p) - @interface.use_parameters(flipper="flipper_index") - @_specfunc - def reset_flipper(self, flipper): - """ - Reset flipper to the default state. - - `flipper` can be a flipper index (starting from 1), ``"input"``, or `"output"``. - """ - self._check_flipper(flipper) - lib.ShamrockFlipperMirrorReset(self.idx,flipper) - return self._wip.get_flipper_port(flipper) - - - ### Iris control ### - _p_iris_port=interface.EnumParameterClass("iris_port",{"direct":0,"side":1}) - @interface.use_parameters(iris="iris_port") - @_specfunc - def is_iris_present(self, iris): - """Check if the iris is present""" - return bool(lib.ShamrockIrisIsPresent is not None and lib.ShamrockIrisIsPresent(self.idx,iris)) - def _check_iris(self, iris): - if lib.ShamrockIrisIsPresent is None or not lib.ShamrockIrisIsPresent(self.idx,iris): - raise AndorNotSupportedError("iris is not present") - @interface.use_parameters(iris="iris_port") - @_specfunc - def get_iris_width(self, iris): - """Get current iris width (0 to 100)""" - self._check_iris(iris) - return lib.ShamrockGetIris(self.idx,iris) - @interface.use_parameters(iris="iris_port") - @_specfunc - def set_iris_width(self, iris, width): - """Set current iris width (0 to 100)""" - self._check_iris(iris) - lib.ShamrockSetIris(self.idx,iris,int(width)) - return lib.ShamrockGetIris(self.idx,iris) - def _get_all_iris_widths(self): - return [self.get_iris_width(s) if self.is_iris_present(s) else None for s in range(2)] - def _set_all_iris_widths(self, widths): - for s,w in enumerate(widths): - if w is not None: - self.set_iris_width(s,w) - - - ### Focus mirror control ### - @_specfunc - def is_focus_mirror_present(self): - """Check if the focus mirror is present""" - return bool(lib.ShamrockFocusMirrorIsPresent is not None and lib.ShamrockFocusMirrorIsPresent(self.idx)) - def _check_focus_mirror(self): - if lib.ShamrockFocusMirrorIsPresent is None or not lib.ShamrockFocusMirrorIsPresent(self.idx): - raise AndorNotSupportedError("focus mirror is not present") - @_specfunc - def get_focus_mirror_position(self): - """Get current focus mirror position""" - self._check_focus_mirror() - return lib.ShamrockGetFocusMirror(self.idx) - @_specfunc - def set_focus_mirror_position(self, position): - """Set current focus mirror position""" - self._check_focus_mirror() - lib.ShamrockSetFocusMirror(self.idx,int(position)) - return lib.ShamrockGetFocusMirror(self.idx) - @_specfunc - def get_focus_mirror_position_max(self): - """Get maximal focus mirror position""" - self._check_focus_mirror() - return lib.ShamrockGetFocusMirrorMaxSteps(self.idx) - @_specfunc - def reset_focus_mirror(self): - """Reset focus mirror position""" - self._check_focus_mirror() - return lib.ShamrockFocusMirrorReset(self.idx) - - - ### Accessory control ### - @_specfunc - def is_accessory_present(self): - """Check if the accessory is present""" - return bool(lib.ShamrockAccessoryIsPresent(self.idx)) - def _check_accessory(self): - if not self.is_accessory_present(): - raise AndorNotSupportedError("accessory is not present") - @_specfunc - def get_accessory_state(self, line): - """Get current accessory state on a given line (1 or 2)""" - self._check_accessory() - return lib.ShamrockGetAccessoryState(self.idx,line) - @_specfunc - def set_accessory_state(self, line, state): - """Set current accessory state (0 or 1) on a given line (1 or 2)""" - self._check_accessory() - lib.ShamrockSetAccessory(self.idx,line,state) - return self.get_accessory_state(line) - def _get_all_accessory_states(self): - return [self.get_accessory_state(l) if self.is_accessory_present() else None for l in range(1,3)] - def _set_all_accessory_states(self, states): - for l,s in enumerate(states,start=1): - if s is not None: - self.set_accessory_state(l,s) - - - ### Calibration ### - @_specfunc - def get_pixel_width(self): - """Get current set detector pixel width (in m)""" - return lib.ShamrockGetPixelWidth(self.idx)*1E-6 - @_specfunc - def set_pixel_width(self, width): - """Set current detector pixel width (in m)""" - lib.ShamrockSetPixelWidth(self.idx,width/1E-6) - return self.get_pixel_width() - @_specfunc - def get_number_pixels(self): - """Get current set detector number of pixels""" - return lib.ShamrockGetNumberPixels(self.idx) - @_specfunc - def set_number_pixels(self, number): - """Set current detector number of pixels""" - lib.ShamrockSetNumberPixels(self.idx,number) - return self.get_number_pixels() - def setup_pixels_from_camera(self, cam): - """Setup detector parameters (number of pixels, pixel width) from the camera""" - pixel_size=cam.get_pixel_size() - det_size=cam.get_detector_size() - self.set_pixel_width(pixel_size[0]) - self.set_number_pixels(det_size[0]) - return self.get_pixel_width(),self.get_number_pixels() - @_specfunc - def get_calibration(self): - """ - Get wavelength calibration. - - Return numpy array which specifies wavelength (in m) corresponding to each pixel. - Prior to calling this method, the total number of pixels and the pixel width of the sensor should be set up using the corresponding methods - (:meth:`set_number_pixels` and :meth:`set_pixel_width`, or :meth:`setup_pixels_from_camera` to set both parameters using and AndorSDK2 camera instance) - """ - npx=self.get_number_pixels() - return np.array(lib.ShamrockGetCalibration(self.idx,self.get_number_pixels()))*1E-9 if npx else np.zeros(0) \ No newline at end of file diff --git a/pylablib/Andor/ShamrockCIF_defs.py b/pylablib/Andor/ShamrockCIF_defs.py deleted file mode 100644 index 164031a..0000000 --- a/pylablib/Andor/ShamrockCIF_defs.py +++ /dev/null @@ -1,518 +0,0 @@ -########## This file is generated automatically based on ShamrockCIF.h ########## - -# pylint: disable=unused-import, unused-argument, wrong-spelling-in-comment - - -import ctypes -import enum -from ...core.utils import ctypes_wrap - - - - -def _int32(v): return (v+0x80000000)%0x100000000-0x80000000 - - - - -##### DEFINE GROUPS ##### - - -class SHAMROCK_ERR(enum.IntEnum): - SHAMROCK_COMMUNICATION_ERROR = _int32(20201) - SHAMROCK_SUCCESS = _int32(20202) - SHAMROCK_P1INVALID = _int32(20266) - SHAMROCK_P2INVALID = _int32(20267) - SHAMROCK_P3INVALID = _int32(20268) - SHAMROCK_P4INVALID = _int32(20269) - SHAMROCK_P5INVALID = _int32(20270) - SHAMROCK_NOT_INITIALIZED = _int32(20275) - SHAMROCK_NOT_AVAILABLE = _int32(20292) -dSHAMROCK_ERR={a.name:a.value for a in SHAMROCK_ERR} -drSHAMROCK_ERR={a.value:a.name for a in SHAMROCK_ERR} - - -class SHAMROCK_CONST(enum.IntEnum): - SHAMROCK_ACCESSORYMIN = _int32(0) - SHAMROCK_ACCESSORYMAX = _int32(1) - SHAMROCK_FILTERMIN = _int32(1) - SHAMROCK_FILTERMAX = _int32(6) - SHAMROCK_TURRETMIN = _int32(1) - SHAMROCK_TURRETMAX = _int32(3) - SHAMROCK_GRATINGMIN = _int32(1) - SHAMROCK_SLITWIDTHMIN = _int32(10) - SHAMROCK_SLITWIDTHMAX = _int32(2500) - SHAMROCK_I24SLITWIDTHMAX = _int32(24000) - SHAMROCK_SHUTTERMODEMIN = _int32(0) - SHAMROCK_SHUTTERMODEMAX = _int32(2) - SHAMROCK_DET_OFFSET_MIN = _int32(-240000) - SHAMROCK_DET_OFFSET_MAX = _int32(240000) - SHAMROCK_GRAT_OFFSET_MIN = _int32(-20000) - SHAMROCK_GRAT_OFFSET_MAX = _int32(20000) - SHAMROCK_SLIT_INDEX_MIN = _int32(1) - SHAMROCK_SLIT_INDEX_MAX = _int32(4) - SHAMROCK_INPUT_SLIT_SIDE = _int32(1) - SHAMROCK_INPUT_SLIT_DIRECT = _int32(2) - SHAMROCK_OUTPUT_SLIT_SIDE = _int32(3) - SHAMROCK_OUTPUT_SLIT_DIRECT = _int32(4) - SHAMROCK_FLIPPER_INDEX_MIN = _int32(1) - SHAMROCK_FLIPPER_INDEX_MAX = _int32(2) - SHAMROCK_PORTMIN = _int32(0) - SHAMROCK_PORTMAX = _int32(1) - SHAMROCK_INPUT_FLIPPER = _int32(1) - SHAMROCK_OUTPUT_FLIPPER = _int32(2) - SHAMROCK_DIRECT_PORT = _int32(0) - SHAMROCK_SIDE_PORT = _int32(1) -dSHAMROCK_CONST={a.name:a.value for a in SHAMROCK_CONST} -drSHAMROCK_CONST={a.value:a.name for a in SHAMROCK_CONST} - - - - - -##### TYPE DEFINITIONS ##### - - -BYTE=ctypes.c_ubyte -PBYTE=ctypes.POINTER(BYTE) -CHAR=ctypes.c_char -PCHAR=ctypes.c_char_p -UCHAR=ctypes.c_ubyte -PUCHAR=ctypes.POINTER(UCHAR) -ULONG_PTR=ctypes.c_uint64 -LONG_PTR=ctypes.c_int64 -WORD=ctypes.c_ushort -DWORD=ctypes.c_ulong -LPWORD=ctypes.POINTER(WORD) -LONG=ctypes.c_long -LONGLONG=ctypes.c_int64 -LPLONG=ctypes.POINTER(ctypes.c_long) -HANDLE=ctypes.c_void_p -LPHANDLE=ctypes.POINTER(HANDLE) -PHANDLE=ctypes.POINTER(HANDLE) -HWND=ctypes.c_void_p -HGLOBAL=ctypes.c_void_p -HINSTANCE=ctypes.c_void_p -HDC=ctypes.c_void_p -HMODULE=ctypes.c_void_p -HKEY=ctypes.c_void_p -PVOID=ctypes.c_void_p -LPVOID=ctypes.c_void_p -class RECT(ctypes.Structure): - _fields_=[ ("left",LONG), - ("top",LONG), - ("right",LONG), - ("bottom",LONG) ] -PRECT=ctypes.POINTER(RECT) -class CRECT(ctypes_wrap.CStructWrapper): - _struct=RECT - - -class BITMAPINFOHEADER(ctypes.Structure): - _fields_=[ ("biSize",DWORD), - ("biWidth",LONG), - ("biHeight",LONG), - ("biPlanes",WORD), - ("biBitCount",WORD), - ("biCompression",DWORD), - ("biSizeImage",DWORD), - ("biXPelsPerMeter",LONG), - ("biYPelsPerMeter",LONG), - ("biClrUsed",DWORD), - ("biClrImportant",DWORD) ] -PBITMAPINFOHEADER=ctypes.POINTER(BITMAPINFOHEADER) -class CBITMAPINFOHEADER(ctypes_wrap.CStructWrapper): - _struct=BITMAPINFOHEADER - - - - - -##### FUNCTION DEFINITIONS ##### - - - - - -def addfunc(lib, name, restype, argtypes=None, argnames=None): - if getattr(lib,name,None) is None: - setattr(lib,name,None) - else: - func=getattr(lib,name) - func.restype=restype - if argtypes is not None: - func.argtypes=argtypes - if argnames is not None: - func.argnames=argnames - -def define_functions(lib): - # ctypes.c_uint ShamrockInitialize(ctypes.c_char_p IniPath) - addfunc(lib, "ShamrockInitialize", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p], - argnames = ["IniPath"] ) - # ctypes.c_uint ShamrockClose() - addfunc(lib, "ShamrockClose", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint ShamrockGetNumberDevices(ctypes.POINTER(ctypes.c_int) nodevices) - addfunc(lib, "ShamrockGetNumberDevices", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["nodevices"] ) - # ctypes.c_uint ShamrockGetFunctionReturnDescription(ctypes.c_int error, ctypes.c_char_p description, ctypes.c_int MaxDescStrLen) - addfunc(lib, "ShamrockGetFunctionReturnDescription", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_char_p, ctypes.c_int], - argnames = ["error", "description", "MaxDescStrLen"] ) - # ctypes.c_uint ShamrockGetSerialNumber(ctypes.c_int device, ctypes.c_char_p serial) - addfunc(lib, "ShamrockGetSerialNumber", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_char_p], - argnames = ["device", "serial"] ) - # ctypes.c_uint ShamrockEepromSetOpticalParams(ctypes.c_int device, ctypes.c_float FocalLength, ctypes.c_float AngularDeviation, ctypes.c_float FocalTilt) - addfunc(lib, "ShamrockEepromSetOpticalParams", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_float, ctypes.c_float, ctypes.c_float], - argnames = ["device", "FocalLength", "AngularDeviation", "FocalTilt"] ) - # ctypes.c_uint ShamrockEepromGetOpticalParams(ctypes.c_int device, ctypes.POINTER(ctypes.c_float) FocalLength, ctypes.POINTER(ctypes.c_float) AngularDeviation, ctypes.POINTER(ctypes.c_float) FocalTilt) - addfunc(lib, "ShamrockEepromGetOpticalParams", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)], - argnames = ["device", "FocalLength", "AngularDeviation", "FocalTilt"] ) - # ctypes.c_uint ShamrockSetGrating(ctypes.c_int device, ctypes.c_int grating) - addfunc(lib, "ShamrockSetGrating", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["device", "grating"] ) - # ctypes.c_uint ShamrockGetGrating(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) grating) - addfunc(lib, "ShamrockGetGrating", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "grating"] ) - # ctypes.c_uint ShamrockWavelengthReset(ctypes.c_int device) - addfunc(lib, "ShamrockWavelengthReset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["device"] ) - # ctypes.c_uint ShamrockGetNumberGratings(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) noGratings) - addfunc(lib, "ShamrockGetNumberGratings", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "noGratings"] ) - # ctypes.c_uint ShamrockGetGratingInfo(ctypes.c_int device, ctypes.c_int Grating, ctypes.POINTER(ctypes.c_float) Lines, ctypes.c_char_p Blaze, ctypes.POINTER(ctypes.c_int) Home, ctypes.POINTER(ctypes.c_int) Offset) - addfunc(lib, "ShamrockGetGratingInfo", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float), ctypes.c_char_p, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "Grating", "Lines", "Blaze", "Home", "Offset"] ) - # ctypes.c_uint ShamrockSetDetectorOffset(ctypes.c_int device, ctypes.c_int offset) - addfunc(lib, "ShamrockSetDetectorOffset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["device", "offset"] ) - # ctypes.c_uint ShamrockGetDetectorOffset(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) offset) - addfunc(lib, "ShamrockGetDetectorOffset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "offset"] ) - # ctypes.c_uint ShamrockSetDetectorOffsetPort2(ctypes.c_int device, ctypes.c_int offset) - addfunc(lib, "ShamrockSetDetectorOffsetPort2", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["device", "offset"] ) - # ctypes.c_uint ShamrockGetDetectorOffsetPort2(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) offset) - addfunc(lib, "ShamrockGetDetectorOffsetPort2", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "offset"] ) - # ctypes.c_uint ShamrockSetDetectorOffsetEx(ctypes.c_int device, ctypes.c_int entrancePort, ctypes.c_int exitPort, ctypes.c_int offset) - addfunc(lib, "ShamrockSetDetectorOffsetEx", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["device", "entrancePort", "exitPort", "offset"] ) - # ctypes.c_uint ShamrockGetDetectorOffsetEx(ctypes.c_int device, ctypes.c_int entrancePort, ctypes.c_int exitPort, ctypes.POINTER(ctypes.c_int) offset) - addfunc(lib, "ShamrockGetDetectorOffsetEx", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "entrancePort", "exitPort", "offset"] ) - # ctypes.c_uint ShamrockSetGratingOffset(ctypes.c_int device, ctypes.c_int Grating, ctypes.c_int offset) - addfunc(lib, "ShamrockSetGratingOffset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["device", "Grating", "offset"] ) - # ctypes.c_uint ShamrockGetGratingOffset(ctypes.c_int device, ctypes.c_int Grating, ctypes.POINTER(ctypes.c_int) offset) - addfunc(lib, "ShamrockGetGratingOffset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "Grating", "offset"] ) - # ctypes.c_uint ShamrockGratingIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - addfunc(lib, "ShamrockGratingIsPresent", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "present"] ) - # ctypes.c_uint ShamrockSetTurret(ctypes.c_int device, ctypes.c_int Turret) - addfunc(lib, "ShamrockSetTurret", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["device", "Turret"] ) - # ctypes.c_uint ShamrockGetTurret(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) Turret) - addfunc(lib, "ShamrockGetTurret", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "Turret"] ) - # ctypes.c_uint ShamrockSetWavelength(ctypes.c_int device, ctypes.c_float wavelength) - addfunc(lib, "ShamrockSetWavelength", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_float], - argnames = ["device", "wavelength"] ) - # ctypes.c_uint ShamrockGetWavelength(ctypes.c_int device, ctypes.POINTER(ctypes.c_float) wavelength) - addfunc(lib, "ShamrockGetWavelength", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["device", "wavelength"] ) - # ctypes.c_uint ShamrockGotoZeroOrder(ctypes.c_int device) - addfunc(lib, "ShamrockGotoZeroOrder", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["device"] ) - # ctypes.c_uint ShamrockAtZeroOrder(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) atZeroOrder) - addfunc(lib, "ShamrockAtZeroOrder", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "atZeroOrder"] ) - # ctypes.c_uint ShamrockGetWavelengthLimits(ctypes.c_int device, ctypes.c_int Grating, ctypes.POINTER(ctypes.c_float) Min, ctypes.POINTER(ctypes.c_float) Max) - addfunc(lib, "ShamrockGetWavelengthLimits", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)], - argnames = ["device", "Grating", "Min", "Max"] ) - # ctypes.c_uint ShamrockWavelengthIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - addfunc(lib, "ShamrockWavelengthIsPresent", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "present"] ) - # ctypes.c_uint ShamrockSetAutoSlitWidth(ctypes.c_int device, ctypes.c_int index, ctypes.c_float width) - addfunc(lib, "ShamrockSetAutoSlitWidth", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_float], - argnames = ["device", "index", "width"] ) - # ctypes.c_uint ShamrockGetAutoSlitWidth(ctypes.c_int device, ctypes.c_int index, ctypes.POINTER(ctypes.c_float) width) - addfunc(lib, "ShamrockGetAutoSlitWidth", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["device", "index", "width"] ) - # ctypes.c_uint ShamrockAutoSlitReset(ctypes.c_int device, ctypes.c_int index) - addfunc(lib, "ShamrockAutoSlitReset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["device", "index"] ) - # ctypes.c_uint ShamrockAutoSlitIsPresent(ctypes.c_int device, ctypes.c_int index, ctypes.POINTER(ctypes.c_int) present) - addfunc(lib, "ShamrockAutoSlitIsPresent", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "index", "present"] ) - # ctypes.c_uint ShamrockSetAutoSlitCoefficients(ctypes.c_int device, ctypes.c_int index, ctypes.c_int x1, ctypes.c_int y1, ctypes.c_int x2, ctypes.c_int y2) - addfunc(lib, "ShamrockSetAutoSlitCoefficients", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["device", "index", "x1", "y1", "x2", "y2"] ) - # ctypes.c_uint ShamrockGetAutoSlitCoefficients(ctypes.c_int device, ctypes.c_int index, ctypes.POINTER(ctypes.c_int) x1, ctypes.POINTER(ctypes.c_int) y1, ctypes.POINTER(ctypes.c_int) x2, ctypes.POINTER(ctypes.c_int) y2) - addfunc(lib, "ShamrockGetAutoSlitCoefficients", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "index", "x1", "y1", "x2", "y2"] ) - # ctypes.c_uint ShamrockSetSlitZeroPosition(ctypes.c_int device, ctypes.c_int index, ctypes.c_int offset) - addfunc(lib, "ShamrockSetSlitZeroPosition", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["device", "index", "offset"] ) - # ctypes.c_uint ShamrockGetSlitZeroPosition(ctypes.c_int device, ctypes.c_int index, ctypes.POINTER(ctypes.c_int) offset) - addfunc(lib, "ShamrockGetSlitZeroPosition", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "index", "offset"] ) - # ctypes.c_uint ShamrockSetSlit(ctypes.c_int device, ctypes.c_float width) - addfunc(lib, "ShamrockSetSlit", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_float], - argnames = ["device", "width"] ) - # ctypes.c_uint ShamrockGetSlit(ctypes.c_int device, ctypes.POINTER(ctypes.c_float) width) - addfunc(lib, "ShamrockGetSlit", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["device", "width"] ) - # ctypes.c_uint ShamrockSlitReset(ctypes.c_int device) - addfunc(lib, "ShamrockSlitReset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["device"] ) - # ctypes.c_uint ShamrockSlitIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - addfunc(lib, "ShamrockSlitIsPresent", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "present"] ) - # ctypes.c_uint ShamrockSetSlitCoefficients(ctypes.c_int device, ctypes.c_int x1, ctypes.c_int y1, ctypes.c_int x2, ctypes.c_int y2) - addfunc(lib, "ShamrockSetSlitCoefficients", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["device", "x1", "y1", "x2", "y2"] ) - # ctypes.c_uint ShamrockGetSlitCoefficients(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) x1, ctypes.POINTER(ctypes.c_int) y1, ctypes.POINTER(ctypes.c_int) x2, ctypes.POINTER(ctypes.c_int) y2) - addfunc(lib, "ShamrockGetSlitCoefficients", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "x1", "y1", "x2", "y2"] ) - # ctypes.c_uint ShamrockSetOutputSlit(ctypes.c_int device, ctypes.c_float width) - addfunc(lib, "ShamrockSetOutputSlit", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_float], - argnames = ["device", "width"] ) - # ctypes.c_uint ShamrockGetOutputSlit(ctypes.c_int device, ctypes.POINTER(ctypes.c_float) width) - addfunc(lib, "ShamrockGetOutputSlit", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["device", "width"] ) - # ctypes.c_uint ShamrockOutputSlitReset(ctypes.c_int device) - addfunc(lib, "ShamrockOutputSlitReset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["device"] ) - # ctypes.c_uint ShamrockOutputSlitIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - addfunc(lib, "ShamrockOutputSlitIsPresent", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "present"] ) - # ctypes.c_uint ShamrockSetShutter(ctypes.c_int device, ctypes.c_int mode) - addfunc(lib, "ShamrockSetShutter", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["device", "mode"] ) - # ctypes.c_uint ShamrockGetShutter(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) mode) - addfunc(lib, "ShamrockGetShutter", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "mode"] ) - # ctypes.c_uint ShamrockIsModePossible(ctypes.c_int device, ctypes.c_int mode, ctypes.POINTER(ctypes.c_int) possible) - addfunc(lib, "ShamrockIsModePossible", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "mode", "possible"] ) - # ctypes.c_uint ShamrockShutterIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - addfunc(lib, "ShamrockShutterIsPresent", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "present"] ) - # ctypes.c_uint ShamrockSetFilter(ctypes.c_int device, ctypes.c_int filter) - addfunc(lib, "ShamrockSetFilter", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["device", "filter"] ) - # ctypes.c_uint ShamrockGetFilter(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) filter) - addfunc(lib, "ShamrockGetFilter", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "filter"] ) - # ctypes.c_uint ShamrockGetFilterInfo(ctypes.c_int device, ctypes.c_int Filter, ctypes.c_char_p Info) - addfunc(lib, "ShamrockGetFilterInfo", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_char_p], - argnames = ["device", "Filter", "Info"] ) - # ctypes.c_uint ShamrockSetFilterInfo(ctypes.c_int device, ctypes.c_int Filter, ctypes.c_char_p Info) - addfunc(lib, "ShamrockSetFilterInfo", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_char_p], - argnames = ["device", "Filter", "Info"] ) - # ctypes.c_uint ShamrockFilterReset(ctypes.c_int device) - addfunc(lib, "ShamrockFilterReset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["device"] ) - # ctypes.c_uint ShamrockFilterIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - addfunc(lib, "ShamrockFilterIsPresent", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "present"] ) - # ctypes.c_uint ShamrockSetFlipperMirror(ctypes.c_int device, ctypes.c_int flipper, ctypes.c_int port) - addfunc(lib, "ShamrockSetFlipperMirror", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["device", "flipper", "port"] ) - # ctypes.c_uint ShamrockGetFlipperMirror(ctypes.c_int device, ctypes.c_int flipper, ctypes.POINTER(ctypes.c_int) port) - addfunc(lib, "ShamrockGetFlipperMirror", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "flipper", "port"] ) - # ctypes.c_uint ShamrockFlipperMirrorReset(ctypes.c_int device, ctypes.c_int flipper) - addfunc(lib, "ShamrockFlipperMirrorReset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["device", "flipper"] ) - # ctypes.c_uint ShamrockFlipperMirrorIsPresent(ctypes.c_int device, ctypes.c_int flipper, ctypes.POINTER(ctypes.c_int) present) - addfunc(lib, "ShamrockFlipperMirrorIsPresent", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "flipper", "present"] ) - # ctypes.c_uint ShamrockGetCCDLimits(ctypes.c_int device, ctypes.c_int port, ctypes.POINTER(ctypes.c_float) Low, ctypes.POINTER(ctypes.c_float) High) - addfunc(lib, "ShamrockGetCCDLimits", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)], - argnames = ["device", "port", "Low", "High"] ) - # ctypes.c_uint ShamrockSetFlipperMirrorPosition(ctypes.c_int device, ctypes.c_int flipper, ctypes.c_int position) - addfunc(lib, "ShamrockSetFlipperMirrorPosition", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["device", "flipper", "position"] ) - # ctypes.c_uint ShamrockGetFlipperMirrorPosition(ctypes.c_int device, ctypes.c_int flipper, ctypes.POINTER(ctypes.c_int) position) - addfunc(lib, "ShamrockGetFlipperMirrorPosition", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "flipper", "position"] ) - # ctypes.c_uint ShamrockGetFlipperMirrorMaxPosition(ctypes.c_int device, ctypes.c_int flipper, ctypes.POINTER(ctypes.c_int) max) - addfunc(lib, "ShamrockGetFlipperMirrorMaxPosition", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "flipper", "max"] ) - # ctypes.c_uint ShamrockSetPort(ctypes.c_int device, ctypes.c_int port) - addfunc(lib, "ShamrockSetPort", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["device", "port"] ) - # ctypes.c_uint ShamrockGetPort(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) port) - addfunc(lib, "ShamrockGetPort", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "port"] ) - # ctypes.c_uint ShamrockFlipperReset(ctypes.c_int device) - addfunc(lib, "ShamrockFlipperReset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["device"] ) - # ctypes.c_uint ShamrockFlipperIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - addfunc(lib, "ShamrockFlipperIsPresent", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "present"] ) - # ctypes.c_uint ShamrockSetAccessory(ctypes.c_int device, ctypes.c_int Accessory, ctypes.c_int State) - addfunc(lib, "ShamrockSetAccessory", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["device", "Accessory", "State"] ) - # ctypes.c_uint ShamrockGetAccessoryState(ctypes.c_int device, ctypes.c_int Accessory, ctypes.POINTER(ctypes.c_int) state) - addfunc(lib, "ShamrockGetAccessoryState", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "Accessory", "state"] ) - # ctypes.c_uint ShamrockAccessoryIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - addfunc(lib, "ShamrockAccessoryIsPresent", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "present"] ) - # ctypes.c_uint ShamrockSetFocusMirror(ctypes.c_int device, ctypes.c_int focus) - addfunc(lib, "ShamrockSetFocusMirror", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["device", "focus"] ) - # ctypes.c_uint ShamrockGetFocusMirror(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) focus) - addfunc(lib, "ShamrockGetFocusMirror", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "focus"] ) - # ctypes.c_uint ShamrockGetFocusMirrorMaxSteps(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) steps) - addfunc(lib, "ShamrockGetFocusMirrorMaxSteps", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "steps"] ) - # ctypes.c_uint ShamrockFocusMirrorReset(ctypes.c_int device) - addfunc(lib, "ShamrockFocusMirrorReset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["device"] ) - # ctypes.c_uint ShamrockFocusMirrorIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - addfunc(lib, "ShamrockFocusMirrorIsPresent", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "present"] ) - # ctypes.c_uint ShamrockSetPixelWidth(ctypes.c_int device, ctypes.c_float Width) - addfunc(lib, "ShamrockSetPixelWidth", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_float], - argnames = ["device", "Width"] ) - # ctypes.c_uint ShamrockSetNumberPixels(ctypes.c_int device, ctypes.c_int NumberPixels) - addfunc(lib, "ShamrockSetNumberPixels", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["device", "NumberPixels"] ) - # ctypes.c_uint ShamrockGetPixelWidth(ctypes.c_int device, ctypes.POINTER(ctypes.c_float) Width) - addfunc(lib, "ShamrockGetPixelWidth", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["device", "Width"] ) - # ctypes.c_uint ShamrockGetNumberPixels(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) NumberPixels) - addfunc(lib, "ShamrockGetNumberPixels", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "NumberPixels"] ) - # ctypes.c_uint ShamrockGetCalibration(ctypes.c_int device, ctypes.POINTER(ctypes.c_float) CalibrationValues, ctypes.c_int NumberPixels) - addfunc(lib, "ShamrockGetCalibration", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float), ctypes.c_int], - argnames = ["device", "CalibrationValues", "NumberPixels"] ) - # ctypes.c_uint ShamrockGetPixelCalibrationCoefficients(ctypes.c_int device, ctypes.POINTER(ctypes.c_float) A, ctypes.POINTER(ctypes.c_float) B, ctypes.POINTER(ctypes.c_float) C, ctypes.POINTER(ctypes.c_float) D) - addfunc(lib, "ShamrockGetPixelCalibrationCoefficients", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)], - argnames = ["device", "A", "B", "C", "D"] ) - # ctypes.c_uint ShamrockIrisIsPresent(ctypes.c_int device, ctypes.c_int iris, ctypes.POINTER(ctypes.c_int) present) - addfunc(lib, "ShamrockIrisIsPresent", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "iris", "present"] ) - # ctypes.c_uint ShamrockSetIris(ctypes.c_int device, ctypes.c_int iris, ctypes.c_int value) - addfunc(lib, "ShamrockSetIris", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["device", "iris", "value"] ) - # ctypes.c_uint ShamrockGetIris(ctypes.c_int device, ctypes.c_int iris, ctypes.POINTER(ctypes.c_int) value) - addfunc(lib, "ShamrockGetIris", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "iris", "value"] ) - # ctypes.c_uint ShamrockFocusMirrorTiltIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - addfunc(lib, "ShamrockFocusMirrorTiltIsPresent", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "present"] ) - # ctypes.c_uint ShamrockSetFocusMirrorTilt(ctypes.c_int device, ctypes.c_int tilt) - addfunc(lib, "ShamrockSetFocusMirrorTilt", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["device", "tilt"] ) - # ctypes.c_uint ShamrockGetFocusMirrorTilt(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) tilt) - addfunc(lib, "ShamrockGetFocusMirrorTilt", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "tilt"] ) - # ctypes.c_uint ShamrockSetFocusMirrorTiltOffset(ctypes.c_int device, ctypes.c_int entrancePort, ctypes.c_int exitPort, ctypes.c_int offset) - addfunc(lib, "ShamrockSetFocusMirrorTiltOffset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["device", "entrancePort", "exitPort", "offset"] ) - # ctypes.c_uint ShamrockGetFocusMirrorTiltOffset(ctypes.c_int device, ctypes.c_int entrancePort, ctypes.c_int exitPort, ctypes.POINTER(ctypes.c_int) offset) - addfunc(lib, "ShamrockGetFocusMirrorTiltOffset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["device", "entrancePort", "exitPort", "offset"] ) - # ctypes.c_uint ShamrockMoveTurretToSafeChangePosition(ctypes.c_int device) - addfunc(lib, "ShamrockMoveTurretToSafeChangePosition", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["device"] ) - - diff --git a/pylablib/Andor/ShamrockCIF_lib.py b/pylablib/Andor/ShamrockCIF_lib.py deleted file mode 100644 index 6b51a46..0000000 --- a/pylablib/Andor/ShamrockCIF_lib.py +++ /dev/null @@ -1,254 +0,0 @@ -# pylint: disable=spelling - -from . import ShamrockCIF_defs # pylint: disable=unused-import -from .ShamrockCIF_defs import SHAMROCK_ERR, drSHAMROCK_ERR -from .ShamrockCIF_defs import SHAMROCK_CONST # pylint: disable=unused-import -from .ShamrockCIF_defs import define_functions -from .base import AndorError - -from ...core.utils import ctypes_wrap, py3 -from ..utils import load_lib - -import platform -import ctypes -import os - - - -class ShamrockLibError(AndorError): - """Generic Andor Shamrock library error""" - def __init__(self, func, code, lib=None): - self.func=func - self.code=code - self.name=drSHAMROCK_ERR.get(self.code,"UNKNOWN") - self.desc="" - try: - if lib is not None: - self.desc=py3.as_str(lib.ShamrockGetFunctionReturnDescription(code)) - except ShamrockLibError: - pass - msg="function '{}' raised error {}({}): {}".format(func,code,self.name,self.desc) - super().__init__(msg) -def errcheck(passing=None, lib=None): - """ - Build an error checking function. - - Return a function which checks return codes of Andor Shamrock library functions. - `passing` is a list specifying which return codes are acceptable (by default only 0, which is success code, is acceptable). - """ - passing=set(passing) if passing is not None else set() - passing.add(SHAMROCK_ERR.SHAMROCK_SUCCESS) # always allow success - def errchecker(result, func, arguments): # pylint: disable=unused-argument - if result not in passing: - raise ShamrockLibError(func.__name__,result,lib=lib) - return result - return errchecker - - - - -class ShamrockLib: - def __init__(self): - self._initialized=False - - def initlib(self): - if self._initialized: - return - - solis_path=load_lib.get_program_files_folder("Andor SOLIS") - shamrock_path=os.path.join(solis_path,"Shamrock") - sdk2_path=load_lib.get_program_files_folder("Andor SDK") - archbit=platform.architecture()[0][:2] - error_message="The library is automatically supplied with Andor SDK2 software or micromanager plugin\n"+load_lib.par_error_message.format("andor_shamrock") - lib_names=["atspectrograph.dll","ShamrockCIF{}.dll".format(archbit),"ShamrockCIF.dll"] - depends=["atshamrock.dll","atshamrock{}.dll".format(archbit),"atmcd{}d.dll".format(archbit),"atmcd{}d_legacy.dll".format(archbit)] - locations=["parameter/andor_shamrock",sdk2_path,solis_path,shamrock_path,"global"] - self.lib=load_lib.load_lib(lib_names,locations=locations,depends=depends,depends_required=False,error_message=error_message,call_conv="stdcall") - lib=self.lib - define_functions(lib) - - wrapper=ctypes_wrap.CFunctionWrapper(errcheck=errcheck(lib=self),default_rvals="pointer") - default_strlen=256 - strprep=ctypes_wrap.strprep(default_strlen) - - - # ctypes.c_uint ShamrockInitialize(ctypes.c_char_p IniPath) - self.ShamrockInitialize=wrapper(lib.ShamrockInitialize) - # ctypes.c_uint ShamrockClose() - self.ShamrockClose=wrapper(lib.ShamrockClose) - # ctypes.c_uint ShamrockGetFunctionReturnDescription(ctypes.c_int error, ctypes.c_char_p description, ctypes.c_int MaxDescStrLen) - self.ShamrockGetFunctionReturnDescription=wrapper(lib.ShamrockGetFunctionReturnDescription, args=["error"], rvals=["description"], - argprep={"description":strprep,"MaxDescStrLen":default_strlen}, byref=[], errcheck=errcheck()) - - # ctypes.c_uint ShamrockGetNumberDevices(ctypes.POINTER(ctypes.c_int) nodevices) - self.ShamrockGetNumberDevices=wrapper(lib.ShamrockGetNumberDevices) - # ctypes.c_uint ShamrockGetSerialNumber(ctypes.c_int device, ctypes.c_char_p serial) - self.ShamrockGetSerialNumber=wrapper(lib.ShamrockGetSerialNumber, args=["device"], rvals=["serial"], - argprep={"serial":strprep}, byref=[]) - # ctypes.c_uint ShamrockEepromGetOpticalParams(ctypes.c_int device, ctypes.POINTER(ctypes.c_float) FocalLength, ctypes.POINTER(ctypes.c_float) AngularDeviation, ctypes.POINTER(ctypes.c_float) FocalTilt) - self.ShamrockEepromGetOpticalParams=wrapper(lib.ShamrockEepromGetOpticalParams) - - # ctypes.c_uint ShamrockGratingIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - self.ShamrockGratingIsPresent=wrapper(lib.ShamrockGratingIsPresent) - # ctypes.c_uint ShamrockGetTurret(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) Turret) - self.ShamrockGetTurret=wrapper(lib.ShamrockGetTurret) - # ctypes.c_uint ShamrockSetTurret(ctypes.c_int device, ctypes.c_int Turret) - self.ShamrockSetTurret=wrapper(lib.ShamrockSetTurret) - # ctypes.c_uint ShamrockGetNumberGratings(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) noGratings) - self.ShamrockGetNumberGratings=wrapper(lib.ShamrockGetNumberGratings) - # ctypes.c_uint ShamrockGetGrating(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) grating) - self.ShamrockGetGrating=wrapper(lib.ShamrockGetGrating) - # ctypes.c_uint ShamrockSetGrating(ctypes.c_int device, ctypes.c_int grating) - self.ShamrockSetGrating=wrapper(lib.ShamrockSetGrating) - # ctypes.c_uint ShamrockGetGratingInfo(ctypes.c_int device, ctypes.c_int Grating, ctypes.POINTER(ctypes.c_float) Lines, ctypes.c_char_p Blaze, ctypes.POINTER(ctypes.c_int) Home, ctypes.POINTER(ctypes.c_int) Offset) - self.ShamrockGetGratingInfo=wrapper(lib.ShamrockGetGratingInfo, args=["device","Grating"], rvals=["Lines","Blaze","Home","Offset"], - argprep={"Blaze":strprep}, byref=["Lines","Home","Offset"]) - # ctypes.c_uint ShamrockGetGratingOffset(ctypes.c_int device, ctypes.c_int Grating, ctypes.POINTER(ctypes.c_int) offset) - self.ShamrockGetGratingOffset=wrapper(lib.ShamrockGetGratingOffset) - # ctypes.c_uint ShamrockSetGratingOffset(ctypes.c_int device, ctypes.c_int Grating, ctypes.c_int offset) - self.ShamrockSetGratingOffset=wrapper(lib.ShamrockSetGratingOffset) - # ctypes.c_uint ShamrockGetDetectorOffset(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) offset) - self.ShamrockGetDetectorOffset=wrapper(lib.ShamrockGetDetectorOffset) - # ctypes.c_uint ShamrockSetDetectorOffset(ctypes.c_int device, ctypes.c_int offset) - self.ShamrockSetDetectorOffset=wrapper(lib.ShamrockSetDetectorOffset) - # ctypes.c_uint ShamrockGetDetectorOffsetPort2(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) offset) - self.ShamrockGetDetectorOffsetPort2=wrapper(lib.ShamrockGetDetectorOffsetPort2) - # ctypes.c_uint ShamrockSetDetectorOffsetPort2(ctypes.c_int device, ctypes.c_int offset) - self.ShamrockSetDetectorOffsetPort2=wrapper(lib.ShamrockSetDetectorOffsetPort2) - # ctypes.c_uint ShamrockWavelengthReset(ctypes.c_int device) - self.ShamrockWavelengthReset=wrapper(lib.ShamrockWavelengthReset) - - # ctypes.c_uint ShamrockWavelengthIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - self.ShamrockWavelengthIsPresent=wrapper(lib.ShamrockWavelengthIsPresent) - # ctypes.c_uint ShamrockGetWavelengthLimits(ctypes.c_int device, ctypes.c_int Grating, ctypes.POINTER(ctypes.c_float) Min, ctypes.POINTER(ctypes.c_float) Max) - self.ShamrockGetWavelengthLimits=wrapper(lib.ShamrockGetWavelengthLimits) - # ctypes.c_uint ShamrockGetWavelength(ctypes.c_int device, ctypes.POINTER(ctypes.c_float) wavelength) - self.ShamrockGetWavelength=wrapper(lib.ShamrockGetWavelength) - # ctypes.c_uint ShamrockSetWavelength(ctypes.c_int device, ctypes.c_float wavelength) - self.ShamrockSetWavelength=wrapper(lib.ShamrockSetWavelength) - # ctypes.c_uint ShamrockAtZeroOrder(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) atZeroOrder) - self.ShamrockAtZeroOrder=wrapper(lib.ShamrockAtZeroOrder) - # ctypes.c_uint ShamrockGotoZeroOrder(ctypes.c_int device) - self.ShamrockGotoZeroOrder=wrapper(lib.ShamrockGotoZeroOrder) - - # ctypes.c_uint ShamrockAutoSlitIsPresent(ctypes.c_int device, ctypes.c_int index, ctypes.POINTER(ctypes.c_int) present) - self.ShamrockAutoSlitIsPresent=wrapper(lib.ShamrockAutoSlitIsPresent) - # ctypes.c_uint ShamrockAutoSlitReset(ctypes.c_int device, ctypes.c_int index) - self.ShamrockAutoSlitReset=wrapper(lib.ShamrockAutoSlitReset) - # ctypes.c_uint ShamrockGetAutoSlitWidth(ctypes.c_int device, ctypes.c_int index, ctypes.POINTER(ctypes.c_float) width) - self.ShamrockGetAutoSlitWidth=wrapper(lib.ShamrockGetAutoSlitWidth) - # ctypes.c_uint ShamrockSetAutoSlitWidth(ctypes.c_int device, ctypes.c_int index, ctypes.c_float width) - self.ShamrockSetAutoSlitWidth=wrapper(lib.ShamrockSetAutoSlitWidth) - # ctypes.c_uint ShamrockGetAutoSlitCoefficients(ctypes.c_int device, ctypes.c_int index, ctypes.POINTER(ctypes.c_int) x1, ctypes.POINTER(ctypes.c_int) y1, ctypes.POINTER(ctypes.c_int) x2, ctypes.POINTER(ctypes.c_int) y2) - self.ShamrockGetAutoSlitCoefficients=wrapper(lib.ShamrockGetAutoSlitCoefficients) - # ctypes.c_uint ShamrockSetAutoSlitCoefficients(ctypes.c_int device, ctypes.c_int index, ctypes.c_int x1, ctypes.c_int y1, ctypes.c_int x2, ctypes.c_int y2) - self.ShamrockSetAutoSlitCoefficients=wrapper(lib.ShamrockSetAutoSlitCoefficients) - - # ctypes.c_uint ShamrockShutterIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - self.ShamrockShutterIsPresent=wrapper(lib.ShamrockShutterIsPresent) - # ctypes.c_uint ShamrockIsModePossible(ctypes.c_int device, ctypes.c_int mode, ctypes.POINTER(ctypes.c_int) possible) - self.ShamrockIsModePossible=wrapper(lib.ShamrockIsModePossible) - # ctypes.c_uint ShamrockGetShutter(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) mode) - self.ShamrockGetShutter=wrapper(lib.ShamrockGetShutter) - # ctypes.c_uint ShamrockSetShutter(ctypes.c_int device, ctypes.c_int mode) - self.ShamrockSetShutter=wrapper(lib.ShamrockSetShutter) - - # ctypes.c_uint ShamrockIrisIsPresent(ctypes.c_int device, ctypes.c_int iris, ctypes.POINTER(ctypes.c_int) present) - self.ShamrockIrisIsPresent=wrapper(lib.ShamrockIrisIsPresent) - # ctypes.c_uint ShamrockSetIris(ctypes.c_int device, ctypes.c_int iris, ctypes.c_int value) - self.ShamrockSetIris=wrapper(lib.ShamrockSetIris) - # ctypes.c_uint ShamrockGetIris(ctypes.c_int device, ctypes.c_int iris, ctypes.POINTER(ctypes.c_int) value) - self.ShamrockGetIris=wrapper(lib.ShamrockGetIris) - - # ctypes.c_uint ShamrockSetFocusMirror(ctypes.c_int device, ctypes.c_int focus) - self.ShamrockSetFocusMirror=wrapper(lib.ShamrockSetFocusMirror) - # ctypes.c_uint ShamrockGetFocusMirror(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) focus) - self.ShamrockGetFocusMirror=wrapper(lib.ShamrockGetFocusMirror) - # ctypes.c_uint ShamrockGetFocusMirrorMaxSteps(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) steps) - self.ShamrockGetFocusMirrorMaxSteps=wrapper(lib.ShamrockGetFocusMirrorMaxSteps) - # ctypes.c_uint ShamrockFocusMirrorReset(ctypes.c_int device) - self.ShamrockFocusMirrorReset=wrapper(lib.ShamrockFocusMirrorReset) - # ctypes.c_uint ShamrockFocusMirrorIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - self.ShamrockFocusMirrorIsPresent=wrapper(lib.ShamrockFocusMirrorIsPresent) - - # ctypes.c_uint ShamrockFilterIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - self.ShamrockFilterIsPresent=wrapper(lib.ShamrockFilterIsPresent) - # ctypes.c_uint ShamrockFilterReset(ctypes.c_int device) - self.ShamrockFilterReset=wrapper(lib.ShamrockFilterReset) - # ctypes.c_uint ShamrockGetFilter(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) filter) - self.ShamrockGetFilter=wrapper(lib.ShamrockGetFilter) - # ctypes.c_uint ShamrockSetFilter(ctypes.c_int device, ctypes.c_int filter) - self.ShamrockSetFilter=wrapper(lib.ShamrockSetFilter) - # ctypes.c_uint ShamrockGetFilterInfo(ctypes.c_int device, ctypes.c_int Filter, ctypes.c_char_p Info) - self.ShamrockGetFilterInfo=wrapper(lib.ShamrockGetFilterInfo) - # ctypes.c_uint ShamrockSetFilterInfo(ctypes.c_int device, ctypes.c_int Filter, ctypes.c_char_p Info) - self.ShamrockSetFilterInfo=wrapper(lib.ShamrockSetFilterInfo) - - # ctypes.c_uint ShamrockFlipperMirrorIsPresent(ctypes.c_int device, ctypes.c_int flipper, ctypes.POINTER(ctypes.c_int) present) - self.ShamrockFlipperMirrorIsPresent=wrapper(lib.ShamrockFlipperMirrorIsPresent) - # ctypes.c_uint ShamrockFlipperMirrorReset(ctypes.c_int device, ctypes.c_int flipper) - self.ShamrockFlipperMirrorReset=wrapper(lib.ShamrockFlipperMirrorReset) - # ctypes.c_uint ShamrockGetFlipperMirror(ctypes.c_int device, ctypes.c_int flipper, ctypes.POINTER(ctypes.c_int) port) - self.ShamrockGetFlipperMirror=wrapper(lib.ShamrockGetFlipperMirror) - # ctypes.c_uint ShamrockSetFlipperMirror(ctypes.c_int device, ctypes.c_int flipper, ctypes.c_int port) - self.ShamrockSetFlipperMirror=wrapper(lib.ShamrockSetFlipperMirror) - # ctypes.c_uint ShamrockGetCCDLimits(ctypes.c_int device, ctypes.c_int port, ctypes.POINTER(ctypes.c_float) Low, ctypes.POINTER(ctypes.c_float) High) - self.ShamrockGetCCDLimits=wrapper(lib.ShamrockGetCCDLimits) - - # ctypes.c_uint ShamrockAccessoryIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - self.ShamrockAccessoryIsPresent=wrapper(lib.ShamrockAccessoryIsPresent) - # ctypes.c_uint ShamrockGetAccessoryState(ctypes.c_int device, ctypes.c_int Accessory, ctypes.POINTER(ctypes.c_int) state) - self.ShamrockGetAccessoryState=wrapper(lib.ShamrockGetAccessoryState) - # ctypes.c_uint ShamrockSetAccessory(ctypes.c_int device, ctypes.c_int Accessory, ctypes.c_int State) - self.ShamrockSetAccessory=wrapper(lib.ShamrockSetAccessory) - - # ctypes.c_uint ShamrockGetPixelWidth(ctypes.c_int device, ctypes.POINTER(ctypes.c_float) Width) - self.ShamrockGetPixelWidth=wrapper(lib.ShamrockGetPixelWidth) - # ctypes.c_uint ShamrockSetPixelWidth(ctypes.c_int device, ctypes.c_float Width) - self.ShamrockSetPixelWidth=wrapper(lib.ShamrockSetPixelWidth) - # ctypes.c_uint ShamrockGetNumberPixels(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) NumberPixels) - self.ShamrockGetNumberPixels=wrapper(lib.ShamrockGetNumberPixels) - # ctypes.c_uint ShamrockSetNumberPixels(ctypes.c_int device, ctypes.c_int NumberPixels) - self.ShamrockSetNumberPixels=wrapper(lib.ShamrockSetNumberPixels) - # ctypes.c_uint ShamrockGetCalibration(ctypes.c_int device, ctypes.POINTER(ctypes.c_float) CalibrationValues, ctypes.c_int NumberPixels) - self.ShamrockGetCalibration_lib=wrapper(lib.ShamrockGetCalibration, rvals=[]) - - return - - # ### Deprecated ### - # # ctypes.c_uint ShamrockSlitIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - # self.ShamrockSlitIsPresent=wrapper(lib.ShamrockSlitIsPresent) - # # ctypes.c_uint ShamrockSlitReset(ctypes.c_int device) - # self.ShamrockSlitReset=wrapper(lib.ShamrockSlitReset) - # # ctypes.c_uint ShamrockGetSlit(ctypes.c_int device, ctypes.POINTER(ctypes.c_float) width) - # self.ShamrockGetSlit=wrapper(lib.ShamrockGetSlit) - # # ctypes.c_uint ShamrockSetSlit(ctypes.c_int device, ctypes.c_float width) - # self.ShamrockSetSlit=wrapper(lib.ShamrockSetSlit) - # # ctypes.c_uint ShamrockOutputSlitIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - # self.ShamrockOutputSlitIsPresent=wrapper(lib.ShamrockOutputSlitIsPresent) - # # ctypes.c_uint ShamrockOutputSlitReset(ctypes.c_int device) - # self.ShamrockOutputSlitReset=wrapper(lib.ShamrockOutputSlitReset) - # # ctypes.c_uint ShamrockGetOutputSlit(ctypes.c_int device, ctypes.POINTER(ctypes.c_float) width) - # self.ShamrockGetOutputSlit=wrapper(lib.ShamrockGetOutputSlit) - # # ctypes.c_uint ShamrockSetOutputSlit(ctypes.c_int device, ctypes.c_float width) - # self.ShamrockSetOutputSlit=wrapper(lib.ShamrockSetOutputSlit) - # # ctypes.c_uint ShamrockSetSlitCoefficients(ctypes.c_int device, ctypes.c_int x1, ctypes.c_int y1, ctypes.c_int x2, ctypes.c_int y2) - # self.ShamrockSetSlitCoefficients=wrapper(lib.ShamrockSetSlitCoefficients) - # # ctypes.c_uint ShamrockGetSlitCoefficients(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) x1, ctypes.POINTER(ctypes.c_int) y1, ctypes.POINTER(ctypes.c_int) x2, ctypes.POINTER(ctypes.c_int) y2) - # self.ShamrockGetSlitCoefficients=wrapper(lib.ShamrockGetSlitCoefficients) - # # ctypes.c_uint ShamrockFlipperIsPresent(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) present) - # self.ShamrockFlipperIsPresent=wrapper(lib.ShamrockFlipperIsPresent) - # # ctypes.c_uint ShamrockFlipperReset(ctypes.c_int device) - # self.ShamrockFlipperReset=wrapper(lib.ShamrockFlipperReset) - # # ctypes.c_uint ShamrockGetPort(ctypes.c_int device, ctypes.POINTER(ctypes.c_int) port) - # self.ShamrockGetPort=wrapper(lib.ShamrockGetPort) - # # ctypes.c_uint ShamrockSetPort(ctypes.c_int device, ctypes.c_int port) - # self.ShamrockSetPort=wrapper(lib.ShamrockSetPort) - - def ShamrockGetCalibration(self, device, NumberPixels): - values=(ctypes.c_float*NumberPixels)() - self.ShamrockGetCalibration_lib(device,values,NumberPixels) - return values[:] - - -wlib=ShamrockLib() \ No newline at end of file diff --git a/pylablib/Andor/__init__.py b/pylablib/Andor/__init__.py deleted file mode 100644 index 64985c7..0000000 --- a/pylablib/Andor/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -from . import AndorSDK2 -from .AndorSDK2 import AndorSDK2Camera, get_cameras_number as get_cameras_number_SDK2, get_SDK_version as get_SDK2_version -from . import AndorSDK3 -from .AndorSDK3 import AndorSDK3Camera, get_cameras_number as get_cameras_number_SDK3 -from .Shamrock import list_spectrographs as list_shamrock_spectrographs, get_spectrographs_number as get_shamrock_spectrographs_number, ShamrockSpectrograph -from .base import AndorError, AndorNotSupportedError, AndorTimeoutError \ No newline at end of file diff --git a/pylablib/Andor/atcore_defs.py b/pylablib/Andor/atcore_defs.py deleted file mode 100644 index a24dd99..0000000 --- a/pylablib/Andor/atcore_defs.py +++ /dev/null @@ -1,266 +0,0 @@ -########## This file is generated automatically based on atcore.h ########## - -# pylint: disable=unused-import, unused-argument, wrong-spelling-in-comment - - -import ctypes -import enum -from ...core.utils import ctypes_wrap - - - - -def _int32(v): return (v+0x80000000)%0x100000000-0x80000000 - - - - -##### DEFINE GROUPS ##### - - -class AT_ERR(enum.IntEnum): - AT_SUCCESS = _int32(0) - AT_ERR_NOTINITIALISED = _int32(1) - AT_ERR_NOTIMPLEMENTED = _int32(2) - AT_ERR_READONLY = _int32(3) - AT_ERR_NOTREADABLE = _int32(4) - AT_ERR_NOTWRITABLE = _int32(5) - AT_ERR_OUTOFRANGE = _int32(6) - AT_ERR_INDEXNOTAVAILABLE = _int32(7) - AT_ERR_INDEXNOTIMPLEMENTED = _int32(8) - AT_ERR_EXCEEDEDMAXSTRINGLENGTH = _int32(9) - AT_ERR_CONNECTION = _int32(10) - AT_ERR_NODATA = _int32(11) - AT_ERR_INVALIDHANDLE = _int32(12) - AT_ERR_TIMEDOUT = _int32(13) - AT_ERR_BUFFERFULL = _int32(14) - AT_ERR_INVALIDSIZE = _int32(15) - AT_ERR_INVALIDALIGNMENT = _int32(16) - AT_ERR_COMM = _int32(17) - AT_ERR_STRINGNOTAVAILABLE = _int32(18) - AT_ERR_STRINGNOTIMPLEMENTED = _int32(19) - AT_ERR_NULL_FEATURE = _int32(20) - AT_ERR_NULL_HANDLE = _int32(21) - AT_ERR_NULL_IMPLEMENTED_VAR = _int32(22) - AT_ERR_NULL_READABLE_VAR = _int32(23) - AT_ERR_NULL_READONLY_VAR = _int32(24) - AT_ERR_NULL_WRITABLE_VAR = _int32(25) - AT_ERR_NULL_MINVALUE = _int32(26) - AT_ERR_NULL_MAXVALUE = _int32(27) - AT_ERR_NULL_VALUE = _int32(28) - AT_ERR_NULL_STRING = _int32(29) - AT_ERR_NULL_COUNT_VAR = _int32(30) - AT_ERR_NULL_ISAVAILABLE_VAR = _int32(31) - AT_ERR_NULL_MAXSTRINGLENGTH = _int32(32) - AT_ERR_NULL_EVCALLBACK = _int32(33) - AT_ERR_NULL_QUEUE_PTR = _int32(34) - AT_ERR_NULL_WAIT_PTR = _int32(35) - AT_ERR_NULL_PTRSIZE = _int32(36) - AT_ERR_NOMEMORY = _int32(37) - AT_ERR_DEVICEINUSE = _int32(38) - AT_ERR_DEVICENOTFOUND = _int32(39) - AT_ERR_HARDWARE_OVERFLOW = _int32(100) -dAT_ERR={a.name:a.value for a in AT_ERR} -drAT_ERR={a.value:a.name for a in AT_ERR} - - -class AT_HANDLE(enum.IntEnum): - AT_HANDLE_UNINITIALISED = _int32(-1) - AT_HANDLE_SYSTEM = _int32(1) -dAT_HANDLE={a.name:a.value for a in AT_HANDLE} -drAT_HANDLE={a.value:a.name for a in AT_HANDLE} - - - - - -##### TYPE DEFINITIONS ##### - - -BYTE=ctypes.c_ubyte -PBYTE=ctypes.POINTER(BYTE) -CHAR=ctypes.c_char -PCHAR=ctypes.c_char_p -UCHAR=ctypes.c_ubyte -PUCHAR=ctypes.POINTER(UCHAR) -ULONG_PTR=ctypes.c_uint64 -LONG_PTR=ctypes.c_int64 -WORD=ctypes.c_ushort -LPWORD=ctypes.POINTER(WORD) -LONGLONG=ctypes.c_int64 -LPLONG=ctypes.POINTER(ctypes.c_long) -HANDLE=ctypes.c_void_p -LPHANDLE=ctypes.POINTER(HANDLE) -HWND=ctypes.c_void_p -HGLOBAL=ctypes.c_void_p -HINSTANCE=ctypes.c_void_p -HDC=ctypes.c_void_p -HMODULE=ctypes.c_void_p -HKEY=ctypes.c_void_p -PVOID=ctypes.c_void_p -LPVOID=ctypes.c_void_p -AT_H=ctypes.c_int -AT_BOOL=ctypes.c_int -AT_64=ctypes.c_longlong -AT_U8=ctypes.c_ubyte -AT_WC=ctypes.c_wchar -FeatureCallback=ctypes.c_void_p - - - -##### FUNCTION DEFINITIONS ##### - - - - - -def addfunc(lib, name, restype, argtypes=None, argnames=None): - if getattr(lib,name,None) is None: - setattr(lib,name,None) - else: - func=getattr(lib,name) - func.restype=restype - if argtypes is not None: - func.argtypes=argtypes - if argnames is not None: - func.argnames=argnames - -def define_functions(lib): - # ctypes.c_int AT_InitialiseLibrary() - addfunc(lib, "AT_InitialiseLibrary", restype = ctypes.c_int, - argtypes = [], - argnames = [] ) - # ctypes.c_int AT_FinaliseLibrary() - addfunc(lib, "AT_FinaliseLibrary", restype = ctypes.c_int, - argtypes = [], - argnames = [] ) - # ctypes.c_int AT_Open(ctypes.c_int CameraIndex, ctypes.POINTER(AT_H) Hndl) - addfunc(lib, "AT_Open", restype = ctypes.c_int, - argtypes = [ctypes.c_int, ctypes.POINTER(AT_H)], - argnames = ["CameraIndex", "Hndl"] ) - # ctypes.c_int AT_Close(AT_H Hndl) - addfunc(lib, "AT_Close", restype = ctypes.c_int, - argtypes = [AT_H], - argnames = ["Hndl"] ) - # ctypes.c_int AT_RegisterFeatureCallback(AT_H Hndl, ctypes.c_wchar_p Feature, FeatureCallback EvCallback, ctypes.c_void_p Context) - addfunc(lib, "AT_RegisterFeatureCallback", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, FeatureCallback, ctypes.c_void_p], - argnames = ["Hndl", "Feature", "EvCallback", "Context"] ) - # ctypes.c_int AT_UnregisterFeatureCallback(AT_H Hndl, ctypes.c_wchar_p Feature, FeatureCallback EvCallback, ctypes.c_void_p Context) - addfunc(lib, "AT_UnregisterFeatureCallback", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, FeatureCallback, ctypes.c_void_p], - argnames = ["Hndl", "Feature", "EvCallback", "Context"] ) - # ctypes.c_int AT_IsImplemented(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.POINTER(AT_BOOL) Implemented) - addfunc(lib, "AT_IsImplemented", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(AT_BOOL)], - argnames = ["Hndl", "Feature", "Implemented"] ) - # ctypes.c_int AT_IsReadable(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.POINTER(AT_BOOL) Readable) - addfunc(lib, "AT_IsReadable", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(AT_BOOL)], - argnames = ["Hndl", "Feature", "Readable"] ) - # ctypes.c_int AT_IsWritable(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.POINTER(AT_BOOL) Writable) - addfunc(lib, "AT_IsWritable", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(AT_BOOL)], - argnames = ["Hndl", "Feature", "Writable"] ) - # ctypes.c_int AT_IsReadOnly(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.POINTER(AT_BOOL) ReadOnly) - addfunc(lib, "AT_IsReadOnly", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(AT_BOOL)], - argnames = ["Hndl", "Feature", "ReadOnly"] ) - # ctypes.c_int AT_SetInt(AT_H Hndl, ctypes.c_wchar_p Feature, AT_64 Value) - addfunc(lib, "AT_SetInt", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, AT_64], - argnames = ["Hndl", "Feature", "Value"] ) - # ctypes.c_int AT_GetInt(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.POINTER(AT_64) Value) - addfunc(lib, "AT_GetInt", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(AT_64)], - argnames = ["Hndl", "Feature", "Value"] ) - # ctypes.c_int AT_GetIntMax(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.POINTER(AT_64) MaxValue) - addfunc(lib, "AT_GetIntMax", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(AT_64)], - argnames = ["Hndl", "Feature", "MaxValue"] ) - # ctypes.c_int AT_GetIntMin(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.POINTER(AT_64) MinValue) - addfunc(lib, "AT_GetIntMin", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(AT_64)], - argnames = ["Hndl", "Feature", "MinValue"] ) - # ctypes.c_int AT_SetFloat(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.c_double Value) - addfunc(lib, "AT_SetFloat", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.c_double], - argnames = ["Hndl", "Feature", "Value"] ) - # ctypes.c_int AT_GetFloat(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.POINTER(ctypes.c_double) Value) - addfunc(lib, "AT_GetFloat", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(ctypes.c_double)], - argnames = ["Hndl", "Feature", "Value"] ) - # ctypes.c_int AT_GetFloatMax(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.POINTER(ctypes.c_double) MaxValue) - addfunc(lib, "AT_GetFloatMax", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(ctypes.c_double)], - argnames = ["Hndl", "Feature", "MaxValue"] ) - # ctypes.c_int AT_GetFloatMin(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.POINTER(ctypes.c_double) MinValue) - addfunc(lib, "AT_GetFloatMin", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(ctypes.c_double)], - argnames = ["Hndl", "Feature", "MinValue"] ) - # ctypes.c_int AT_SetBool(AT_H Hndl, ctypes.c_wchar_p Feature, AT_BOOL Value) - addfunc(lib, "AT_SetBool", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, AT_BOOL], - argnames = ["Hndl", "Feature", "Value"] ) - # ctypes.c_int AT_GetBool(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.POINTER(AT_BOOL) Value) - addfunc(lib, "AT_GetBool", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(AT_BOOL)], - argnames = ["Hndl", "Feature", "Value"] ) - # ctypes.c_int AT_SetEnumIndex(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.c_int Value) - addfunc(lib, "AT_SetEnumIndex", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.c_int], - argnames = ["Hndl", "Feature", "Value"] ) - # ctypes.c_int AT_SetEnumString(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.c_wchar_p String) - addfunc(lib, "AT_SetEnumString", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.c_wchar_p], - argnames = ["Hndl", "Feature", "String"] ) - # ctypes.c_int AT_GetEnumIndex(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.POINTER(ctypes.c_int) Value) - addfunc(lib, "AT_GetEnumIndex", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(ctypes.c_int)], - argnames = ["Hndl", "Feature", "Value"] ) - # ctypes.c_int AT_GetEnumCount(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.POINTER(ctypes.c_int) Count) - addfunc(lib, "AT_GetEnumCount", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(ctypes.c_int)], - argnames = ["Hndl", "Feature", "Count"] ) - # ctypes.c_int AT_IsEnumIndexAvailable(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.c_int Index, ctypes.POINTER(AT_BOOL) Available) - addfunc(lib, "AT_IsEnumIndexAvailable", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.c_int, ctypes.POINTER(AT_BOOL)], - argnames = ["Hndl", "Feature", "Index", "Available"] ) - # ctypes.c_int AT_IsEnumIndexImplemented(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.c_int Index, ctypes.POINTER(AT_BOOL) Implemented) - addfunc(lib, "AT_IsEnumIndexImplemented", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.c_int, ctypes.POINTER(AT_BOOL)], - argnames = ["Hndl", "Feature", "Index", "Implemented"] ) - # ctypes.c_int AT_GetEnumStringByIndex(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.c_int Index, ctypes.c_wchar_p String, ctypes.c_int StringLength) - addfunc(lib, "AT_GetEnumStringByIndex", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.c_int, ctypes.c_wchar_p, ctypes.c_int], - argnames = ["Hndl", "Feature", "Index", "String", "StringLength"] ) - # ctypes.c_int AT_Command(AT_H Hndl, ctypes.c_wchar_p Feature) - addfunc(lib, "AT_Command", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p], - argnames = ["Hndl", "Feature"] ) - # ctypes.c_int AT_SetString(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.c_wchar_p String) - addfunc(lib, "AT_SetString", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.c_wchar_p], - argnames = ["Hndl", "Feature", "String"] ) - # ctypes.c_int AT_GetString(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.c_wchar_p String, ctypes.c_int StringLength) - addfunc(lib, "AT_GetString", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_int], - argnames = ["Hndl", "Feature", "String", "StringLength"] ) - # ctypes.c_int AT_GetStringMaxLength(AT_H Hndl, ctypes.c_wchar_p Feature, ctypes.POINTER(ctypes.c_int) MaxStringLength) - addfunc(lib, "AT_GetStringMaxLength", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(ctypes.c_int)], - argnames = ["Hndl", "Feature", "MaxStringLength"] ) - # ctypes.c_int AT_QueueBuffer(AT_H Hndl, ctypes.POINTER(AT_U8) Ptr, ctypes.c_int PtrSize) - addfunc(lib, "AT_QueueBuffer", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.POINTER(AT_U8), ctypes.c_int], - argnames = ["Hndl", "Ptr", "PtrSize"] ) - # ctypes.c_int AT_WaitBuffer(AT_H Hndl, ctypes.POINTER(ctypes.POINTER(AT_U8)) Ptr, ctypes.POINTER(ctypes.c_int) PtrSize, ctypes.c_uint Timeout) - addfunc(lib, "AT_WaitBuffer", restype = ctypes.c_int, - argtypes = [AT_H, ctypes.POINTER(ctypes.POINTER(AT_U8)), ctypes.POINTER(ctypes.c_int), ctypes.c_uint], - argnames = ["Hndl", "Ptr", "PtrSize", "Timeout"] ) - # ctypes.c_int AT_Flush(AT_H Hndl) - addfunc(lib, "AT_Flush", restype = ctypes.c_int, - argtypes = [AT_H], - argnames = ["Hndl"] ) - - diff --git a/pylablib/Andor/atcore_features.py b/pylablib/Andor/atcore_features.py deleted file mode 100644 index d30253a..0000000 --- a/pylablib/Andor/atcore_features.py +++ /dev/null @@ -1,171 +0,0 @@ -# pylint: disable=wrong-spelling-in-comment - -feature_types={ - "AcquisitionStart": "comm", - "AcquisitionStop": "comm", - "CameraDump": "comm", - "DDGStepUploadModeValues": "comm", - "I2CRead": "comm", - "I2CWrite": "comm", - "SoftwareTrigger": "comm", - "TimestampClockReset": "comm", - - "AccumulateCount": "int", - "AcquiredCount": "int", - "AOIHBin": "int", - "AOIHeight": "int", - "AOILeft": "int", - "AOIStride": "int", - "AOITop": "int", - "AOIVBin": "int", - "AOIWidth": "int", - "Baseline": "int", - "BufferOverflowEvent": "int", - "CameraMemory": "int", - "DDGIOCNumberOfPulses": "int", - "DDGIOCPeriod": "int", - "DDGOutputDelay": "int", - "DDGOutputWidth": "int", - "DDGStepCount": "int", - "DDGStepUploadProgress": "int", - "DeviceCount": "int", - "DeviceVideoIndex": "int", - "EventsMissedEvent": "int", - "ExposedPixelHeight": "int", - "ExposureEndEvent": "int", - "ExposureStartEvent": "int", - "FrameCount": "int", - "I2CAddress": "int", - "I2CByte": "int", - "I2CByteCount": "int", - "I2CByteSelector": "int", - "ImageSizeBytes": "int", - "LUTIndex": "int", - "LUTValue": "int", - "MCPGain": "int", - "MCPVoltage": "int", - "MultitrackCount": "int", - "MultitrackEnd": "int", - "MultitrackSelector": "int", - "MultitrackStart": "int", - "PortSelector": "int", - "PreAmpGainValue": "int", - "PreAmpOffsetValue": "int", - "RowNExposureEndEvent": "int", - "RowNExposureStartEvent": "int", - "SensorHeight": "int", - "SensorWidth": "int", - "TimestampClock": "int", - "TimestampClockFrequency": "int", - "UsbProductId": "int", - "UsbDeviceId": "int", - - "AlternatingReadoutDirection": "bool", - "CameraAcquiring": "bool", - "CameraPresent": "bool", - "DDGIOCEnable": "bool", - "DDGOutputEnable": "bool", - "DDGOutputStepEnable": "bool", - "DDGOpticalWidthEnable": "bool", - "DDGStepEnabled": "bool", - "DDGStepUploadRequired": "bool", - "DisableShutter": "bool", - "EventEnable": "bool", - "ExternalIOReadout": "bool", - "FastAOIFrameRateEnable": "bool", - "ForceShutterOpen": "bool", - "FrameIntervalTiming": "bool", - "FullAOIControl": "bool", - "IODirection": "bool", - "IOState": "bool", - "IOInvert": "bool", - "IRPreFlashEnable": "bool", - "KeepCleanEnable": "bool", - "KeepCleanPostExposureEnable": "bool", - "MCPIntelligate": "bool", - "MetadataEnable": "bool", - "MetadataFrame": "bool", - "MetadataFrameInfo": "bool", - "MetadataTimestamp": "bool", - "MultitrackBinned": "bool", - "Overlap": "bool", - "PIVEnable": "bool", - "PreTriggerEnable": "bool", - "RollingShutterGlobalClear": "bool", - "ScanSpeedControlEnable": "bool", - "SensorCooling": "bool", - "ShutterAmpControl": "bool", - "ShutterState": "bool", - "SpuriousNoiseFilter": "bool", - "StaticBlemishCorrection": "bool", - "SynchronousTriggering": "bool", - "TransmitFrames": "bool", - "VerticallyCentreAOI": "bool", - - "BackoffTemperatureOffset": "float", - "BytesPerPixel": "float", - "CoolerPower": "float", - "DDGStepDelayCoefficientA": "float", - "DDGStepDelayCoefficientB": "float", - "DDGStepWidthCoefficientA": "float", - "DDGStepWidthCoefficientB": "float", - "ExposureTime": "float", - "ExternalTriggerDelay": "float", - "FrameInterval": "float", - "FrameRate": "float", - "HeatSinkTemperature": "float", - "InputVoltage": "float", - "LineScanSpeed": "float", - "PixelHeight": "float", - "PixelWidth": "float", - "ReadoutTime": "float", - "RowReadTime": "float", - "SensorTemperature": "float", - "ShutterTransferTime": "float", - "TargetSensorTemperature": "float", - - "CameraFamily": "str", - "CameraModel": "str", - "CameraName": "str", - "ControllerID": "str", - "DDR2Type": "str", - "DriverVersion": "str", - "FirmwareVersion": "str", - "MicrocodeVersion": "str", - "SerialNumber": "str", - "SoftwareVersion": "str", - - "AOIBinning": "enum", - "AOILayout": "enum", - "AuxiliaryOutSource": "enum", - "AuxOutSourceTwo": "enum", - "BitDepth": "enum", - "ColourFilter": "enum", - "CycleMode": "enum", - "DDGOutputPolarity": "enum", - "DDGOutputSelector": "enum", - "DDGStepDelayMode": "enum", - "DDGStepWidthMode": "enum", - "ElectronicShutteringMode": "enum", - "EventSelector": "enum", - "FanSpeed": "enum", - "GateMode": "enum", - "InsertionDelay": "enum", - "IOControl": "enum", - "IOSelector": "enum", - "PixelCorrection": "enum", - "PixelEncoding": "enum", - "PixelReadoutRate": "enum", - "PreAmpGain": "enum", - "PreAmpGainChannel": "enum", - "PreAmpGainControl": "enum", - "PreAmpGainSelector": "enum", - "SensorReadoutMode": "enum", - "SensorType": "enum", - "ShutterMode": "enum", - "ShutterOutputMode": "enum", - "SimplePreAmpGainControl": "enum", - "TemperatureControl": "enum", - "TemperatureStatus": "enum", - "TriggerMode": "enum" -} \ No newline at end of file diff --git a/pylablib/Andor/atcore_lib.py b/pylablib/Andor/atcore_lib.py deleted file mode 100644 index b3095b2..0000000 --- a/pylablib/Andor/atcore_lib.py +++ /dev/null @@ -1,238 +0,0 @@ -# pylint: disable=wrong-spelling-in-comment - -from . import atcore_defs -from .atcore_defs import AT_ERR, drAT_ERR -from .atcore_defs import define_functions -from .atcore_features import feature_types # pylint: disable=unused-import -from .base import AndorError - -from ...core.utils import ctypes_wrap, ctypes_tools -from ..utils import load_lib - -import ctypes -import warnings -import numpy as np - - - -class AndorSDK3LibError(AndorError): - """Generic Andor SDK3 library error""" - def __init__(self, func, code): - self.func=func - self.code=code - self.name=drAT_ERR.get(self.code,"UNKNOWN") - msg="function '{}' raised error {}({})".format(func,code,self.name) - AndorError.__init__(self,msg) -def errcheck(passing=None): - """ - Build an error checking function. - - Return a function which checks return codes of Andor SDK3 library functions. - `passing` is a list specifying which return codes are acceptable (by default only 0, which is success code, is acceptable). - """ - passing=set(passing) if passing is not None else set() - passing.add(0) # always allow success - def errchecker(result, func, arguments): # pylint: disable=unused-argument - if result not in passing: - raise AndorSDK3LibError(func.__name__,result) - return result - return errchecker - - - -AT_pWC=ctypes.c_wchar_p -AT_H=atcore_defs.AT_H - -class AndorSDK3Lib: - def __init__(self): - self._initialized=False - - def initlib(self): - if self._initialized: - return - - solis_path=load_lib.get_program_files_folder("Andor SOLIS") - sdk3_path=load_lib.get_program_files_folder("Andor SDK3") - error_message=( "The library is automatically supplied with Andor Solis software or Andor SDK3 software;\n"+ - load_lib.par_error_message.format("andor_sdk3")+ - "\nAdditional required libraries: atblkbx.dll, atcl_bitflow.dll, atdevapogee.dll, atdevregcam.dll, atusb_libusb.dll, atusb_libusb10.dll (distributed together with the main library)") - self.lib=load_lib.load_lib("atcore.dll",locations=("parameter/andor_sdk3",solis_path,sdk3_path,"global"),error_message=error_message,locally=True,call_conv="stdcall") - lib=self.lib - define_functions(lib) - - wrapper=ctypes_wrap.CFunctionWrapper(errcheck=errcheck()) - - # ctypes.c_int AT_InitialiseLibrary() - self.AT_InitialiseLibrary=wrapper(lib.AT_InitialiseLibrary) - # ctypes.c_int AT_FinaliseLibrary() - self.AT_FinaliseLibrary=wrapper(lib.AT_FinaliseLibrary) - # ctypes.c_int AT_Open(ctypes.c_int CameraIndex, ctypes.POINTER(AT_H) Hndl) - self.AT_Open=wrapper(lib.AT_Open, rvals=["Hndl"]) - # ctypes.c_int AT_Close(AT_H Hndl) - self.AT_Close=wrapper(lib.AT_Close) - - - # ctypes.c_int AT_IsImplemented(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(AT_BOOL) Implemented) - self.AT_IsImplemented=wrapper(lib.AT_IsImplemented, rvals=["Implemented"]) - # ctypes.c_int AT_IsReadable(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(AT_BOOL) Readable) - self.AT_IsReadable=wrapper(lib.AT_IsReadable, rvals=["Readable"]) - # ctypes.c_int AT_IsWritable(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(AT_BOOL) Writable) - self.AT_IsWritable=wrapper(lib.AT_IsWritable, rvals=["Writable"]) - # ctypes.c_int AT_IsReadOnly(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(AT_BOOL) ReadOnly) - self.AT_IsReadOnly=wrapper(lib.AT_IsReadOnly, rvals=["ReadOnly"]) - - # ctypes.c_int AT_SetInt(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, AT_64 Value) - self.AT_SetInt=wrapper(lib.AT_SetInt) - # ctypes.c_int AT_GetInt(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(AT_64) Value) - self.AT_GetInt=wrapper(lib.AT_GetInt, rvals=["Value"]) - # ctypes.c_int AT_GetIntMax(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(AT_64) MaxValue) - self.AT_GetIntMax=wrapper(lib.AT_GetIntMax, rvals=["MaxValue"]) - # ctypes.c_int AT_GetIntMin(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(AT_64) MinValue) - self.AT_GetIntMin=wrapper(lib.AT_GetIntMin, rvals=["MinValue"]) - - # ctypes.c_int AT_SetFloat(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.c_double Value) - self.AT_SetFloat=wrapper(lib.AT_SetFloat) - # ctypes.c_int AT_GetFloat(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(ctypes.c_double) Value) - self.AT_GetFloat=wrapper(lib.AT_GetFloat, rvals=["Value"]) - # ctypes.c_int AT_GetFloatMax(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(ctypes.c_double) MaxValue) - self.AT_GetFloatMax=wrapper(lib.AT_GetFloatMax, rvals=["MaxValue"]) - # ctypes.c_int AT_GetFloatMin(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(ctypes.c_double) MinValue) - self.AT_GetFloatMin=wrapper(lib.AT_GetFloatMin, rvals=["MinValue"]) - - # ctypes.c_int AT_SetBool(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, AT_BOOL Value) - self.AT_SetBool=wrapper(lib.AT_SetBool) - # ctypes.c_int AT_GetBool(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(AT_BOOL) Value) - self.AT_GetBool=wrapper(lib.AT_GetBool, rvals=["Value"]) - - # ctypes.c_int AT_SetEnumIndex(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.c_int Value) - self.AT_SetEnumIndex=wrapper(lib.AT_SetEnumIndex) - # ctypes.c_int AT_SetEnumString(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(AT_WC) String) - self.AT_SetEnumString=wrapper(lib.AT_SetEnumString) - # ctypes.c_int AT_GetEnumIndex(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(ctypes.c_int) Value) - self.AT_GetEnumIndex=wrapper(lib.AT_GetEnumIndex, rvals=["Value"]) - # ctypes.c_int AT_GetEnumCount(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(ctypes.c_int) Count) - self.AT_GetEnumCount=wrapper(lib.AT_GetEnumCount, rvals=["Count"]) - # ctypes.c_int AT_IsEnumIndexAvailable(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.c_int Index, ctypes.POINTER(AT_BOOL) Available) - self.AT_IsEnumIndexAvailable=wrapper(lib.AT_IsEnumIndexAvailable, rvals=["Available"]) - # ctypes.c_int AT_IsEnumIndexImplemented(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.c_int Index, ctypes.POINTER(AT_BOOL) Implemented) - self.AT_IsEnumIndexImplemented=wrapper(lib.AT_IsEnumIndexImplemented, rvals=["Implemented"]) - # ctypes.c_int AT_GetEnumStringByIndex(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.c_int Index, ctypes.POINTER(AT_WC) String, ctypes.c_int StringLength) - self.AT_GetEnumStringByIndex=wrapper(lib.AT_GetEnumStringByIndex, args=["Hndl","Feature","Index","StringLength"], - rvals=["String"], argprep={"String":lambda StringLength: ctypes_wrap.strprep(StringLength,ctype=AT_pWC,unicode=True)()}, byref=[]) - - # ctypes.c_int AT_SetString(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(AT_WC) String) - self.AT_SetString=wrapper(lib.AT_SetString) - # ctypes.c_int AT_GetString(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(AT_WC) String, ctypes.c_int StringLength) - self.AT_GetString=wrapper(lib.AT_GetString, args=["Hndl","Feature","StringLength"], - rvals=["String"], argprep={"String":lambda StringLength: ctypes_wrap.strprep(StringLength,ctype=AT_pWC,unicode=True)()}, byref=[]) - # ctypes.c_int AT_GetStringMaxLength(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, ctypes.POINTER(ctypes.c_int) MaxStringLength) - self.AT_GetStringMaxLength=wrapper(lib.AT_GetStringMaxLength, rvals=["MaxStringLength"]) - - # ctypes.c_int AT_Command(AT_H Hndl, ctypes.POINTER(AT_WC) Feature) - self.AT_Command=wrapper(lib.AT_Command) - - # typedef int (AT_EXP_CONV *FeatureCallback)(AT_H Hndl, const AT_WC* Feature, void* Context); - self.c_callback=ctypes_tools.WINFUNCTYPE(ctypes.c_int,AT_H,AT_pWC,ctypes.c_void_p) - # ctypes.c_int AT_RegisterFeatureCallback(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, FeatureCallback EvCallback, ctypes.c_void_p Context) - self.AT_RegisterFeatureCallback_lib=wrapper(lib.AT_RegisterFeatureCallback) - # ctypes.c_int AT_UnregisterFeatureCallback(AT_H Hndl, ctypes.POINTER(AT_WC) Feature, FeatureCallback EvCallback, ctypes.c_void_p Context) - self.AT_UnregisterFeatureCallback_lib=wrapper(lib.AT_UnregisterFeatureCallback) - - # ctypes.c_int AT_QueueBuffer(AT_H Hndl, ctypes.POINTER(AT_U8) Ptr, ctypes.c_int PtrSize) - self.AT_QueueBuffer=wrapper(lib.AT_QueueBuffer) - # ctypes.c_int AT_WaitBuffer(AT_H Hndl, ctypes.POINTER(ctypes.POINTER(AT_U8)) Ptr, ctypes.POINTER(ctypes.c_int) PtrSize, ctypes.c_uint Timeout) - self.AT_WaitBuffer=wrapper(lib.AT_WaitBuffer, rvals=["Ptr","PtrSize"]) - # ctypes.c_int AT_Flush(AT_H Hndl) - self.AT_Flush=wrapper(lib.AT_Flush) - - self._initialized=True - - - - def AT_RegisterFeatureCallback(self, Hndl, Feature, callback, Context=None, wrap=True): - if wrap: - def wrapped_callback(*args): - try: - callback(*args) - return 0 - except: # pylint: disable=bare-except - return 1 - cb=self.c_callback(wrapped_callback) - else: - cb=self.c_callback(callback) - self.AT_RegisterFeatureCallback_lib(Hndl,Feature,cb,Context) - return cb - def AT_UnregisterFeatureCallback(self, Hndl, Feature, callback, Context=None): - self.AT_UnregisterFeatureCallback_lib(Hndl,Feature,callback,Context) - - # def allocate_buffers(self, handle, nframes, frame_size): - # buffs=[] - # for _ in range(nframes): - # b=ctypes.create_string_buffer(frame_size) - # buffs.append(b) - # return buffs - def flush_buffers(self, handle): - while True: - try: - self.AT_WaitBuffer(handle,0) - except AndorSDK3LibError as e: - if e.code in {AT_ERR.AT_ERR_TIMEDOUT,AT_ERR.AT_ERR_NODATA}: - break - raise - self.AT_Flush(handle) - - - - - - -NBError=ImportError -try: - import numba as nb - NBError=nb.errors.NumbaError - nb_uint8_ro=nb.typeof(np.frombuffer(b"\x00",dtype="u1").reshape((1,1))) # for readonly attribute of a numpy array - nb_width=nb.typeof(np.empty([0]).shape[0]) # pylint: disable=unsubscriptable-object - @nb.njit(nb.uint16[:,:](nb_uint8_ro,nb_width),parallel=False,nogil=True) - def read_uint12(raw_data, width): - """ - Convert packed 12bit data (3 bytes per 2 pixels) into unpacked 16bit data (2 bytes per pixel). - - `raw_data` is a 2D numpy array with the raw frame data of dimensions ``(nrows, stride)``, where ``stride`` is the size of one row in bytes. - `width` is the size of the resulting row in pixels; if it is 0, assumed to be maximal possible size. - - Function semantics is identical to :func:`read_uint12`, but it is implemented with Numba to speed up calculations. - """ - h,s=raw_data.shape - if width==0: - width=(s*2)//3 - out=np.empty((h,width),dtype=nb.uint16) - chwidth=width//2 - for i in range(h): - for j in range(chwidth): - fst_uint8=nb.uint16(raw_data[i,j*3]) - mid_uint8=nb.uint16(raw_data[i,j*3+1]) - lst_uint8=nb.uint16(raw_data[i,j*3+2]) - out[i,j*2]=(fst_uint8<<4)|(mid_uint8&0x0F) - out[i,j*2+1]=(mid_uint8>>4)|(lst_uint8<<4) - if width%2==1: - fst_uint8=nb.uint16(raw_data[i,chwidth*3]) - mid_uint8=nb.uint16(raw_data[i,chwidth*3+1]) - out[i,width-1]=(fst_uint8<<4)|(mid_uint8&0x0F) - return out -except NBError: - def read_uint12(raw_data, width): - """ - Convert packed 12bit data (3 bytes per 2 pixels) into unpacked 16bit data (2 bytes per pixel). - - `raw_data` is a 2D numpy array with the raw frame data of dimensions ``(nrows, stride)``, where ``stride`` is the size of one row in bytes. - `width` is the size of the resulting row in pixels; if it is 0, assumed to be maximal possible size. - """ - warnings.warn("Numba is missing, so the 12-bit data unpacking is implemented via Numpy; the performance might suffer") - data=raw_data.astype(">4)|(lst_uint8<<4) - return result[:,:width] if width else result - -wlib=AndorSDK3Lib() \ No newline at end of file diff --git a/pylablib/Andor/atmcd32d_defs.py b/pylablib/Andor/atmcd32d_defs.py deleted file mode 100644 index e730cb4..0000000 --- a/pylablib/Andor/atmcd32d_defs.py +++ /dev/null @@ -1,2070 +0,0 @@ -########## This file is generated automatically based on atmcd32d.h ########## - -# pylint: disable=unused-import, unused-argument, wrong-spelling-in-comment - - -import ctypes -import enum -from ...core.utils import ctypes_wrap - - - - -def _int32(v): return (v+0x80000000)%0x100000000-0x80000000 - - - - -##### DEFINE GROUPS ##### - - -class AT_DDG_POL(enum.IntEnum): - AT_DDG_POLARITY_POSITIVE = _int32(0) - AT_DDG_POLARITY_NEGATIVE = _int32(1) -dAT_DDG_POL={a.name:a.value for a in AT_DDG_POL} -drAT_DDG_POL={a.value:a.name for a in AT_DDG_POL} - - -class AT_DDG_TERM(enum.IntEnum): - AT_DDG_TERMINATION_50OHMS = _int32(0) - AT_DDG_TERMINATION_HIGHZ = _int32(1) -dAT_DDG_TERM={a.name:a.value for a in AT_DDG_TERM} -drAT_DDG_TERM={a.value:a.name for a in AT_DDG_TERM} - - -class AT_STEPMODE(enum.IntEnum): - AT_STEPMODE_CONSTANT = _int32(0) - AT_STEPMODE_EXPONENTIAL = _int32(1) - AT_STEPMODE_LOGARITHMIC = _int32(2) - AT_STEPMODE_LINEAR = _int32(3) - AT_STEPMODE_OFF = _int32(100) -dAT_STEPMODE={a.name:a.value for a in AT_STEPMODE} -drAT_STEPMODE={a.value:a.name for a in AT_STEPMODE} - - -class AT_GATEMODE(enum.IntEnum): - AT_GATEMODE_FIRE_AND_GATE = _int32(0) - AT_GATEMODE_FIRE_ONLY = _int32(1) - AT_GATEMODE_GATE_ONLY = _int32(2) - AT_GATEMODE_CW_ON = _int32(3) - AT_GATEMODE_CW_OFF = _int32(4) - AT_GATEMODE_DDG = _int32(5) -dAT_GATEMODE={a.name:a.value for a in AT_GATEMODE} -drAT_GATEMODE={a.value:a.name for a in AT_GATEMODE} - - -class DRV_STATUS(enum.IntEnum): - DRV_ERROR_CODES = _int32(20001) - DRV_SUCCESS = _int32(20002) - DRV_VXDNOTINSTALLED = _int32(20003) - DRV_ERROR_SCAN = _int32(20004) - DRV_ERROR_CHECK_SUM = _int32(20005) - DRV_ERROR_FILELOAD = _int32(20006) - DRV_UNKNOWN_FUNCTION = _int32(20007) - DRV_ERROR_VXD_INIT = _int32(20008) - DRV_ERROR_ADDRESS = _int32(20009) - DRV_ERROR_PAGELOCK = _int32(20010) - DRV_ERROR_PAGEUNLOCK = _int32(20011) - DRV_ERROR_BOARDTEST = _int32(20012) - DRV_ERROR_ACK = _int32(20013) - DRV_ERROR_UP_FIFO = _int32(20014) - DRV_ERROR_PATTERN = _int32(20015) - DRV_ACQUISITION_ERRORS = _int32(20017) - DRV_ACQ_BUFFER = _int32(20018) - DRV_ACQ_DOWNFIFO_FULL = _int32(20019) - DRV_PROC_UNKONWN_INSTRUCTION = _int32(20020) - DRV_ILLEGAL_OP_CODE = _int32(20021) - DRV_KINETIC_TIME_NOT_MET = _int32(20022) - DRV_ACCUM_TIME_NOT_MET = _int32(20023) - DRV_NO_NEW_DATA = _int32(20024) - DRV_PCI_DMA_FAIL = _int32(20025) - DRV_SPOOLERROR = _int32(20026) - DRV_SPOOLSETUPERROR = _int32(20027) - DRV_FILESIZELIMITERROR = _int32(20028) - DRV_ERROR_FILESAVE = _int32(20029) - DRV_TEMPERATURE_CODES = _int32(20033) - DRV_TEMPERATURE_OFF = _int32(20034) - DRV_TEMPERATURE_NOT_STABILIZED = _int32(20035) - DRV_TEMPERATURE_STABILIZED = _int32(20036) - DRV_TEMPERATURE_NOT_REACHED = _int32(20037) - DRV_TEMPERATURE_OUT_RANGE = _int32(20038) - DRV_TEMPERATURE_NOT_SUPPORTED = _int32(20039) - DRV_TEMPERATURE_DRIFT = _int32(20040) - DRV_TEMP_CODES = _int32(20033) - DRV_TEMP_OFF = _int32(20034) - DRV_TEMP_NOT_STABILIZED = _int32(20035) - DRV_TEMP_STABILIZED = _int32(20036) - DRV_TEMP_NOT_REACHED = _int32(20037) - DRV_TEMP_OUT_RANGE = _int32(20038) - DRV_TEMP_NOT_SUPPORTED = _int32(20039) - DRV_TEMP_DRIFT = _int32(20040) - DRV_GENERAL_ERRORS = _int32(20049) - DRV_INVALID_AUX = _int32(20050) - DRV_COF_NOTLOADED = _int32(20051) - DRV_FPGAPROG = _int32(20052) - DRV_FLEXERROR = _int32(20053) - DRV_GPIBERROR = _int32(20054) - DRV_EEPROMVERSIONERROR = _int32(20055) - DRV_DATATYPE = _int32(20064) - DRV_DRIVER_ERRORS = _int32(20065) - DRV_P1INVALID = _int32(20066) - DRV_P2INVALID = _int32(20067) - DRV_P3INVALID = _int32(20068) - DRV_P4INVALID = _int32(20069) - DRV_INIERROR = _int32(20070) - DRV_COFERROR = _int32(20071) - DRV_ACQUIRING = _int32(20072) - DRV_IDLE = _int32(20073) - DRV_TEMPCYCLE = _int32(20074) - DRV_NOT_INITIALIZED = _int32(20075) - DRV_P5INVALID = _int32(20076) - DRV_P6INVALID = _int32(20077) - DRV_INVALID_MODE = _int32(20078) - DRV_INVALID_FILTER = _int32(20079) - DRV_I2CERRORS = _int32(20080) - DRV_I2CDEVNOTFOUND = _int32(20081) - DRV_I2CTIMEOUT = _int32(20082) - DRV_P7INVALID = _int32(20083) - DRV_P8INVALID = _int32(20084) - DRV_P9INVALID = _int32(20085) - DRV_P10INVALID = _int32(20086) - DRV_P11INVALID = _int32(20087) - DRV_USBERROR = _int32(20089) - DRV_IOCERROR = _int32(20090) - DRV_VRMVERSIONERROR = _int32(20091) - DRV_GATESTEPERROR = _int32(20092) - DRV_USB_INTERRUPT_ENDPOINT_ERROR = _int32(20093) - DRV_RANDOM_TRACK_ERROR = _int32(20094) - DRV_INVALID_TRIGGER_MODE = _int32(20095) - DRV_LOAD_FIRMWARE_ERROR = _int32(20096) - DRV_DIVIDE_BY_ZERO_ERROR = _int32(20097) - DRV_INVALID_RINGEXPOSURES = _int32(20098) - DRV_BINNING_ERROR = _int32(20099) - DRV_INVALID_AMPLIFIER = _int32(20100) - DRV_INVALID_COUNTCONVERT_MODE = _int32(20101) - DRV_USB_INTERRUPT_ENDPOINT_TIMEOUT = _int32(20102) - DRV_ERROR_NOCAMERA = _int32(20990) - DRV_NOT_SUPPORTED = _int32(20991) - DRV_NOT_AVAILABLE = _int32(20992) - DRV_ERROR_MAP = _int32(20115) - DRV_ERROR_UNMAP = _int32(20116) - DRV_ERROR_MDL = _int32(20117) - DRV_ERROR_UNMDL = _int32(20118) - DRV_ERROR_BUFFSIZE = _int32(20119) - DRV_ERROR_NOHANDLE = _int32(20121) - DRV_GATING_NOT_AVAILABLE = _int32(20130) - DRV_FPGA_VOLTAGE_ERROR = _int32(20131) - DRV_OW_CMD_FAIL = _int32(20150) - DRV_OWMEMORY_BAD_ADDR = _int32(20151) - DRV_OWCMD_NOT_AVAILABLE = _int32(20152) - DRV_OW_NO_SLAVES = _int32(20153) - DRV_OW_NOT_INITIALIZED = _int32(20154) - DRV_OW_ERROR_SLAVE_NUM = _int32(20155) - DRV_MSTIMINGS_ERROR = _int32(20156) - DRV_OA_NULL_ERROR = _int32(20173) - DRV_OA_PARSE_DTD_ERROR = _int32(20174) - DRV_OA_DTD_VALIDATE_ERROR = _int32(20175) - DRV_OA_FILE_ACCESS_ERROR = _int32(20176) - DRV_OA_FILE_DOES_NOT_EXIST = _int32(20177) - DRV_OA_XML_INVALID_OR_NOT_FOUND_ERROR = _int32(20178) - DRV_OA_PRESET_FILE_NOT_LOADED = _int32(20179) - DRV_OA_USER_FILE_NOT_LOADED = _int32(20180) - DRV_OA_PRESET_AND_USER_FILE_NOT_LOADED = _int32(20181) - DRV_OA_INVALID_FILE = _int32(20182) - DRV_OA_FILE_HAS_BEEN_MODIFIED = _int32(20183) - DRV_OA_BUFFER_FULL = _int32(20184) - DRV_OA_INVALID_STRING_LENGTH = _int32(20185) - DRV_OA_INVALID_CHARS_IN_NAME = _int32(20186) - DRV_OA_INVALID_NAMING = _int32(20187) - DRV_OA_GET_CAMERA_ERROR = _int32(20188) - DRV_OA_MODE_ALREADY_EXISTS = _int32(20189) - DRV_OA_STRINGS_NOT_EQUAL = _int32(20190) - DRV_OA_NO_USER_DATA = _int32(20191) - DRV_OA_VALUE_NOT_SUPPORTED = _int32(20192) - DRV_OA_MODE_DOES_NOT_EXIST = _int32(20193) - DRV_OA_CAMERA_NOT_SUPPORTED = _int32(20194) - DRV_OA_FAILED_TO_GET_MODE = _int32(20195) - DRV_OA_CAMERA_NOT_AVAILABLE = _int32(20196) - DRV_PROCESSING_FAILED = _int32(20211) -dDRV_STATUS={a.name:a.value for a in DRV_STATUS} -drDRV_STATUS={a.value:a.name for a in DRV_STATUS} - - -class AC_ACQMODE(enum.IntEnum): - AC_ACQMODE_SINGLE = _int32(1) - AC_ACQMODE_VIDEO = _int32(2) - AC_ACQMODE_ACCUMULATE = _int32(4) - AC_ACQMODE_KINETIC = _int32(8) - AC_ACQMODE_FRAMETRANSFER = _int32(16) - AC_ACQMODE_FASTKINETICS = _int32(32) - AC_ACQMODE_OVERLAP = _int32(64) - AC_ACQMODE_TDI = _int32(0x80) -dAC_ACQMODE={a.name:a.value for a in AC_ACQMODE} -drAC_ACQMODE={a.value:a.name for a in AC_ACQMODE} - - -class AC_READMODE(enum.IntEnum): - AC_READMODE_FULLIMAGE = _int32(1) - AC_READMODE_SUBIMAGE = _int32(2) - AC_READMODE_SINGLETRACK = _int32(4) - AC_READMODE_FVB = _int32(8) - AC_READMODE_MULTITRACK = _int32(16) - AC_READMODE_RANDOMTRACK = _int32(32) - AC_READMODE_MULTITRACKSCAN = _int32(64) -dAC_READMODE={a.name:a.value for a in AC_READMODE} -drAC_READMODE={a.value:a.name for a in AC_READMODE} - - -class AC_TRIGGERMODE(enum.IntEnum): - AC_TRIGGERMODE_INTERNAL = _int32(1) - AC_TRIGGERMODE_EXTERNAL = _int32(2) - AC_TRIGGERMODE_EXTERNAL_FVB_EM = _int32(4) - AC_TRIGGERMODE_CONTINUOUS = _int32(8) - AC_TRIGGERMODE_EXTERNALSTART = _int32(16) - AC_TRIGGERMODE_EXTERNALEXPOSURE = _int32(32) - AC_TRIGGERMODE_INVERTED = _int32(0x40) - AC_TRIGGERMODE_EXTERNAL_CHARGESHIFTING = _int32(0x80) - AC_TRIGGERMODE_EXTERNAL_RISING = _int32(0x0100) - AC_TRIGGERMODE_EXTERNAL_PURGE = _int32(0x0200) -dAC_TRIGGERMODE={a.name:a.value for a in AC_TRIGGERMODE} -drAC_TRIGGERMODE={a.value:a.name for a in AC_TRIGGERMODE} - - -class AC_CAMERATYPE(enum.IntEnum): - AC_CAMERATYPE_PDA = _int32(0) - AC_CAMERATYPE_IXON = _int32(1) - AC_CAMERATYPE_ICCD = _int32(2) - AC_CAMERATYPE_EMCCD = _int32(3) - AC_CAMERATYPE_CCD = _int32(4) - AC_CAMERATYPE_ISTAR = _int32(5) - AC_CAMERATYPE_VIDEO = _int32(6) - AC_CAMERATYPE_IDUS = _int32(7) - AC_CAMERATYPE_NEWTON = _int32(8) - AC_CAMERATYPE_SURCAM = _int32(9) - AC_CAMERATYPE_USBICCD = _int32(10) - AC_CAMERATYPE_LUCA = _int32(11) - AC_CAMERATYPE_RESERVED = _int32(12) - AC_CAMERATYPE_IKON = _int32(13) - AC_CAMERATYPE_INGAAS = _int32(14) - AC_CAMERATYPE_IVAC = _int32(15) - AC_CAMERATYPE_UNPROGRAMMED = _int32(16) - AC_CAMERATYPE_CLARA = _int32(17) - AC_CAMERATYPE_USBISTAR = _int32(18) - AC_CAMERATYPE_SIMCAM = _int32(19) - AC_CAMERATYPE_NEO = _int32(20) - AC_CAMERATYPE_IXONULTRA = _int32(21) - AC_CAMERATYPE_VOLMOS = _int32(22) - AC_CAMERATYPE_IVAC_CCD = _int32(23) - AC_CAMERATYPE_ASPEN = _int32(24) - AC_CAMERATYPE_ASCENT = _int32(25) - AC_CAMERATYPE_ALTA = _int32(26) - AC_CAMERATYPE_ALTAF = _int32(27) - AC_CAMERATYPE_IKONXL = _int32(28) - AC_CAMERATYPE_CMOS_GEN2 = _int32(29) - AC_CAMERATYPE_ISTAR_SCMOS = _int32(30) - AC_CAMERATYPE_IKONLR = _int32(31) -dAC_CAMERATYPE={a.name:a.value for a in AC_CAMERATYPE} -drAC_CAMERATYPE={a.value:a.name for a in AC_CAMERATYPE} - - -class AC_PIXELMODE(enum.IntEnum): - AC_PIXELMODE_8BIT = _int32(1) - AC_PIXELMODE_14BIT = _int32(2) - AC_PIXELMODE_16BIT = _int32(4) - AC_PIXELMODE_32BIT = _int32(8) - AC_PIXELMODE_MONO = _int32(0x000000) - AC_PIXELMODE_RGB = _int32(0x010000) - AC_PIXELMODE_CMY = _int32(0x020000) -dAC_PIXELMODE={a.name:a.value for a in AC_PIXELMODE} -drAC_PIXELMODE={a.value:a.name for a in AC_PIXELMODE} - - -class AC_SETFUNC(enum.IntEnum): - AC_SETFUNCTION_VREADOUT = _int32(0x01) - AC_SETFUNCTION_HREADOUT = _int32(0x02) - AC_SETFUNCTION_TEMPERATURE = _int32(0x04) - AC_SETFUNCTION_MCPGAIN = _int32(0x08) - AC_SETFUNCTION_EMCCDGAIN = _int32(0x10) - AC_SETFUNCTION_BASELINECLAMP = _int32(0x20) - AC_SETFUNCTION_VSAMPLITUDE = _int32(0x40) - AC_SETFUNCTION_HIGHCAPACITY = _int32(0x80) - AC_SETFUNCTION_BASELINEOFFSET = _int32(0x0100) - AC_SETFUNCTION_PREAMPGAIN = _int32(0x0200) - AC_SETFUNCTION_CROPMODE = _int32(0x0400) - AC_SETFUNCTION_DMAPARAMETERS = _int32(0x0800) - AC_SETFUNCTION_HORIZONTALBIN = _int32(0x1000) - AC_SETFUNCTION_MULTITRACKHRANGE = _int32(0x2000) - AC_SETFUNCTION_RANDOMTRACKNOGAPS = _int32(0x4000) - AC_SETFUNCTION_EMADVANCED = _int32(0x8000) - AC_SETFUNCTION_GATEMODE = _int32(0x010000) - AC_SETFUNCTION_DDGTIMES = _int32(0x020000) - AC_SETFUNCTION_IOC = _int32(0x040000) - AC_SETFUNCTION_INTELLIGATE = _int32(0x080000) - AC_SETFUNCTION_INSERTION_DELAY = _int32(0x100000) - AC_SETFUNCTION_GATESTEP = _int32(0x200000) - AC_SETFUNCTION_GATEDELAYSTEP = _int32(0x200000) - AC_SETFUNCTION_TRIGGERTERMINATION = _int32(0x400000) - AC_SETFUNCTION_EXTENDEDNIR = _int32(0x800000) - AC_SETFUNCTION_SPOOLTHREADCOUNT = _int32(0x1000000) - AC_SETFUNCTION_REGISTERPACK = _int32(0x2000000) - AC_SETFUNCTION_PRESCANS = _int32(0x4000000) - AC_SETFUNCTION_GATEWIDTHSTEP = _int32(0x8000000) - AC_SETFUNCTION_EXTENDED_CROP_MODE = _int32(0x10000000) - AC_SETFUNCTION_SUPERKINETICS = _int32(0x20000000) - AC_SETFUNCTION_TIMESCAN = _int32(0x40000000) - AC_SETFUNCTION_CROPMODETYPE = _int32(0x80000000) -dAC_SETFUNC={a.name:a.value for a in AC_SETFUNC} -drAC_SETFUNC={a.value:a.name for a in AC_SETFUNC} - - -class AC_GETFUNC(enum.IntEnum): - AC_GETFUNCTION_TEMPERATURE = _int32(0x01) - AC_GETFUNCTION_TARGETTEMPERATURE = _int32(0x02) - AC_GETFUNCTION_TEMPERATURERANGE = _int32(0x04) - AC_GETFUNCTION_DETECTORSIZE = _int32(0x08) - AC_GETFUNCTION_MCPGAIN = _int32(0x10) - AC_GETFUNCTION_EMCCDGAIN = _int32(0x20) - AC_GETFUNCTION_HVFLAG = _int32(0x40) - AC_GETFUNCTION_GATEMODE = _int32(0x80) - AC_GETFUNCTION_DDGTIMES = _int32(0x0100) - AC_GETFUNCTION_IOC = _int32(0x0200) - AC_GETFUNCTION_INTELLIGATE = _int32(0x0400) - AC_GETFUNCTION_INSERTION_DELAY = _int32(0x0800) - AC_GETFUNCTION_GATESTEP = _int32(0x1000) - AC_GETFUNCTION_GATEDELAYSTEP = _int32(0x1000) - AC_GETFUNCTION_PHOSPHORSTATUS = _int32(0x2000) - AC_GETFUNCTION_MCPGAINTABLE = _int32(0x4000) - AC_GETFUNCTION_BASELINECLAMP = _int32(0x8000) - AC_GETFUNCTION_GATEWIDTHSTEP = _int32(0x10000) -dAC_GETFUNC={a.name:a.value for a in AC_GETFUNC} -drAC_GETFUNC={a.value:a.name for a in AC_GETFUNC} - - -class AC_FEATURES(enum.IntEnum): - AC_FEATURES_POLLING = _int32(1) - AC_FEATURES_EVENTS = _int32(2) - AC_FEATURES_SPOOLING = _int32(4) - AC_FEATURES_SHUTTER = _int32(8) - AC_FEATURES_SHUTTEREX = _int32(16) - AC_FEATURES_EXTERNAL_I2C = _int32(32) - AC_FEATURES_SATURATIONEVENT = _int32(64) - AC_FEATURES_FANCONTROL = _int32(128) - AC_FEATURES_MIDFANCONTROL = _int32(256) - AC_FEATURES_TEMPERATUREDURINGACQUISITION = _int32(512) - AC_FEATURES_KEEPCLEANCONTROL = _int32(1024) - AC_FEATURES_DDGLITE = _int32(0x0800) - AC_FEATURES_FTEXTERNALEXPOSURE = _int32(0x1000) - AC_FEATURES_KINETICEXTERNALEXPOSURE = _int32(0x2000) - AC_FEATURES_DACCONTROL = _int32(0x4000) - AC_FEATURES_METADATA = _int32(0x8000) - AC_FEATURES_IOCONTROL = _int32(0x10000) - AC_FEATURES_PHOTONCOUNTING = _int32(0x20000) - AC_FEATURES_COUNTCONVERT = _int32(0x40000) - AC_FEATURES_DUALMODE = _int32(0x80000) - AC_FEATURES_OPTACQUIRE = _int32(0x100000) - AC_FEATURES_REALTIMESPURIOUSNOISEFILTER = _int32(0x200000) - AC_FEATURES_POSTPROCESSSPURIOUSNOISEFILTER = _int32(0x400000) - AC_FEATURES_DUALPREAMPGAIN = _int32(0x800000) - AC_FEATURES_DEFECT_CORRECTION = _int32(0x1000000) - AC_FEATURES_STARTOFEXPOSURE_EVENT = _int32(0x2000000) - AC_FEATURES_ENDOFEXPOSURE_EVENT = _int32(0x4000000) - AC_FEATURES_CAMERALINK = _int32(0x8000000) - AC_FEATURES_FIFOFULL_EVENT = _int32(0x10000000) - AC_FEATURES_SENSOR_PORT_CONFIGURATION = _int32(0x20000000) - AC_FEATURES_SENSOR_COMPENSATION = _int32(0x40000000) - AC_FEATURES_IRIG_SUPPORT = _int32(0x80000000) -dAC_FEATURES={a.name:a.value for a in AC_FEATURES} -drAC_FEATURES={a.value:a.name for a in AC_FEATURES} - - -class AC_EMGAIN(enum.IntEnum): - AC_EMGAIN_8BIT = _int32(1) - AC_EMGAIN_12BIT = _int32(2) - AC_EMGAIN_LINEAR12 = _int32(4) - AC_EMGAIN_REAL12 = _int32(8) -dAC_EMGAIN={a.name:a.value for a in AC_EMGAIN} -drAC_EMGAIN={a.value:a.name for a in AC_EMGAIN} - - -class AC_FEATURES32(enum.IntEnum): - AC_FEATURES2_ESD_EVENTS = _int32(1) - AC_FEATURES2_DUAL_PORT_CONFIGURATION = _int32(2) - AC_FEATURES2_OVERTEMP_EVENTS = _int32(4) -dAC_FEATURES32={a.name:a.value for a in AC_FEATURES32} -drAC_FEATURES32={a.value:a.name for a in AC_FEATURES32} - - - - - -##### TYPE DEFINITIONS ##### - - -BYTE=ctypes.c_ubyte -PBYTE=ctypes.POINTER(BYTE) -CHAR=ctypes.c_char -PCHAR=ctypes.c_char_p -UCHAR=ctypes.c_ubyte -PUCHAR=ctypes.POINTER(UCHAR) -ULONG_PTR=ctypes.c_uint64 -LONG_PTR=ctypes.c_int64 -WORD=ctypes.c_ushort -DWORD=ctypes.c_ulong -LPWORD=ctypes.POINTER(WORD) -ULONG=ctypes.c_ulong -LONGLONG=ctypes.c_int64 -LPLONG=ctypes.POINTER(ctypes.c_long) -HANDLE=ctypes.c_void_p -LPHANDLE=ctypes.POINTER(HANDLE) -HWND=ctypes.c_void_p -HGLOBAL=ctypes.c_void_p -HINSTANCE=ctypes.c_void_p -HDC=ctypes.c_void_p -HMODULE=ctypes.c_void_p -HKEY=ctypes.c_void_p -PVOID=ctypes.c_void_p -LPVOID=ctypes.c_void_p -class AT_VersionInfoId(enum.IntEnum): - AT_SDKVersion =_int32(0x40000000) - AT_DeviceDriverVersion=_int32(0x40000001) -dAT_VersionInfoId={a.name:a.value for a in AT_VersionInfoId} -drAT_VersionInfoId={a.value:a.name for a in AT_VersionInfoId} - - -class AT_DDGLiteChannelId(enum.IntEnum): - AT_DDGLite_ChannelA=_int32(0x40000000) - AT_DDGLite_ChannelB=_int32(0x40000001) - AT_DDGLite_ChannelC=_int32(0x40000002) -dAT_DDGLiteChannelId={a.name:a.value for a in AT_DDGLiteChannelId} -drAT_DDGLiteChannelId={a.value:a.name for a in AT_DDGLiteChannelId} - - -class AndorCapabilities(ctypes.Structure): - _fields_=[ ("ulSize",ULONG), - ("ulAcqModes",ULONG), - ("ulReadModes",ULONG), - ("ulTriggerModes",ULONG), - ("ulCameraType",ULONG), - ("ulPixelMode",ULONG), - ("ulSetFunctions",ULONG), - ("ulGetFunctions",ULONG), - ("ulFeatures",ULONG), - ("ulPCICard",ULONG), - ("ulEMGainCapability",ULONG), - ("ulFTReadModes",ULONG), - ("ulFeatures2",ULONG) ] -PAndorCapabilities=ctypes.POINTER(AndorCapabilities) -class CAndorCapabilities(ctypes_wrap.CStructWrapper): - _struct=AndorCapabilities - - -class ColorDemosaicInfo(ctypes.Structure): - _fields_=[ ("iX",ctypes.c_int), - ("iY",ctypes.c_int), - ("iAlgorithm",ctypes.c_int), - ("iXPhase",ctypes.c_int), - ("iYPhase",ctypes.c_int), - ("iBackground",ctypes.c_int) ] -PColorDemosaicInfo=ctypes.POINTER(ColorDemosaicInfo) -class CColorDemosaicInfo(ctypes_wrap.CStructWrapper): - _struct=ColorDemosaicInfo - - -class WhiteBalanceInfo(ctypes.Structure): - _fields_=[ ("iSize",ctypes.c_int), - ("iX",ctypes.c_int), - ("iY",ctypes.c_int), - ("iAlgorithm",ctypes.c_int), - ("iROI_left",ctypes.c_int), - ("iROI_right",ctypes.c_int), - ("iROI_top",ctypes.c_int), - ("iROI_bottom",ctypes.c_int), - ("iOperation",ctypes.c_int) ] -PWhiteBalanceInfo=ctypes.POINTER(WhiteBalanceInfo) -class CWhiteBalanceInfo(ctypes_wrap.CStructWrapper): - _struct=WhiteBalanceInfo - - - - - -##### FUNCTION DEFINITIONS ##### - - - - - -def addfunc(lib, name, restype, argtypes=None, argnames=None): - if getattr(lib,name,None) is None: - setattr(lib,name,None) - else: - func=getattr(lib,name) - func.restype=restype - if argtypes is not None: - func.argtypes=argtypes - if argnames is not None: - func.argnames=argnames - -def define_functions(lib): - # ctypes.c_uint AbortAcquisition() - addfunc(lib, "AbortAcquisition", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint CancelWait() - addfunc(lib, "CancelWait", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint CoolerOFF() - addfunc(lib, "CoolerOFF", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint CoolerON() - addfunc(lib, "CoolerON", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint DemosaicImage(ctypes.POINTER(WORD) grey, ctypes.POINTER(WORD) red, ctypes.POINTER(WORD) green, ctypes.POINTER(WORD) blue, ctypes.POINTER(ColorDemosaicInfo) info) - addfunc(lib, "DemosaicImage", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(WORD), ctypes.POINTER(WORD), ctypes.POINTER(WORD), ctypes.POINTER(WORD), ctypes.POINTER(ColorDemosaicInfo)], - argnames = ["grey", "red", "green", "blue", "info"] ) - # ctypes.c_uint EnableKeepCleans(ctypes.c_int iMode) - addfunc(lib, "EnableKeepCleans", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["iMode"] ) - # ctypes.c_uint EnableSensorCompensation(ctypes.c_int iMode) - addfunc(lib, "EnableSensorCompensation", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["iMode"] ) - # ctypes.c_uint SetIRIGModulation(ctypes.c_char mode) - addfunc(lib, "SetIRIGModulation", restype = ctypes.c_uint, - argtypes = [ctypes.c_char], - argnames = ["mode"] ) - # ctypes.c_uint FreeInternalMemory() - addfunc(lib, "FreeInternalMemory", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint GetAcquiredData(ctypes.POINTER(ctypes.c_long) arr, ctypes.c_ulong size) - addfunc(lib, "GetAcquiredData", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.c_ulong], - argnames = ["arr", "size"] ) - # ctypes.c_uint GetAcquiredData16(ctypes.POINTER(WORD) arr, ctypes.c_ulong size) - addfunc(lib, "GetAcquiredData16", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(WORD), ctypes.c_ulong], - argnames = ["arr", "size"] ) - # ctypes.c_uint GetAcquiredFloatData(ctypes.POINTER(ctypes.c_float) arr, ctypes.c_ulong size) - addfunc(lib, "GetAcquiredFloatData", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float), ctypes.c_ulong], - argnames = ["arr", "size"] ) - # ctypes.c_uint GetAcquisitionProgress(ctypes.POINTER(ctypes.c_long) acc, ctypes.POINTER(ctypes.c_long) series) - addfunc(lib, "GetAcquisitionProgress", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.POINTER(ctypes.c_long)], - argnames = ["acc", "series"] ) - # ctypes.c_uint GetAcquisitionTimings(ctypes.POINTER(ctypes.c_float) exposure, ctypes.POINTER(ctypes.c_float) accumulate, ctypes.POINTER(ctypes.c_float) kinetic) - addfunc(lib, "GetAcquisitionTimings", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)], - argnames = ["exposure", "accumulate", "kinetic"] ) - # ctypes.c_uint GetAdjustedRingExposureTimes(ctypes.c_int inumTimes, ctypes.POINTER(ctypes.c_float) fptimes) - addfunc(lib, "GetAdjustedRingExposureTimes", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["inumTimes", "fptimes"] ) - # ctypes.c_uint GetAllDMAData(ctypes.POINTER(ctypes.c_long) arr, ctypes.c_ulong size) - addfunc(lib, "GetAllDMAData", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.c_ulong], - argnames = ["arr", "size"] ) - # ctypes.c_uint GetAmpDesc(ctypes.c_int index, ctypes.c_char_p name, ctypes.c_int length) - addfunc(lib, "GetAmpDesc", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_char_p, ctypes.c_int], - argnames = ["index", "name", "length"] ) - # ctypes.c_uint GetAmpMaxSpeed(ctypes.c_int index, ctypes.POINTER(ctypes.c_float) speed) - addfunc(lib, "GetAmpMaxSpeed", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["index", "speed"] ) - # ctypes.c_uint GetAvailableCameras(ctypes.POINTER(ctypes.c_long) totalCameras) - addfunc(lib, "GetAvailableCameras", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long)], - argnames = ["totalCameras"] ) - # ctypes.c_uint GetBackground(ctypes.POINTER(ctypes.c_long) arr, ctypes.c_ulong size) - addfunc(lib, "GetBackground", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.c_ulong], - argnames = ["arr", "size"] ) - # ctypes.c_uint GetBaselineClamp(ctypes.POINTER(ctypes.c_int) state) - addfunc(lib, "GetBaselineClamp", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["state"] ) - # ctypes.c_uint GetBitDepth(ctypes.c_int channel, ctypes.POINTER(ctypes.c_int) depth) - addfunc(lib, "GetBitDepth", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["channel", "depth"] ) - # ctypes.c_uint GetBitsPerPixel(ctypes.c_int readout_index, ctypes.c_int index, ctypes.POINTER(ctypes.c_int) value) - addfunc(lib, "GetBitsPerPixel", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["readout_index", "index", "value"] ) - # ctypes.c_uint GetCameraEventStatus(ctypes.POINTER(DWORD) camStatus) - addfunc(lib, "GetCameraEventStatus", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(DWORD)], - argnames = ["camStatus"] ) - # ctypes.c_uint GetCameraHandle(ctypes.c_long cameraIndex, ctypes.POINTER(ctypes.c_long) cameraHandle) - addfunc(lib, "GetCameraHandle", restype = ctypes.c_uint, - argtypes = [ctypes.c_long, ctypes.POINTER(ctypes.c_long)], - argnames = ["cameraIndex", "cameraHandle"] ) - # ctypes.c_uint GetCameraInformation(ctypes.c_int index, ctypes.POINTER(ctypes.c_long) information) - addfunc(lib, "GetCameraInformation", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_long)], - argnames = ["index", "information"] ) - # ctypes.c_uint GetCameraSerialNumber(ctypes.POINTER(ctypes.c_int) number) - addfunc(lib, "GetCameraSerialNumber", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["number"] ) - # ctypes.c_uint GetCapabilities(ctypes.POINTER(AndorCapabilities) caps) - addfunc(lib, "GetCapabilities", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(AndorCapabilities)], - argnames = ["caps"] ) - # ctypes.c_uint GetControllerCardModel(ctypes.c_char_p controllerCardModel) - addfunc(lib, "GetControllerCardModel", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p], - argnames = ["controllerCardModel"] ) - # ctypes.c_uint GetCountConvertWavelengthRange(ctypes.POINTER(ctypes.c_float) minval, ctypes.POINTER(ctypes.c_float) maxval) - addfunc(lib, "GetCountConvertWavelengthRange", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)], - argnames = ["minval", "maxval"] ) - # ctypes.c_uint GetCurrentCamera(ctypes.POINTER(ctypes.c_long) cameraHandle) - addfunc(lib, "GetCurrentCamera", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long)], - argnames = ["cameraHandle"] ) - # ctypes.c_uint GetCYMGShift(ctypes.POINTER(ctypes.c_int) iXshift, ctypes.POINTER(ctypes.c_int) iYShift) - addfunc(lib, "GetCYMGShift", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)], - argnames = ["iXshift", "iYShift"] ) - # ctypes.c_uint GetDDGExternalOutputEnabled(ctypes.c_ulong uiIndex, ctypes.POINTER(ctypes.c_ulong) puiEnabled) - addfunc(lib, "GetDDGExternalOutputEnabled", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong, ctypes.POINTER(ctypes.c_ulong)], - argnames = ["uiIndex", "puiEnabled"] ) - # ctypes.c_uint GetDDGExternalOutputPolarity(ctypes.c_ulong uiIndex, ctypes.POINTER(ctypes.c_ulong) puiPolarity) - addfunc(lib, "GetDDGExternalOutputPolarity", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong, ctypes.POINTER(ctypes.c_ulong)], - argnames = ["uiIndex", "puiPolarity"] ) - # ctypes.c_uint GetDDGExternalOutputStepEnabled(ctypes.c_ulong uiIndex, ctypes.POINTER(ctypes.c_ulong) puiEnabled) - addfunc(lib, "GetDDGExternalOutputStepEnabled", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong, ctypes.POINTER(ctypes.c_ulong)], - argnames = ["uiIndex", "puiEnabled"] ) - # ctypes.c_uint GetDDGExternalOutputTime(ctypes.c_ulong uiIndex, ctypes.POINTER(ctypes.c_ulonglong) puiDelay, ctypes.POINTER(ctypes.c_ulonglong) puiWidth) - addfunc(lib, "GetDDGExternalOutputTime", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong, ctypes.POINTER(ctypes.c_ulonglong), ctypes.POINTER(ctypes.c_ulonglong)], - argnames = ["uiIndex", "puiDelay", "puiWidth"] ) - # ctypes.c_uint GetDDGTTLGateWidth(ctypes.c_ulonglong opticalWidth, ctypes.POINTER(ctypes.c_ulonglong) ttlWidth) - addfunc(lib, "GetDDGTTLGateWidth", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulonglong, ctypes.POINTER(ctypes.c_ulonglong)], - argnames = ["opticalWidth", "ttlWidth"] ) - # ctypes.c_uint GetDDGGateTime(ctypes.POINTER(ctypes.c_ulonglong) puiDelay, ctypes.POINTER(ctypes.c_ulonglong) puiWidth) - addfunc(lib, "GetDDGGateTime", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ulonglong), ctypes.POINTER(ctypes.c_ulonglong)], - argnames = ["puiDelay", "puiWidth"] ) - # ctypes.c_uint GetDDGInsertionDelay(ctypes.POINTER(ctypes.c_int) piState) - addfunc(lib, "GetDDGInsertionDelay", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["piState"] ) - # ctypes.c_uint GetDDGIntelligate(ctypes.POINTER(ctypes.c_int) piState) - addfunc(lib, "GetDDGIntelligate", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["piState"] ) - # ctypes.c_uint GetDDGIOC(ctypes.POINTER(ctypes.c_int) state) - addfunc(lib, "GetDDGIOC", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["state"] ) - # ctypes.c_uint GetDDGIOCFrequency(ctypes.POINTER(ctypes.c_double) frequency) - addfunc(lib, "GetDDGIOCFrequency", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_double)], - argnames = ["frequency"] ) - # ctypes.c_uint GetDDGIOCNumber(ctypes.POINTER(ctypes.c_ulong) numberPulses) - addfunc(lib, "GetDDGIOCNumber", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ulong)], - argnames = ["numberPulses"] ) - # ctypes.c_uint GetDDGIOCNumberRequested(ctypes.POINTER(ctypes.c_ulong) pulses) - addfunc(lib, "GetDDGIOCNumberRequested", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ulong)], - argnames = ["pulses"] ) - # ctypes.c_uint GetDDGIOCPeriod(ctypes.POINTER(ctypes.c_ulonglong) period) - addfunc(lib, "GetDDGIOCPeriod", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ulonglong)], - argnames = ["period"] ) - # ctypes.c_uint GetDDGIOCPulses(ctypes.POINTER(ctypes.c_int) pulses) - addfunc(lib, "GetDDGIOCPulses", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["pulses"] ) - # ctypes.c_uint GetDDGIOCTrigger(ctypes.POINTER(ctypes.c_ulong) trigger) - addfunc(lib, "GetDDGIOCTrigger", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ulong)], - argnames = ["trigger"] ) - # ctypes.c_uint GetDDGOpticalWidthEnabled(ctypes.POINTER(ctypes.c_ulong) puiEnabled) - addfunc(lib, "GetDDGOpticalWidthEnabled", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ulong)], - argnames = ["puiEnabled"] ) - # ctypes.c_uint GetDDGLiteGlobalControlByte(ctypes.POINTER(ctypes.c_ubyte) control) - addfunc(lib, "GetDDGLiteGlobalControlByte", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ubyte)], - argnames = ["control"] ) - # ctypes.c_uint GetDDGLiteControlByte(ctypes.c_int channel, ctypes.POINTER(ctypes.c_ubyte) control) - addfunc(lib, "GetDDGLiteControlByte", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_ubyte)], - argnames = ["channel", "control"] ) - # ctypes.c_uint GetDDGLiteInitialDelay(ctypes.c_int channel, ctypes.POINTER(ctypes.c_float) fDelay) - addfunc(lib, "GetDDGLiteInitialDelay", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["channel", "fDelay"] ) - # ctypes.c_uint GetDDGLitePulseWidth(ctypes.c_int channel, ctypes.POINTER(ctypes.c_float) fWidth) - addfunc(lib, "GetDDGLitePulseWidth", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["channel", "fWidth"] ) - # ctypes.c_uint GetDDGLiteInterPulseDelay(ctypes.c_int channel, ctypes.POINTER(ctypes.c_float) fDelay) - addfunc(lib, "GetDDGLiteInterPulseDelay", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["channel", "fDelay"] ) - # ctypes.c_uint GetDDGLitePulsesPerExposure(ctypes.c_int channel, ctypes.POINTER(ctypes.c_ulong) ui32Pulses) - addfunc(lib, "GetDDGLitePulsesPerExposure", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_ulong)], - argnames = ["channel", "ui32Pulses"] ) - # ctypes.c_uint GetDDGPulse(ctypes.c_double wid, ctypes.c_double resolution, ctypes.POINTER(ctypes.c_double) Delay, ctypes.POINTER(ctypes.c_double) Width) - addfunc(lib, "GetDDGPulse", restype = ctypes.c_uint, - argtypes = [ctypes.c_double, ctypes.c_double, ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double)], - argnames = ["wid", "resolution", "Delay", "Width"] ) - # ctypes.c_uint GetDDGStepCoefficients(ctypes.c_ulong mode, ctypes.POINTER(ctypes.c_double) p1, ctypes.POINTER(ctypes.c_double) p2) - addfunc(lib, "GetDDGStepCoefficients", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong, ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double)], - argnames = ["mode", "p1", "p2"] ) - # ctypes.c_uint GetDDGWidthStepCoefficients(ctypes.c_ulong mode, ctypes.POINTER(ctypes.c_double) p1, ctypes.POINTER(ctypes.c_double) p2) - addfunc(lib, "GetDDGWidthStepCoefficients", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong, ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double)], - argnames = ["mode", "p1", "p2"] ) - # ctypes.c_uint GetDDGStepMode(ctypes.POINTER(ctypes.c_ulong) mode) - addfunc(lib, "GetDDGStepMode", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ulong)], - argnames = ["mode"] ) - # ctypes.c_uint GetDDGWidthStepMode(ctypes.POINTER(ctypes.c_ulong) mode) - addfunc(lib, "GetDDGWidthStepMode", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ulong)], - argnames = ["mode"] ) - # ctypes.c_uint GetDetector(ctypes.POINTER(ctypes.c_int) xpixels, ctypes.POINTER(ctypes.c_int) ypixels) - addfunc(lib, "GetDetector", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)], - argnames = ["xpixels", "ypixels"] ) - # ctypes.c_uint GetDICameraInfo(ctypes.c_void_p info) - addfunc(lib, "GetDICameraInfo", restype = ctypes.c_uint, - argtypes = [ctypes.c_void_p], - argnames = ["info"] ) - # ctypes.c_uint GetEMAdvanced(ctypes.POINTER(ctypes.c_int) state) - addfunc(lib, "GetEMAdvanced", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["state"] ) - # ctypes.c_uint GetEMCCDGain(ctypes.POINTER(ctypes.c_int) gain) - addfunc(lib, "GetEMCCDGain", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["gain"] ) - # ctypes.c_uint GetEMGainRange(ctypes.POINTER(ctypes.c_int) low, ctypes.POINTER(ctypes.c_int) high) - addfunc(lib, "GetEMGainRange", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)], - argnames = ["low", "high"] ) - # ctypes.c_uint GetESDEventStatus(ctypes.POINTER(DWORD) camStatus) - addfunc(lib, "GetESDEventStatus", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(DWORD)], - argnames = ["camStatus"] ) - # ctypes.c_uint GetExternalTriggerTermination(ctypes.POINTER(ctypes.c_ulong) puiTermination) - addfunc(lib, "GetExternalTriggerTermination", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ulong)], - argnames = ["puiTermination"] ) - # ctypes.c_uint GetFastestRecommendedVSSpeed(ctypes.POINTER(ctypes.c_int) index, ctypes.POINTER(ctypes.c_float) speed) - addfunc(lib, "GetFastestRecommendedVSSpeed", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_float)], - argnames = ["index", "speed"] ) - # ctypes.c_uint GetFIFOUsage(ctypes.POINTER(ctypes.c_int) FIFOusage) - addfunc(lib, "GetFIFOUsage", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["FIFOusage"] ) - # ctypes.c_uint GetFilterMode(ctypes.POINTER(ctypes.c_int) mode) - addfunc(lib, "GetFilterMode", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["mode"] ) - # ctypes.c_uint GetFKExposureTime(ctypes.POINTER(ctypes.c_float) time) - addfunc(lib, "GetFKExposureTime", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float)], - argnames = ["time"] ) - # ctypes.c_uint GetFKVShiftSpeed(ctypes.c_int index, ctypes.POINTER(ctypes.c_int) speed) - addfunc(lib, "GetFKVShiftSpeed", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["index", "speed"] ) - # ctypes.c_uint GetFKVShiftSpeedF(ctypes.c_int index, ctypes.POINTER(ctypes.c_float) speed) - addfunc(lib, "GetFKVShiftSpeedF", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["index", "speed"] ) - # ctypes.c_uint GetFrontEndStatus(ctypes.POINTER(ctypes.c_int) piFlag) - addfunc(lib, "GetFrontEndStatus", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["piFlag"] ) - # ctypes.c_uint GetGateMode(ctypes.POINTER(ctypes.c_int) piGatemode) - addfunc(lib, "GetGateMode", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["piGatemode"] ) - # ctypes.c_uint GetHardwareVersion(ctypes.POINTER(ctypes.c_uint) PCB, ctypes.POINTER(ctypes.c_uint) Decode, ctypes.POINTER(ctypes.c_uint) dummy1, ctypes.POINTER(ctypes.c_uint) dummy2, ctypes.POINTER(ctypes.c_uint) CameraFirmwareVersion, ctypes.POINTER(ctypes.c_uint) CameraFirmwareBuild) - addfunc(lib, "GetHardwareVersion", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)], - argnames = ["PCB", "Decode", "dummy1", "dummy2", "CameraFirmwareVersion", "CameraFirmwareBuild"] ) - # ctypes.c_uint GetHeadModel(ctypes.c_char_p name) - addfunc(lib, "GetHeadModel", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p], - argnames = ["name"] ) - # ctypes.c_uint GetHorizontalSpeed(ctypes.c_int index, ctypes.POINTER(ctypes.c_int) speed) - addfunc(lib, "GetHorizontalSpeed", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["index", "speed"] ) - # ctypes.c_uint GetHSSpeed(ctypes.c_int channel, ctypes.c_int typ, ctypes.c_int index, ctypes.POINTER(ctypes.c_float) speed) - addfunc(lib, "GetHSSpeed", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["channel", "typ", "index", "speed"] ) - # ctypes.c_uint GetHVflag(ctypes.POINTER(ctypes.c_int) bFlag) - addfunc(lib, "GetHVflag", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["bFlag"] ) - # ctypes.c_uint GetID(ctypes.c_int devNum, ctypes.POINTER(ctypes.c_int) id) - addfunc(lib, "GetID", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["devNum", "id"] ) - # ctypes.c_uint GetImageFlip(ctypes.POINTER(ctypes.c_int) iHFlip, ctypes.POINTER(ctypes.c_int) iVFlip) - addfunc(lib, "GetImageFlip", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)], - argnames = ["iHFlip", "iVFlip"] ) - # ctypes.c_uint GetImageRotate(ctypes.POINTER(ctypes.c_int) iRotate) - addfunc(lib, "GetImageRotate", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["iRotate"] ) - # ctypes.c_uint GetImages(ctypes.c_long first, ctypes.c_long last, ctypes.POINTER(ctypes.c_long) arr, ctypes.c_ulong size, ctypes.POINTER(ctypes.c_long) validfirst, ctypes.POINTER(ctypes.c_long) validlast) - addfunc(lib, "GetImages", restype = ctypes.c_uint, - argtypes = [ctypes.c_long, ctypes.c_long, ctypes.POINTER(ctypes.c_long), ctypes.c_ulong, ctypes.POINTER(ctypes.c_long), ctypes.POINTER(ctypes.c_long)], - argnames = ["first", "last", "arr", "size", "validfirst", "validlast"] ) - # ctypes.c_uint GetImages16(ctypes.c_long first, ctypes.c_long last, ctypes.POINTER(WORD) arr, ctypes.c_ulong size, ctypes.POINTER(ctypes.c_long) validfirst, ctypes.POINTER(ctypes.c_long) validlast) - addfunc(lib, "GetImages16", restype = ctypes.c_uint, - argtypes = [ctypes.c_long, ctypes.c_long, ctypes.POINTER(WORD), ctypes.c_ulong, ctypes.POINTER(ctypes.c_long), ctypes.POINTER(ctypes.c_long)], - argnames = ["first", "last", "arr", "size", "validfirst", "validlast"] ) - # ctypes.c_uint GetImagesPerDMA(ctypes.POINTER(ctypes.c_ulong) images) - addfunc(lib, "GetImagesPerDMA", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ulong)], - argnames = ["images"] ) - # ctypes.c_uint GetIRQ(ctypes.POINTER(ctypes.c_int) IRQ) - addfunc(lib, "GetIRQ", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["IRQ"] ) - # ctypes.c_uint GetKeepCleanTime(ctypes.POINTER(ctypes.c_float) KeepCleanTime) - addfunc(lib, "GetKeepCleanTime", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float)], - argnames = ["KeepCleanTime"] ) - # ctypes.c_uint GetMaximumBinning(ctypes.c_int ReadMode, ctypes.c_int HorzVert, ctypes.POINTER(ctypes.c_int) MaxBinning) - addfunc(lib, "GetMaximumBinning", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["ReadMode", "HorzVert", "MaxBinning"] ) - # ctypes.c_uint GetMaximumExposure(ctypes.POINTER(ctypes.c_float) MaxExp) - addfunc(lib, "GetMaximumExposure", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float)], - argnames = ["MaxExp"] ) - # ctypes.c_uint GetMaximumNumberRingExposureTimes(ctypes.POINTER(ctypes.c_int) number) - addfunc(lib, "GetMaximumNumberRingExposureTimes", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["number"] ) - # ctypes.c_uint GetMCPGain(ctypes.POINTER(ctypes.c_int) piGain) - addfunc(lib, "GetMCPGain", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["piGain"] ) - # ctypes.c_uint GetMCPGainRange(ctypes.POINTER(ctypes.c_int) iLow, ctypes.POINTER(ctypes.c_int) iHigh) - addfunc(lib, "GetMCPGainRange", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)], - argnames = ["iLow", "iHigh"] ) - # ctypes.c_uint GetMCPGainTable(ctypes.c_int iNum, ctypes.POINTER(ctypes.c_int) piGain, ctypes.POINTER(ctypes.c_float) pfPhotoepc) - addfunc(lib, "GetMCPGainTable", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_float)], - argnames = ["iNum", "piGain", "pfPhotoepc"] ) - # ctypes.c_uint GetMCPVoltage(ctypes.POINTER(ctypes.c_int) iVoltage) - addfunc(lib, "GetMCPVoltage", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["iVoltage"] ) - # ctypes.c_uint GetMinimumImageLength(ctypes.POINTER(ctypes.c_int) MinImageLength) - addfunc(lib, "GetMinimumImageLength", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["MinImageLength"] ) - # ctypes.c_uint GetMinimumNumberInSeries(ctypes.POINTER(ctypes.c_int) number) - addfunc(lib, "GetMinimumNumberInSeries", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["number"] ) - # ctypes.c_uint GetMostRecentColorImage16(ctypes.c_ulong size, ctypes.c_int algorithm, ctypes.POINTER(WORD) red, ctypes.POINTER(WORD) green, ctypes.POINTER(WORD) blue) - addfunc(lib, "GetMostRecentColorImage16", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong, ctypes.c_int, ctypes.POINTER(WORD), ctypes.POINTER(WORD), ctypes.POINTER(WORD)], - argnames = ["size", "algorithm", "red", "green", "blue"] ) - # ctypes.c_uint GetMostRecentImage(ctypes.POINTER(ctypes.c_long) arr, ctypes.c_ulong size) - addfunc(lib, "GetMostRecentImage", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.c_ulong], - argnames = ["arr", "size"] ) - # ctypes.c_uint GetMostRecentImage16(ctypes.POINTER(WORD) arr, ctypes.c_ulong size) - addfunc(lib, "GetMostRecentImage16", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(WORD), ctypes.c_ulong], - argnames = ["arr", "size"] ) - # ctypes.c_uint GetMSTimingsData(ctypes.c_void_p TimeOfStart, ctypes.POINTER(ctypes.c_float) pfDifferences, ctypes.c_int inoOfImages) - addfunc(lib, "GetMSTimingsData", restype = ctypes.c_uint, - argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_float), ctypes.c_int], - argnames = ["TimeOfStart", "pfDifferences", "inoOfImages"] ) - # ctypes.c_uint GetMetaDataInfo(ctypes.c_void_p TimeOfStart, ctypes.POINTER(ctypes.c_float) pfTimeFromStart, ctypes.c_uint index) - addfunc(lib, "GetMetaDataInfo", restype = ctypes.c_uint, - argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_float), ctypes.c_uint], - argnames = ["TimeOfStart", "pfTimeFromStart", "index"] ) - # ctypes.c_uint GetMSTimingsEnabled() - addfunc(lib, "GetMSTimingsEnabled", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint GetNewData(ctypes.POINTER(ctypes.c_long) arr, ctypes.c_ulong size) - addfunc(lib, "GetNewData", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.c_ulong], - argnames = ["arr", "size"] ) - # ctypes.c_uint GetNewData16(ctypes.POINTER(WORD) arr, ctypes.c_ulong size) - addfunc(lib, "GetNewData16", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(WORD), ctypes.c_ulong], - argnames = ["arr", "size"] ) - # ctypes.c_uint GetNewData8(ctypes.POINTER(ctypes.c_ubyte) arr, ctypes.c_ulong size) - addfunc(lib, "GetNewData8", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ubyte), ctypes.c_ulong], - argnames = ["arr", "size"] ) - # ctypes.c_uint GetNewFloatData(ctypes.POINTER(ctypes.c_float) arr, ctypes.c_ulong size) - addfunc(lib, "GetNewFloatData", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float), ctypes.c_ulong], - argnames = ["arr", "size"] ) - # ctypes.c_uint GetNumberADChannels(ctypes.POINTER(ctypes.c_int) channels) - addfunc(lib, "GetNumberADChannels", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["channels"] ) - # ctypes.c_uint GetNumberAmp(ctypes.POINTER(ctypes.c_int) amp) - addfunc(lib, "GetNumberAmp", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["amp"] ) - # ctypes.c_uint GetNumberAvailableImages(ctypes.POINTER(ctypes.c_long) first, ctypes.POINTER(ctypes.c_long) last) - addfunc(lib, "GetNumberAvailableImages", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.POINTER(ctypes.c_long)], - argnames = ["first", "last"] ) - # ctypes.c_uint GetNumberDDGExternalOutputs(ctypes.POINTER(ctypes.c_ulong) puiCount) - addfunc(lib, "GetNumberDDGExternalOutputs", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ulong)], - argnames = ["puiCount"] ) - # ctypes.c_uint GetNumberDevices(ctypes.POINTER(ctypes.c_int) numDevs) - addfunc(lib, "GetNumberDevices", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["numDevs"] ) - # ctypes.c_uint GetNumberFKVShiftSpeeds(ctypes.POINTER(ctypes.c_int) number) - addfunc(lib, "GetNumberFKVShiftSpeeds", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["number"] ) - # ctypes.c_uint GetNumberHorizontalSpeeds(ctypes.POINTER(ctypes.c_int) number) - addfunc(lib, "GetNumberHorizontalSpeeds", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["number"] ) - # ctypes.c_uint GetNumberHSSpeeds(ctypes.c_int channel, ctypes.c_int typ, ctypes.POINTER(ctypes.c_int) speeds) - addfunc(lib, "GetNumberHSSpeeds", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["channel", "typ", "speeds"] ) - # ctypes.c_uint GetNumberMissedExternalTriggers(ctypes.c_uint first, ctypes.c_uint last, ctypes.POINTER(WORD) arr, ctypes.c_uint size) - addfunc(lib, "GetNumberMissedExternalTriggers", restype = ctypes.c_uint, - argtypes = [ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(WORD), ctypes.c_uint], - argnames = ["first", "last", "arr", "size"] ) - # ctypes.c_uint GetIRIGData(ctypes.POINTER(ctypes.c_ubyte) _uc_irigData, ctypes.c_uint _ui_index) - addfunc(lib, "GetIRIGData", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ubyte), ctypes.c_uint], - argnames = ["_uc_irigData", "_ui_index"] ) - # ctypes.c_uint GetMetaData(ctypes.POINTER(ctypes.c_ubyte) data, ctypes.c_uint _ui_index) - addfunc(lib, "GetMetaData", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ubyte), ctypes.c_uint], - argnames = ["data", "_ui_index"] ) - # ctypes.c_uint GetNumberNewImages(ctypes.POINTER(ctypes.c_long) first, ctypes.POINTER(ctypes.c_long) last) - addfunc(lib, "GetNumberNewImages", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.POINTER(ctypes.c_long)], - argnames = ["first", "last"] ) - # ctypes.c_uint GetNumberPhotonCountingDivisions(ctypes.POINTER(ctypes.c_ulong) noOfDivisions) - addfunc(lib, "GetNumberPhotonCountingDivisions", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ulong)], - argnames = ["noOfDivisions"] ) - # ctypes.c_uint GetNumberPreAmpGains(ctypes.POINTER(ctypes.c_int) noGains) - addfunc(lib, "GetNumberPreAmpGains", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["noGains"] ) - # ctypes.c_uint GetNumberRingExposureTimes(ctypes.POINTER(ctypes.c_int) ipnumTimes) - addfunc(lib, "GetNumberRingExposureTimes", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["ipnumTimes"] ) - # ctypes.c_uint GetNumberIO(ctypes.POINTER(ctypes.c_int) iNumber) - addfunc(lib, "GetNumberIO", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["iNumber"] ) - # ctypes.c_uint GetNumberVerticalSpeeds(ctypes.POINTER(ctypes.c_int) number) - addfunc(lib, "GetNumberVerticalSpeeds", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["number"] ) - # ctypes.c_uint GetNumberVSAmplitudes(ctypes.POINTER(ctypes.c_int) number) - addfunc(lib, "GetNumberVSAmplitudes", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["number"] ) - # ctypes.c_uint GetNumberVSSpeeds(ctypes.POINTER(ctypes.c_int) speeds) - addfunc(lib, "GetNumberVSSpeeds", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["speeds"] ) - # ctypes.c_uint GetOldestImage(ctypes.POINTER(ctypes.c_long) arr, ctypes.c_ulong size) - addfunc(lib, "GetOldestImage", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.c_ulong], - argnames = ["arr", "size"] ) - # ctypes.c_uint GetOldestImage16(ctypes.POINTER(WORD) arr, ctypes.c_ulong size) - addfunc(lib, "GetOldestImage16", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(WORD), ctypes.c_ulong], - argnames = ["arr", "size"] ) - # ctypes.c_uint GetPhosphorStatus(ctypes.POINTER(ctypes.c_int) piFlag) - addfunc(lib, "GetPhosphorStatus", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["piFlag"] ) - # ctypes.c_uint GetPhysicalDMAAddress(ctypes.POINTER(ctypes.c_ulong) Address1, ctypes.POINTER(ctypes.c_ulong) Address2) - addfunc(lib, "GetPhysicalDMAAddress", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_ulong), ctypes.POINTER(ctypes.c_ulong)], - argnames = ["Address1", "Address2"] ) - # ctypes.c_uint GetPixelSize(ctypes.POINTER(ctypes.c_float) xSize, ctypes.POINTER(ctypes.c_float) ySize) - addfunc(lib, "GetPixelSize", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)], - argnames = ["xSize", "ySize"] ) - # ctypes.c_uint GetPreAmpGain(ctypes.c_int index, ctypes.POINTER(ctypes.c_float) gain) - addfunc(lib, "GetPreAmpGain", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["index", "gain"] ) - # ctypes.c_uint GetPreAmpGainText(ctypes.c_int index, ctypes.c_char_p name, ctypes.c_int length) - addfunc(lib, "GetPreAmpGainText", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_char_p, ctypes.c_int], - argnames = ["index", "name", "length"] ) - # ctypes.c_uint GetCurrentPreAmpGain(ctypes.POINTER(ctypes.c_int) index, ctypes.c_char_p name, ctypes.c_int length) - addfunc(lib, "GetCurrentPreAmpGain", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.c_char_p, ctypes.c_int], - argnames = ["index", "name", "length"] ) - # ctypes.c_uint GetDualExposureTimes(ctypes.POINTER(ctypes.c_float) exposure1, ctypes.POINTER(ctypes.c_float) exposure2) - addfunc(lib, "GetDualExposureTimes", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)], - argnames = ["exposure1", "exposure2"] ) - # ctypes.c_uint GetQE(ctypes.c_char_p sensor, ctypes.c_float wavelength, ctypes.c_uint mode, ctypes.POINTER(ctypes.c_float) QE) - addfunc(lib, "GetQE", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_float, ctypes.c_uint, ctypes.POINTER(ctypes.c_float)], - argnames = ["sensor", "wavelength", "mode", "QE"] ) - # ctypes.c_uint GetReadOutTime(ctypes.POINTER(ctypes.c_float) ReadOutTime) - addfunc(lib, "GetReadOutTime", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float)], - argnames = ["ReadOutTime"] ) - # ctypes.c_uint GetRegisterDump(ctypes.POINTER(ctypes.c_int) mode) - addfunc(lib, "GetRegisterDump", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["mode"] ) - # ctypes.c_uint GetRelativeImageTimes(ctypes.c_uint first, ctypes.c_uint last, ctypes.POINTER(ctypes.c_ulonglong) arr, ctypes.c_uint size) - addfunc(lib, "GetRelativeImageTimes", restype = ctypes.c_uint, - argtypes = [ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(ctypes.c_ulonglong), ctypes.c_uint], - argnames = ["first", "last", "arr", "size"] ) - # ctypes.c_uint GetRingExposureRange(ctypes.POINTER(ctypes.c_float) fpMin, ctypes.POINTER(ctypes.c_float) fpMax) - addfunc(lib, "GetRingExposureRange", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)], - argnames = ["fpMin", "fpMax"] ) - # ctypes.c_uint GetSDK3Handle(ctypes.POINTER(ctypes.c_int) Handle) - addfunc(lib, "GetSDK3Handle", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["Handle"] ) - # ctypes.c_uint GetSensitivity(ctypes.c_int channel, ctypes.c_int horzShift, ctypes.c_int amplifier, ctypes.c_int pa, ctypes.POINTER(ctypes.c_float) sensitivity) - addfunc(lib, "GetSensitivity", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["channel", "horzShift", "amplifier", "pa", "sensitivity"] ) - # ctypes.c_uint GetShutterMinTimes(ctypes.POINTER(ctypes.c_int) minclosingtime, ctypes.POINTER(ctypes.c_int) minopeningtime) - addfunc(lib, "GetShutterMinTimes", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)], - argnames = ["minclosingtime", "minopeningtime"] ) - # ctypes.c_uint GetSizeOfCircularBuffer(ctypes.POINTER(ctypes.c_long) index) - addfunc(lib, "GetSizeOfCircularBuffer", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long)], - argnames = ["index"] ) - # ctypes.c_uint GetSlotBusDeviceFunction(ctypes.POINTER(DWORD) dwslot, ctypes.POINTER(DWORD) dwBus, ctypes.POINTER(DWORD) dwDevice, ctypes.POINTER(DWORD) dwFunction) - addfunc(lib, "GetSlotBusDeviceFunction", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(DWORD), ctypes.POINTER(DWORD), ctypes.POINTER(DWORD), ctypes.POINTER(DWORD)], - argnames = ["dwslot", "dwBus", "dwDevice", "dwFunction"] ) - # ctypes.c_uint GetSoftwareVersion(ctypes.POINTER(ctypes.c_uint) eprom, ctypes.POINTER(ctypes.c_uint) coffile, ctypes.POINTER(ctypes.c_uint) vxdrev, ctypes.POINTER(ctypes.c_uint) vxdver, ctypes.POINTER(ctypes.c_uint) dllrev, ctypes.POINTER(ctypes.c_uint) dllver) - addfunc(lib, "GetSoftwareVersion", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)], - argnames = ["eprom", "coffile", "vxdrev", "vxdver", "dllrev", "dllver"] ) - # ctypes.c_uint GetSpoolProgress(ctypes.POINTER(ctypes.c_long) index) - addfunc(lib, "GetSpoolProgress", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long)], - argnames = ["index"] ) - # ctypes.c_uint GetStartUpTime(ctypes.POINTER(ctypes.c_float) time) - addfunc(lib, "GetStartUpTime", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float)], - argnames = ["time"] ) - # ctypes.c_uint GetStatus(ctypes.POINTER(ctypes.c_int) status) - addfunc(lib, "GetStatus", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["status"] ) - # ctypes.c_uint GetTECStatus(ctypes.POINTER(ctypes.c_int) piFlag) - addfunc(lib, "GetTECStatus", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["piFlag"] ) - # ctypes.c_uint GetTemperature(ctypes.POINTER(ctypes.c_int) temperature) - addfunc(lib, "GetTemperature", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["temperature"] ) - # ctypes.c_uint GetTemperatureF(ctypes.POINTER(ctypes.c_float) temperature) - addfunc(lib, "GetTemperatureF", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float)], - argnames = ["temperature"] ) - # ctypes.c_uint GetTemperatureRange(ctypes.POINTER(ctypes.c_int) mintemp, ctypes.POINTER(ctypes.c_int) maxtemp) - addfunc(lib, "GetTemperatureRange", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)], - argnames = ["mintemp", "maxtemp"] ) - # ctypes.c_uint GetTemperaturePrecision(ctypes.POINTER(ctypes.c_int) precision) - addfunc(lib, "GetTemperaturePrecision", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["precision"] ) - # ctypes.c_uint GetTemperatureStatus(ctypes.POINTER(ctypes.c_float) SensorTemp, ctypes.POINTER(ctypes.c_float) TargetTemp, ctypes.POINTER(ctypes.c_float) AmbientTemp, ctypes.POINTER(ctypes.c_float) CoolerVolts) - addfunc(lib, "GetTemperatureStatus", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)], - argnames = ["SensorTemp", "TargetTemp", "AmbientTemp", "CoolerVolts"] ) - # ctypes.c_uint GetTotalNumberImagesAcquired(ctypes.POINTER(ctypes.c_long) index) - addfunc(lib, "GetTotalNumberImagesAcquired", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long)], - argnames = ["index"] ) - # ctypes.c_uint GetIODirection(ctypes.c_int index, ctypes.POINTER(ctypes.c_int) iDirection) - addfunc(lib, "GetIODirection", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["index", "iDirection"] ) - # ctypes.c_uint GetIOLevel(ctypes.c_int index, ctypes.POINTER(ctypes.c_int) iLevel) - addfunc(lib, "GetIOLevel", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["index", "iLevel"] ) - # ctypes.c_uint GetUSBDeviceDetails(ctypes.POINTER(WORD) VendorID, ctypes.POINTER(WORD) ProductID, ctypes.POINTER(WORD) FirmwareVersion, ctypes.POINTER(WORD) SpecificationNumber) - addfunc(lib, "GetUSBDeviceDetails", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(WORD), ctypes.POINTER(WORD), ctypes.POINTER(WORD), ctypes.POINTER(WORD)], - argnames = ["VendorID", "ProductID", "FirmwareVersion", "SpecificationNumber"] ) - # ctypes.c_uint GetVersionInfo(ctypes.c_int arr, ctypes.c_char_p szVersionInfo, ctypes.c_ulong ui32BufferLen) - addfunc(lib, "GetVersionInfo", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_char_p, ctypes.c_ulong], - argnames = ["arr", "szVersionInfo", "ui32BufferLen"] ) - # ctypes.c_uint GetVerticalSpeed(ctypes.c_int index, ctypes.POINTER(ctypes.c_int) speed) - addfunc(lib, "GetVerticalSpeed", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["index", "speed"] ) - # ctypes.c_uint GetVirtualDMAAddress(ctypes.POINTER(ctypes.c_void_p) Address1, ctypes.POINTER(ctypes.c_void_p) Address2) - addfunc(lib, "GetVirtualDMAAddress", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(ctypes.c_void_p)], - argnames = ["Address1", "Address2"] ) - # ctypes.c_uint GetVSAmplitudeString(ctypes.c_int index, ctypes.c_char_p text) - addfunc(lib, "GetVSAmplitudeString", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_char_p], - argnames = ["index", "text"] ) - # ctypes.c_uint GetVSAmplitudeFromString(ctypes.c_char_p text, ctypes.POINTER(ctypes.c_int) index) - addfunc(lib, "GetVSAmplitudeFromString", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.POINTER(ctypes.c_int)], - argnames = ["text", "index"] ) - # ctypes.c_uint GetVSAmplitudeValue(ctypes.c_int index, ctypes.POINTER(ctypes.c_int) value) - addfunc(lib, "GetVSAmplitudeValue", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["index", "value"] ) - # ctypes.c_uint GetVSSpeed(ctypes.c_int index, ctypes.POINTER(ctypes.c_float) speed) - addfunc(lib, "GetVSSpeed", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["index", "speed"] ) - # ctypes.c_uint GPIBReceive(ctypes.c_int id, ctypes.c_short address, ctypes.c_char_p text, ctypes.c_int size) - addfunc(lib, "GPIBReceive", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_short, ctypes.c_char_p, ctypes.c_int], - argnames = ["id", "address", "text", "size"] ) - # ctypes.c_uint GPIBSend(ctypes.c_int id, ctypes.c_short address, ctypes.c_char_p text) - addfunc(lib, "GPIBSend", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_short, ctypes.c_char_p], - argnames = ["id", "address", "text"] ) - # ctypes.c_uint I2CBurstRead(BYTE i2cAddress, ctypes.c_long nBytes, ctypes.POINTER(BYTE) data) - addfunc(lib, "I2CBurstRead", restype = ctypes.c_uint, - argtypes = [BYTE, ctypes.c_long, ctypes.POINTER(BYTE)], - argnames = ["i2cAddress", "nBytes", "data"] ) - # ctypes.c_uint I2CBurstWrite(BYTE i2cAddress, ctypes.c_long nBytes, ctypes.POINTER(BYTE) data) - addfunc(lib, "I2CBurstWrite", restype = ctypes.c_uint, - argtypes = [BYTE, ctypes.c_long, ctypes.POINTER(BYTE)], - argnames = ["i2cAddress", "nBytes", "data"] ) - # ctypes.c_uint I2CRead(BYTE deviceID, BYTE intAddress, ctypes.POINTER(BYTE) pdata) - addfunc(lib, "I2CRead", restype = ctypes.c_uint, - argtypes = [BYTE, BYTE, ctypes.POINTER(BYTE)], - argnames = ["deviceID", "intAddress", "pdata"] ) - # ctypes.c_uint I2CReset() - addfunc(lib, "I2CReset", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint I2CWrite(BYTE deviceID, BYTE intAddress, BYTE data) - addfunc(lib, "I2CWrite", restype = ctypes.c_uint, - argtypes = [BYTE, BYTE, BYTE], - argnames = ["deviceID", "intAddress", "data"] ) - # ctypes.c_uint IdAndorDll() - addfunc(lib, "IdAndorDll", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint InAuxPort(ctypes.c_int port, ctypes.POINTER(ctypes.c_int) state) - addfunc(lib, "InAuxPort", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["port", "state"] ) - # ctypes.c_uint Initialize(ctypes.c_char_p dir) - addfunc(lib, "Initialize", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p], - argnames = ["dir"] ) - # ctypes.c_uint InitializeDevice(ctypes.c_char_p dir) - addfunc(lib, "InitializeDevice", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p], - argnames = ["dir"] ) - # ctypes.c_uint IsAmplifierAvailable(ctypes.c_int iamp) - addfunc(lib, "IsAmplifierAvailable", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["iamp"] ) - # ctypes.c_uint IsCoolerOn(ctypes.POINTER(ctypes.c_int) iCoolerStatus) - addfunc(lib, "IsCoolerOn", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["iCoolerStatus"] ) - # ctypes.c_uint IsCountConvertModeAvailable(ctypes.c_int mode) - addfunc(lib, "IsCountConvertModeAvailable", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint IsInternalMechanicalShutter(ctypes.POINTER(ctypes.c_int) InternalShutter) - addfunc(lib, "IsInternalMechanicalShutter", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["InternalShutter"] ) - # ctypes.c_uint IsPreAmpGainAvailable(ctypes.c_int channel, ctypes.c_int amplifier, ctypes.c_int index, ctypes.c_int pa, ctypes.POINTER(ctypes.c_int) status) - addfunc(lib, "IsPreAmpGainAvailable", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["channel", "amplifier", "index", "pa", "status"] ) - # ctypes.c_uint IsReadoutFlippedByAmplifier(ctypes.c_int iAmplifier, ctypes.POINTER(ctypes.c_int) iFlipped) - addfunc(lib, "IsReadoutFlippedByAmplifier", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["iAmplifier", "iFlipped"] ) - # ctypes.c_uint IsTriggerModeAvailable(ctypes.c_int iTriggerMode) - addfunc(lib, "IsTriggerModeAvailable", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["iTriggerMode"] ) - # ctypes.c_uint Merge(ctypes.POINTER(ctypes.c_long) arr, ctypes.c_long nOrder, ctypes.c_long nPoint, ctypes.c_long nPixel, ctypes.POINTER(ctypes.c_float) coeff, ctypes.c_long fit, ctypes.c_long hbin, ctypes.POINTER(ctypes.c_long) output, ctypes.POINTER(ctypes.c_float) start, ctypes.POINTER(ctypes.c_float) step_Renamed) - addfunc(lib, "Merge", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.c_long, ctypes.c_long, ctypes.c_long, ctypes.POINTER(ctypes.c_float), ctypes.c_long, ctypes.c_long, ctypes.POINTER(ctypes.c_long), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)], - argnames = ["arr", "nOrder", "nPoint", "nPixel", "coeff", "fit", "hbin", "output", "start", "step_Renamed"] ) - # ctypes.c_uint OutAuxPort(ctypes.c_int port, ctypes.c_int state) - addfunc(lib, "OutAuxPort", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["port", "state"] ) - # ctypes.c_uint PrepareAcquisition() - addfunc(lib, "PrepareAcquisition", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint SaveAsBmp(ctypes.c_char_p path, ctypes.c_char_p palette, ctypes.c_long ymin, ctypes.c_long ymax) - addfunc(lib, "SaveAsBmp", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_long], - argnames = ["path", "palette", "ymin", "ymax"] ) - # ctypes.c_uint SaveAsCalibratedSif(ctypes.c_char_p path, ctypes.c_int x_data_type, ctypes.c_int x_unit, ctypes.POINTER(ctypes.c_float) x_cal, ctypes.c_float rayleighWavelength) - addfunc(lib, "SaveAsCalibratedSif", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float), ctypes.c_float], - argnames = ["path", "x_data_type", "x_unit", "x_cal", "rayleighWavelength"] ) - # ctypes.c_uint SaveAsCommentedSif(ctypes.c_char_p path, ctypes.c_char_p comment) - addfunc(lib, "SaveAsCommentedSif", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_char_p], - argnames = ["path", "comment"] ) - # ctypes.c_uint SaveAsEDF(ctypes.c_char_p szPath, ctypes.c_int iMode) - addfunc(lib, "SaveAsEDF", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_int], - argnames = ["szPath", "iMode"] ) - # ctypes.c_uint SaveAsFITS(ctypes.c_char_p szFileTitle, ctypes.c_int typ) - addfunc(lib, "SaveAsFITS", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_int], - argnames = ["szFileTitle", "typ"] ) - # ctypes.c_uint SaveAsRaw(ctypes.c_char_p szFileTitle, ctypes.c_int typ) - addfunc(lib, "SaveAsRaw", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_int], - argnames = ["szFileTitle", "typ"] ) - # ctypes.c_uint SaveAsSif(ctypes.c_char_p path) - addfunc(lib, "SaveAsSif", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p], - argnames = ["path"] ) - # ctypes.c_uint SaveAsSPC(ctypes.c_char_p path) - addfunc(lib, "SaveAsSPC", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p], - argnames = ["path"] ) - # ctypes.c_uint SaveAsTiff(ctypes.c_char_p path, ctypes.c_char_p palette, ctypes.c_int position, ctypes.c_int typ) - addfunc(lib, "SaveAsTiff", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_int], - argnames = ["path", "palette", "position", "typ"] ) - # ctypes.c_uint SaveAsTiffEx(ctypes.c_char_p path, ctypes.c_char_p palette, ctypes.c_int position, ctypes.c_int typ, ctypes.c_int mode) - addfunc(lib, "SaveAsTiffEx", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["path", "palette", "position", "typ", "mode"] ) - # ctypes.c_uint SaveEEPROMToFile(ctypes.c_char_p cFileName) - addfunc(lib, "SaveEEPROMToFile", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p], - argnames = ["cFileName"] ) - # ctypes.c_uint SaveToClipBoard(ctypes.c_char_p palette) - addfunc(lib, "SaveToClipBoard", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p], - argnames = ["palette"] ) - # ctypes.c_uint SelectDevice(ctypes.c_int devNum) - addfunc(lib, "SelectDevice", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["devNum"] ) - # ctypes.c_uint SendSoftwareTrigger() - addfunc(lib, "SendSoftwareTrigger", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint SetAccumulationCycleTime(ctypes.c_float time) - addfunc(lib, "SetAccumulationCycleTime", restype = ctypes.c_uint, - argtypes = [ctypes.c_float], - argnames = ["time"] ) - # ctypes.c_uint SetAcqStatusEvent(HANDLE statusEvent) - addfunc(lib, "SetAcqStatusEvent", restype = ctypes.c_uint, - argtypes = [HANDLE], - argnames = ["statusEvent"] ) - # ctypes.c_uint SetAcquisitionMode(ctypes.c_int mode) - addfunc(lib, "SetAcquisitionMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetSensorPortMode(ctypes.c_int mode) - addfunc(lib, "SetSensorPortMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SelectSensorPort(ctypes.c_int port) - addfunc(lib, "SelectSensorPort", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["port"] ) - # ctypes.c_uint SetSizeOfCircularBufferMegaBytes(ctypes.c_ulong sizeMB) - addfunc(lib, "SetSizeOfCircularBufferMegaBytes", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong], - argnames = ["sizeMB"] ) - # ctypes.c_uint SelectDualSensorPort(ctypes.c_int port) - addfunc(lib, "SelectDualSensorPort", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["port"] ) - # ctypes.c_uint SetAcquisitionType(ctypes.c_int typ) - addfunc(lib, "SetAcquisitionType", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["typ"] ) - # ctypes.c_uint SetADChannel(ctypes.c_int channel) - addfunc(lib, "SetADChannel", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["channel"] ) - # ctypes.c_uint SetAdvancedTriggerModeState(ctypes.c_int iState) - addfunc(lib, "SetAdvancedTriggerModeState", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["iState"] ) - # ctypes.c_uint SetBackground(ctypes.POINTER(ctypes.c_long) arr, ctypes.c_ulong size) - addfunc(lib, "SetBackground", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.c_ulong], - argnames = ["arr", "size"] ) - # ctypes.c_uint SetBaselineClamp(ctypes.c_int state) - addfunc(lib, "SetBaselineClamp", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["state"] ) - # ctypes.c_uint SetBaselineOffset(ctypes.c_int offset) - addfunc(lib, "SetBaselineOffset", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["offset"] ) - # ctypes.c_uint SetBitsPerPixel(ctypes.c_int state) - addfunc(lib, "SetBitsPerPixel", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["state"] ) - # ctypes.c_uint SetCameraLinkMode(ctypes.c_int mode) - addfunc(lib, "SetCameraLinkMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetCameraStatusEnable(DWORD Enable) - addfunc(lib, "SetCameraStatusEnable", restype = ctypes.c_uint, - argtypes = [DWORD], - argnames = ["Enable"] ) - # ctypes.c_uint SetChargeShifting(ctypes.c_uint NumberRows, ctypes.c_uint NumberRepeats) - addfunc(lib, "SetChargeShifting", restype = ctypes.c_uint, - argtypes = [ctypes.c_uint, ctypes.c_uint], - argnames = ["NumberRows", "NumberRepeats"] ) - # ctypes.c_uint SetComplexImage(ctypes.c_int numAreas, ctypes.POINTER(ctypes.c_int) areas) - addfunc(lib, "SetComplexImage", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["numAreas", "areas"] ) - # ctypes.c_uint SetCoolerMode(ctypes.c_int mode) - addfunc(lib, "SetCoolerMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetCountConvertMode(ctypes.c_int Mode) - addfunc(lib, "SetCountConvertMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["Mode"] ) - # ctypes.c_uint SetCountConvertWavelength(ctypes.c_float wavelength) - addfunc(lib, "SetCountConvertWavelength", restype = ctypes.c_uint, - argtypes = [ctypes.c_float], - argnames = ["wavelength"] ) - # ctypes.c_uint SetCropMode(ctypes.c_int active, ctypes.c_int cropHeight, ctypes.c_int reserved) - addfunc(lib, "SetCropMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["active", "cropHeight", "reserved"] ) - # ctypes.c_uint SetCurrentCamera(ctypes.c_long cameraHandle) - addfunc(lib, "SetCurrentCamera", restype = ctypes.c_uint, - argtypes = [ctypes.c_long], - argnames = ["cameraHandle"] ) - # ctypes.c_uint SetCustomTrackHBin(ctypes.c_int bin) - addfunc(lib, "SetCustomTrackHBin", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["bin"] ) - # ctypes.c_uint SetDataType(ctypes.c_int typ) - addfunc(lib, "SetDataType", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["typ"] ) - # ctypes.c_uint SetDACOutput(ctypes.c_int iOption, ctypes.c_int iResolution, ctypes.c_int iValue) - addfunc(lib, "SetDACOutput", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["iOption", "iResolution", "iValue"] ) - # ctypes.c_uint SetDACOutputScale(ctypes.c_int iScale) - addfunc(lib, "SetDACOutputScale", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["iScale"] ) - # ctypes.c_uint SetDDGAddress(BYTE t0, BYTE t1, BYTE t2, BYTE t3, BYTE address) - addfunc(lib, "SetDDGAddress", restype = ctypes.c_uint, - argtypes = [BYTE, BYTE, BYTE, BYTE, BYTE], - argnames = ["t0", "t1", "t2", "t3", "address"] ) - # ctypes.c_uint SetDDGExternalOutputEnabled(ctypes.c_ulong uiIndex, ctypes.c_ulong uiEnabled) - addfunc(lib, "SetDDGExternalOutputEnabled", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong, ctypes.c_ulong], - argnames = ["uiIndex", "uiEnabled"] ) - # ctypes.c_uint SetDDGExternalOutputPolarity(ctypes.c_ulong uiIndex, ctypes.c_ulong uiPolarity) - addfunc(lib, "SetDDGExternalOutputPolarity", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong, ctypes.c_ulong], - argnames = ["uiIndex", "uiPolarity"] ) - # ctypes.c_uint SetDDGExternalOutputStepEnabled(ctypes.c_ulong uiIndex, ctypes.c_ulong uiEnabled) - addfunc(lib, "SetDDGExternalOutputStepEnabled", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong, ctypes.c_ulong], - argnames = ["uiIndex", "uiEnabled"] ) - # ctypes.c_uint SetDDGExternalOutputTime(ctypes.c_ulong uiIndex, ctypes.c_ulonglong uiDelay, ctypes.c_ulonglong uiWidth) - addfunc(lib, "SetDDGExternalOutputTime", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong, ctypes.c_ulonglong, ctypes.c_ulonglong], - argnames = ["uiIndex", "uiDelay", "uiWidth"] ) - # ctypes.c_uint SetDDGGain(ctypes.c_int gain) - addfunc(lib, "SetDDGGain", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["gain"] ) - # ctypes.c_uint SetDDGGateStep(ctypes.c_double step_Renamed) - addfunc(lib, "SetDDGGateStep", restype = ctypes.c_uint, - argtypes = [ctypes.c_double], - argnames = ["step_Renamed"] ) - # ctypes.c_uint SetDDGGateTime(ctypes.c_ulonglong uiDelay, ctypes.c_ulonglong uiWidth) - addfunc(lib, "SetDDGGateTime", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulonglong, ctypes.c_ulonglong], - argnames = ["uiDelay", "uiWidth"] ) - # ctypes.c_uint SetDDGInsertionDelay(ctypes.c_int state) - addfunc(lib, "SetDDGInsertionDelay", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["state"] ) - # ctypes.c_uint SetDDGIntelligate(ctypes.c_int state) - addfunc(lib, "SetDDGIntelligate", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["state"] ) - # ctypes.c_uint SetDDGIOC(ctypes.c_int state) - addfunc(lib, "SetDDGIOC", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["state"] ) - # ctypes.c_uint SetDDGIOCFrequency(ctypes.c_double frequency) - addfunc(lib, "SetDDGIOCFrequency", restype = ctypes.c_uint, - argtypes = [ctypes.c_double], - argnames = ["frequency"] ) - # ctypes.c_uint SetDDGIOCNumber(ctypes.c_ulong numberPulses) - addfunc(lib, "SetDDGIOCNumber", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong], - argnames = ["numberPulses"] ) - # ctypes.c_uint SetDDGIOCPeriod(ctypes.c_ulonglong period) - addfunc(lib, "SetDDGIOCPeriod", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulonglong], - argnames = ["period"] ) - # ctypes.c_uint SetDDGIOCTrigger(ctypes.c_ulong trigger) - addfunc(lib, "SetDDGIOCTrigger", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong], - argnames = ["trigger"] ) - # ctypes.c_uint SetDDGOpticalWidthEnabled(ctypes.c_ulong uiEnabled) - addfunc(lib, "SetDDGOpticalWidthEnabled", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong], - argnames = ["uiEnabled"] ) - # ctypes.c_uint SetDDGLiteGlobalControlByte(ctypes.c_ubyte control) - addfunc(lib, "SetDDGLiteGlobalControlByte", restype = ctypes.c_uint, - argtypes = [ctypes.c_ubyte], - argnames = ["control"] ) - # ctypes.c_uint SetDDGLiteControlByte(ctypes.c_int channel, ctypes.c_ubyte control) - addfunc(lib, "SetDDGLiteControlByte", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_ubyte], - argnames = ["channel", "control"] ) - # ctypes.c_uint SetDDGLiteInitialDelay(ctypes.c_int channel, ctypes.c_float fDelay) - addfunc(lib, "SetDDGLiteInitialDelay", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_float], - argnames = ["channel", "fDelay"] ) - # ctypes.c_uint SetDDGLitePulseWidth(ctypes.c_int channel, ctypes.c_float fWidth) - addfunc(lib, "SetDDGLitePulseWidth", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_float], - argnames = ["channel", "fWidth"] ) - # ctypes.c_uint SetDDGLiteInterPulseDelay(ctypes.c_int channel, ctypes.c_float fDelay) - addfunc(lib, "SetDDGLiteInterPulseDelay", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_float], - argnames = ["channel", "fDelay"] ) - # ctypes.c_uint SetDDGLitePulsesPerExposure(ctypes.c_int channel, ctypes.c_ulong ui32Pulses) - addfunc(lib, "SetDDGLitePulsesPerExposure", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_ulong], - argnames = ["channel", "ui32Pulses"] ) - # ctypes.c_uint SetDDGStepCoefficients(ctypes.c_ulong mode, ctypes.c_double p1, ctypes.c_double p2) - addfunc(lib, "SetDDGStepCoefficients", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong, ctypes.c_double, ctypes.c_double], - argnames = ["mode", "p1", "p2"] ) - # ctypes.c_uint SetDDGWidthStepCoefficients(ctypes.c_ulong mode, ctypes.c_double p1, ctypes.c_double p2) - addfunc(lib, "SetDDGWidthStepCoefficients", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong, ctypes.c_double, ctypes.c_double], - argnames = ["mode", "p1", "p2"] ) - # ctypes.c_uint SetDDGStepMode(ctypes.c_ulong mode) - addfunc(lib, "SetDDGStepMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong], - argnames = ["mode"] ) - # ctypes.c_uint SetDDGWidthStepMode(ctypes.c_ulong mode) - addfunc(lib, "SetDDGWidthStepMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong], - argnames = ["mode"] ) - # ctypes.c_uint SetDDGTimes(ctypes.c_double t0, ctypes.c_double t1, ctypes.c_double t2) - addfunc(lib, "SetDDGTimes", restype = ctypes.c_uint, - argtypes = [ctypes.c_double, ctypes.c_double, ctypes.c_double], - argnames = ["t0", "t1", "t2"] ) - # ctypes.c_uint SetDDGTriggerMode(ctypes.c_int mode) - addfunc(lib, "SetDDGTriggerMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetDDGVariableGateStep(ctypes.c_int mode, ctypes.c_double p1, ctypes.c_double p2) - addfunc(lib, "SetDDGVariableGateStep", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_double, ctypes.c_double], - argnames = ["mode", "p1", "p2"] ) - # ctypes.c_uint SetDelayGenerator(ctypes.c_int board, ctypes.c_short address, ctypes.c_int typ) - addfunc(lib, "SetDelayGenerator", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_short, ctypes.c_int], - argnames = ["board", "address", "typ"] ) - # ctypes.c_uint SetDMAParameters(ctypes.c_int MaxImagesPerDMA, ctypes.c_float SecondsPerDMA) - addfunc(lib, "SetDMAParameters", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_float], - argnames = ["MaxImagesPerDMA", "SecondsPerDMA"] ) - # ctypes.c_uint SetDriverEvent(HANDLE driverEvent) - addfunc(lib, "SetDriverEvent", restype = ctypes.c_uint, - argtypes = [HANDLE], - argnames = ["driverEvent"] ) - # ctypes.c_uint SetESDEvent(HANDLE esdEvent) - addfunc(lib, "SetESDEvent", restype = ctypes.c_uint, - argtypes = [HANDLE], - argnames = ["esdEvent"] ) - # ctypes.c_uint SetEMAdvanced(ctypes.c_int state) - addfunc(lib, "SetEMAdvanced", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["state"] ) - # ctypes.c_uint SetEMCCDGain(ctypes.c_int gain) - addfunc(lib, "SetEMCCDGain", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["gain"] ) - # ctypes.c_uint SetEMClockCompensation(ctypes.c_int EMClockCompensationFlag) - addfunc(lib, "SetEMClockCompensation", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["EMClockCompensationFlag"] ) - # ctypes.c_uint SetEMGainMode(ctypes.c_int mode) - addfunc(lib, "SetEMGainMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetExposureTime(ctypes.c_float time) - addfunc(lib, "SetExposureTime", restype = ctypes.c_uint, - argtypes = [ctypes.c_float], - argnames = ["time"] ) - # ctypes.c_uint SetExternalTriggerTermination(ctypes.c_ulong uiTermination) - addfunc(lib, "SetExternalTriggerTermination", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong], - argnames = ["uiTermination"] ) - # ctypes.c_uint SetFanMode(ctypes.c_int mode) - addfunc(lib, "SetFanMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetFastExtTrigger(ctypes.c_int mode) - addfunc(lib, "SetFastExtTrigger", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetFastKinetics(ctypes.c_int exposedRows, ctypes.c_int seriesLength, ctypes.c_float time, ctypes.c_int mode, ctypes.c_int hbin, ctypes.c_int vbin) - addfunc(lib, "SetFastKinetics", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_float, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["exposedRows", "seriesLength", "time", "mode", "hbin", "vbin"] ) - # ctypes.c_uint SetFastKineticsEx(ctypes.c_int exposedRows, ctypes.c_int seriesLength, ctypes.c_float time, ctypes.c_int mode, ctypes.c_int hbin, ctypes.c_int vbin, ctypes.c_int offset) - addfunc(lib, "SetFastKineticsEx", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_float, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["exposedRows", "seriesLength", "time", "mode", "hbin", "vbin", "offset"] ) - # ctypes.c_uint SetFastKineticsStorageMode(ctypes.c_int mode) - addfunc(lib, "SetFastKineticsStorageMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetFastKineticsTimeScanMode(ctypes.c_int rows, ctypes.c_int tracks, ctypes.c_int mode) - addfunc(lib, "SetFastKineticsTimeScanMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["rows", "tracks", "mode"] ) - # ctypes.c_uint SetFilterMode(ctypes.c_int mode) - addfunc(lib, "SetFilterMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetFilterParameters(ctypes.c_int width, ctypes.c_float sensitivity, ctypes.c_int range, ctypes.c_float accept, ctypes.c_int smooth, ctypes.c_int noise) - addfunc(lib, "SetFilterParameters", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_float, ctypes.c_int, ctypes.c_float, ctypes.c_int, ctypes.c_int], - argnames = ["width", "sensitivity", "range", "accept", "smooth", "noise"] ) - # ctypes.c_uint SetFKVShiftSpeed(ctypes.c_int index) - addfunc(lib, "SetFKVShiftSpeed", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["index"] ) - # ctypes.c_uint SetFPDP(ctypes.c_int state) - addfunc(lib, "SetFPDP", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["state"] ) - # ctypes.c_uint SetFrameTransferMode(ctypes.c_int mode) - addfunc(lib, "SetFrameTransferMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetFrontEndEvent(HANDLE driverEvent) - addfunc(lib, "SetFrontEndEvent", restype = ctypes.c_uint, - argtypes = [HANDLE], - argnames = ["driverEvent"] ) - # ctypes.c_uint SetFullImage(ctypes.c_int hbin, ctypes.c_int vbin) - addfunc(lib, "SetFullImage", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["hbin", "vbin"] ) - # ctypes.c_uint SetFVBHBin(ctypes.c_int bin) - addfunc(lib, "SetFVBHBin", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["bin"] ) - # ctypes.c_uint SetGain(ctypes.c_int gain) - addfunc(lib, "SetGain", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["gain"] ) - # ctypes.c_uint SetGate(ctypes.c_float delay, ctypes.c_float width, ctypes.c_float stepRenamed) - addfunc(lib, "SetGate", restype = ctypes.c_uint, - argtypes = [ctypes.c_float, ctypes.c_float, ctypes.c_float], - argnames = ["delay", "width", "stepRenamed"] ) - # ctypes.c_uint SetGateMode(ctypes.c_int gatemode) - addfunc(lib, "SetGateMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["gatemode"] ) - # ctypes.c_uint SetHighCapacity(ctypes.c_int state) - addfunc(lib, "SetHighCapacity", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["state"] ) - # ctypes.c_uint SetHorizontalSpeed(ctypes.c_int index) - addfunc(lib, "SetHorizontalSpeed", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["index"] ) - # ctypes.c_uint SetHSSpeed(ctypes.c_int typ, ctypes.c_int index) - addfunc(lib, "SetHSSpeed", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["typ", "index"] ) - # ctypes.c_uint SetImage(ctypes.c_int hbin, ctypes.c_int vbin, ctypes.c_int hstart, ctypes.c_int hend, ctypes.c_int vstart, ctypes.c_int vend) - addfunc(lib, "SetImage", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["hbin", "vbin", "hstart", "hend", "vstart", "vend"] ) - # ctypes.c_uint SetImageFlip(ctypes.c_int iHFlip, ctypes.c_int iVFlip) - addfunc(lib, "SetImageFlip", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["iHFlip", "iVFlip"] ) - # ctypes.c_uint SetImageRotate(ctypes.c_int iRotate) - addfunc(lib, "SetImageRotate", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["iRotate"] ) - # ctypes.c_uint SetIsolatedCropMode(ctypes.c_int active, ctypes.c_int cropheight, ctypes.c_int cropwidth, ctypes.c_int vbin, ctypes.c_int hbin) - addfunc(lib, "SetIsolatedCropMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["active", "cropheight", "cropwidth", "vbin", "hbin"] ) - # ctypes.c_uint SetIsolatedCropModeEx(ctypes.c_int active, ctypes.c_int cropheight, ctypes.c_int cropwidth, ctypes.c_int vbin, ctypes.c_int hbin, ctypes.c_int cropleft, ctypes.c_int cropbottom) - addfunc(lib, "SetIsolatedCropModeEx", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["active", "cropheight", "cropwidth", "vbin", "hbin", "cropleft", "cropbottom"] ) - # ctypes.c_uint SetIsolatedCropModeType(ctypes.c_int type) - addfunc(lib, "SetIsolatedCropModeType", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["type"] ) - # ctypes.c_uint SetKineticCycleTime(ctypes.c_float time) - addfunc(lib, "SetKineticCycleTime", restype = ctypes.c_uint, - argtypes = [ctypes.c_float], - argnames = ["time"] ) - # ctypes.c_uint SetMCPGain(ctypes.c_int gain) - addfunc(lib, "SetMCPGain", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["gain"] ) - # ctypes.c_uint SetMCPGating(ctypes.c_int gating) - addfunc(lib, "SetMCPGating", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["gating"] ) - # ctypes.c_uint SetMessageWindow(HWND wnd) - addfunc(lib, "SetMessageWindow", restype = ctypes.c_uint, - argtypes = [HWND], - argnames = ["wnd"] ) - # ctypes.c_uint SetMetaData(ctypes.c_int state) - addfunc(lib, "SetMetaData", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["state"] ) - # ctypes.c_uint SetMultiTrack(ctypes.c_int number, ctypes.c_int height, ctypes.c_int offset, ctypes.POINTER(ctypes.c_int) bottom, ctypes.POINTER(ctypes.c_int) gap) - addfunc(lib, "SetMultiTrack", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)], - argnames = ["number", "height", "offset", "bottom", "gap"] ) - # ctypes.c_uint SetMultiTrackHBin(ctypes.c_int bin) - addfunc(lib, "SetMultiTrackHBin", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["bin"] ) - # ctypes.c_uint SetMultiTrackHRange(ctypes.c_int iStart, ctypes.c_int iEnd) - addfunc(lib, "SetMultiTrackHRange", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["iStart", "iEnd"] ) - # ctypes.c_uint SetMultiTrackScan(ctypes.c_int trackHeight, ctypes.c_int numberTracks, ctypes.c_int iSIHStart, ctypes.c_int iSIHEnd, ctypes.c_int trackHBinning, ctypes.c_int trackVBinning, ctypes.c_int trackGap, ctypes.c_int trackOffset, ctypes.c_int trackSkip, ctypes.c_int numberSubFrames) - addfunc(lib, "SetMultiTrackScan", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["trackHeight", "numberTracks", "iSIHStart", "iSIHEnd", "trackHBinning", "trackVBinning", "trackGap", "trackOffset", "trackSkip", "numberSubFrames"] ) - # ctypes.c_uint SetNextAddress(ctypes.POINTER(ctypes.c_long) data, ctypes.c_long lowAdd, ctypes.c_long highAdd, ctypes.c_long length, ctypes.c_long physical) - addfunc(lib, "SetNextAddress", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.c_long, ctypes.c_long, ctypes.c_long, ctypes.c_long], - argnames = ["data", "lowAdd", "highAdd", "length", "physical"] ) - # ctypes.c_uint SetNextAddress16(ctypes.POINTER(ctypes.c_long) data, ctypes.c_long lowAdd, ctypes.c_long highAdd, ctypes.c_long length, ctypes.c_long physical) - addfunc(lib, "SetNextAddress16", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.c_long, ctypes.c_long, ctypes.c_long, ctypes.c_long], - argnames = ["data", "lowAdd", "highAdd", "length", "physical"] ) - # ctypes.c_uint SetNumberAccumulations(ctypes.c_int number) - addfunc(lib, "SetNumberAccumulations", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["number"] ) - # ctypes.c_uint SetNumberKinetics(ctypes.c_int number) - addfunc(lib, "SetNumberKinetics", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["number"] ) - # ctypes.c_uint SetNumberPrescans(ctypes.c_int iNumber) - addfunc(lib, "SetNumberPrescans", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["iNumber"] ) - # ctypes.c_uint SetOutputAmplifier(ctypes.c_int typ) - addfunc(lib, "SetOutputAmplifier", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["typ"] ) - # ctypes.c_uint SetOverlapMode(ctypes.c_int mode) - addfunc(lib, "SetOverlapMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetOverTempEvent(HANDLE tempEvent) - addfunc(lib, "SetOverTempEvent", restype = ctypes.c_uint, - argtypes = [HANDLE], - argnames = ["tempEvent"] ) - # ctypes.c_uint SetPCIMode(ctypes.c_int mode, ctypes.c_int value) - addfunc(lib, "SetPCIMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["mode", "value"] ) - # ctypes.c_uint SetPhotonCounting(ctypes.c_int state) - addfunc(lib, "SetPhotonCounting", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["state"] ) - # ctypes.c_uint SetPhotonCountingThreshold(ctypes.c_long min, ctypes.c_long max) - addfunc(lib, "SetPhotonCountingThreshold", restype = ctypes.c_uint, - argtypes = [ctypes.c_long, ctypes.c_long], - argnames = ["min", "max"] ) - # ctypes.c_uint SetPhosphorEvent(HANDLE driverEvent) - addfunc(lib, "SetPhosphorEvent", restype = ctypes.c_uint, - argtypes = [HANDLE], - argnames = ["driverEvent"] ) - # ctypes.c_uint SetPhotonCountingDivisions(ctypes.c_ulong noOfDivisions, ctypes.POINTER(ctypes.c_long) divisions) - addfunc(lib, "SetPhotonCountingDivisions", restype = ctypes.c_uint, - argtypes = [ctypes.c_ulong, ctypes.POINTER(ctypes.c_long)], - argnames = ["noOfDivisions", "divisions"] ) - # ctypes.c_uint SetPixelMode(ctypes.c_int bitdepth, ctypes.c_int colormode) - addfunc(lib, "SetPixelMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["bitdepth", "colormode"] ) - # ctypes.c_uint SetPreAmpGain(ctypes.c_int index) - addfunc(lib, "SetPreAmpGain", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["index"] ) - # ctypes.c_uint SetDualExposureTimes(ctypes.c_float expTime1, ctypes.c_float expTime2) - addfunc(lib, "SetDualExposureTimes", restype = ctypes.c_uint, - argtypes = [ctypes.c_float, ctypes.c_float], - argnames = ["expTime1", "expTime2"] ) - # ctypes.c_uint SetDualExposureMode(ctypes.c_int mode) - addfunc(lib, "SetDualExposureMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetRandomTracks(ctypes.c_int numTracks, ctypes.POINTER(ctypes.c_int) areas) - addfunc(lib, "SetRandomTracks", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)], - argnames = ["numTracks", "areas"] ) - # ctypes.c_uint SetReadMode(ctypes.c_int mode) - addfunc(lib, "SetReadMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetReadoutRegisterPacking(ctypes.c_uint mode) - addfunc(lib, "SetReadoutRegisterPacking", restype = ctypes.c_uint, - argtypes = [ctypes.c_uint], - argnames = ["mode"] ) - # ctypes.c_uint SetRegisterDump(ctypes.c_int mode) - addfunc(lib, "SetRegisterDump", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetRingExposureTimes(ctypes.c_int numTimes, ctypes.POINTER(ctypes.c_float) times) - addfunc(lib, "SetRingExposureTimes", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_float)], - argnames = ["numTimes", "times"] ) - # ctypes.c_uint SetSaturationEvent(HANDLE saturationEvent) - addfunc(lib, "SetSaturationEvent", restype = ctypes.c_uint, - argtypes = [HANDLE], - argnames = ["saturationEvent"] ) - # ctypes.c_uint SetShutter(ctypes.c_int typ, ctypes.c_int mode, ctypes.c_int closingtime, ctypes.c_int openingtime) - addfunc(lib, "SetShutter", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["typ", "mode", "closingtime", "openingtime"] ) - # ctypes.c_uint SetShutterEx(ctypes.c_int typ, ctypes.c_int mode, ctypes.c_int closingtime, ctypes.c_int openingtime, ctypes.c_int extmode) - addfunc(lib, "SetShutterEx", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["typ", "mode", "closingtime", "openingtime", "extmode"] ) - # ctypes.c_uint SetShutters(ctypes.c_int typ, ctypes.c_int mode, ctypes.c_int closingtime, ctypes.c_int openingtime, ctypes.c_int exttype, ctypes.c_int extmode, ctypes.c_int dummy1, ctypes.c_int dummy2) - addfunc(lib, "SetShutters", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["typ", "mode", "closingtime", "openingtime", "exttype", "extmode", "dummy1", "dummy2"] ) - # ctypes.c_uint SetSifComment(ctypes.c_char_p comment) - addfunc(lib, "SetSifComment", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p], - argnames = ["comment"] ) - # ctypes.c_uint SetSingleTrack(ctypes.c_int centre, ctypes.c_int height) - addfunc(lib, "SetSingleTrack", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["centre", "height"] ) - # ctypes.c_uint SetSingleTrackHBin(ctypes.c_int bin) - addfunc(lib, "SetSingleTrackHBin", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["bin"] ) - # ctypes.c_uint SetSpool(ctypes.c_int active, ctypes.c_int method, ctypes.c_char_p path, ctypes.c_int framebuffersize) - addfunc(lib, "SetSpool", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_char_p, ctypes.c_int], - argnames = ["active", "method", "path", "framebuffersize"] ) - # ctypes.c_uint SetSpoolThreadCount(ctypes.c_int count) - addfunc(lib, "SetSpoolThreadCount", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["count"] ) - # ctypes.c_uint SetStorageMode(ctypes.c_long mode) - addfunc(lib, "SetStorageMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_long], - argnames = ["mode"] ) - # ctypes.c_uint SetTECEvent(HANDLE driverEvent) - addfunc(lib, "SetTECEvent", restype = ctypes.c_uint, - argtypes = [HANDLE], - argnames = ["driverEvent"] ) - # ctypes.c_uint SetTemperature(ctypes.c_int temperature) - addfunc(lib, "SetTemperature", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["temperature"] ) - # ctypes.c_uint SetTemperatureEvent(HANDLE temperatureEvent) - addfunc(lib, "SetTemperatureEvent", restype = ctypes.c_uint, - argtypes = [HANDLE], - argnames = ["temperatureEvent"] ) - # ctypes.c_uint SetTriggerMode(ctypes.c_int mode) - addfunc(lib, "SetTriggerMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint SetTriggerInvert(ctypes.c_int mode) - addfunc(lib, "SetTriggerInvert", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint GetTriggerLevelRange(ctypes.POINTER(ctypes.c_float) minimum, ctypes.POINTER(ctypes.c_float) maximum) - addfunc(lib, "GetTriggerLevelRange", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)], - argnames = ["minimum", "maximum"] ) - # ctypes.c_uint SetTriggerLevel(ctypes.c_float f_level) - addfunc(lib, "SetTriggerLevel", restype = ctypes.c_uint, - argtypes = [ctypes.c_float], - argnames = ["f_level"] ) - # ctypes.c_uint SetIODirection(ctypes.c_int index, ctypes.c_int iDirection) - addfunc(lib, "SetIODirection", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["index", "iDirection"] ) - # ctypes.c_uint SetIOLevel(ctypes.c_int index, ctypes.c_int iLevel) - addfunc(lib, "SetIOLevel", restype = ctypes.c_uint, - argtypes = [ctypes.c_int, ctypes.c_int], - argnames = ["index", "iLevel"] ) - # ctypes.c_uint SetUserEvent(HANDLE userEvent) - addfunc(lib, "SetUserEvent", restype = ctypes.c_uint, - argtypes = [HANDLE], - argnames = ["userEvent"] ) - # ctypes.c_uint SetUSGenomics(ctypes.c_long width, ctypes.c_long height) - addfunc(lib, "SetUSGenomics", restype = ctypes.c_uint, - argtypes = [ctypes.c_long, ctypes.c_long], - argnames = ["width", "height"] ) - # ctypes.c_uint SetVerticalRowBuffer(ctypes.c_int rows) - addfunc(lib, "SetVerticalRowBuffer", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["rows"] ) - # ctypes.c_uint SetVerticalSpeed(ctypes.c_int index) - addfunc(lib, "SetVerticalSpeed", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["index"] ) - # ctypes.c_uint SetVirtualChip(ctypes.c_int state) - addfunc(lib, "SetVirtualChip", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["state"] ) - # ctypes.c_uint SetVSAmplitude(ctypes.c_int index) - addfunc(lib, "SetVSAmplitude", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["index"] ) - # ctypes.c_uint SetVSSpeed(ctypes.c_int index) - addfunc(lib, "SetVSSpeed", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["index"] ) - # ctypes.c_uint ShutDown() - addfunc(lib, "ShutDown", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint StartAcquisition() - addfunc(lib, "StartAcquisition", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint UnMapPhysicalAddress() - addfunc(lib, "UnMapPhysicalAddress", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint UpdateDDGTimings() - addfunc(lib, "UpdateDDGTimings", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint WaitForAcquisition() - addfunc(lib, "WaitForAcquisition", restype = ctypes.c_uint, - argtypes = [], - argnames = [] ) - # ctypes.c_uint WaitForAcquisitionByHandle(ctypes.c_long cameraHandle) - addfunc(lib, "WaitForAcquisitionByHandle", restype = ctypes.c_uint, - argtypes = [ctypes.c_long], - argnames = ["cameraHandle"] ) - # ctypes.c_uint WaitForAcquisitionByHandleTimeOut(ctypes.c_long cameraHandle, ctypes.c_int iTimeOutMs) - addfunc(lib, "WaitForAcquisitionByHandleTimeOut", restype = ctypes.c_uint, - argtypes = [ctypes.c_long, ctypes.c_int], - argnames = ["cameraHandle", "iTimeOutMs"] ) - # ctypes.c_uint WaitForAcquisitionTimeOut(ctypes.c_int iTimeOutMs) - addfunc(lib, "WaitForAcquisitionTimeOut", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["iTimeOutMs"] ) - # ctypes.c_uint WhiteBalance(ctypes.POINTER(WORD) wRed, ctypes.POINTER(WORD) wGreen, ctypes.POINTER(WORD) wBlue, ctypes.POINTER(ctypes.c_float) fRelR, ctypes.POINTER(ctypes.c_float) fRelB, ctypes.POINTER(WhiteBalanceInfo) info) - addfunc(lib, "WhiteBalance", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(WORD), ctypes.POINTER(WORD), ctypes.POINTER(WORD), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(WhiteBalanceInfo)], - argnames = ["wRed", "wGreen", "wBlue", "fRelR", "fRelB", "info"] ) - # ctypes.c_uint OA_Initialize(ctypes.c_char_p pcFilename, ctypes.c_uint uiFileNameLen) - addfunc(lib, "OA_Initialize", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_uint], - argnames = ["pcFilename", "uiFileNameLen"] ) - # ctypes.c_uint OA_IsPreSetModeAvailable(ctypes.c_char_p pcModeName) - addfunc(lib, "OA_IsPreSetModeAvailable", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p], - argnames = ["pcModeName"] ) - # ctypes.c_uint OA_EnableMode(ctypes.c_char_p pcModeName) - addfunc(lib, "OA_EnableMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p], - argnames = ["pcModeName"] ) - # ctypes.c_uint OA_GetModeAcqParams(ctypes.c_char_p pcModeName, ctypes.c_char_p pcListOfParams) - addfunc(lib, "OA_GetModeAcqParams", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_char_p], - argnames = ["pcModeName", "pcListOfParams"] ) - # ctypes.c_uint OA_GetUserModeNames(ctypes.c_char_p pcListOfModes) - addfunc(lib, "OA_GetUserModeNames", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p], - argnames = ["pcListOfModes"] ) - # ctypes.c_uint OA_GetPreSetModeNames(ctypes.c_char_p pcListOfModes) - addfunc(lib, "OA_GetPreSetModeNames", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p], - argnames = ["pcListOfModes"] ) - # ctypes.c_uint OA_GetNumberOfUserModes(ctypes.POINTER(ctypes.c_uint) puiNumberOfModes) - addfunc(lib, "OA_GetNumberOfUserModes", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_uint)], - argnames = ["puiNumberOfModes"] ) - # ctypes.c_uint OA_GetNumberOfPreSetModes(ctypes.POINTER(ctypes.c_uint) puiNumberOfModes) - addfunc(lib, "OA_GetNumberOfPreSetModes", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_uint)], - argnames = ["puiNumberOfModes"] ) - # ctypes.c_uint OA_GetNumberOfAcqParams(ctypes.c_char_p pcModeName, ctypes.POINTER(ctypes.c_uint) puiNumberOfParams) - addfunc(lib, "OA_GetNumberOfAcqParams", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.POINTER(ctypes.c_uint)], - argnames = ["pcModeName", "puiNumberOfParams"] ) - # ctypes.c_uint OA_AddMode(ctypes.c_char_p pcModeName, ctypes.c_uint uiModeNameLen, ctypes.c_char_p pcModeDescription, ctypes.c_uint uiModeDescriptionLen) - addfunc(lib, "OA_AddMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_uint, ctypes.c_char_p, ctypes.c_uint], - argnames = ["pcModeName", "uiModeNameLen", "pcModeDescription", "uiModeDescriptionLen"] ) - # ctypes.c_uint OA_WriteToFile(ctypes.c_char_p pcFileName, ctypes.c_uint uiFileNameLen) - addfunc(lib, "OA_WriteToFile", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_uint], - argnames = ["pcFileName", "uiFileNameLen"] ) - # ctypes.c_uint OA_DeleteMode(ctypes.c_char_p pcModeName, ctypes.c_uint uiModeNameLen) - addfunc(lib, "OA_DeleteMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_uint], - argnames = ["pcModeName", "uiModeNameLen"] ) - # ctypes.c_uint OA_SetInt(ctypes.c_char_p pcModeName, ctypes.c_char_p pcModeParam, ctypes.c_int iIntValue) - addfunc(lib, "OA_SetInt", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int], - argnames = ["pcModeName", "pcModeParam", "iIntValue"] ) - # ctypes.c_uint OA_SetFloat(ctypes.c_char_p pcModeName, ctypes.c_char_p pcModeParam, ctypes.c_float fFloatValue) - addfunc(lib, "OA_SetFloat", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_float], - argnames = ["pcModeName", "pcModeParam", "fFloatValue"] ) - # ctypes.c_uint OA_SetString(ctypes.c_char_p pcModeName, ctypes.c_char_p pcModeParam, ctypes.c_char_p pcStringValue, ctypes.c_uint uiStringLen) - addfunc(lib, "OA_SetString", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_uint], - argnames = ["pcModeName", "pcModeParam", "pcStringValue", "uiStringLen"] ) - # ctypes.c_uint OA_GetInt(ctypes.c_char_p pcModeName, ctypes.c_char_p pcModeParam, ctypes.POINTER(ctypes.c_int) iIntValue) - addfunc(lib, "OA_GetInt", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_int)], - argnames = ["pcModeName", "pcModeParam", "iIntValue"] ) - # ctypes.c_uint OA_GetFloat(ctypes.c_char_p pcModeName, ctypes.c_char_p pcModeParam, ctypes.POINTER(ctypes.c_float) fFloatValue) - addfunc(lib, "OA_GetFloat", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_float)], - argnames = ["pcModeName", "pcModeParam", "fFloatValue"] ) - # ctypes.c_uint OA_GetString(ctypes.c_char_p pcModeName, ctypes.c_char_p pcModeParam, ctypes.c_char_p pcStringValue, ctypes.c_uint uiStringLen) - addfunc(lib, "OA_GetString", restype = ctypes.c_uint, - argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_uint], - argnames = ["pcModeName", "pcModeParam", "pcStringValue", "uiStringLen"] ) - # ctypes.c_uint Filter_SetMode(ctypes.c_uint mode) - addfunc(lib, "Filter_SetMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_uint], - argnames = ["mode"] ) - # ctypes.c_uint Filter_GetMode(ctypes.POINTER(ctypes.c_uint) mode) - addfunc(lib, "Filter_GetMode", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_uint)], - argnames = ["mode"] ) - # ctypes.c_uint Filter_SetThreshold(ctypes.c_float threshold) - addfunc(lib, "Filter_SetThreshold", restype = ctypes.c_uint, - argtypes = [ctypes.c_float], - argnames = ["threshold"] ) - # ctypes.c_uint Filter_GetThreshold(ctypes.POINTER(ctypes.c_float) threshold) - addfunc(lib, "Filter_GetThreshold", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_float)], - argnames = ["threshold"] ) - # ctypes.c_uint Filter_SetDataAveragingMode(ctypes.c_int mode) - addfunc(lib, "Filter_SetDataAveragingMode", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["mode"] ) - # ctypes.c_uint Filter_GetDataAveragingMode(ctypes.POINTER(ctypes.c_int) mode) - addfunc(lib, "Filter_GetDataAveragingMode", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["mode"] ) - # ctypes.c_uint Filter_SetAveragingFrameCount(ctypes.c_int frames) - addfunc(lib, "Filter_SetAveragingFrameCount", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["frames"] ) - # ctypes.c_uint Filter_GetAveragingFrameCount(ctypes.POINTER(ctypes.c_int) frames) - addfunc(lib, "Filter_GetAveragingFrameCount", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["frames"] ) - # ctypes.c_uint Filter_SetAveragingFactor(ctypes.c_int averagingFactor) - addfunc(lib, "Filter_SetAveragingFactor", restype = ctypes.c_uint, - argtypes = [ctypes.c_int], - argnames = ["averagingFactor"] ) - # ctypes.c_uint Filter_GetAveragingFactor(ctypes.POINTER(ctypes.c_int) averagingFactor) - addfunc(lib, "Filter_GetAveragingFactor", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_int)], - argnames = ["averagingFactor"] ) - # ctypes.c_uint PostProcessNoiseFilter(ctypes.POINTER(ctypes.c_long) pInputImage, ctypes.POINTER(ctypes.c_long) pOutputImage, ctypes.c_int iOutputBufferSize, ctypes.c_int iBaseline, ctypes.c_int iMode, ctypes.c_float fThreshold, ctypes.c_int iHeight, ctypes.c_int iWidth) - addfunc(lib, "PostProcessNoiseFilter", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.POINTER(ctypes.c_long), ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_float, ctypes.c_int, ctypes.c_int], - argnames = ["pInputImage", "pOutputImage", "iOutputBufferSize", "iBaseline", "iMode", "fThreshold", "iHeight", "iWidth"] ) - # ctypes.c_uint PostProcessCountConvert(ctypes.POINTER(ctypes.c_long) pInputImage, ctypes.POINTER(ctypes.c_long) pOutputImage, ctypes.c_int iOutputBufferSize, ctypes.c_int iNumImages, ctypes.c_int iBaseline, ctypes.c_int iMode, ctypes.c_int iEmGain, ctypes.c_float fQE, ctypes.c_float fSensitivity, ctypes.c_int iHeight, ctypes.c_int iWidth) - addfunc(lib, "PostProcessCountConvert", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.POINTER(ctypes.c_long), ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_float, ctypes.c_float, ctypes.c_int, ctypes.c_int], - argnames = ["pInputImage", "pOutputImage", "iOutputBufferSize", "iNumImages", "iBaseline", "iMode", "iEmGain", "fQE", "fSensitivity", "iHeight", "iWidth"] ) - # ctypes.c_uint PostProcessPhotonCounting(ctypes.POINTER(ctypes.c_long) pInputImage, ctypes.POINTER(ctypes.c_long) pOutputImage, ctypes.c_int iOutputBufferSize, ctypes.c_int iNumImages, ctypes.c_int iNumframes, ctypes.c_int iNumberOfThresholds, ctypes.POINTER(ctypes.c_float) pfThreshold, ctypes.c_int iHeight, ctypes.c_int iWidth) - addfunc(lib, "PostProcessPhotonCounting", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.POINTER(ctypes.c_long), ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float), ctypes.c_int, ctypes.c_int], - argnames = ["pInputImage", "pOutputImage", "iOutputBufferSize", "iNumImages", "iNumframes", "iNumberOfThresholds", "pfThreshold", "iHeight", "iWidth"] ) - # ctypes.c_uint PostProcessDataAveraging(ctypes.POINTER(ctypes.c_long) pInputImage, ctypes.POINTER(ctypes.c_long) pOutputImage, ctypes.c_int iOutputBufferSize, ctypes.c_int iNumImages, ctypes.c_int iAveragingFilterMode, ctypes.c_int iHeight, ctypes.c_int iWidth, ctypes.c_int iFrameCount, ctypes.c_int iAveragingFactor) - addfunc(lib, "PostProcessDataAveraging", restype = ctypes.c_uint, - argtypes = [ctypes.POINTER(ctypes.c_long), ctypes.POINTER(ctypes.c_long), ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int], - argnames = ["pInputImage", "pOutputImage", "iOutputBufferSize", "iNumImages", "iAveragingFilterMode", "iHeight", "iWidth", "iFrameCount", "iAveragingFactor"] ) - - diff --git a/pylablib/Andor/atmcd32d_lib.py b/pylablib/Andor/atmcd32d_lib.py deleted file mode 100644 index 37d6538..0000000 --- a/pylablib/Andor/atmcd32d_lib.py +++ /dev/null @@ -1,709 +0,0 @@ -# pylint: disable=spelling - -from . import atmcd32d_defs -from .atmcd32d_defs import DRV_STATUS, drDRV_STATUS -from .atmcd32d_defs import define_functions -from .atmcd32d_defs import AT_STEPMODE, AT_GATEMODE # pylint: disable=unused-import -from .atmcd32d_defs import AC_ACQMODE, AC_READMODE, AC_TRIGGERMODE, AC_EMGAIN, AC_FEATURES # pylint: disable=unused-import -from .atmcd32d_defs import AC_CAMERATYPE, drAC_CAMERATYPE, AC_PIXELMODE # pylint: disable=unused-import -from .atmcd32d_defs import AC_SETFUNC, AC_GETFUNC # pylint: disable=unused-import -from .base import AndorError - -from ...core.utils import ctypes_wrap, py3 -from ..utils import load_lib - -import numpy as np -import platform -import ctypes -import collections - - - -class AndorSDK2LibError(AndorError): - """Generic Andor SDK2 library error""" - def __init__(self, func, code): - self.func=func - self.code=code - self.name=drDRV_STATUS.get(self.code,"UNKNOWN") - msg="function '{}' raised error {}({})".format(func,code,self.name) - AndorError.__init__(self,msg) -def errcheck(passing=None): - """ - Build an error checking function. - - Return a function which checks return codes of Andor SDK3 library functions. - `passing` is a list specifying which return codes are acceptable (by default only 0, which is success code, is acceptable). - """ - passing=set(passing) if passing is not None else set() - passing.add(DRV_STATUS.DRV_SUCCESS) # always allow success - def errchecker(result, func, arguments): # pylint: disable=unused-argument - if result not in passing: - raise AndorSDK2LibError(func.__name__,result) - return result - return errchecker - -class CAndorCapabilities(atmcd32d_defs.CAndorCapabilities): - def prep(self, struct): - struct.ulSize=ctypes.sizeof(struct) - return struct - -TAmpModeSimple=collections.namedtuple("TAmpModeSimple",["channel","oamp","hsspeed","preamp"]) -TAmpModeFull=collections.namedtuple("TAmpModeFull",["channel","channel_bitdepth","oamp","oamp_kind","hsspeed","hsspeed_MHz","preamp","preamp_gain"]) -class AndorSDK2Lib: - def __init__(self): - self._initialized=False - - def initlib(self): - if self._initialized: - return - - solis_path=load_lib.get_program_files_folder("Andor SOLIS") - sdk2_path=load_lib.get_program_files_folder("Andor SDK") - archbit=platform.architecture()[0][:2] - error_message="The library is automatically supplied with Andor Solis software or Andor SDK2 software\n"+load_lib.par_error_message.format("andor_sdk2") - lib_names=["atmcd{}d_legacy.dll".format(archbit),"atmcd{}d.dll".format(archbit)] - self.lib=load_lib.load_lib(lib_names,locations=("parameter/andor_sdk2",solis_path,sdk2_path,"global"),error_message=error_message,call_conv="stdcall") - lib=self.lib - define_functions(lib) - - wrapper=ctypes_wrap.CFunctionWrapper(errcheck=errcheck(),default_rvals="pointer") - default_strlen=256 - strprep=ctypes_wrap.strprep(default_strlen) - - # ctypes.c_uint Initialize(ctypes.c_char_p dir) - self.Initialize=wrapper(lib.Initialize) - # ctypes.c_uint ShutDown() - self.ShutDown=wrapper(lib.ShutDown) - # ctypes.c_uint GetVersionInfo(ctypes.c_int arr, ctypes.c_char_p szVersionInfo, ctypes.c_ulong ui32BufferLen) - self.GetVersionInfo=wrapper(lib.GetVersionInfo, args=["arr"], rvals=["szVersionInfo"], - argprep={"szVersionInfo":strprep,"ui32BufferLen":default_strlen}, byref=[]) - # ctypes.c_uint GetAvailableCameras(ctypes.POINTER(ctypes.c_long) totalCameras) - self.GetAvailableCameras=wrapper(lib.GetAvailableCameras) - # ctypes.c_uint GetCameraHandle(ctypes.c_long cameraIndex, ctypes.POINTER(ctypes.c_long) cameraHandle) - self.GetCameraHandle=wrapper(lib.GetCameraHandle) - # ctypes.c_uint GetCurrentCamera(ctypes.POINTER(ctypes.c_long) cameraHandle) - self.GetCurrentCamera=wrapper(lib.GetCurrentCamera) - # ctypes.c_uint SetCurrentCamera(ctypes.c_long cameraHandle) - self.SetCurrentCamera=wrapper(lib.SetCurrentCamera) - - # # ctypes.c_uint GetCapabilities(ctypes.POINTER(AndorCapabilities) caps) - self.GetCapabilities=wrapper(lib.GetCapabilities, rvals=["caps"], - argprep={"caps":CAndorCapabilities.prep_struct}, rconv={"caps":CAndorCapabilities.tup_struct}) - # # ctypes.c_uint GetControllerCardModel(ctypes.c_char_p controllerCardModel) - self.GetControllerCardModel=wrapper(lib.GetControllerCardModel, rvals=["controllerCardModel"], - argprep={"controllerCardModel":strprep}, byref=[]) - # # ctypes.c_uint GetHeadModel(ctypes.c_char_p name) - self.GetHeadModel=wrapper(lib.GetHeadModel, rvals=["name"], - argprep={"name":strprep}, byref=[]) - # ctypes.c_uint GetHardwareVersion(ctypes.POINTER(ctypes.c_uint) PCB, ctypes.POINTER(ctypes.c_uint) Decode, ctypes.POINTER(ctypes.c_uint) dummy1, ctypes.POINTER(ctypes.c_uint) dummy2, ctypes.POINTER(ctypes.c_uint) CameraFirmwareVersion, ctypes.POINTER(ctypes.c_uint) CameraFirmwareBuild) - self.GetHardwareVersion=wrapper(lib.GetHardwareVersion) - # ctypes.c_uint GetSoftwareVersion(ctypes.POINTER(ctypes.c_uint) eprom, ctypes.POINTER(ctypes.c_uint) coffile, ctypes.POINTER(ctypes.c_uint) vxdrev, ctypes.POINTER(ctypes.c_uint) vxdver, ctypes.POINTER(ctypes.c_uint) dllrev, ctypes.POINTER(ctypes.c_uint) dllver) - self.GetSoftwareVersion=wrapper(lib.GetSoftwareVersion) - # ctypes.c_uint GetCameraSerialNumber(ctypes.POINTER(ctypes.c_int) number) - self.GetCameraSerialNumber=wrapper(lib.GetCameraSerialNumber) # only iDus, set index=0 - # # ctypes.c_uint GetPixelSize(ctypes.POINTER(ctypes.c_float) xSize, ctypes.POINTER(ctypes.c_float) ySize) - self.GetPixelSize=wrapper(lib.GetPixelSize) - # ctypes.c_uint GetQE(ctypes.c_char_p sensor, ctypes.c_float wavelength, ctypes.c_uint mode, ctypes.POINTER(ctypes.c_float) QE) - self.GetQE=wrapper(lib.GetQE) - - # ctypes.c_uint InAuxPort(ctypes.c_int port, ctypes.POINTER(ctypes.c_int) state) - self.InAuxPort=wrapper(lib.InAuxPort) - # ctypes.c_uint OutAuxPort(ctypes.c_int port, ctypes.c_int state) - self.OutAuxPort=wrapper(lib.OutAuxPort) - # ctypes.c_uint GetNumberIO(ctypes.POINTER(ctypes.c_int) iNumber) - self.GetNumberIO=wrapper(lib.GetNumberIO) - # ctypes.c_uint GetIODirection(ctypes.c_int index, ctypes.POINTER(ctypes.c_int) iDirection) - self.GetIODirection=wrapper(lib.GetIODirection) - # ctypes.c_uint GetIOLevel(ctypes.c_int index, ctypes.POINTER(ctypes.c_int) iLevel) - self.SetIODirection=wrapper(lib.SetIODirection) - # ctypes.c_uint SetIOLevel(ctypes.c_int index, ctypes.c_int iLevel) - self.GetIOLevel=wrapper(lib.GetIOLevel) - # ctypes.c_uint SetIODirection(ctypes.c_int index, ctypes.c_int iDirection) - self.SetIOLevel=wrapper(lib.SetIOLevel) - # ctypes.c_uint SetDACOutput(ctypes.c_int iOption, ctypes.c_int iResolution, ctypes.c_int iValue) - self.SetDACOutput=wrapper(lib.SetDACOutput) - # ctypes.c_uint SetDACOutputScale(ctypes.c_int iScale) - self.SetDACOutputScale=wrapper(lib.SetDACOutputScale) - - # ctypes.c_uint GPIBReceive(ctypes.c_int id, ctypes.c_short address, ctypes.c_char_p text, ctypes.c_int size) - self.GPIBReceive=wrapper(lib.GPIBReceive, rvals=["text"], - argprep={"text": lambda size: strprep(size)()}, byref=[]) - # ctypes.c_uint GPIBSend(ctypes.c_int id, ctypes.c_short address, ctypes.c_char_p text) - self.GPIBSend=wrapper(lib.GPIBSend) - # ctypes.c_uint SetDelayGenerator(ctypes.c_int board, ctypes.c_short address, ctypes.c_int typ) - self.SetDelayGenerator=wrapper(lib.SetDelayGenerator) - # # ctypes.c_uint I2CBurstRead(BYTE i2cAddress, ctypes.c_long nBytes, ctypes.POINTER(BYTE) data) - # lib.I2CBurstRead.restype=ctypes.c_uint - # lib.I2CBurstRead.argtypes=[BYTE, ctypes.c_long, ctypes.POINTER(BYTE)] - # lib.I2CBurstRead.argnames=["i2cAddress", "nBytes", "data"] - # # ctypes.c_uint I2CBurstWrite(BYTE i2cAddress, ctypes.c_long nBytes, ctypes.POINTER(BYTE) data) - # lib.I2CBurstWrite.restype=ctypes.c_uint - # lib.I2CBurstWrite.argtypes=[BYTE, ctypes.c_long, ctypes.POINTER(BYTE)] - # lib.I2CBurstWrite.argnames=["i2cAddress", "nBytes", "data"] - # # ctypes.c_uint I2CRead(BYTE deviceID, BYTE intAddress, ctypes.POINTER(BYTE) pdata) - # lib.I2CRead.restype=ctypes.c_uint - # lib.I2CRead.argtypes=[BYTE, BYTE, ctypes.POINTER(BYTE)] - # lib.I2CRead.argnames=["deviceID", "intAddress", "pdata"] - # # ctypes.c_uint I2CReset() - # lib.I2CReset.restype=ctypes.c_uint - # lib.I2CReset.argtypes=[] - # lib.I2CReset.argnames=[] - # # ctypes.c_uint I2CWrite(BYTE deviceID, BYTE intAddress, BYTE data) - # lib.I2CWrite.restype=ctypes.c_uint - # lib.I2CWrite.argtypes=[BYTE, BYTE, BYTE] - # lib.I2CWrite.argnames=["deviceID", "intAddress", "data"] - - # ctypes.c_uint SetTriggerMode(ctypes.c_int mode) - self.SetTriggerMode=wrapper(lib.SetTriggerMode) - # ctypes.c_uint GetExternalTriggerTermination(ctypes.POINTER(ctypes.c_ulong) puiTermination) - self.GetExternalTriggerTermination=wrapper(lib.GetExternalTriggerTermination) - # ctypes.c_uint SetExternalTriggerTermination(ctypes.c_ulong uiTermination) - self.SetExternalTriggerTermination=wrapper(lib.SetExternalTriggerTermination) - # ctypes.c_uint GetTriggerLevelRange(ctypes.POINTER(ctypes.c_float) minimum, ctypes.POINTER(ctypes.c_float) maximum) - self.GetTriggerLevelRange=wrapper(lib.GetTriggerLevelRange) - # ctypes.c_uint SetTriggerLevel(ctypes.c_float f_level) - self.SetTriggerLevel=wrapper(lib.SetTriggerLevel) - # ctypes.c_uint SetTriggerInvert(ctypes.c_int mode) - self.SetTriggerInvert=wrapper(lib.SetTriggerInvert) - # ctypes.c_uint IsTriggerModeAvailable(ctypes.c_int iTriggerMode) - self.IsTriggerModeAvailable=wrapper(lib.IsTriggerModeAvailable) - # ctypes.c_uint SendSoftwareTrigger() - self.SendSoftwareTrigger=wrapper(lib.SendSoftwareTrigger) - # ctypes.c_uint SetAdvancedTriggerModeState(ctypes.c_int iState) - self.SetAdvancedTriggerModeState=wrapper(lib.SetAdvancedTriggerModeState) - # ctypes.c_uint SetFastExtTrigger(ctypes.c_int mode) - self.SetFastExtTrigger=wrapper(lib.SetFastExtTrigger) - # ctypes.c_uint SetChargeShifting(ctypes.c_uint NumberRows, ctypes.c_uint NumberRepeats) - self.SetChargeShifting=wrapper(lib.SetChargeShifting) - - errcheck_temp=errcheck(passing={20034,20035,20036,20037,20040}) - # ctypes.c_uint GetTemperature(ctypes.POINTER(ctypes.c_int) temperature) - self.GetTemperature=wrapper(lib.GetTemperature, rvals=[None,"temperature"], errcheck=errcheck_temp) - # ctypes.c_uint GetTemperatureF(ctypes.POINTER(ctypes.c_float) temperature) - self.GetTemperatureF=wrapper(lib.GetTemperatureF, rvals=[None,"temperature"], errcheck=errcheck_temp) - # ctypes.c_uint SetTemperature(ctypes.c_int temperature) - self.SetTemperature=wrapper(lib.SetTemperature) - # ctypes.c_uint GetTemperatureRange(ctypes.POINTER(ctypes.c_int) mintemp, ctypes.POINTER(ctypes.c_int) maxtemp) - self.GetTemperatureRange=wrapper(lib.GetTemperatureRange) - # ctypes.c_uint CoolerON() - self.CoolerON=wrapper(lib.CoolerON) - # ctypes.c_uint CoolerOFF() - self.CoolerOFF=wrapper(lib.CoolerOFF) - # ctypes.c_uint IsCoolerOn(ctypes.POINTER(ctypes.c_int) iCoolerStatus) - self.IsCoolerOn=wrapper(lib.IsCoolerOn) - # ctypes.c_uint SetCoolerMode(ctypes.c_int mode) - self.SetCoolerMode=wrapper(lib.SetCoolerMode) - # ctypes.c_uint SetFanMode(ctypes.c_int mode) - self.SetFanMode=wrapper(lib.SetFanMode) - # ctypes.c_uint GetTECStatus(ctypes.POINTER(ctypes.c_int) piFlag) - self.GetTECStatus=wrapper(lib.GetTECStatus) - - # ctypes.c_uint GetNumberADChannels(ctypes.POINTER(ctypes.c_int) channels) - self.GetNumberADChannels=wrapper(lib.GetNumberADChannels) - # ctypes.c_uint SetADChannel(ctypes.c_int channel) - self.SetADChannel=wrapper(lib.SetADChannel) - # ctypes.c_uint GetBitDepth(ctypes.c_int channel, ctypes.POINTER(ctypes.c_int) depth) - self.GetBitDepth=wrapper(lib.GetBitDepth) - # ctypes.c_uint GetNumberAmp(ctypes.POINTER(ctypes.c_int) amp) - self.GetNumberAmp=wrapper(lib.GetNumberAmp) - # ctypes.c_uint SetOutputAmplifier(ctypes.c_int typ) - self.SetOutputAmplifier=wrapper(lib.SetOutputAmplifier) - # ctypes.c_uint IsAmplifierAvailable(ctypes.c_int iamp) - self.IsAmplifierAvailable=wrapper(lib.IsAmplifierAvailable) - # ctypes.c_uint GetNumberPreAmpGains(ctypes.POINTER(ctypes.c_int) noGains) - self.GetNumberPreAmpGains=wrapper(lib.GetNumberPreAmpGains) - # ctypes.c_uint GetPreAmpGain(ctypes.c_int index, ctypes.POINTER(ctypes.c_float) gain) - self.GetPreAmpGain=wrapper(lib.GetPreAmpGain) - # ctypes.c_uint SetPreAmpGain(ctypes.c_int index) - self.SetPreAmpGain=wrapper(lib.SetPreAmpGain) - # ctypes.c_uint IsPreAmpGainAvailable(ctypes.c_int channel, ctypes.c_int amplifier, ctypes.c_int index, ctypes.c_int pa, ctypes.POINTER(ctypes.c_int) status) - self.IsPreAmpGainAvailable=wrapper(lib.IsPreAmpGainAvailable) - # ctypes.c_uint GetPreAmpGainText(ctypes.c_int index, ctypes.c_char_p name, ctypes.c_int length) - self.GetPreAmpGainText=wrapper(lib.GetPreAmpGainText, args=["index"], rvals=["name"], - argprep={"name":strprep,"length":default_strlen}, byref=[]) - # ctypes.c_uint GetAmpDesc(ctypes.c_int index, ctypes.c_char_p name, ctypes.c_int length) - self.GetAmpDesc=wrapper(lib.GetAmpDesc, args=["index"], rvals=["name"], - argprep={"name":strprep,"length":default_strlen}, byref=[]) - # ctypes.c_uint GetAmpMaxSpeed(ctypes.c_int index, ctypes.POINTER(ctypes.c_float) speed) - self.GetAmpMaxSpeed=wrapper(lib.GetAmpMaxSpeed) - # ctypes.c_uint GetSensitivity(ctypes.c_int channel, ctypes.c_int horzShift, ctypes.c_int amplifier, ctypes.c_int pa, ctypes.POINTER(ctypes.c_float) sensitivity) - self.GetSensitivity=wrapper(lib.GetSensitivity) - - # ctypes.c_uint GetNumberHSSpeeds(ctypes.c_int channel, ctypes.c_int typ, ctypes.POINTER(ctypes.c_int) speeds) - self.GetNumberHSSpeeds=wrapper(lib.GetNumberHSSpeeds) - # ctypes.c_uint GetHSSpeed(ctypes.c_int channel, ctypes.c_int typ, ctypes.c_int index, ctypes.POINTER(ctypes.c_float) speed) - self.GetHSSpeed=wrapper(lib.GetHSSpeed) - # ctypes.c_uint SetHSSpeed(ctypes.c_int typ, ctypes.c_int index) - self.SetHSSpeed=wrapper(lib.SetHSSpeed) - # ctypes.c_uint GetNumberVSSpeeds(ctypes.POINTER(ctypes.c_int) speeds) - self.GetNumberVSSpeeds=wrapper(lib.GetNumberVSSpeeds) - # ctypes.c_uint GetVSSpeed(ctypes.c_int index, ctypes.POINTER(ctypes.c_float) speed) - self.GetVSSpeed=wrapper(lib.GetVSSpeed) - # ctypes.c_uint SetVSSpeed(ctypes.c_int index) - self.SetVSSpeed=wrapper(lib.SetVSSpeed) - # ctypes.c_uint GetFastestRecommendedVSSpeed(ctypes.POINTER(ctypes.c_int) index, ctypes.POINTER(ctypes.c_float) speed) - self.GetFastestRecommendedVSSpeed=wrapper(lib.GetFastestRecommendedVSSpeed) - # ctypes.c_uint GetNumberVSAmplitudes(ctypes.POINTER(ctypes.c_int) number) - self.GetNumberVSAmplitudes=wrapper(lib.GetNumberVSAmplitudes) - # ctypes.c_uint GetVSAmplitudeValue(ctypes.c_int index, ctypes.POINTER(ctypes.c_int) value) - self.GetVSAmplitudeValue=wrapper(lib.GetVSAmplitudeValue) - # ctypes.c_uint SetVSAmplitude(ctypes.c_int index) - self.SetVSAmplitude=wrapper(lib.SetVSAmplitude) - # ctypes.c_uint GetVSAmplitudeString(ctypes.c_int index, ctypes.c_char_p text) - self.GetVSAmplitudeString=wrapper(lib.GetVSAmplitudeString, rvals=["text"], - argprep={"text":strprep}, byref=[]) - # ctypes.c_uint GetVSAmplitudeFromString(ctypes.c_char_p text, ctypes.POINTER(ctypes.c_int) index) - self.GetVSAmplitudeFromString=wrapper(lib.GetVSAmplitudeFromString) - # ctypes.c_uint SetHighCapacity(ctypes.c_int state) - self.SetHighCapacity=wrapper(lib.SetHighCapacity) - - # ctypes.c_uint SetEMGainMode(ctypes.c_int mode) - self.SetEMGainMode=wrapper(lib.SetEMGainMode) - # ctypes.c_uint GetEMGainRange(ctypes.POINTER(ctypes.c_int) low, ctypes.POINTER(ctypes.c_int) high) - self.GetEMGainRange=wrapper(lib.GetEMGainRange) - # ctypes.c_uint GetEMCCDGain(ctypes.POINTER(ctypes.c_int) gain) - self.GetEMCCDGain=wrapper(lib.GetEMCCDGain) - # ctypes.c_uint SetEMCCDGain(ctypes.c_int gain) - self.SetEMCCDGain=wrapper(lib.SetEMCCDGain) - # ctypes.c_uint GetEMAdvanced(ctypes.POINTER(ctypes.c_int) state) - self.GetEMAdvanced=wrapper(lib.GetEMAdvanced) - # ctypes.c_uint SetEMAdvanced(ctypes.c_int state) - self.SetEMAdvanced=wrapper(lib.SetEMAdvanced) - - # ctypes.c_uint GetShutterMinTimes(ctypes.POINTER(ctypes.c_int) minclosingtime, ctypes.POINTER(ctypes.c_int) minopeningtime) - self.GetShutterMinTimes=wrapper(lib.GetShutterMinTimes) - # ctypes.c_uint SetShutter(ctypes.c_int typ, ctypes.c_int mode, ctypes.c_int closingtime, ctypes.c_int openingtime) - self.SetShutter=wrapper(lib.SetShutter) - # ctypes.c_uint SetShutterEx(ctypes.c_int typ, ctypes.c_int mode, ctypes.c_int closingtime, ctypes.c_int openingtime, ctypes.c_int extmode) - self.SetShutterEx=wrapper(lib.SetShutterEx) - # ctypes.c_uint IsInternalMechanicalShutter(ctypes.POINTER(ctypes.c_int) InternalShutter) - self.IsInternalMechanicalShutter=wrapper(lib.IsInternalMechanicalShutter) - - # ctypes.c_uint GetCountConvertWavelengthRange(ctypes.POINTER(ctypes.c_float) minval, ctypes.POINTER(ctypes.c_float) maxval) - self.GetCountConvertWavelengthRange=wrapper(lib.GetCountConvertWavelengthRange) - # ctypes.c_uint IsCountConvertModeAvailable(ctypes.c_int mode) - self.IsCountConvertModeAvailable=wrapper(lib.IsCountConvertModeAvailable) - # ctypes.c_uint SetCountConvertMode(ctypes.c_int Mode) - self.SetCountConvertMode=wrapper(lib.SetCountConvertMode) - # ctypes.c_uint SetCountConvertWavelength(ctypes.c_float wavelength) - self.SetCountConvertWavelength=wrapper(lib.SetCountConvertWavelength) - - # ctypes.c_uint SetPhotonCounting(ctypes.c_int state) - self.SetPhotonCounting=wrapper(lib.SetPhotonCounting) - # ctypes.c_uint SetPhotonCountingThreshold(ctypes.c_long min, ctypes.c_long max) - self.SetPhotonCountingThreshold=wrapper(lib.SetPhotonCountingThreshold) - # ctypes.c_uint GetNumberPhotonCountingDivisions(ctypes.POINTER(ctypes.c_ulong) noOfDivisions) - self.GetNumberPhotonCountingDivisions=wrapper(lib.GetNumberPhotonCountingDivisions) - # ctypes.c_uint SetPhotonCountingDivisions(ctypes.c_ulong noOfDivisions, ctypes.POINTER(ctypes.c_long) divisions) - self.SetPhotonCountingDivisions=wrapper(lib.SetPhotonCountingDivisions, rvals=[]) - - # ctypes.c_uint SetGate(ctypes.c_float delay, ctypes.c_float width, ctypes.c_float stepRenamed) - self.SetGate=wrapper(lib.SetGate) - # ctypes.c_uint GetGateMode(ctypes.POINTER(ctypes.c_int) piGatemode) - self.GetGateMode=wrapper(lib.GetGateMode) - # ctypes.c_uint SetGateMode(ctypes.c_int gatemode) - self.SetGateMode=wrapper(lib.SetGateMode) - - # ctypes.c_uint GetAcquisitionTimings(ctypes.POINTER(ctypes.c_float) exposure, ctypes.POINTER(ctypes.c_float) accumulate, ctypes.POINTER(ctypes.c_float) kinetic) - self.GetAcquisitionTimings=wrapper(lib.GetAcquisitionTimings) - # ctypes.c_uint SetExposureTime(ctypes.c_float time) - self.SetExposureTime=wrapper(lib.SetExposureTime) - # ctypes.c_uint GetMaximumExposure(ctypes.POINTER(ctypes.c_float) MaxExp) - self.GetMaximumExposure=wrapper(lib.GetMaximumExposure) - # ctypes.c_uint SetDualExposureTimes(ctypes.c_float expTime1, ctypes.c_float expTime2) - self.SetDualExposureTimes=wrapper(lib.SetDualExposureTimes) - # ctypes.c_uint SetDualExposureMode(ctypes.c_int mode) - self.SetDualExposureMode=wrapper(lib.SetDualExposureMode) - # ctypes.c_uint GetDualExposureTimes(ctypes.POINTER(ctypes.c_float) exposure1, ctypes.POINTER(ctypes.c_float) exposure2) - self.GetDualExposureTimes=wrapper(lib.GetDualExposureTimes) - # ctypes.c_uint GetMaximumNumberRingExposureTimes(ctypes.POINTER(ctypes.c_int) number) - self.GetMaximumNumberRingExposureTimes=wrapper(lib.GetMaximumNumberRingExposureTimes) - # ctypes.c_uint GetRingExposureRange(ctypes.POINTER(ctypes.c_float) fpMin, ctypes.POINTER(ctypes.c_float) fpMax) - self.GetRingExposureRange=wrapper(lib.GetRingExposureRange) - # ctypes.c_uint GetNumberRingExposureTimes(ctypes.POINTER(ctypes.c_int) ipnumTimes) - self.GetNumberRingExposureTimes=wrapper(lib.GetNumberRingExposureTimes) - # ctypes.c_uint SetRingExposureTimes(ctypes.c_int numTimes, ctypes.POINTER(ctypes.c_float) times) - self.SetRingExposureTimes=wrapper(lib.SetRingExposureTimes, rvals=["times"], byref=[], - argprep={"times":lambda numTimes: (ctypes.c_float*numTimes)()}, - rconv={"times": lambda v,_,kwargs: np.ctypeslib.as_array(v,(kwargs["numTimes"],)).copy()}) - # ctypes.c_uint GetAdjustedRingExposureTimes(ctypes.c_int inumTimes, ctypes.POINTER(ctypes.c_float) fptimes) - self.GetAdjustedRingExposureTimes=wrapper(lib.GetAdjustedRingExposureTimes, rvals=["fptimes"], byref=[], - argprep={"fptimes":lambda inumTimes: (ctypes.c_float*inumTimes)()}, - rconv={"fptimes": lambda v,_,kwargs: np.ctypeslib.as_array(v,(kwargs["inumTimes"],)).copy()}) - - # ctypes.c_uint SetAcquisitionMode(ctypes.c_int mode) - self.SetAcquisitionMode=wrapper(lib.SetAcquisitionMode) - # ctypes.c_uint SetNumberAccumulations(ctypes.c_int number) - self.SetNumberAccumulations=wrapper(lib.SetNumberAccumulations) - # ctypes.c_uint SetNumberKinetics(ctypes.c_int number) - self.SetNumberKinetics=wrapper(lib.SetNumberKinetics) - # ctypes.c_uint SetNumberPrescans(ctypes.c_int iNumber) - self.SetNumberPrescans=wrapper(lib.SetNumberPrescans) - # ctypes.c_uint SetKineticCycleTime(ctypes.c_float time) - self.SetKineticCycleTime=wrapper(lib.SetKineticCycleTime) - # ctypes.c_uint SetAccumulationCycleTime(ctypes.c_float time) - self.SetAccumulationCycleTime=wrapper(lib.SetAccumulationCycleTime) - # ctypes.c_uint SetFrameTransferMode(ctypes.c_int mode) - self.SetFrameTransferMode=wrapper(lib.SetFrameTransferMode) - # ctypes.c_uint GetReadOutTime(ctypes.POINTER(ctypes.c_float) ReadOutTime) - self.GetReadOutTime=wrapper(lib.GetReadOutTime) - # ctypes.c_uint GetKeepCleanTime(ctypes.POINTER(ctypes.c_float) KeepCleanTime) - self.GetKeepCleanTime=wrapper(lib.GetKeepCleanTime) - # ctypes.c_uint EnableKeepCleans(ctypes.c_int iMode) - self.EnableKeepCleans=wrapper(lib.EnableKeepCleans) - # ctypes.c_uint SetOverlapMode(ctypes.c_int mode) - self.SetOverlapMode=wrapper(lib.SetOverlapMode) - - # ctypes.c_uint SetFastKinetics(ctypes.c_int exposedRows, ctypes.c_int seriesLength, ctypes.c_float time, ctypes.c_int mode, ctypes.c_int hbin, ctypes.c_int vbin) - self.SetFastKinetics=wrapper(lib.SetFastKinetics) - # ctypes.c_uint SetFastKineticsEx(ctypes.c_int exposedRows, ctypes.c_int seriesLength, ctypes.c_float time, ctypes.c_int mode, ctypes.c_int hbin, ctypes.c_int vbin, ctypes.c_int offset) - self.SetFastKineticsEx=wrapper(lib.SetFastKineticsEx) - # ctypes.c_uint GetFKExposureTime(ctypes.POINTER(ctypes.c_float) time) - self.GetFKExposureTime=wrapper(lib.GetFKExposureTime) - # ctypes.c_uint GetFKVShiftSpeedF(ctypes.c_int index, ctypes.POINTER(ctypes.c_float) speed) - self.GetFKVShiftSpeedF=wrapper(lib.GetFKVShiftSpeedF) - # ctypes.c_uint SetFKVShiftSpeed(ctypes.c_int index) - self.SetFKVShiftSpeed=wrapper(lib.SetFKVShiftSpeed) - # ctypes.c_uint GetNumberFKVShiftSpeeds(ctypes.POINTER(ctypes.c_int) number) - self.GetNumberFKVShiftSpeeds=wrapper(lib.GetNumberFKVShiftSpeeds) - - # ctypes.c_uint GetMCPGain(ctypes.POINTER(ctypes.c_int) piGain) - self.GetMCPGain=wrapper(lib.GetMCPGain) - # ctypes.c_uint GetMCPGainRange(ctypes.POINTER(ctypes.c_int) iLow, ctypes.POINTER(ctypes.c_int) iHigh) - self.GetMCPGainRange=wrapper(lib.GetMCPGainRange) - # ctypes.c_uint GetMCPVoltage(ctypes.POINTER(ctypes.c_int) iVoltage) - self.GetMCPVoltage=wrapper(lib.GetMCPVoltage) - # ctypes.c_uint SetMCPGain(ctypes.c_int gain) - self.SetMCPGain=wrapper(lib.SetMCPGain) - # ctypes.c_uint SetMCPGating(ctypes.c_int gating) - self.SetMCPGating=wrapper(lib.SetMCPGating) - - # ctypes.c_uint PrepareAcquisition() - self.PrepareAcquisition=wrapper(lib.PrepareAcquisition) - # ctypes.c_uint StartAcquisition() - self.StartAcquisition=wrapper(lib.StartAcquisition) - # ctypes.c_uint AbortAcquisition() - self.AbortAcquisition=wrapper(lib.AbortAcquisition) - # ctypes.c_uint GetAcquisitionProgress(ctypes.POINTER(ctypes.c_long) acc, ctypes.POINTER(ctypes.c_long) series) - self.GetAcquisitionProgress=wrapper(lib.GetAcquisitionProgress) - # ctypes.c_uint GetStatus(ctypes.POINTER(ctypes.c_int) status) - self.GetStatus=wrapper(lib.GetStatus) - # ctypes.c_uint GetCameraEventStatus(ctypes.POINTER(DWORD) camStatus) - self.GetCameraEventStatus=wrapper(lib.GetCameraEventStatus) - # ctypes.c_uint GetFrontEndStatus(ctypes.POINTER(ctypes.c_int) piFlag) - self.GetFrontEndStatus=wrapper(lib.GetFrontEndStatus) - # ctypes.c_uint WaitForAcquisition() - self.WaitForAcquisition=wrapper(lib.WaitForAcquisition) - # ctypes.c_uint WaitForAcquisitionTimeOut(ctypes.c_int iTimeOutMs) - self.WaitForAcquisitionTimeOut=wrapper(lib.WaitForAcquisitionTimeOut) - # ctypes.c_uint WaitForAcquisitionByHandle(ctypes.c_long cameraHandle) - self.WaitForAcquisitionByHandle=wrapper(lib.WaitForAcquisitionByHandle) - # ctypes.c_uint WaitForAcquisitionByHandleTimeOut(ctypes.c_long cameraHandle, ctypes.c_int iTimeOutMs) - self.WaitForAcquisitionByHandleTimeOut=wrapper(lib.WaitForAcquisitionByHandleTimeOut) - # ctypes.c_uint CancelWait() - self.CancelWait=wrapper(lib.CancelWait) - - # ctypes.c_uint SetReadMode(ctypes.c_int mode) - self.SetReadMode=wrapper(lib.SetReadMode) - # ctypes.c_uint GetMaximumBinning(ctypes.c_int ReadMode, ctypes.c_int HorzVert, ctypes.POINTER(ctypes.c_int) MaxBinning) - self.GetMaximumBinning=wrapper(lib.GetMaximumBinning) - # ctypes.c_uint GetMinimumImageLength(ctypes.POINTER(ctypes.c_int) MinImageLength) - self.GetMinimumImageLength=wrapper(lib.GetMinimumImageLength) - # ctypes.c_uint SetSingleTrack(ctypes.c_int centre, ctypes.c_int height) - self.SetSingleTrack=wrapper(lib.SetSingleTrack) - # ctypes.c_uint SetMultiTrack(ctypes.c_int number, ctypes.c_int height, ctypes.c_int offset, ctypes.POINTER(ctypes.c_int) bottom, ctypes.POINTER(ctypes.c_int) gap) - self.SetMultiTrack=wrapper(lib.SetMultiTrack) - # ctypes.c_uint SetRa\ndomTracks(ctypes.c_int numTracks, ctypes.POINTER(ctypes.c_int) areas) - self.SetRandomTracks_lib=wrapper(lib.SetRandomTracks, args="all", byref=[]) - # ctypes.c_uint SetImage(ctypes.c_int hbin, ctypes.c_int vbin, ctypes.c_int hstart, ctypes.c_int hend, ctypes.c_int vstart, ctypes.c_int vend) - self.SetImage=wrapper(lib.SetImage) - # ctypes.c_uint SetFVBHBin(ctypes.c_int bin) - self.SetFVBHBin=wrapper(lib.SetFVBHBin) - # ctypes.c_uint GetImageFlip(ctypes.POINTER(ctypes.c_int) iHFlip, ctypes.POINTER(ctypes.c_int) iVFlip) - self.GetImageFlip=wrapper(lib.GetImageFlip) - # ctypes.c_uint GetImageRotate(ctypes.POINTER(ctypes.c_int) iRotate) - self.SetImageFlip=wrapper(lib.SetImageFlip) - # ctypes.c_uint SetImageRotate(ctypes.c_int iRotate) - self.GetImageRotate=wrapper(lib.GetImageRotate) - # ctypes.c_uint SetImageFlip(ctypes.c_int iHFlip, ctypes.c_int iVFlip) - self.SetImageRotate=wrapper(lib.SetImageRotate) - # ctypes.c_uint GetDetector(ctypes.POINTER(ctypes.c_int) xpixels, ctypes.POINTER(ctypes.c_int) ypixels) - self.GetDetector=wrapper(lib.GetDetector) - - # ctypes.c_uint GetBaselineClamp(ctypes.POINTER(ctypes.c_int) state) - self.GetBaselineClamp=wrapper(lib.GetBaselineClamp) - # ctypes.c_uint SetBaselineClamp(ctypes.c_int state) - self.SetBaselineClamp=wrapper(lib.SetBaselineClamp) - # ctypes.c_uint SetBaselineOffset(ctypes.c_int offset) - self.SetBaselineOffset=wrapper(lib.SetBaselineOffset) - - # ctypes.c_uint GetFilterMode(ctypes.POINTER(ctypes.c_int) mode) - self.GetFilterMode=wrapper(lib.GetFilterMode) - # ctypes.c_uint SetFilterMode(ctypes.c_int mode) - self.SetFilterMode=wrapper(lib.SetFilterMode) - # ctypes.c_uint Filter_SetMode(ctypes.c_uint mode) - self.Filter_SetMode=wrapper(lib.Filter_SetMode) - # ctypes.c_uint Filter_GetMode(ctypes.POINTER(ctypes.c_uint) mode) - self.Filter_GetMode=wrapper(lib.Filter_GetMode) - # ctypes.c_uint Filter_SetThreshold(ctypes.c_float threshold) - self.Filter_SetThreshold=wrapper(lib.Filter_SetThreshold) - # ctypes.c_uint Filter_GetThreshold(ctypes.POINTER(ctypes.c_float) threshold) - self.Filter_GetThreshold=wrapper(lib.Filter_GetThreshold) - # ctypes.c_uint Filter_SetDataAveragingMode(ctypes.c_int mode) - self.Filter_SetDataAveragingMode=wrapper(lib.Filter_SetDataAveragingMode) - # ctypes.c_uint Filter_GetDataAveragingMode(ctypes.POINTER(ctypes.c_int) mode) - self.Filter_GetDataAveragingMode=wrapper(lib.Filter_GetDataAveragingMode) - # ctypes.c_uint Filter_SetAveragingFrameCount(ctypes.c_int frames) - self.Filter_SetAveragingFrameCount=wrapper(lib.Filter_SetAveragingFrameCount) - # ctypes.c_uint Filter_GetAveragingFrameCount(ctypes.POINTER(ctypes.c_int) frames) - self.Filter_GetAveragingFrameCount=wrapper(lib.Filter_GetAveragingFrameCount) - # ctypes.c_uint Filter_SetAveragingFactor(ctypes.c_int averagingFactor) - self.Filter_SetAveragingFactor=wrapper(lib.Filter_SetAveragingFactor) - # ctypes.c_uint Filter_GetAveragingFactor(ctypes.POINTER(ctypes.c_int) averagingFactor) - self.Filter_GetAveragingFactor=wrapper(lib.Filter_GetAveragingFactor) - - # ctypes.c_uint GetSizeOfCircularBuffer(ctypes.POINTER(ctypes.c_long) index) - self.GetSizeOfCircularBuffer=wrapper(lib.GetSizeOfCircularBuffer) - # ctypes.c_uint FreeInternalMemory() - self.FreeInternalMemory=wrapper(lib.FreeInternalMemory) - # ctypes.c_uint GetImagesPerDMA(ctypes.POINTER(ctypes.c_ulong) images) - self.GetImagesPerDMA=wrapper(lib.GetImagesPerDMA) - # ctypes.c_uint SetDMAParameters(ctypes.c_int MaxImagesPerDMA, ctypes.c_float SecondsPerDMA) - self.SetDMAParameters=wrapper(lib.SetDMAParameters) - - buffer16_prep=ctypes_wrap.buffprep(0," 0x03030000 - #define Py_LIMITED_API CYTHON_LIMITED_API - #else - #define Py_LIMITED_API 0x03030000 - #endif - #endif -#endif - -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.7+ or Python 3.3+. -#else -#if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API -#define __PYX_EXTRA_ABI_MODULE_NAME "limited" -#else -#define __PYX_EXTRA_ABI_MODULE_NAME "" -#endif -#define CYTHON_ABI "3_0_10" __PYX_EXTRA_ABI_MODULE_NAME -#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI -#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x03000AF0 -#define CYTHON_FUTURE_DIVISION 1 -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#define __PYX_COMMA , -#ifndef HAVE_LONG_LONG - #define HAVE_LONG_LONG -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX -#if defined(GRAALVM_PYTHON) - /* For very preliminary testing purposes. Most variables are set the same as PyPy. - The existence of this section does not imply that anything works or is even tested */ - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 1 - #define CYTHON_COMPILING_IN_NOGIL 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 0 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL 0 - #undef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) - #endif - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 1 - #undef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 - #endif - #undef CYTHON_USE_FREELISTS - #define CYTHON_USE_FREELISTS 0 -#elif defined(PYPY_VERSION) - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #ifndef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 0 - #endif - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL 0 - #undef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) - #endif - #if PY_VERSION_HEX < 0x03090000 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) - #define CYTHON_PEP489_MULTI_PHASE_INIT 1 - #endif - #undef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 - #endif - #undef CYTHON_USE_FREELISTS - #define CYTHON_USE_FREELISTS 0 -#elif defined(CYTHON_LIMITED_API) - #ifdef Py_LIMITED_API - #undef __PYX_LIMITED_VERSION_HEX - #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API - #endif - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #define CYTHON_COMPILING_IN_LIMITED_API 1 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 0 - #undef CYTHON_CLINE_IN_TRACEBACK - #define CYTHON_CLINE_IN_TRACEBACK 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 1 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #endif - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL 0 - #undef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS 1 - #endif - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 1 - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #endif - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 - #endif - #undef CYTHON_USE_FREELISTS - #define CYTHON_USE_FREELISTS 0 -#elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #ifndef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 0 - #endif - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #ifndef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #ifndef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL 0 - #ifndef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL 1 - #endif - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS 1 - #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 1 - #endif - #ifndef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 0 - #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 1 - #endif - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 - #endif - #ifndef CYTHON_USE_FREELISTS - #define CYTHON_USE_FREELISTS 0 - #endif -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #ifndef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 0 - #endif - #ifndef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #ifndef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) - #endif - #ifndef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS 1 - #endif - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) - #define CYTHON_PEP489_MULTI_PHASE_INIT 1 - #endif - #ifndef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 0 - #endif - #if PY_VERSION_HEX < 0x030400a1 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #elif !defined(CYTHON_USE_TP_FINALIZE) - #define CYTHON_USE_TP_FINALIZE 1 - #endif - #if PY_VERSION_HEX < 0x030600B1 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #elif !defined(CYTHON_USE_DICT_VERSIONS) - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) - #endif - #if PY_VERSION_HEX < 0x030700A3 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK 1 - #endif - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 - #endif - #ifndef CYTHON_USE_FREELISTS - #define CYTHON_USE_FREELISTS 1 - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if !defined(CYTHON_VECTORCALL) -#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) -#endif -#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) -#if CYTHON_USE_PYLONG_INTERNALS - #if PY_MAJOR_VERSION < 3 - #include "longintrepr.h" - #endif - #undef SHIFT - #undef BASE - #undef MASK - #ifdef SIZEOF_VOID_P - enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; - #endif -#endif -#ifndef __has_attribute - #define __has_attribute(x) 0 -#endif -#ifndef __has_cpp_attribute - #define __has_cpp_attribute(x) 0 -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED - #if defined(__cplusplus) - /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 - * but leads to warnings with -pedantic, since it is a C++17 feature */ - #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) - #if __has_cpp_attribute(maybe_unused) - #define CYTHON_UNUSED [[maybe_unused]] - #endif - #endif - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR - #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_USE_CPP_STD_MOVE - #if defined(__cplusplus) && (\ - __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) - #define CYTHON_USE_CPP_STD_MOVE 1 - #else - #define CYTHON_USE_CPP_STD_MOVE 0 - #endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) -#ifdef _MSC_VER - #ifndef _MSC_STDINT_H_ - #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; - #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; - #endif - #endif - #if _MSC_VER < 1300 - #ifdef _WIN64 - typedef unsigned long long __pyx_uintptr_t; - #else - typedef unsigned int __pyx_uintptr_t; - #endif - #else - #ifdef _WIN64 - typedef unsigned __int64 __pyx_uintptr_t; - #else - typedef unsigned __int32 __pyx_uintptr_t; - #endif - #endif -#else - #include - typedef uintptr_t __pyx_uintptr_t; -#endif -#ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) - /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 - * but leads to warnings with -pedantic, since it is a C++17 feature */ - #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #endif - #endif - #ifndef CYTHON_FALLTHROUGH - #if __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] - #endif - #endif - #endif - #ifndef CYTHON_FALLTHROUGH - #if __has_attribute(fallthrough) - #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) - #else - #define CYTHON_FALLTHROUGH - #endif - #endif - #if defined(__clang__) && defined(__apple_build_version__) - #if __apple_build_version__ < 7000000 - #undef CYTHON_FALLTHROUGH - #define CYTHON_FALLTHROUGH - #endif - #endif -#endif -#ifdef __cplusplus - template - struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; - #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) -#else - #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) -#endif -#if CYTHON_COMPILING_IN_PYPY == 1 - #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) -#else - #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) -#endif -#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_DefaultClassType PyClass_Type - #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_DefaultClassType PyType_Type -#if CYTHON_COMPILING_IN_LIMITED_API - static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, - PyObject *code, PyObject *c, PyObject* n, PyObject *v, - PyObject *fv, PyObject *cell, PyObject* fn, - PyObject *name, int fline, PyObject *lnos) { - PyObject *exception_table = NULL; - PyObject *types_module=NULL, *code_type=NULL, *result=NULL; - #if __PYX_LIMITED_VERSION_HEX < 0x030B0000 - PyObject *version_info; - PyObject *py_minor_version = NULL; - #endif - long minor_version = 0; - PyObject *type, *value, *traceback; - PyErr_Fetch(&type, &value, &traceback); - #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 - minor_version = 11; - #else - if (!(version_info = PySys_GetObject("version_info"))) goto end; - if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; - minor_version = PyLong_AsLong(py_minor_version); - Py_DECREF(py_minor_version); - if (minor_version == -1 && PyErr_Occurred()) goto end; - #endif - if (!(types_module = PyImport_ImportModule("types"))) goto end; - if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; - if (minor_version <= 7) { - (void)p; - result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code, - c, n, v, fn, name, fline, lnos, fv, cell); - } else if (minor_version <= 10) { - result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code, - c, n, v, fn, name, fline, lnos, fv, cell); - } else { - if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; - result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code, - c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); - } - end: - Py_XDECREF(code_type); - Py_XDECREF(exception_table); - Py_XDECREF(types_module); - if (type) { - PyErr_Restore(type, value, traceback); - } - return result; - } - #ifndef CO_OPTIMIZED - #define CO_OPTIMIZED 0x0001 - #endif - #ifndef CO_NEWLOCALS - #define CO_NEWLOCALS 0x0002 - #endif - #ifndef CO_VARARGS - #define CO_VARARGS 0x0004 - #endif - #ifndef CO_VARKEYWORDS - #define CO_VARKEYWORDS 0x0008 - #endif - #ifndef CO_ASYNC_GENERATOR - #define CO_ASYNC_GENERATOR 0x0200 - #endif - #ifndef CO_GENERATOR - #define CO_GENERATOR 0x0020 - #endif - #ifndef CO_COROUTINE - #define CO_COROUTINE 0x0080 - #endif -#elif PY_VERSION_HEX >= 0x030B0000 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, - PyObject *code, PyObject *c, PyObject* n, PyObject *v, - PyObject *fv, PyObject *cell, PyObject* fn, - PyObject *name, int fline, PyObject *lnos) { - PyCodeObject *result; - PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); - if (!empty_bytes) return NULL; - result = - #if PY_VERSION_HEX >= 0x030C0000 - PyUnstable_Code_NewWithPosOnlyArgs - #else - PyCode_NewWithPosOnlyArgs - #endif - (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes); - Py_DECREF(empty_bytes); - return result; - } -#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#else - #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#endif -#endif -#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) - #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) -#else - #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) -#endif -#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) - #define __Pyx_Py_Is(x, y) Py_Is(x, y) -#else - #define __Pyx_Py_Is(x, y) ((x) == (y)) -#endif -#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) - #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) -#else - #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) -#endif -#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) - #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) -#else - #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) -#endif -#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) - #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) -#else - #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) -#endif -#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) -#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) -#else - #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) -#endif -#ifndef CO_COROUTINE - #define CO_COROUTINE 0x80 -#endif -#ifndef CO_ASYNC_GENERATOR - #define CO_ASYNC_GENERATOR 0x200 -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef Py_TPFLAGS_SEQUENCE - #define Py_TPFLAGS_SEQUENCE 0 -#endif -#ifndef Py_TPFLAGS_MAPPING - #define Py_TPFLAGS_MAPPING 0 -#endif -#ifndef METH_STACKLESS - #define METH_STACKLESS 0 -#endif -#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) - #ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - #endif - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); - typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #if PY_VERSION_HEX >= 0x030d00A4 - # define __Pyx_PyCFunctionFast PyCFunctionFast - # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords - #else - # define __Pyx_PyCFunctionFast _PyCFunctionFast - # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords - #endif -#endif -#if CYTHON_METH_FASTCALL - #define __Pyx_METH_FASTCALL METH_FASTCALL - #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast - #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords -#else - #define __Pyx_METH_FASTCALL METH_VARARGS - #define __Pyx_PyCFunction_FastCall PyCFunction - #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords -#endif -#if CYTHON_VECTORCALL - #define __pyx_vectorcallfunc vectorcallfunc - #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET - #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) -#elif CYTHON_BACKPORT_VECTORCALL - typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, - size_t nargsf, PyObject *kwnames); - #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) - #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) -#else - #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 - #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) -#endif -#if PY_MAJOR_VERSION >= 0x030900B1 -#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) -#else -#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) -#endif -#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) -#elif !CYTHON_COMPILING_IN_LIMITED_API -#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) -#endif -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) -static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { - return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; -} -#endif -static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) { -#if CYTHON_COMPILING_IN_LIMITED_API - return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; -#else - return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; -#endif -} -#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) -#if __PYX_LIMITED_VERSION_HEX < 0x030900B1 - #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) - typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); -#else - #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) - #define __Pyx_PyCMethod PyCMethod -#endif -#ifndef METH_METHOD - #define METH_METHOD 0x200 -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#if CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_PyThreadState_Current PyThreadState_Get() -#elif !CYTHON_FAST_THREAD_STATE - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#elif PY_VERSION_HEX >= 0x030d00A1 - #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() -#elif PY_VERSION_HEX >= 0x03060000 - #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() -#elif PY_VERSION_HEX >= 0x03000000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#else - #define __Pyx_PyThreadState_Current _PyThreadState_Current -#endif -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) -{ - void *result; - result = PyModule_GetState(op); - if (!result) - Py_FatalError("Couldn't find the module state"); - return result; -} -#endif -#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) -#if CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) -#else - #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) -#endif -#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) -#include "pythread.h" -#define Py_tss_NEEDS_INIT 0 -typedef int Py_tss_t; -static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { - *key = PyThread_create_key(); - return 0; -} -static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { - Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); - *key = Py_tss_NEEDS_INIT; - return key; -} -static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { - PyObject_Free(key); -} -static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { - return *key != Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { - PyThread_delete_key(*key); - *key = Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { - return PyThread_set_key_value(*key, value); -} -static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { - return PyThread_get_key_value(*key); -} -#endif -#if PY_MAJOR_VERSION < 3 - #if CYTHON_COMPILING_IN_PYPY - #if PYPY_VERSION_NUM < 0x07030600 - #if defined(__cplusplus) && __cplusplus >= 201402L - [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] - #elif defined(__GNUC__) || defined(__clang__) - __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) - #elif defined(_MSC_VER) - __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) - #endif - static CYTHON_INLINE int PyGILState_Check(void) { - return 0; - } - #else // PYPY_VERSION_NUM < 0x07030600 - #endif // PYPY_VERSION_NUM < 0x07030600 - #else - static CYTHON_INLINE int PyGILState_Check(void) { - PyThreadState * tstate = _PyThreadState_Current; - return tstate && (tstate == PyGILState_GetThisThreadState()); - } - #endif -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized) -#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) -#else -#define __Pyx_PyDict_NewPresized(n) PyDict_New() -#endif -#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) -static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { - PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); - if (res == NULL) PyErr_Clear(); - return res; -} -#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) -#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError -#define __Pyx_PyDict_GetItemStr PyDict_GetItem -#else -static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { -#if CYTHON_COMPILING_IN_PYPY - return PyDict_GetItem(dict, name); -#else - PyDictEntry *ep; - PyDictObject *mp = (PyDictObject*) dict; - long hash = ((PyStringObject *) name)->ob_shash; - assert(hash != -1); - ep = (mp->ma_lookup)(mp, name, hash); - if (ep == NULL) { - return NULL; - } - return ep->me_value; -#endif -} -#define __Pyx_PyDict_GetItemStr PyDict_GetItem -#endif -#if CYTHON_USE_TYPE_SLOTS - #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) - #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) - #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) -#else - #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) - #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) - #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next -#endif -#if CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) -#else - #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) -#endif -#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 -#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ - PyTypeObject *type = Py_TYPE((PyObject*)obj);\ - assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ - PyObject_GC_Del(obj);\ - Py_DECREF(type);\ -} -#else -#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) -#endif -#if CYTHON_COMPILING_IN_LIMITED_API - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) - #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) - #define __Pyx_PyUnicode_DATA(u) ((void*)u) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) -#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #if PY_VERSION_HEX >= 0x030C0000 - #define __Pyx_PyUnicode_READY(op) (0) - #else - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #endif - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) - #if PY_VERSION_HEX >= 0x030C0000 - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) - #else - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) - #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) - #endif - #endif -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) - #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #if !defined(PyUnicode_DecodeUnicodeEscape) - #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) - #endif - #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) - #undef PyUnicode_Contains - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) - #endif - #if !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) - #endif - #if !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) - #endif -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#ifndef PyObject_Unicode - #define PyObject_Unicode PyObject_Str -#endif -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#if CYTHON_COMPILING_IN_CPYTHON - #define __Pyx_PySequence_ListKeepNew(obj)\ - (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) -#else - #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) -#endif -#if PY_VERSION_HEX >= 0x030900A4 - #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) - #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) -#else - #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) - #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) -#endif -#if CYTHON_ASSUME_SAFE_MACROS - #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) - #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) - #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) - #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) - #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) - #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) - #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) - #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) - #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) -#else - #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) - #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) - #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) - #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) - #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) - #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) - #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) - #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) - #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) -#endif -#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 - #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) -#else - static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { - PyObject *module = PyImport_AddModule(name); - Py_XINCREF(module); - return module; - } -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define __Pyx_Py3Int_Check(op) PyLong_Check(op) - #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#else - #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) - #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef __Pyx_PyAsyncMethodsStruct - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; -#endif - -#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) - #if !defined(_USE_MATH_DEFINES) - #define _USE_MATH_DEFINES - #endif -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - -#define __PYX_MARK_ERR_POS(f_index, lineno) \ - { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } -#define __PYX_ERR(f_index, lineno, Ln_error) \ - { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } - -#ifdef CYTHON_EXTERN_C - #undef __PYX_EXTERN_C - #define __PYX_EXTERN_C CYTHON_EXTERN_C -#elif defined(__PYX_EXTERN_C) - #ifdef _MSC_VER - #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") - #else - #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. - #endif -#else - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__pylablib__devices__Andor__utils -#define __PYX_HAVE_API__pylablib__devices__Andor__utils -/* Early includes */ -#include -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { - return (size_t) i < (size_t) limit; -} -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) - #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -#define __Pyx_PySequence_Tuple(obj)\ - (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #if PY_VERSION_HEX >= 0x030C00A7 - #ifndef _PyLong_SIGN_MASK - #define _PyLong_SIGN_MASK 3 - #endif - #ifndef _PyLong_NON_SIZE_BITS - #define _PyLong_NON_SIZE_BITS 3 - #endif - #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) - #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) - #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) - #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) - #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) - #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) - #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) - #define __Pyx_PyLong_SignedDigitCount(x)\ - ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) - #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) - #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) - #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) - #else - #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) - #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) - #endif - typedef Py_ssize_t __Pyx_compact_pylong; - typedef size_t __Pyx_compact_upylong; - #else - #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) - #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) - #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) - #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) - #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) - #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) - #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) - #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) - #define __Pyx_PyLong_CompactValue(x)\ - ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) - typedef sdigit __Pyx_compact_pylong; - typedef digit __Pyx_compact_upylong; - #endif - #if PY_VERSION_HEX >= 0x030C00A5 - #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) - #else - #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) - #endif -#endif -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -#include -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = (char) c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -#include -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ -static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } - -#if !CYTHON_USE_MODULE_STATE -static PyObject *__pyx_m = NULL; -#endif -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm = __FILE__; -static const char *__pyx_filename; - -/* #### Code section: filename_table ### */ - -static const char *__pyx_f[] = { - "utils.pyx", -}; -/* #### Code section: utility_code_proto_before_types ### */ -/* NoFastGil.proto */ -#define __Pyx_PyGILState_Ensure PyGILState_Ensure -#define __Pyx_PyGILState_Release PyGILState_Release -#define __Pyx_FastGIL_Remember() -#define __Pyx_FastGIL_Forget() -#define __Pyx_FastGilFuncInit() - -/* ForceInitThreads.proto */ -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif - -/* #### Code section: numeric_typedefs ### */ -/* #### Code section: complex_type_declarations ### */ -/* #### Code section: type_declarations ### */ - -/*--- Type declarations ---*/ - -/* "pylablib/devices/Andor/utils.pyx":4 - * from libc.string cimport memcpy - * - * ctypedef int (*pAT_WaitBuffer)(int Hndl, void **Ptr, int *PtrSize, unsigned int Timeout) noexcept nogil # <<<<<<<<<<<<<< - * ctypedef int (*pAT_QueueBuffer)(int Hndl, void *Ptr, int PtrSize) noexcept nogil - * - */ -typedef int (*__pyx_t_8pylablib_7devices_5Andor_5utils_pAT_WaitBuffer)(int, void **, int *, unsigned int); - -/* "pylablib/devices/Andor/utils.pyx":5 - * - * ctypedef int (*pAT_WaitBuffer)(int Hndl, void **Ptr, int *PtrSize, unsigned int Timeout) noexcept nogil - * ctypedef int (*pAT_QueueBuffer)(int Hndl, void *Ptr, int PtrSize) noexcept nogil # <<<<<<<<<<<<<< - * - * @cython.cdivision(True) - */ -typedef int (*__pyx_t_8pylablib_7devices_5Andor_5utils_pAT_QueueBuffer)(int, void *, int); -/* #### Code section: utility_code_proto ### */ - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, Py_ssize_t); - void (*DECREF)(void*, PyObject*, Py_ssize_t); - void (*GOTREF)(void*, PyObject*, Py_ssize_t); - void (*GIVEREF)(void*, PyObject*, Py_ssize_t); - void* (*SetupContext)(const char*, Py_ssize_t, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ - } - #define __Pyx_RefNannyFinishContextNogil() {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __Pyx_RefNannyFinishContext();\ - PyGILState_Release(__pyx_gilstate_save);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) - #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() -#endif - #define __Pyx_RefNannyFinishContextNogil() {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __Pyx_RefNannyFinishContext();\ - PyGILState_Release(__pyx_gilstate_save);\ - } - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) - #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContextNogil() - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_Py_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; Py_XDECREF(tmp);\ - } while (0) -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#if PY_VERSION_HEX >= 0x030C00A6 -#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) -#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) -#else -#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) -#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) -#endif -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) -#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* TupleAndListFromArray.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); -static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); -#endif - -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - -/* fastcall.proto */ -#if CYTHON_AVOID_BORROWED_REFS - #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) -#elif CYTHON_ASSUME_SAFE_MACROS - #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) -#else - #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) -#endif -#if CYTHON_AVOID_BORROWED_REFS - #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) - #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) -#else - #define __Pyx_Arg_NewRef_VARARGS(arg) arg - #define __Pyx_Arg_XDECREF_VARARGS(arg) -#endif -#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) -#define __Pyx_KwValues_VARARGS(args, nargs) NULL -#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) -#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) -#if CYTHON_METH_FASTCALL - #define __Pyx_Arg_FASTCALL(args, i) args[i] - #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) - #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) - static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 - CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); - #else - #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) - #endif - #define __Pyx_Arg_NewRef_FASTCALL(arg) arg /* no-op, __Pyx_Arg_FASTCALL is direct and this needs - to have the same reference counting */ - #define __Pyx_Arg_XDECREF_FASTCALL(arg) -#else - #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS - #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS - #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS - #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS - #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS - #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) - #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS -#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) -#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) -#else -#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) -#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) -#endif - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, - PyObject **argnames[], - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, - const char* function_name); - -/* ErrOccurredWithGIL.proto */ -static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void); - -/* IncludeStructmemberH.proto */ -#include - -/* FixUpExtensionType.proto */ -#if CYTHON_USE_TYPE_SPECS -static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); -#endif - -/* FetchSharedCythonModule.proto */ -static PyObject *__Pyx_FetchSharedCythonABIModule(void); - -/* FetchCommonType.proto */ -#if !CYTHON_USE_TYPE_SPECS -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); -#else -static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); -#endif - -/* PyMethodNew.proto */ -#if CYTHON_COMPILING_IN_LIMITED_API -static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { - PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; - CYTHON_UNUSED_VAR(typ); - if (!self) - return __Pyx_NewRef(func); - typesModule = PyImport_ImportModule("types"); - if (!typesModule) return NULL; - methodType = PyObject_GetAttrString(typesModule, "MethodType"); - Py_DECREF(typesModule); - if (!methodType) return NULL; - result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); - Py_DECREF(methodType); - return result; -} -#elif PY_MAJOR_VERSION >= 3 -static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { - CYTHON_UNUSED_VAR(typ); - if (!self) - return __Pyx_NewRef(func); - return PyMethod_New(func, self); -} -#else - #define __Pyx_PyMethod_New PyMethod_New -#endif - -/* PyVectorcallFastCallDict.proto */ -#if CYTHON_METH_FASTCALL -static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); -#endif - -/* CythonFunctionShared.proto */ -#define __Pyx_CyFunction_USED -#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 -#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 -#define __Pyx_CYFUNCTION_CCLASS 0x04 -#define __Pyx_CYFUNCTION_COROUTINE 0x08 -#define __Pyx_CyFunction_GetClosure(f)\ - (((__pyx_CyFunctionObject *) (f))->func_closure) -#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) -#else - #define __Pyx_CyFunction_GetClassObj(f)\ - ((PyObject*) ((PyCMethodObject *) (f))->mm_class) -#endif -#define __Pyx_CyFunction_SetClassObj(f, classobj)\ - __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) -#define __Pyx_CyFunction_Defaults(type, f)\ - ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) -#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ - ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) -typedef struct { -#if CYTHON_COMPILING_IN_LIMITED_API - PyObject_HEAD - PyObject *func; -#elif PY_VERSION_HEX < 0x030900B1 - PyCFunctionObject func; -#else - PyCMethodObject func; -#endif -#if CYTHON_BACKPORT_VECTORCALL - __pyx_vectorcallfunc func_vectorcall; -#endif -#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API - PyObject *func_weakreflist; -#endif - PyObject *func_dict; - PyObject *func_name; - PyObject *func_qualname; - PyObject *func_doc; - PyObject *func_globals; - PyObject *func_code; - PyObject *func_closure; -#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API - PyObject *func_classobj; -#endif - void *defaults; - int defaults_pyobjects; - size_t defaults_size; - int flags; - PyObject *defaults_tuple; - PyObject *defaults_kwdict; - PyObject *(*defaults_getter)(PyObject *); - PyObject *func_annotations; - PyObject *func_is_coroutine; -} __pyx_CyFunctionObject; -#undef __Pyx_CyOrPyCFunction_Check -#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) -#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) -#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) -static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc); -#undef __Pyx_IsSameCFunction -#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) -static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *closure, - PyObject *module, PyObject *globals, - PyObject* code); -static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, - size_t size, - int pyobjects); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, - PyObject *tuple); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, - PyObject *dict); -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, - PyObject *dict); -static int __pyx_CyFunction_init(PyObject *module); -#if CYTHON_METH_FASTCALL -static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); -static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); -static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); -static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); -#if CYTHON_BACKPORT_VECTORCALL -#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) -#else -#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) -#endif -#endif - -/* CythonFunction.proto */ -static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *closure, - PyObject *module, PyObject *globals, - PyObject* code); - -/* PyDictVersioning.proto */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif - -/* CLineInTraceback.proto */ -#ifdef CYTHON_CLINE_IN_TRACEBACK -#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) -#else -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); -#endif - -/* CodeObjectCache.proto */ -#if !CYTHON_COMPILING_IN_LIMITED_API -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); -#endif - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* GCCDiagnostics.proto */ -#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -#define __Pyx_HAS_GCC_DIAGNOSTIC -#endif - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value); - -/* FormatTypeName.proto */ -#if CYTHON_COMPILING_IN_LIMITED_API -typedef PyObject *__Pyx_TypeName; -#define __Pyx_FMT_TYPENAME "%U" -static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); -#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) -#else -typedef const char *__Pyx_TypeName; -#define __Pyx_FMT_TYPENAME "%.200s" -#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) -#define __Pyx_DECREF_TypeName(obj) -#endif - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* FastTypeChecks.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) -#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); -#else -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) -#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) -#endif -#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) - -/* CheckBinaryVersion.proto */ -static unsigned long __Pyx_get_runtime_version(void); -static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - -/* #### Code section: module_declarations ### */ - -/* Module declarations from "cython" */ - -/* Module declarations from "libc.string" */ - -/* Module declarations from "pylablib.devices.Andor.utils" */ -static int __pyx_f_8pylablib_7devices_5Andor_5utils_clooper(int, unsigned int, void **, int, int, int *, unsigned int *, __pyx_t_8pylablib_7devices_5Andor_5utils_pAT_WaitBuffer, __pyx_t_8pylablib_7devices_5Andor_5utils_pAT_QueueBuffer); /*proto*/ -static int __pyx_f_8pylablib_7devices_5Andor_5utils_ccopyframes(unsigned int, char **, unsigned int, unsigned int, unsigned int, unsigned int, char *); /*proto*/ -/* #### Code section: typeinfo ### */ -/* #### Code section: before_global_var ### */ -#define __Pyx_MODULE_NAME "pylablib.devices.Andor.utils" -extern int __pyx_module_is_main_pylablib__devices__Andor__utils; -int __pyx_module_is_main_pylablib__devices__Andor__utils = 0; - -/* Implementation of "pylablib.devices.Andor.utils" */ -/* #### Code section: global_var ### */ -static PyObject *__pyx_builtin_range; -/* #### Code section: string_decls ### */ -static const char __pyx_k__5[] = "?"; -static const char __pyx_k_dst[] = "dst"; -static const char __pyx_k_off[] = "off"; -static const char __pyx_k_Hndl[] = "Hndl"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_name[] = "__name__"; -static const char __pyx_k_ncpy[] = "ncpy"; -static const char __pyx_k_size[] = "size"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_esize[] = "esize"; -static const char __pyx_k_nbuff[] = "nbuff"; -static const char __pyx_k_nread[] = "nread"; -static const char __pyx_k_range[] = "range"; -static const char __pyx_k_start[] = "start"; -static const char __pyx_k_looper[] = "looper"; -static const char __pyx_k_queued[] = "queued"; -static const char __pyx_k_result[] = "result"; -static const char __pyx_k_looping[] = "looping"; -static const char __pyx_k_hbuffers[] = "hbuffers"; -static const char __pyx_k_utils_pyx[] = "utils.pyx"; -static const char __pyx_k_copyframes[] = "copyframes"; -static const char __pyx_k_is_coroutine[] = "_is_coroutine"; -static const char __pyx_k_AT_WaitBuffer[] = "AT_WaitBuffer"; -static const char __pyx_k_AT_QueueBuffer[] = "AT_QueueBuffer"; -static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; -static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; -static const char __pyx_k_pylablib_devices_Andor_utils[] = "pylablib.devices.Andor.utils"; -/* #### Code section: decls ### */ -static PyObject *__pyx_pf_8pylablib_7devices_5Andor_5utils_looper(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_Hndl, unsigned int __pyx_v_nbuff, size_t __pyx_v_hbuffers, int __pyx_v_esize, int __pyx_v_queued, size_t __pyx_v_looping, size_t __pyx_v_nread, size_t __pyx_v_AT_WaitBuffer, size_t __pyx_v_AT_QueueBuffer); /* proto */ -static PyObject *__pyx_pf_8pylablib_7devices_5Andor_5utils_2copyframes(CYTHON_UNUSED PyObject *__pyx_self, unsigned int __pyx_v_nbuff, size_t __pyx_v_hbuffers, unsigned int __pyx_v_size, unsigned int __pyx_v_start, unsigned int __pyx_v_ncpy, unsigned int __pyx_v_off, size_t __pyx_v_dst); /* proto */ -/* #### Code section: late_includes ### */ -/* #### Code section: module_state ### */ -typedef struct { - PyObject *__pyx_d; - PyObject *__pyx_b; - PyObject *__pyx_cython_runtime; - PyObject *__pyx_empty_tuple; - PyObject *__pyx_empty_bytes; - PyObject *__pyx_empty_unicode; - #ifdef __Pyx_CyFunction_USED - PyTypeObject *__pyx_CyFunctionType; - #endif - #ifdef __Pyx_FusedFunction_USED - PyTypeObject *__pyx_FusedFunctionType; - #endif - #ifdef __Pyx_Generator_USED - PyTypeObject *__pyx_GeneratorType; - #endif - #ifdef __Pyx_IterableCoroutine_USED - PyTypeObject *__pyx_IterableCoroutineType; - #endif - #ifdef __Pyx_Coroutine_USED - PyTypeObject *__pyx_CoroutineAwaitType; - #endif - #ifdef __Pyx_Coroutine_USED - PyTypeObject *__pyx_CoroutineType; - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - #endif - PyObject *__pyx_n_s_AT_QueueBuffer; - PyObject *__pyx_n_s_AT_WaitBuffer; - PyObject *__pyx_n_s_Hndl; - PyObject *__pyx_n_s__5; - PyObject *__pyx_n_s_asyncio_coroutines; - PyObject *__pyx_n_s_cline_in_traceback; - PyObject *__pyx_n_s_copyframes; - PyObject *__pyx_n_s_dst; - PyObject *__pyx_n_s_esize; - PyObject *__pyx_n_s_hbuffers; - PyObject *__pyx_n_s_is_coroutine; - PyObject *__pyx_n_s_looper; - PyObject *__pyx_n_s_looping; - PyObject *__pyx_n_s_main; - PyObject *__pyx_n_s_name; - PyObject *__pyx_n_s_nbuff; - PyObject *__pyx_n_s_ncpy; - PyObject *__pyx_n_s_nread; - PyObject *__pyx_n_s_off; - PyObject *__pyx_n_s_pylablib_devices_Andor_utils; - PyObject *__pyx_n_s_queued; - PyObject *__pyx_n_s_range; - PyObject *__pyx_n_s_result; - PyObject *__pyx_n_s_size; - PyObject *__pyx_n_s_start; - PyObject *__pyx_n_s_test; - PyObject *__pyx_kp_s_utils_pyx; - PyObject *__pyx_tuple_; - PyObject *__pyx_tuple__3; - PyObject *__pyx_codeobj__2; - PyObject *__pyx_codeobj__4; -} __pyx_mstate; - -#if CYTHON_USE_MODULE_STATE -#ifdef __cplusplus -namespace { - extern struct PyModuleDef __pyx_moduledef; -} /* anonymous namespace */ -#else -static struct PyModuleDef __pyx_moduledef; -#endif - -#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) - -#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) - -#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) -#else -static __pyx_mstate __pyx_mstate_global_static = -#ifdef __cplusplus - {}; -#else - {0}; -#endif -static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; -#endif -/* #### Code section: module_state_clear ### */ -#if CYTHON_USE_MODULE_STATE -static int __pyx_m_clear(PyObject *m) { - __pyx_mstate *clear_module_state = __pyx_mstate(m); - if (!clear_module_state) return 0; - Py_CLEAR(clear_module_state->__pyx_d); - Py_CLEAR(clear_module_state->__pyx_b); - Py_CLEAR(clear_module_state->__pyx_cython_runtime); - Py_CLEAR(clear_module_state->__pyx_empty_tuple); - Py_CLEAR(clear_module_state->__pyx_empty_bytes); - Py_CLEAR(clear_module_state->__pyx_empty_unicode); - #ifdef __Pyx_CyFunction_USED - Py_CLEAR(clear_module_state->__pyx_CyFunctionType); - #endif - #ifdef __Pyx_FusedFunction_USED - Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); - #endif - Py_CLEAR(clear_module_state->__pyx_n_s_AT_QueueBuffer); - Py_CLEAR(clear_module_state->__pyx_n_s_AT_WaitBuffer); - Py_CLEAR(clear_module_state->__pyx_n_s_Hndl); - Py_CLEAR(clear_module_state->__pyx_n_s__5); - Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); - Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); - Py_CLEAR(clear_module_state->__pyx_n_s_copyframes); - Py_CLEAR(clear_module_state->__pyx_n_s_dst); - Py_CLEAR(clear_module_state->__pyx_n_s_esize); - Py_CLEAR(clear_module_state->__pyx_n_s_hbuffers); - Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); - Py_CLEAR(clear_module_state->__pyx_n_s_looper); - Py_CLEAR(clear_module_state->__pyx_n_s_looping); - Py_CLEAR(clear_module_state->__pyx_n_s_main); - Py_CLEAR(clear_module_state->__pyx_n_s_name); - Py_CLEAR(clear_module_state->__pyx_n_s_nbuff); - Py_CLEAR(clear_module_state->__pyx_n_s_ncpy); - Py_CLEAR(clear_module_state->__pyx_n_s_nread); - Py_CLEAR(clear_module_state->__pyx_n_s_off); - Py_CLEAR(clear_module_state->__pyx_n_s_pylablib_devices_Andor_utils); - Py_CLEAR(clear_module_state->__pyx_n_s_queued); - Py_CLEAR(clear_module_state->__pyx_n_s_range); - Py_CLEAR(clear_module_state->__pyx_n_s_result); - Py_CLEAR(clear_module_state->__pyx_n_s_size); - Py_CLEAR(clear_module_state->__pyx_n_s_start); - Py_CLEAR(clear_module_state->__pyx_n_s_test); - Py_CLEAR(clear_module_state->__pyx_kp_s_utils_pyx); - Py_CLEAR(clear_module_state->__pyx_tuple_); - Py_CLEAR(clear_module_state->__pyx_tuple__3); - Py_CLEAR(clear_module_state->__pyx_codeobj__2); - Py_CLEAR(clear_module_state->__pyx_codeobj__4); - return 0; -} -#endif -/* #### Code section: module_state_traverse ### */ -#if CYTHON_USE_MODULE_STATE -static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { - __pyx_mstate *traverse_module_state = __pyx_mstate(m); - if (!traverse_module_state) return 0; - Py_VISIT(traverse_module_state->__pyx_d); - Py_VISIT(traverse_module_state->__pyx_b); - Py_VISIT(traverse_module_state->__pyx_cython_runtime); - Py_VISIT(traverse_module_state->__pyx_empty_tuple); - Py_VISIT(traverse_module_state->__pyx_empty_bytes); - Py_VISIT(traverse_module_state->__pyx_empty_unicode); - #ifdef __Pyx_CyFunction_USED - Py_VISIT(traverse_module_state->__pyx_CyFunctionType); - #endif - #ifdef __Pyx_FusedFunction_USED - Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); - #endif - Py_VISIT(traverse_module_state->__pyx_n_s_AT_QueueBuffer); - Py_VISIT(traverse_module_state->__pyx_n_s_AT_WaitBuffer); - Py_VISIT(traverse_module_state->__pyx_n_s_Hndl); - Py_VISIT(traverse_module_state->__pyx_n_s__5); - Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); - Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); - Py_VISIT(traverse_module_state->__pyx_n_s_copyframes); - Py_VISIT(traverse_module_state->__pyx_n_s_dst); - Py_VISIT(traverse_module_state->__pyx_n_s_esize); - Py_VISIT(traverse_module_state->__pyx_n_s_hbuffers); - Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); - Py_VISIT(traverse_module_state->__pyx_n_s_looper); - Py_VISIT(traverse_module_state->__pyx_n_s_looping); - Py_VISIT(traverse_module_state->__pyx_n_s_main); - Py_VISIT(traverse_module_state->__pyx_n_s_name); - Py_VISIT(traverse_module_state->__pyx_n_s_nbuff); - Py_VISIT(traverse_module_state->__pyx_n_s_ncpy); - Py_VISIT(traverse_module_state->__pyx_n_s_nread); - Py_VISIT(traverse_module_state->__pyx_n_s_off); - Py_VISIT(traverse_module_state->__pyx_n_s_pylablib_devices_Andor_utils); - Py_VISIT(traverse_module_state->__pyx_n_s_queued); - Py_VISIT(traverse_module_state->__pyx_n_s_range); - Py_VISIT(traverse_module_state->__pyx_n_s_result); - Py_VISIT(traverse_module_state->__pyx_n_s_size); - Py_VISIT(traverse_module_state->__pyx_n_s_start); - Py_VISIT(traverse_module_state->__pyx_n_s_test); - Py_VISIT(traverse_module_state->__pyx_kp_s_utils_pyx); - Py_VISIT(traverse_module_state->__pyx_tuple_); - Py_VISIT(traverse_module_state->__pyx_tuple__3); - Py_VISIT(traverse_module_state->__pyx_codeobj__2); - Py_VISIT(traverse_module_state->__pyx_codeobj__4); - return 0; -} -#endif -/* #### Code section: module_state_defines ### */ -#define __pyx_d __pyx_mstate_global->__pyx_d -#define __pyx_b __pyx_mstate_global->__pyx_b -#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime -#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple -#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes -#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode -#ifdef __Pyx_CyFunction_USED -#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType -#endif -#ifdef __Pyx_FusedFunction_USED -#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType -#endif -#ifdef __Pyx_Generator_USED -#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType -#endif -#ifdef __Pyx_IterableCoroutine_USED -#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType -#endif -#ifdef __Pyx_Coroutine_USED -#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType -#endif -#ifdef __Pyx_Coroutine_USED -#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#define __pyx_n_s_AT_QueueBuffer __pyx_mstate_global->__pyx_n_s_AT_QueueBuffer -#define __pyx_n_s_AT_WaitBuffer __pyx_mstate_global->__pyx_n_s_AT_WaitBuffer -#define __pyx_n_s_Hndl __pyx_mstate_global->__pyx_n_s_Hndl -#define __pyx_n_s__5 __pyx_mstate_global->__pyx_n_s__5 -#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines -#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback -#define __pyx_n_s_copyframes __pyx_mstate_global->__pyx_n_s_copyframes -#define __pyx_n_s_dst __pyx_mstate_global->__pyx_n_s_dst -#define __pyx_n_s_esize __pyx_mstate_global->__pyx_n_s_esize -#define __pyx_n_s_hbuffers __pyx_mstate_global->__pyx_n_s_hbuffers -#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine -#define __pyx_n_s_looper __pyx_mstate_global->__pyx_n_s_looper -#define __pyx_n_s_looping __pyx_mstate_global->__pyx_n_s_looping -#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main -#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name -#define __pyx_n_s_nbuff __pyx_mstate_global->__pyx_n_s_nbuff -#define __pyx_n_s_ncpy __pyx_mstate_global->__pyx_n_s_ncpy -#define __pyx_n_s_nread __pyx_mstate_global->__pyx_n_s_nread -#define __pyx_n_s_off __pyx_mstate_global->__pyx_n_s_off -#define __pyx_n_s_pylablib_devices_Andor_utils __pyx_mstate_global->__pyx_n_s_pylablib_devices_Andor_utils -#define __pyx_n_s_queued __pyx_mstate_global->__pyx_n_s_queued -#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range -#define __pyx_n_s_result __pyx_mstate_global->__pyx_n_s_result -#define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size -#define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start -#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test -#define __pyx_kp_s_utils_pyx __pyx_mstate_global->__pyx_kp_s_utils_pyx -#define __pyx_tuple_ __pyx_mstate_global->__pyx_tuple_ -#define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3 -#define __pyx_codeobj__2 __pyx_mstate_global->__pyx_codeobj__2 -#define __pyx_codeobj__4 __pyx_mstate_global->__pyx_codeobj__4 -/* #### Code section: module_code ### */ - -/* "pylablib/devices/Andor/utils.pyx":8 - * - * @cython.cdivision(True) - * cdef int clooper(int Hndl, unsigned nbuff, void **hbuffers, int esize, int queued, int *looping, unsigned *nread, # <<<<<<<<<<<<<< - * pAT_WaitBuffer AT_WaitBuffer, pAT_QueueBuffer AT_QueueBuffer) nogil: - * cdef int size=0 - */ - -static int __pyx_f_8pylablib_7devices_5Andor_5utils_clooper(int __pyx_v_Hndl, unsigned int __pyx_v_nbuff, void **__pyx_v_hbuffers, int __pyx_v_esize, int __pyx_v_queued, int *__pyx_v_looping, unsigned int *__pyx_v_nread, __pyx_t_8pylablib_7devices_5Andor_5utils_pAT_WaitBuffer __pyx_v_AT_WaitBuffer, __pyx_t_8pylablib_7devices_5Andor_5utils_pAT_QueueBuffer __pyx_v_AT_QueueBuffer) { - int __pyx_v_size; - int __pyx_v_code; - void *__pyx_v_buffer; - int __pyx_r; - int __pyx_t_1; - long __pyx_t_2; - - /* "pylablib/devices/Andor/utils.pyx":10 - * cdef int clooper(int Hndl, unsigned nbuff, void **hbuffers, int esize, int queued, int *looping, unsigned *nread, - * pAT_WaitBuffer AT_WaitBuffer, pAT_QueueBuffer AT_QueueBuffer) nogil: - * cdef int size=0 # <<<<<<<<<<<<<< - * cdef int code=0 - * cdef void* buffer=(0) - */ - __pyx_v_size = 0; - - /* "pylablib/devices/Andor/utils.pyx":11 - * pAT_WaitBuffer AT_WaitBuffer, pAT_QueueBuffer AT_QueueBuffer) nogil: - * cdef int size=0 - * cdef int code=0 # <<<<<<<<<<<<<< - * cdef void* buffer=(0) - * while looping[0]: - */ - __pyx_v_code = 0; - - /* "pylablib/devices/Andor/utils.pyx":12 - * cdef int size=0 - * cdef int code=0 - * cdef void* buffer=(0) # <<<<<<<<<<<<<< - * while looping[0]: - * code=AT_WaitBuffer(Hndl,&buffer,&size,300) - */ - __pyx_v_buffer = ((void *)0); - - /* "pylablib/devices/Andor/utils.pyx":13 - * cdef int code=0 - * cdef void* buffer=(0) - * while looping[0]: # <<<<<<<<<<<<<< - * code=AT_WaitBuffer(Hndl,&buffer,&size,300) - * if code==13 or code==11: # AT_ERR_TIMEDOUT or AT_ERR_NODATA - */ - while (1) { - __pyx_t_1 = ((__pyx_v_looping[0]) != 0); - if (!__pyx_t_1) break; - - /* "pylablib/devices/Andor/utils.pyx":14 - * cdef void* buffer=(0) - * while looping[0]: - * code=AT_WaitBuffer(Hndl,&buffer,&size,300) # <<<<<<<<<<<<<< - * if code==13 or code==11: # AT_ERR_TIMEDOUT or AT_ERR_NODATA - * continue - */ - __pyx_v_code = __pyx_v_AT_WaitBuffer(__pyx_v_Hndl, (&__pyx_v_buffer), (&__pyx_v_size), 0x12C); - - /* "pylablib/devices/Andor/utils.pyx":15 - * while looping[0]: - * code=AT_WaitBuffer(Hndl,&buffer,&size,300) - * if code==13 or code==11: # AT_ERR_TIMEDOUT or AT_ERR_NODATA # <<<<<<<<<<<<<< - * continue - * if code: - */ - switch (__pyx_v_code) { - case 13: - case 11: - - /* "pylablib/devices/Andor/utils.pyx":16 - * code=AT_WaitBuffer(Hndl,&buffer,&size,300) - * if code==13 or code==11: # AT_ERR_TIMEDOUT or AT_ERR_NODATA - * continue # <<<<<<<<<<<<<< - * if code: - * return code - */ - goto __pyx_L3_continue; - - /* "pylablib/devices/Andor/utils.pyx":15 - * while looping[0]: - * code=AT_WaitBuffer(Hndl,&buffer,&size,300) - * if code==13 or code==11: # AT_ERR_TIMEDOUT or AT_ERR_NODATA # <<<<<<<<<<<<<< - * continue - * if code: - */ - break; - default: break; - } - - /* "pylablib/devices/Andor/utils.pyx":17 - * if code==13 or code==11: # AT_ERR_TIMEDOUT or AT_ERR_NODATA - * continue - * if code: # <<<<<<<<<<<<<< - * return code - * if size!=esize: - */ - __pyx_t_1 = (__pyx_v_code != 0); - if (__pyx_t_1) { - - /* "pylablib/devices/Andor/utils.pyx":18 - * continue - * if code: - * return code # <<<<<<<<<<<<<< - * if size!=esize: - * return -1 - */ - __pyx_r = __pyx_v_code; - goto __pyx_L0; - - /* "pylablib/devices/Andor/utils.pyx":17 - * if code==13 or code==11: # AT_ERR_TIMEDOUT or AT_ERR_NODATA - * continue - * if code: # <<<<<<<<<<<<<< - * return code - * if size!=esize: - */ - } - - /* "pylablib/devices/Andor/utils.pyx":19 - * if code: - * return code - * if size!=esize: # <<<<<<<<<<<<<< - * return -1 - * AT_QueueBuffer(Hndl,hbuffers[(nread[0]+queued)%nbuff],esize) - */ - __pyx_t_1 = (__pyx_v_size != __pyx_v_esize); - if (__pyx_t_1) { - - /* "pylablib/devices/Andor/utils.pyx":20 - * return code - * if size!=esize: - * return -1 # <<<<<<<<<<<<<< - * AT_QueueBuffer(Hndl,hbuffers[(nread[0]+queued)%nbuff],esize) - * nread[0]+=1 - */ - __pyx_r = -1; - goto __pyx_L0; - - /* "pylablib/devices/Andor/utils.pyx":19 - * if code: - * return code - * if size!=esize: # <<<<<<<<<<<<<< - * return -1 - * AT_QueueBuffer(Hndl,hbuffers[(nread[0]+queued)%nbuff],esize) - */ - } - - /* "pylablib/devices/Andor/utils.pyx":21 - * if size!=esize: - * return -1 - * AT_QueueBuffer(Hndl,hbuffers[(nread[0]+queued)%nbuff],esize) # <<<<<<<<<<<<<< - * nread[0]+=1 - * return code - */ - (void)(__pyx_v_AT_QueueBuffer(__pyx_v_Hndl, (__pyx_v_hbuffers[(((__pyx_v_nread[0]) + __pyx_v_queued) % __pyx_v_nbuff)]), __pyx_v_esize)); - - /* "pylablib/devices/Andor/utils.pyx":22 - * return -1 - * AT_QueueBuffer(Hndl,hbuffers[(nread[0]+queued)%nbuff],esize) - * nread[0]+=1 # <<<<<<<<<<<<<< - * return code - * - */ - __pyx_t_2 = 0; - (__pyx_v_nread[__pyx_t_2]) = ((__pyx_v_nread[__pyx_t_2]) + 1); - __pyx_L3_continue:; - } - - /* "pylablib/devices/Andor/utils.pyx":23 - * AT_QueueBuffer(Hndl,hbuffers[(nread[0]+queued)%nbuff],esize) - * nread[0]+=1 - * return code # <<<<<<<<<<<<<< - * - * def looper(int Hndl, unsigned nbuff, size_t hbuffers, int esize, int queued, size_t looping, size_t nread, - */ - __pyx_r = __pyx_v_code; - goto __pyx_L0; - - /* "pylablib/devices/Andor/utils.pyx":8 - * - * @cython.cdivision(True) - * cdef int clooper(int Hndl, unsigned nbuff, void **hbuffers, int esize, int queued, int *looping, unsigned *nread, # <<<<<<<<<<<<<< - * pAT_WaitBuffer AT_WaitBuffer, pAT_QueueBuffer AT_QueueBuffer) nogil: - * cdef int size=0 - */ - - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "pylablib/devices/Andor/utils.pyx":25 - * return code - * - * def looper(int Hndl, unsigned nbuff, size_t hbuffers, int esize, int queued, size_t looping, size_t nread, # <<<<<<<<<<<<<< - * size_t AT_WaitBuffer, size_t AT_QueueBuffer): - * cdef int result=0 - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8pylablib_7devices_5Andor_5utils_1looper(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyMethodDef __pyx_mdef_8pylablib_7devices_5Andor_5utils_1looper = {"looper", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylablib_7devices_5Andor_5utils_1looper, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8pylablib_7devices_5Andor_5utils_1looper(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - int __pyx_v_Hndl; - unsigned int __pyx_v_nbuff; - size_t __pyx_v_hbuffers; - int __pyx_v_esize; - int __pyx_v_queued; - size_t __pyx_v_looping; - size_t __pyx_v_nread; - size_t __pyx_v_AT_WaitBuffer; - size_t __pyx_v_AT_QueueBuffer; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED Py_ssize_t __pyx_nargs; - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("looper (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; - #endif - #endif - __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Hndl,&__pyx_n_s_nbuff,&__pyx_n_s_hbuffers,&__pyx_n_s_esize,&__pyx_n_s_queued,&__pyx_n_s_looping,&__pyx_n_s_nread,&__pyx_n_s_AT_WaitBuffer,&__pyx_n_s_AT_QueueBuffer,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_Hndl)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nbuff)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("looper", 1, 9, 9, 1); __PYX_ERR(0, 25, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_hbuffers)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("looper", 1, 9, 9, 2); __PYX_ERR(0, 25, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_esize)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("looper", 1, 9, 9, 3); __PYX_ERR(0, 25, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_queued)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("looper", 1, 9, 9, 4); __PYX_ERR(0, 25, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_looping)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("looper", 1, 9, 9, 5); __PYX_ERR(0, 25, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nread)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("looper", 1, 9, 9, 6); __PYX_ERR(0, 25, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_AT_WaitBuffer)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("looper", 1, 9, 9, 7); __PYX_ERR(0, 25, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_AT_QueueBuffer)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("looper", 1, 9, 9, 8); __PYX_ERR(0, 25, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "looper") < 0)) __PYX_ERR(0, 25, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 9)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); - values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); - values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); - values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); - values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); - values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); - } - __pyx_v_Hndl = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_Hndl == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - __pyx_v_nbuff = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_nbuff == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - __pyx_v_hbuffers = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_hbuffers == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - __pyx_v_esize = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_esize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - __pyx_v_queued = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_queued == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - __pyx_v_looping = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_looping == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - __pyx_v_nread = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_nread == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) - __pyx_v_AT_WaitBuffer = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_AT_WaitBuffer == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 26, __pyx_L3_error) - __pyx_v_AT_QueueBuffer = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_AT_QueueBuffer == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 26, __pyx_L3_error) - } - goto __pyx_L6_skip; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("looper", 1, 9, 9, __pyx_nargs); __PYX_ERR(0, 25, __pyx_L3_error) - __pyx_L6_skip:; - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_AddTraceback("pylablib.devices.Andor.utils.looper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8pylablib_7devices_5Andor_5utils_looper(__pyx_self, __pyx_v_Hndl, __pyx_v_nbuff, __pyx_v_hbuffers, __pyx_v_esize, __pyx_v_queued, __pyx_v_looping, __pyx_v_nread, __pyx_v_AT_WaitBuffer, __pyx_v_AT_QueueBuffer); - - /* function exit code */ - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8pylablib_7devices_5Andor_5utils_looper(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_Hndl, unsigned int __pyx_v_nbuff, size_t __pyx_v_hbuffers, int __pyx_v_esize, int __pyx_v_queued, size_t __pyx_v_looping, size_t __pyx_v_nread, size_t __pyx_v_AT_WaitBuffer, size_t __pyx_v_AT_QueueBuffer) { - int __pyx_v_result; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("looper", 1); - - /* "pylablib/devices/Andor/utils.pyx":27 - * def looper(int Hndl, unsigned nbuff, size_t hbuffers, int esize, int queued, size_t looping, size_t nread, - * size_t AT_WaitBuffer, size_t AT_QueueBuffer): - * cdef int result=0 # <<<<<<<<<<<<<< - * with nogil: - * result=clooper(Hndl,nbuff,hbuffers,esize,queued,looping,nread, - */ - __pyx_v_result = 0; - - /* "pylablib/devices/Andor/utils.pyx":28 - * size_t AT_WaitBuffer, size_t AT_QueueBuffer): - * cdef int result=0 - * with nogil: # <<<<<<<<<<<<<< - * result=clooper(Hndl,nbuff,hbuffers,esize,queued,looping,nread, - * AT_WaitBuffer,AT_QueueBuffer) - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - _save = NULL; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "pylablib/devices/Andor/utils.pyx":29 - * cdef int result=0 - * with nogil: - * result=clooper(Hndl,nbuff,hbuffers,esize,queued,looping,nread, # <<<<<<<<<<<<<< - * AT_WaitBuffer,AT_QueueBuffer) - * return result - */ - __pyx_t_1 = __pyx_f_8pylablib_7devices_5Andor_5utils_clooper(__pyx_v_Hndl, __pyx_v_nbuff, ((void **)__pyx_v_hbuffers), __pyx_v_esize, __pyx_v_queued, ((int *)__pyx_v_looping), ((unsigned int *)__pyx_v_nread), ((__pyx_t_8pylablib_7devices_5Andor_5utils_pAT_WaitBuffer)__pyx_v_AT_WaitBuffer), ((__pyx_t_8pylablib_7devices_5Andor_5utils_pAT_QueueBuffer)__pyx_v_AT_QueueBuffer)); if (unlikely(__pyx_t_1 == ((int)-1) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 29, __pyx_L4_error) - __pyx_v_result = __pyx_t_1; - } - - /* "pylablib/devices/Andor/utils.pyx":28 - * size_t AT_WaitBuffer, size_t AT_QueueBuffer): - * cdef int result=0 - * with nogil: # <<<<<<<<<<<<<< - * result=clooper(Hndl,nbuff,hbuffers,esize,queued,looping,nread, - * AT_WaitBuffer,AT_QueueBuffer) - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } - } - - /* "pylablib/devices/Andor/utils.pyx":31 - * result=clooper(Hndl,nbuff,hbuffers,esize,queued,looping,nread, - * AT_WaitBuffer,AT_QueueBuffer) - * return result # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "pylablib/devices/Andor/utils.pyx":25 - * return code - * - * def looper(int Hndl, unsigned nbuff, size_t hbuffers, int esize, int queued, size_t looping, size_t nread, # <<<<<<<<<<<<<< - * size_t AT_WaitBuffer, size_t AT_QueueBuffer): - * cdef int result=0 - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pylablib.devices.Andor.utils.looper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pylablib/devices/Andor/utils.pyx":34 - * - * - * cdef int ccopyframes(unsigned nbuff, char **hbuffers, unsigned size, unsigned start, unsigned ncpy, unsigned off, char *dst) nogil: # <<<<<<<<<<<<<< - * cdef unsigned i=0 - * for i in range(ncpy): - */ - -static int __pyx_f_8pylablib_7devices_5Andor_5utils_ccopyframes(unsigned int __pyx_v_nbuff, char **__pyx_v_hbuffers, unsigned int __pyx_v_size, unsigned int __pyx_v_start, unsigned int __pyx_v_ncpy, unsigned int __pyx_v_off, char *__pyx_v_dst) { - unsigned int __pyx_v_i; - int __pyx_r; - unsigned int __pyx_t_1; - unsigned int __pyx_t_2; - unsigned int __pyx_t_3; - unsigned int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save; - #endif - - /* "pylablib/devices/Andor/utils.pyx":35 - * - * cdef int ccopyframes(unsigned nbuff, char **hbuffers, unsigned size, unsigned start, unsigned ncpy, unsigned off, char *dst) nogil: - * cdef unsigned i=0 # <<<<<<<<<<<<<< - * for i in range(ncpy): - * memcpy(dst,hbuffers[(start+i)%nbuff]+off,size) - */ - __pyx_v_i = 0; - - /* "pylablib/devices/Andor/utils.pyx":36 - * cdef int ccopyframes(unsigned nbuff, char **hbuffers, unsigned size, unsigned start, unsigned ncpy, unsigned off, char *dst) nogil: - * cdef unsigned i=0 - * for i in range(ncpy): # <<<<<<<<<<<<<< - * memcpy(dst,hbuffers[(start+i)%nbuff]+off,size) - * dst+=size - */ - __pyx_t_1 = __pyx_v_ncpy; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "pylablib/devices/Andor/utils.pyx":37 - * cdef unsigned i=0 - * for i in range(ncpy): - * memcpy(dst,hbuffers[(start+i)%nbuff]+off,size) # <<<<<<<<<<<<<< - * dst+=size - * return 0 - */ - __pyx_t_4 = (__pyx_v_start + __pyx_v_i); - if (unlikely(__pyx_v_nbuff == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 37, __pyx_L1_error) - } - (void)(memcpy(__pyx_v_dst, ((__pyx_v_hbuffers[(__pyx_t_4 % __pyx_v_nbuff)]) + __pyx_v_off), __pyx_v_size)); - - /* "pylablib/devices/Andor/utils.pyx":38 - * for i in range(ncpy): - * memcpy(dst,hbuffers[(start+i)%nbuff]+off,size) - * dst+=size # <<<<<<<<<<<<<< - * return 0 - * - */ - __pyx_v_dst = (__pyx_v_dst + __pyx_v_size); - } - - /* "pylablib/devices/Andor/utils.pyx":39 - * memcpy(dst,hbuffers[(start+i)%nbuff]+off,size) - * dst+=size - * return 0 # <<<<<<<<<<<<<< - * - * def copyframes(unsigned nbuff, size_t hbuffers, unsigned size, unsigned start, unsigned ncpy, unsigned off, size_t dst): - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "pylablib/devices/Andor/utils.pyx":34 - * - * - * cdef int ccopyframes(unsigned nbuff, char **hbuffers, unsigned size, unsigned start, unsigned ncpy, unsigned off, char *dst) nogil: # <<<<<<<<<<<<<< - * cdef unsigned i=0 - * for i in range(ncpy): - */ - - /* function exit code */ - __pyx_L1_error:; - #ifdef WITH_THREAD - __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("pylablib.devices.Andor.utils.ccopyframes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __pyx_L0:; - return __pyx_r; -} - -/* "pylablib/devices/Andor/utils.pyx":41 - * return 0 - * - * def copyframes(unsigned nbuff, size_t hbuffers, unsigned size, unsigned start, unsigned ncpy, unsigned off, size_t dst): # <<<<<<<<<<<<<< - * with nogil: - * ccopyframes(nbuff,hbuffers,size,start,ncpy,off,dst) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8pylablib_7devices_5Andor_5utils_3copyframes(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyMethodDef __pyx_mdef_8pylablib_7devices_5Andor_5utils_3copyframes = {"copyframes", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylablib_7devices_5Andor_5utils_3copyframes, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8pylablib_7devices_5Andor_5utils_3copyframes(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - unsigned int __pyx_v_nbuff; - size_t __pyx_v_hbuffers; - unsigned int __pyx_v_size; - unsigned int __pyx_v_start; - unsigned int __pyx_v_ncpy; - unsigned int __pyx_v_off; - size_t __pyx_v_dst; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED Py_ssize_t __pyx_nargs; - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[7] = {0,0,0,0,0,0,0}; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copyframes (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; - #endif - #endif - __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nbuff,&__pyx_n_s_hbuffers,&__pyx_n_s_size,&__pyx_n_s_start,&__pyx_n_s_ncpy,&__pyx_n_s_off,&__pyx_n_s_dst,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nbuff)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_hbuffers)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("copyframes", 1, 7, 7, 1); __PYX_ERR(0, 41, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("copyframes", 1, 7, 7, 2); __PYX_ERR(0, 41, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("copyframes", 1, 7, 7, 3); __PYX_ERR(0, 41, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ncpy)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("copyframes", 1, 7, 7, 4); __PYX_ERR(0, 41, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_off)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("copyframes", 1, 7, 7, 5); __PYX_ERR(0, 41, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dst)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("copyframes", 1, 7, 7, 6); __PYX_ERR(0, 41, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "copyframes") < 0)) __PYX_ERR(0, 41, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 7)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); - values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); - values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); - values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); - } - __pyx_v_nbuff = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_nbuff == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - __pyx_v_hbuffers = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_hbuffers == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - __pyx_v_size = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - __pyx_v_start = __Pyx_PyInt_As_unsigned_int(values[3]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - __pyx_v_ncpy = __Pyx_PyInt_As_unsigned_int(values[4]); if (unlikely((__pyx_v_ncpy == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - __pyx_v_off = __Pyx_PyInt_As_unsigned_int(values[5]); if (unlikely((__pyx_v_off == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - __pyx_v_dst = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_dst == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - } - goto __pyx_L6_skip; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("copyframes", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 41, __pyx_L3_error) - __pyx_L6_skip:; - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_AddTraceback("pylablib.devices.Andor.utils.copyframes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8pylablib_7devices_5Andor_5utils_2copyframes(__pyx_self, __pyx_v_nbuff, __pyx_v_hbuffers, __pyx_v_size, __pyx_v_start, __pyx_v_ncpy, __pyx_v_off, __pyx_v_dst); - - /* function exit code */ - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8pylablib_7devices_5Andor_5utils_2copyframes(CYTHON_UNUSED PyObject *__pyx_self, unsigned int __pyx_v_nbuff, size_t __pyx_v_hbuffers, unsigned int __pyx_v_size, unsigned int __pyx_v_start, unsigned int __pyx_v_ncpy, unsigned int __pyx_v_off, size_t __pyx_v_dst) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copyframes", 1); - - /* "pylablib/devices/Andor/utils.pyx":42 - * - * def copyframes(unsigned nbuff, size_t hbuffers, unsigned size, unsigned start, unsigned ncpy, unsigned off, size_t dst): - * with nogil: # <<<<<<<<<<<<<< - * ccopyframes(nbuff,hbuffers,size,start,ncpy,off,dst) - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - _save = NULL; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "pylablib/devices/Andor/utils.pyx":43 - * def copyframes(unsigned nbuff, size_t hbuffers, unsigned size, unsigned start, unsigned ncpy, unsigned off, size_t dst): - * with nogil: - * ccopyframes(nbuff,hbuffers,size,start,ncpy,off,dst) # <<<<<<<<<<<<<< - */ - __pyx_t_1 = __pyx_f_8pylablib_7devices_5Andor_5utils_ccopyframes(__pyx_v_nbuff, ((char **)__pyx_v_hbuffers), __pyx_v_size, __pyx_v_start, __pyx_v_ncpy, __pyx_v_off, ((char *)__pyx_v_dst)); if (unlikely(__pyx_t_1 == ((int)-1) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 43, __pyx_L4_error) - } - - /* "pylablib/devices/Andor/utils.pyx":42 - * - * def copyframes(unsigned nbuff, size_t hbuffers, unsigned size, unsigned start, unsigned ncpy, unsigned off, size_t dst): - * with nogil: # <<<<<<<<<<<<<< - * ccopyframes(nbuff,hbuffers,size,start,ncpy,off,dst) - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } - } - - /* "pylablib/devices/Andor/utils.pyx":41 - * return 0 - * - * def copyframes(unsigned nbuff, size_t hbuffers, unsigned size, unsigned start, unsigned ncpy, unsigned off, size_t dst): # <<<<<<<<<<<<<< - * with nogil: - * ccopyframes(nbuff,hbuffers,size,start,ncpy,off,dst) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pylablib.devices.Andor.utils.copyframes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - #define CYTHON_SMALL_CODE __attribute__((cold)) -#else - #define CYTHON_SMALL_CODE -#endif -#endif -/* #### Code section: pystring_table ### */ - -static int __Pyx_CreateStringTabAndInitStrings(void) { - __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_AT_QueueBuffer, __pyx_k_AT_QueueBuffer, sizeof(__pyx_k_AT_QueueBuffer), 0, 0, 1, 1}, - {&__pyx_n_s_AT_WaitBuffer, __pyx_k_AT_WaitBuffer, sizeof(__pyx_k_AT_WaitBuffer), 0, 0, 1, 1}, - {&__pyx_n_s_Hndl, __pyx_k_Hndl, sizeof(__pyx_k_Hndl), 0, 0, 1, 1}, - {&__pyx_n_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 1}, - {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_copyframes, __pyx_k_copyframes, sizeof(__pyx_k_copyframes), 0, 0, 1, 1}, - {&__pyx_n_s_dst, __pyx_k_dst, sizeof(__pyx_k_dst), 0, 0, 1, 1}, - {&__pyx_n_s_esize, __pyx_k_esize, sizeof(__pyx_k_esize), 0, 0, 1, 1}, - {&__pyx_n_s_hbuffers, __pyx_k_hbuffers, sizeof(__pyx_k_hbuffers), 0, 0, 1, 1}, - {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, - {&__pyx_n_s_looper, __pyx_k_looper, sizeof(__pyx_k_looper), 0, 0, 1, 1}, - {&__pyx_n_s_looping, __pyx_k_looping, sizeof(__pyx_k_looping), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_nbuff, __pyx_k_nbuff, sizeof(__pyx_k_nbuff), 0, 0, 1, 1}, - {&__pyx_n_s_ncpy, __pyx_k_ncpy, sizeof(__pyx_k_ncpy), 0, 0, 1, 1}, - {&__pyx_n_s_nread, __pyx_k_nread, sizeof(__pyx_k_nread), 0, 0, 1, 1}, - {&__pyx_n_s_off, __pyx_k_off, sizeof(__pyx_k_off), 0, 0, 1, 1}, - {&__pyx_n_s_pylablib_devices_Andor_utils, __pyx_k_pylablib_devices_Andor_utils, sizeof(__pyx_k_pylablib_devices_Andor_utils), 0, 0, 1, 1}, - {&__pyx_n_s_queued, __pyx_k_queued, sizeof(__pyx_k_queued), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_kp_s_utils_pyx, __pyx_k_utils_pyx, sizeof(__pyx_k_utils_pyx), 0, 0, 1, 0}, - {0, 0, 0, 0, 0, 0, 0} - }; - return __Pyx_InitStrings(__pyx_string_tab); -} -/* #### Code section: cached_builtins ### */ -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 36, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} -/* #### Code section: cached_constants ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "pylablib/devices/Andor/utils.pyx":25 - * return code - * - * def looper(int Hndl, unsigned nbuff, size_t hbuffers, int esize, int queued, size_t looping, size_t nread, # <<<<<<<<<<<<<< - * size_t AT_WaitBuffer, size_t AT_QueueBuffer): - * cdef int result=0 - */ - __pyx_tuple_ = PyTuple_Pack(10, __pyx_n_s_Hndl, __pyx_n_s_nbuff, __pyx_n_s_hbuffers, __pyx_n_s_esize, __pyx_n_s_queued, __pyx_n_s_looping, __pyx_n_s_nread, __pyx_n_s_AT_WaitBuffer, __pyx_n_s_AT_QueueBuffer, __pyx_n_s_result); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_pyx, __pyx_n_s_looper, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 25, __pyx_L1_error) - - /* "pylablib/devices/Andor/utils.pyx":41 - * return 0 - * - * def copyframes(unsigned nbuff, size_t hbuffers, unsigned size, unsigned start, unsigned ncpy, unsigned off, size_t dst): # <<<<<<<<<<<<<< - * with nogil: - * ccopyframes(nbuff,hbuffers,size,start,ncpy,off,dst) - */ - __pyx_tuple__3 = PyTuple_Pack(7, __pyx_n_s_nbuff, __pyx_n_s_hbuffers, __pyx_n_s_size, __pyx_n_s_start, __pyx_n_s_ncpy, __pyx_n_s_off, __pyx_n_s_dst); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_pyx, __pyx_n_s_copyframes, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} -/* #### Code section: init_constants ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { - if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); - return 0; - __pyx_L1_error:; - return -1; -} -/* #### Code section: init_globals ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - return 0; -} -/* #### Code section: init_module ### */ - -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ - -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_utils(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_utils}, - {0, NULL} -}; -#endif - -#ifdef __cplusplus -namespace { - struct PyModuleDef __pyx_moduledef = - #else - static struct PyModuleDef __pyx_moduledef = - #endif - { - PyModuleDef_HEAD_INIT, - "utils", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #elif CYTHON_USE_MODULE_STATE - sizeof(__pyx_mstate), /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - #if CYTHON_USE_MODULE_STATE - __pyx_m_traverse, /* m_traverse */ - __pyx_m_clear, /* m_clear */ - NULL /* m_free */ - #else - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ - #endif - }; - #ifdef __cplusplus -} /* anonymous namespace */ -#endif -#endif - -#ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#elif PY_MAJOR_VERSION < 3 -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" void -#else -#define __Pyx_PyMODINIT_FUNC void -#endif -#else -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyObject * -#endif -#endif - - -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC initutils(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC initutils(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_utils(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_utils(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) -#else -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) -#endif -{ - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { -#if CYTHON_COMPILING_IN_LIMITED_API - result = PyModule_AddObject(module, to_name, value); -#else - result = PyDict_SetItemString(moddict, to_name, value); -#endif - } - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; - } - return result; -} -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - CYTHON_UNUSED_VAR(def); - if (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; -#if CYTHON_COMPILING_IN_LIMITED_API - moddict = module; -#else - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; -#endif - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; -} - - -static CYTHON_SMALL_CODE int __pyx_pymod_exec_utils(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - int stringtab_initialized = 0; - #if CYTHON_USE_MODULE_STATE - int pystate_addmodule_run = 0; - #endif - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module 'utils' has already been imported. Re-initialisation is not supported."); - return -1; - } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("utils", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #elif CYTHON_USE_MODULE_STATE - __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - { - int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); - __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "utils" pseudovariable */ - if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - pystate_addmodule_run = 1; - } - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #endif - CYTHON_UNUSED_VAR(__pyx_t_1); - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_utils(void)", 0); - if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - PyEval_InitThreads(); - #endif - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - stringtab_initialized = 1; - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_pylablib__devices__Andor__utils) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "pylablib.devices.Andor.utils")) { - if (unlikely((PyDict_SetItemString(modules, "pylablib.devices.Andor.utils", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - (void)__Pyx_modinit_type_init_code(); - (void)__Pyx_modinit_type_import_code(); - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "pylablib/devices/Andor/utils.pyx":25 - * return code - * - * def looper(int Hndl, unsigned nbuff, size_t hbuffers, int esize, int queued, size_t looping, size_t nread, # <<<<<<<<<<<<<< - * size_t AT_WaitBuffer, size_t AT_QueueBuffer): - * cdef int result=0 - */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylablib_7devices_5Andor_5utils_1looper, 0, __pyx_n_s_looper, NULL, __pyx_n_s_pylablib_devices_Andor_utils, __pyx_d, ((PyObject *)__pyx_codeobj__2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_looper, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "pylablib/devices/Andor/utils.pyx":41 - * return 0 - * - * def copyframes(unsigned nbuff, size_t hbuffers, unsigned size, unsigned start, unsigned ncpy, unsigned off, size_t dst): # <<<<<<<<<<<<<< - * with nogil: - * ccopyframes(nbuff,hbuffers,size,start,ncpy,off,dst) - */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylablib_7devices_5Andor_5utils_3copyframes, 0, __pyx_n_s_copyframes, NULL, __pyx_n_s_pylablib_devices_Andor_utils, __pyx_d, ((PyObject *)__pyx_codeobj__4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_copyframes, __pyx_t_2) < 0) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "pylablib/devices/Andor/utils.pyx":1 - * import cython # <<<<<<<<<<<<<< - * from libc.string cimport memcpy - * - */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - if (__pyx_m) { - if (__pyx_d && stringtab_initialized) { - __Pyx_AddTraceback("init pylablib.devices.Andor.utils", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - #if !CYTHON_USE_MODULE_STATE - Py_CLEAR(__pyx_m); - #else - Py_DECREF(__pyx_m); - if (pystate_addmodule_run) { - PyObject *tp, *value, *tb; - PyErr_Fetch(&tp, &value, &tb); - PyState_RemoveModule(&__pyx_moduledef); - PyErr_Restore(tp, value, tb); - } - #endif - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init pylablib.devices.Andor.utils"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif -} -/* #### Code section: cleanup_globals ### */ -/* #### Code section: cleanup_module ### */ -/* #### Code section: main_method ### */ -/* #### Code section: utility_code_pragmas ### */ -#ifdef _MSC_VER -#pragma warning( push ) -/* Warning 4127: conditional expression is constant - * Cython uses constant conditional expressions to allow in inline functions to be optimized at - * compile-time, so this warning is not useful - */ -#pragma warning( disable : 4127 ) -#endif - - - -/* #### Code section: utility_code_def ### */ - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* PyErrExceptionMatches */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; i= 0x030C00A6 - PyObject *current_exception = tstate->current_exception; - if (unlikely(!current_exception)) return 0; - exc_type = (PyObject*) Py_TYPE(current_exception); - if (exc_type == err) return 1; -#else - exc_type = tstate->curexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; -#endif - #if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(exc_type); - #endif - if (unlikely(PyTuple_Check(err))) { - result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - } else { - result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); - } - #if CYTHON_AVOID_BORROWED_REFS - Py_DECREF(exc_type); - #endif - return result; -} -#endif - -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyObject *tmp_value; - assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); - if (value) { - #if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) - #endif - PyException_SetTraceback(value, tb); - } - tmp_value = tstate->current_exception; - tstate->current_exception = value; - Py_XDECREF(tmp_value); - Py_XDECREF(type); - Py_XDECREF(tb); -#else - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#endif -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyObject* exc_value; - exc_value = tstate->current_exception; - tstate->current_exception = 0; - *value = exc_value; - *type = NULL; - *tb = NULL; - if (exc_value) { - *type = (PyObject*) Py_TYPE(exc_value); - Py_INCREF(*type); - #if CYTHON_COMPILING_IN_CPYTHON - *tb = ((PyBaseExceptionObject*) exc_value)->traceback; - Py_XINCREF(*tb); - #else - *tb = PyException_GetTraceback(exc_value); - #endif - } -#else - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#endif -} -#endif - -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#endif - -/* PyObjectGetAttrStrNoError */ -#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 -static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); -} -#endif -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 - (void) PyObject_GetOptionalAttr(obj, attr_name, &result); - return result; -#else -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); - } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); - } - return result; -#endif -} - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); - if (unlikely(!result) && !PyErr_Occurred()) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* TupleAndListFromArray */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { - PyObject *v; - Py_ssize_t i; - for (i = 0; i < length; i++) { - v = dest[i] = src[i]; - Py_INCREF(v); - } -} -static CYTHON_INLINE PyObject * -__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) -{ - PyObject *res; - if (n <= 0) { - Py_INCREF(__pyx_empty_tuple); - return __pyx_empty_tuple; - } - res = PyTuple_New(n); - if (unlikely(res == NULL)) return NULL; - __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); - return res; -} -static CYTHON_INLINE PyObject * -__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) -{ - PyObject *res; - if (n <= 0) { - return PyList_New(0); - } - res = PyList_New(n); - if (unlikely(res == NULL)) return NULL; - __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); - return res; -} -#endif - -/* BytesEquals */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } -#endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -#endif -} - -/* UnicodeEquals */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); - } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } -#if CYTHON_USE_UNICODE_INTERNALS - { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; - #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; - #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; - } - } -#endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; - } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); -#endif -} - -/* fastcall */ -#if CYTHON_METH_FASTCALL -static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) -{ - Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); - for (i = 0; i < n; i++) - { - if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; - } - for (i = 0; i < n; i++) - { - int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); - if (unlikely(eq != 0)) { - if (unlikely(eq < 0)) return NULL; - return kwvalues[i]; - } - } - return NULL; -} -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 -CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { - Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames); - PyObject *dict; - dict = PyDict_New(); - if (unlikely(!dict)) - return NULL; - for (i=0; i= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject *const *kwvalues, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); - while (1) { - Py_XDECREF(key); key = NULL; - Py_XDECREF(value); value = NULL; - if (kwds_is_tuple) { - Py_ssize_t size; -#if CYTHON_ASSUME_SAFE_MACROS - size = PyTuple_GET_SIZE(kwds); -#else - size = PyTuple_Size(kwds); - if (size < 0) goto bad; -#endif - if (pos >= size) break; -#if CYTHON_AVOID_BORROWED_REFS - key = __Pyx_PySequence_ITEM(kwds, pos); - if (!key) goto bad; -#elif CYTHON_ASSUME_SAFE_MACROS - key = PyTuple_GET_ITEM(kwds, pos); -#else - key = PyTuple_GetItem(kwds, pos); - if (!key) goto bad; -#endif - value = kwvalues[pos]; - pos++; - } - else - { - if (!PyDict_Next(kwds, &pos, &key, &value)) break; -#if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(key); -#endif - } - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; -#if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(value); - Py_DECREF(key); -#endif - key = NULL; - value = NULL; - continue; - } -#if !CYTHON_AVOID_BORROWED_REFS - Py_INCREF(key); -#endif - Py_INCREF(value); - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; -#if CYTHON_AVOID_BORROWED_REFS - value = NULL; -#endif - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = ( - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key) - ); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; -#if CYTHON_AVOID_BORROWED_REFS - value = NULL; -#endif - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - Py_XDECREF(key); - Py_XDECREF(value); - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - #if PY_MAJOR_VERSION < 3 - PyErr_Format(PyExc_TypeError, - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - PyErr_Format(PyExc_TypeError, - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - Py_XDECREF(key); - Py_XDECREF(value); - return -1; -} - -/* ErrOccurredWithGIL */ -static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void) { - int err; - #ifdef WITH_THREAD - PyGILState_STATE _save = PyGILState_Ensure(); - #endif - err = !!PyErr_Occurred(); - #ifdef WITH_THREAD - PyGILState_Release(_save); - #endif - return err; -} - -/* FixUpExtensionType */ -#if CYTHON_USE_TYPE_SPECS -static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { -#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API - CYTHON_UNUSED_VAR(spec); - CYTHON_UNUSED_VAR(type); -#else - const PyType_Slot *slot = spec->slots; - while (slot && slot->slot && slot->slot != Py_tp_members) - slot++; - if (slot && slot->slot == Py_tp_members) { - int changed = 0; -#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) - const -#endif - PyMemberDef *memb = (PyMemberDef*) slot->pfunc; - while (memb && memb->name) { - if (memb->name[0] == '_' && memb->name[1] == '_') { -#if PY_VERSION_HEX < 0x030900b1 - if (strcmp(memb->name, "__weaklistoffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); - type->tp_weaklistoffset = memb->offset; - changed = 1; - } - else if (strcmp(memb->name, "__dictoffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); - type->tp_dictoffset = memb->offset; - changed = 1; - } -#if CYTHON_METH_FASTCALL - else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); -#if PY_VERSION_HEX >= 0x030800b4 - type->tp_vectorcall_offset = memb->offset; -#else - type->tp_print = (printfunc) memb->offset; -#endif - changed = 1; - } -#endif -#else - if ((0)); -#endif -#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON - else if (strcmp(memb->name, "__module__") == 0) { - PyObject *descr; - assert(memb->type == T_OBJECT); - assert(memb->flags == 0 || memb->flags == READONLY); - descr = PyDescr_NewMember(type, memb); - if (unlikely(!descr)) - return -1; - if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { - Py_DECREF(descr); - return -1; - } - Py_DECREF(descr); - changed = 1; - } -#endif - } - memb++; - } - if (changed) - PyType_Modified(type); - } -#endif - return 0; -} -#endif - -/* FetchSharedCythonModule */ -static PyObject *__Pyx_FetchSharedCythonABIModule(void) { - return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME); -} - -/* FetchCommonType */ -static int __Pyx_VerifyCachedType(PyObject *cached_type, - const char *name, - Py_ssize_t basicsize, - Py_ssize_t expected_basicsize) { - if (!PyType_Check(cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", name); - return -1; - } - if (basicsize != expected_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - name); - return -1; - } - return 0; -} -#if !CYTHON_USE_TYPE_SPECS -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* abi_module; - const char* object_name; - PyTypeObject *cached_type = NULL; - abi_module = __Pyx_FetchSharedCythonABIModule(); - if (!abi_module) return NULL; - object_name = strrchr(type->tp_name, '.'); - object_name = object_name ? object_name+1 : type->tp_name; - cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); - if (cached_type) { - if (__Pyx_VerifyCachedType( - (PyObject *)cached_type, - object_name, - cached_type->tp_basicsize, - type->tp_basicsize) < 0) { - goto bad; - } - goto done; - } - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; -done: - Py_DECREF(abi_module); - return cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} -#else -static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { - PyObject *abi_module, *cached_type = NULL; - const char* object_name = strrchr(spec->name, '.'); - object_name = object_name ? object_name+1 : spec->name; - abi_module = __Pyx_FetchSharedCythonABIModule(); - if (!abi_module) return NULL; - cached_type = PyObject_GetAttrString(abi_module, object_name); - if (cached_type) { - Py_ssize_t basicsize; -#if CYTHON_COMPILING_IN_LIMITED_API - PyObject *py_basicsize; - py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); - if (unlikely(!py_basicsize)) goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; -#else - basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; -#endif - if (__Pyx_VerifyCachedType( - cached_type, - object_name, - basicsize, - spec->basicsize) < 0) { - goto bad; - } - goto done; - } - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - CYTHON_UNUSED_VAR(module); - cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); - if (unlikely(!cached_type)) goto bad; - if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; - if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; -done: - Py_DECREF(abi_module); - assert(cached_type == NULL || PyType_Check(cached_type)); - return (PyTypeObject *) cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} -#endif - -/* PyVectorcallFastCallDict */ -#if CYTHON_METH_FASTCALL -static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) -{ - PyObject *res = NULL; - PyObject *kwnames; - PyObject **newargs; - PyObject **kwvalues; - Py_ssize_t i, pos; - size_t j; - PyObject *key, *value; - unsigned long keys_are_strings; - Py_ssize_t nkw = PyDict_GET_SIZE(kw); - newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); - if (unlikely(newargs == NULL)) { - PyErr_NoMemory(); - return NULL; - } - for (j = 0; j < nargs; j++) newargs[j] = args[j]; - kwnames = PyTuple_New(nkw); - if (unlikely(kwnames == NULL)) { - PyMem_Free(newargs); - return NULL; - } - kwvalues = newargs + nargs; - pos = i = 0; - keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; - while (PyDict_Next(kw, &pos, &key, &value)) { - keys_are_strings &= Py_TYPE(key)->tp_flags; - Py_INCREF(key); - Py_INCREF(value); - PyTuple_SET_ITEM(kwnames, i, key); - kwvalues[i] = value; - i++; - } - if (unlikely(!keys_are_strings)) { - PyErr_SetString(PyExc_TypeError, "keywords must be strings"); - goto cleanup; - } - res = vc(func, newargs, nargs, kwnames); -cleanup: - Py_DECREF(kwnames); - for (i = 0; i < nkw; i++) - Py_DECREF(kwvalues[i]); - PyMem_Free(newargs); - return res; -} -static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) -{ - if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { - return vc(func, args, nargs, NULL); - } - return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); -} -#endif - -/* CythonFunctionShared */ -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { - if (__Pyx_CyFunction_Check(func)) { - return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; - } else if (PyCFunction_Check(func)) { - return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; - } - return 0; -} -#else -static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { - return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; -} -#endif -static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { -#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API - __Pyx_Py_XDECREF_SET( - __Pyx_CyFunction_GetClassObj(f), - ((classobj) ? __Pyx_NewRef(classobj) : NULL)); -#else - __Pyx_Py_XDECREF_SET( - ((PyCMethodObject *) (f))->mm_class, - (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); -#endif -} -static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) -{ - CYTHON_UNUSED_VAR(closure); - if (unlikely(op->func_doc == NULL)) { -#if CYTHON_COMPILING_IN_LIMITED_API - op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); - if (unlikely(!op->func_doc)) return NULL; -#else - if (((PyCFunctionObject*)op)->m_ml->ml_doc) { -#if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); -#else - op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); -#endif - if (unlikely(op->func_doc == NULL)) - return NULL; - } else { - Py_INCREF(Py_None); - return Py_None; - } -#endif - } - Py_INCREF(op->func_doc); - return op->func_doc; -} -static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); - if (value == NULL) { - value = Py_None; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_doc, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(context); - if (unlikely(op->func_name == NULL)) { -#if CYTHON_COMPILING_IN_LIMITED_API - op->func_name = PyObject_GetAttrString(op->func, "__name__"); -#elif PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); -#else - op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); -#endif - if (unlikely(op->func_name == NULL)) - return NULL; - } - Py_INCREF(op->func_name); - return op->func_name; -} -static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) -#else - if (unlikely(value == NULL || !PyString_Check(value))) -#endif - { - PyErr_SetString(PyExc_TypeError, - "__name__ must be set to a string object"); - return -1; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_name, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(context); - Py_INCREF(op->func_qualname); - return op->func_qualname; -} -static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) -#else - if (unlikely(value == NULL || !PyString_Check(value))) -#endif - { - PyErr_SetString(PyExc_TypeError, - "__qualname__ must be set to a string object"); - return -1; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_qualname, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(context); - if (unlikely(op->func_dict == NULL)) { - op->func_dict = PyDict_New(); - if (unlikely(op->func_dict == NULL)) - return NULL; - } - Py_INCREF(op->func_dict); - return op->func_dict; -} -static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); - if (unlikely(value == NULL)) { - PyErr_SetString(PyExc_TypeError, - "function's dictionary may not be deleted"); - return -1; - } - if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "setting function's dictionary to a non-dict"); - return -1; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_dict, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(context); - Py_INCREF(op->func_globals); - return op->func_globals; -} -static PyObject * -__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(op); - CYTHON_UNUSED_VAR(context); - Py_INCREF(Py_None); - return Py_None; -} -static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) -{ - PyObject* result = (op->func_code) ? op->func_code : Py_None; - CYTHON_UNUSED_VAR(context); - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { - int result = 0; - PyObject *res = op->defaults_getter((PyObject *) op); - if (unlikely(!res)) - return -1; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - op->defaults_tuple = PyTuple_GET_ITEM(res, 0); - Py_INCREF(op->defaults_tuple); - op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); - Py_INCREF(op->defaults_kwdict); - #else - op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); - if (unlikely(!op->defaults_tuple)) result = -1; - else { - op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); - if (unlikely(!op->defaults_kwdict)) result = -1; - } - #endif - Py_DECREF(res); - return result; -} -static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { - CYTHON_UNUSED_VAR(context); - if (!value) { - value = Py_None; - } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "__defaults__ must be set to a tuple object"); - return -1; - } - PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " - "currently affect the values used in function calls", 1); - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { - PyObject* result = op->defaults_tuple; - CYTHON_UNUSED_VAR(context); - if (unlikely(!result)) { - if (op->defaults_getter) { - if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; - result = op->defaults_tuple; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { - CYTHON_UNUSED_VAR(context); - if (!value) { - value = Py_None; - } else if (unlikely(value != Py_None && !PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "__kwdefaults__ must be set to a dict object"); - return -1; - } - PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " - "currently affect the values used in function calls", 1); - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { - PyObject* result = op->defaults_kwdict; - CYTHON_UNUSED_VAR(context); - if (unlikely(!result)) { - if (op->defaults_getter) { - if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; - result = op->defaults_kwdict; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { - CYTHON_UNUSED_VAR(context); - if (!value || value == Py_None) { - value = NULL; - } else if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "__annotations__ must be set to a dict object"); - return -1; - } - Py_XINCREF(value); - __Pyx_Py_XDECREF_SET(op->func_annotations, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { - PyObject* result = op->func_annotations; - CYTHON_UNUSED_VAR(context); - if (unlikely(!result)) { - result = PyDict_New(); - if (unlikely(!result)) return NULL; - op->func_annotations = result; - } - Py_INCREF(result); - return result; -} -static PyObject * -__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { - int is_coroutine; - CYTHON_UNUSED_VAR(context); - if (op->func_is_coroutine) { - return __Pyx_NewRef(op->func_is_coroutine); - } - is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; -#if PY_VERSION_HEX >= 0x03050000 - if (is_coroutine) { - PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; - fromlist = PyList_New(1); - if (unlikely(!fromlist)) return NULL; - Py_INCREF(marker); -#if CYTHON_ASSUME_SAFE_MACROS - PyList_SET_ITEM(fromlist, 0, marker); -#else - if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { - Py_DECREF(marker); - Py_DECREF(fromlist); - return NULL; - } -#endif - module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); - Py_DECREF(fromlist); - if (unlikely(!module)) goto ignore; - op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); - Py_DECREF(module); - if (likely(op->func_is_coroutine)) { - return __Pyx_NewRef(op->func_is_coroutine); - } -ignore: - PyErr_Clear(); - } -#endif - op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); - return __Pyx_NewRef(op->func_is_coroutine); -} -#if CYTHON_COMPILING_IN_LIMITED_API -static PyObject * -__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { - CYTHON_UNUSED_VAR(context); - return PyObject_GetAttrString(op->func, "__module__"); -} -static int -__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { - CYTHON_UNUSED_VAR(context); - return PyObject_SetAttrString(op->func, "__module__", value); -} -#endif -static PyGetSetDef __pyx_CyFunction_getsets[] = { - {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, - {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, - {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, -#if CYTHON_COMPILING_IN_LIMITED_API - {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, -#endif - {0, 0, 0, 0, 0} -}; -static PyMemberDef __pyx_CyFunction_members[] = { -#if !CYTHON_COMPILING_IN_LIMITED_API - {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, -#endif -#if CYTHON_USE_TYPE_SPECS - {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, -#if CYTHON_METH_FASTCALL -#if CYTHON_BACKPORT_VECTORCALL - {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, -#else -#if !CYTHON_COMPILING_IN_LIMITED_API - {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, -#endif -#endif -#endif -#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API - {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, -#else - {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, -#endif -#endif - {0, 0, 0, 0, 0} -}; -static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) -{ - CYTHON_UNUSED_VAR(args); -#if PY_MAJOR_VERSION >= 3 - Py_INCREF(m->func_qualname); - return m->func_qualname; -#else - return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); -#endif -} -static PyMethodDef __pyx_CyFunction_methods[] = { - {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, - {0, 0, 0, 0} -}; -#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) -#else -#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) -#endif -static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { -#if !CYTHON_COMPILING_IN_LIMITED_API - PyCFunctionObject *cf = (PyCFunctionObject*) op; -#endif - if (unlikely(op == NULL)) - return NULL; -#if CYTHON_COMPILING_IN_LIMITED_API - op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); - if (unlikely(!op->func)) return NULL; -#endif - op->flags = flags; - __Pyx_CyFunction_weakreflist(op) = NULL; -#if !CYTHON_COMPILING_IN_LIMITED_API - cf->m_ml = ml; - cf->m_self = (PyObject *) op; -#endif - Py_XINCREF(closure); - op->func_closure = closure; -#if !CYTHON_COMPILING_IN_LIMITED_API - Py_XINCREF(module); - cf->m_module = module; -#endif - op->func_dict = NULL; - op->func_name = NULL; - Py_INCREF(qualname); - op->func_qualname = qualname; - op->func_doc = NULL; -#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API - op->func_classobj = NULL; -#else - ((PyCMethodObject*)op)->mm_class = NULL; -#endif - op->func_globals = globals; - Py_INCREF(op->func_globals); - Py_XINCREF(code); - op->func_code = code; - op->defaults_pyobjects = 0; - op->defaults_size = 0; - op->defaults = NULL; - op->defaults_tuple = NULL; - op->defaults_kwdict = NULL; - op->defaults_getter = NULL; - op->func_annotations = NULL; - op->func_is_coroutine = NULL; -#if CYTHON_METH_FASTCALL - switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { - case METH_NOARGS: - __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; - break; - case METH_O: - __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; - break; - case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: - __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; - break; - case METH_FASTCALL | METH_KEYWORDS: - __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; - break; - case METH_VARARGS | METH_KEYWORDS: - __Pyx_CyFunction_func_vectorcall(op) = NULL; - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); - Py_DECREF(op); - return NULL; - } -#endif - return (PyObject *) op; -} -static int -__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) -{ - Py_CLEAR(m->func_closure); -#if CYTHON_COMPILING_IN_LIMITED_API - Py_CLEAR(m->func); -#else - Py_CLEAR(((PyCFunctionObject*)m)->m_module); -#endif - Py_CLEAR(m->func_dict); - Py_CLEAR(m->func_name); - Py_CLEAR(m->func_qualname); - Py_CLEAR(m->func_doc); - Py_CLEAR(m->func_globals); - Py_CLEAR(m->func_code); -#if !CYTHON_COMPILING_IN_LIMITED_API -#if PY_VERSION_HEX < 0x030900B1 - Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); -#else - { - PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; - ((PyCMethodObject *) (m))->mm_class = NULL; - Py_XDECREF(cls); - } -#endif -#endif - Py_CLEAR(m->defaults_tuple); - Py_CLEAR(m->defaults_kwdict); - Py_CLEAR(m->func_annotations); - Py_CLEAR(m->func_is_coroutine); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_XDECREF(pydefaults[i]); - PyObject_Free(m->defaults); - m->defaults = NULL; - } - return 0; -} -static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - if (__Pyx_CyFunction_weakreflist(m) != NULL) - PyObject_ClearWeakRefs((PyObject *) m); - __Pyx_CyFunction_clear(m); - __Pyx_PyHeapTypeObject_GC_Del(m); -} -static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - PyObject_GC_UnTrack(m); - __Pyx__CyFunction_dealloc(m); -} -static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) -{ - Py_VISIT(m->func_closure); -#if CYTHON_COMPILING_IN_LIMITED_API - Py_VISIT(m->func); -#else - Py_VISIT(((PyCFunctionObject*)m)->m_module); -#endif - Py_VISIT(m->func_dict); - Py_VISIT(m->func_name); - Py_VISIT(m->func_qualname); - Py_VISIT(m->func_doc); - Py_VISIT(m->func_globals); - Py_VISIT(m->func_code); -#if !CYTHON_COMPILING_IN_LIMITED_API - Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); -#endif - Py_VISIT(m->defaults_tuple); - Py_VISIT(m->defaults_kwdict); - Py_VISIT(m->func_is_coroutine); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_VISIT(pydefaults[i]); - } - return 0; -} -static PyObject* -__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromFormat("", - op->func_qualname, (void *)op); -#else - return PyString_FromFormat("", - PyString_AsString(op->func_qualname), (void *)op); -#endif -} -static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { -#if CYTHON_COMPILING_IN_LIMITED_API - PyObject *f = ((__pyx_CyFunctionObject*)func)->func; - PyObject *py_name = NULL; - PyCFunction meth; - int flags; - meth = PyCFunction_GetFunction(f); - if (unlikely(!meth)) return NULL; - flags = PyCFunction_GetFlags(f); - if (unlikely(flags < 0)) return NULL; -#else - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = f->m_ml->ml_meth; - int flags = f->m_ml->ml_flags; -#endif - Py_ssize_t size; - switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { - case METH_VARARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) - return (*meth)(self, arg); - break; - case METH_VARARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); - case METH_NOARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { -#if CYTHON_ASSUME_SAFE_MACROS - size = PyTuple_GET_SIZE(arg); -#else - size = PyTuple_Size(arg); - if (unlikely(size < 0)) return NULL; -#endif - if (likely(size == 0)) - return (*meth)(self, NULL); -#if CYTHON_COMPILING_IN_LIMITED_API - py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); - if (!py_name) return NULL; - PyErr_Format(PyExc_TypeError, - "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - py_name, size); - Py_DECREF(py_name); -#else - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); -#endif - return NULL; - } - break; - case METH_O: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { -#if CYTHON_ASSUME_SAFE_MACROS - size = PyTuple_GET_SIZE(arg); -#else - size = PyTuple_Size(arg); - if (unlikely(size < 0)) return NULL; -#endif - if (likely(size == 1)) { - PyObject *result, *arg0; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - arg0 = PyTuple_GET_ITEM(arg, 0); - #else - arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; - #endif - result = (*meth)(self, arg0); - #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) - Py_DECREF(arg0); - #endif - return result; - } -#if CYTHON_COMPILING_IN_LIMITED_API - py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); - if (!py_name) return NULL; - PyErr_Format(PyExc_TypeError, - "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - py_name, size); - Py_DECREF(py_name); -#else - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); -#endif - return NULL; - } - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); - return NULL; - } -#if CYTHON_COMPILING_IN_LIMITED_API - py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); - if (!py_name) return NULL; - PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", - py_name); - Py_DECREF(py_name); -#else - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - f->m_ml->ml_name); -#endif - return NULL; -} -static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *self, *result; -#if CYTHON_COMPILING_IN_LIMITED_API - self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); - if (unlikely(!self) && PyErr_Occurred()) return NULL; -#else - self = ((PyCFunctionObject*)func)->m_self; -#endif - result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); - return result; -} -static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { - PyObject *result; - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; -#if CYTHON_METH_FASTCALL - __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); - if (vc) { -#if CYTHON_ASSUME_SAFE_MACROS - return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); -#else - (void) &__Pyx_PyVectorcall_FastCallDict; - return PyVectorcall_Call(func, args, kw); -#endif - } -#endif - if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { - Py_ssize_t argc; - PyObject *new_args; - PyObject *self; -#if CYTHON_ASSUME_SAFE_MACROS - argc = PyTuple_GET_SIZE(args); -#else - argc = PyTuple_Size(args); - if (unlikely(!argc) < 0) return NULL; -#endif - new_args = PyTuple_GetSlice(args, 1, argc); - if (unlikely(!new_args)) - return NULL; - self = PyTuple_GetItem(args, 0); - if (unlikely(!self)) { - Py_DECREF(new_args); -#if PY_MAJOR_VERSION > 2 - PyErr_Format(PyExc_TypeError, - "unbound method %.200S() needs an argument", - cyfunc->func_qualname); -#else - PyErr_SetString(PyExc_TypeError, - "unbound method needs an argument"); -#endif - return NULL; - } - result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); - Py_DECREF(new_args); - } else { - result = __Pyx_CyFunction_Call(func, args, kw); - } - return result; -} -#if CYTHON_METH_FASTCALL -static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) -{ - int ret = 0; - if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { - if (unlikely(nargs < 1)) { - PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", - ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); - return -1; - } - ret = 1; - } - if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); - return -1; - } - return ret; -} -static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) -{ - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - if (unlikely(nargs != 0)) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - def->ml_name, nargs); - return NULL; - } - return def->ml_meth(self, NULL); -} -static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) -{ - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - if (unlikely(nargs != 1)) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - def->ml_name, nargs); - return NULL; - } - return def->ml_meth(self, args[0]); -} -static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) -{ - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); -} -static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) -{ - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; - PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); -} -#endif -#if CYTHON_USE_TYPE_SPECS -static PyType_Slot __pyx_CyFunctionType_slots[] = { - {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, - {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, - {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, - {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, - {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, - {Py_tp_methods, (void *)__pyx_CyFunction_methods}, - {Py_tp_members, (void *)__pyx_CyFunction_members}, - {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, - {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, - {0, 0}, -}; -static PyType_Spec __pyx_CyFunctionType_spec = { - __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, -#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR - Py_TPFLAGS_METHOD_DESCRIPTOR | -#endif -#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) - _Py_TPFLAGS_HAVE_VECTORCALL | -#endif - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, - __pyx_CyFunctionType_slots -}; -#else -static PyTypeObject __pyx_CyFunctionType_type = { - PyVarObject_HEAD_INIT(0, 0) - __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, - (destructor) __Pyx_CyFunction_dealloc, -#if !CYTHON_METH_FASTCALL - 0, -#elif CYTHON_BACKPORT_VECTORCALL - (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), -#else - offsetof(PyCFunctionObject, vectorcall), -#endif - 0, - 0, -#if PY_MAJOR_VERSION < 3 - 0, -#else - 0, -#endif - (reprfunc) __Pyx_CyFunction_repr, - 0, - 0, - 0, - 0, - __Pyx_CyFunction_CallAsMethod, - 0, - 0, - 0, - 0, -#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR - Py_TPFLAGS_METHOD_DESCRIPTOR | -#endif -#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL - _Py_TPFLAGS_HAVE_VECTORCALL | -#endif - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, - 0, - (traverseproc) __Pyx_CyFunction_traverse, - (inquiry) __Pyx_CyFunction_clear, - 0, -#if PY_VERSION_HEX < 0x030500A0 - offsetof(__pyx_CyFunctionObject, func_weakreflist), -#else - offsetof(PyCFunctionObject, m_weakreflist), -#endif - 0, - 0, - __pyx_CyFunction_methods, - __pyx_CyFunction_members, - __pyx_CyFunction_getsets, - 0, - 0, - __Pyx_PyMethod_New, - 0, - offsetof(__pyx_CyFunctionObject, func_dict), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -#if PY_VERSION_HEX >= 0x030400a1 - 0, -#endif -#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, -#endif -#if __PYX_NEED_TP_PRINT_SLOT - 0, -#endif -#if PY_VERSION_HEX >= 0x030C0000 - 0, -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, -#endif -}; -#endif -static int __pyx_CyFunction_init(PyObject *module) { -#if CYTHON_USE_TYPE_SPECS - __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); -#else - CYTHON_UNUSED_VAR(module); - __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); -#endif - if (unlikely(__pyx_CyFunctionType == NULL)) { - return -1; - } - return 0; -} -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults = PyObject_Malloc(size); - if (unlikely(!m->defaults)) - return PyErr_NoMemory(); - memset(m->defaults, 0, size); - m->defaults_pyobjects = pyobjects; - m->defaults_size = size; - return m->defaults; -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_tuple = tuple; - Py_INCREF(tuple); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_kwdict = dict; - Py_INCREF(dict); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->func_annotations = dict; - Py_INCREF(dict); -} - -/* CythonFunction */ -static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - PyObject *op = __Pyx_CyFunction_Init( - PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), - ml, flags, qualname, closure, module, globals, code - ); - if (likely(op)) { - PyObject_GC_Track(op); - } - return op; -} - -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); -} -#endif - -/* CLineInTraceback */ -#ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { - PyObject *use_cline; - PyObject *ptype, *pvalue, *ptraceback; -#if CYTHON_COMPILING_IN_CPYTHON - PyObject **cython_runtime_dict; -#endif - CYTHON_MAYBE_UNUSED_VAR(tstate); - if (unlikely(!__pyx_cython_runtime)) { - return c_line; - } - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); -#if CYTHON_COMPILING_IN_CPYTHON - cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); - if (likely(cython_runtime_dict)) { - __PYX_PY_DICT_LOOKUP_IF_MODIFIED( - use_cline, *cython_runtime_dict, - __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) - } else -#endif - { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); - if (use_cline_obj) { - use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; - Py_DECREF(use_cline_obj); - } else { - PyErr_Clear(); - use_cline = NULL; - } - } - if (!use_cline) { - c_line = 0; - (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); - } - else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { - c_line = 0; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - return c_line; -} -#endif - -/* CodeObjectCache */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} -#endif - -/* AddTraceback */ -#include "compile.h" -#include "frameobject.h" -#include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API - #ifndef Py_BUILD_CORE - #define Py_BUILD_CORE 1 - #endif - #include "internal/pycore_frame.h" -#endif -#if CYTHON_COMPILING_IN_LIMITED_API -static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, - PyObject *firstlineno, PyObject *name) { - PyObject *replace = NULL; - if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; - if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; - replace = PyObject_GetAttrString(code, "replace"); - if (likely(replace)) { - PyObject *result; - result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); - Py_DECREF(replace); - return result; - } - PyErr_Clear(); - #if __PYX_LIMITED_VERSION_HEX < 0x030780000 - { - PyObject *compiled = NULL, *result = NULL; - if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; - if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; - compiled = Py_CompileString( - "out = type(code)(\n" - " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" - " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" - " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" - " code.co_lnotab)\n", "", Py_file_input); - if (!compiled) return NULL; - result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); - Py_DECREF(compiled); - if (!result) PyErr_Print(); - Py_DECREF(result); - result = PyDict_GetItemString(scratch_dict, "out"); - if (result) Py_INCREF(result); - return result; - } - #else - return NULL; - #endif -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; - PyObject *replace = NULL, *getframe = NULL, *frame = NULL; - PyObject *exc_type, *exc_value, *exc_traceback; - int success = 0; - if (c_line) { - (void) __pyx_cfilenm; - (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); - } - PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); - code_object = Py_CompileString("_getframe()", filename, Py_eval_input); - if (unlikely(!code_object)) goto bad; - py_py_line = PyLong_FromLong(py_line); - if (unlikely(!py_py_line)) goto bad; - py_funcname = PyUnicode_FromString(funcname); - if (unlikely(!py_funcname)) goto bad; - dict = PyDict_New(); - if (unlikely(!dict)) goto bad; - { - PyObject *old_code_object = code_object; - code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); - Py_DECREF(old_code_object); - } - if (unlikely(!code_object)) goto bad; - getframe = PySys_GetObject("_getframe"); - if (unlikely(!getframe)) goto bad; - if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; - frame = PyEval_EvalCode(code_object, dict, dict); - if (unlikely(!frame) || frame == Py_None) goto bad; - success = 1; - bad: - PyErr_Restore(exc_type, exc_value, exc_traceback); - Py_XDECREF(code_object); - Py_XDECREF(py_py_line); - Py_XDECREF(py_funcname); - Py_XDECREF(dict); - Py_XDECREF(replace); - if (success) { - PyTraceBack_Here( - (struct _frame*)frame); - } - Py_XDECREF(frame); -} -#else -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = NULL; - PyObject *py_funcname = NULL; - #if PY_MAJOR_VERSION < 3 - PyObject *py_srcfile = NULL; - py_srcfile = PyString_FromString(filename); - if (!py_srcfile) goto bad; - #endif - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - if (!py_funcname) goto bad; - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - if (!py_funcname) goto bad; - funcname = PyUnicode_AsUTF8(py_funcname); - if (!funcname) goto bad; - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - if (!py_funcname) goto bad; - #endif - } - #if PY_MAJOR_VERSION < 3 - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - #else - py_code = PyCode_NewEmpty(filename, funcname, py_line); - #endif - Py_XDECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_funcname); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_srcfile); - #endif - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject *ptype, *pvalue, *ptraceback; - if (c_line) { - c_line = __Pyx_CLineForTraceback(tstate, c_line); - } - py_code = __pyx_find_code_object(c_line ? -c_line : py_line); - if (!py_code) { - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) { - /* If the code object creation fails, then we should clear the - fetched exception references and propagate the new exception */ - Py_XDECREF(ptype); - Py_XDECREF(pvalue); - Py_XDECREF(ptraceback); - goto bad; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); - } - py_frame = PyFrame_New( - tstate, /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} -#endif - -/* CIntFromPyVerify */ -#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntFromPy */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const int neg_one = (int) -1, const_zero = (int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(int) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - if (unlikely(__Pyx_PyLong_IsNeg(x))) { - goto raise_neg_overflow; - } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_DigitCount(x)) { - case 2: - if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if ((sizeof(int) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_SignedDigitCount(x)) { - case -2: - if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } - } -#endif - if ((sizeof(int) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); -#if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } -#endif - if (likely(v)) { - int ret = -1; -#if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - long idigit; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (unlikely(!PyLong_CheckExact(v))) { - PyObject *tmp = v; - v = PyNumber_Long(v); - assert(PyLong_CheckExact(v)); - Py_DECREF(tmp); - if (unlikely(!v)) return (int) -1; - } -#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(x) == 0) - return (int) 0; - is_negative = Py_SIZE(x) < 0; -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - is_negative = result == 1; - } -#endif - if (is_unsigned && unlikely(is_negative)) { - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - if (unlikely(!stepval)) - return (int) -1; - } else { - stepval = __Pyx_NewRef(v); - } - val = (int) 0; - mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; - shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { - PyObject *tmp, *digit; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - val |= ((int) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(stepval) == 0) - goto unpacking_done; - #endif - } - idigit = PyLong_AsLong(stepval); - if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); - if (unlikely(idigit >= (1L << remaining_bits))) - goto raise_overflow; - val |= ((int) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - unpacking_done: - #endif - if (!is_unsigned) { - if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) - goto raise_overflow; - if (is_negative) - val = ~val; - } - ret = 0; - done: - Py_XDECREF(shift); - Py_XDECREF(mask); - Py_XDECREF(stepval); -#endif - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CIntFromPy */ -static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(unsigned int) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (unsigned int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - if (unlikely(__Pyx_PyLong_IsNeg(x))) { - goto raise_neg_overflow; - } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_DigitCount(x)) { - case 2: - if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT)) { - return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); - } - } - break; - case 3: - if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT)) { - return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); - } - } - break; - case 4: - if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT)) { - return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); - } - } - break; - } - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (unsigned int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if ((sizeof(unsigned int) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_SignedDigitCount(x)) { - case -2: - if ((8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) { - return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); - } - } - break; - case 2: - if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) { - return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); - } - } - break; - case -3: - if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) { - return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); - } - } - break; - case 3: - if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) { - return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); - } - } - break; - case -4: - if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT)) { - return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); - } - } - break; - case 4: - if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT)) { - return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); - } - } - break; - } - } -#endif - if ((sizeof(unsigned int) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(unsigned int) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - unsigned int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); -#if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } -#endif - if (likely(v)) { - int ret = -1; -#if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - long idigit; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (unlikely(!PyLong_CheckExact(v))) { - PyObject *tmp = v; - v = PyNumber_Long(v); - assert(PyLong_CheckExact(v)); - Py_DECREF(tmp); - if (unlikely(!v)) return (unsigned int) -1; - } -#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(x) == 0) - return (unsigned int) 0; - is_negative = Py_SIZE(x) < 0; -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (unsigned int) -1; - is_negative = result == 1; - } -#endif - if (is_unsigned && unlikely(is_negative)) { - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - if (unlikely(!stepval)) - return (unsigned int) -1; - } else { - stepval = __Pyx_NewRef(v); - } - val = (unsigned int) 0; - mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; - shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(unsigned int) * 8 - chunk_size; bits += chunk_size) { - PyObject *tmp, *digit; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - val |= ((unsigned int) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(stepval) == 0) - goto unpacking_done; - #endif - } - idigit = PyLong_AsLong(stepval); - if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(unsigned int) * 8) - bits - (is_unsigned ? 0 : 1); - if (unlikely(idigit >= (1L << remaining_bits))) - goto raise_overflow; - val |= ((unsigned int) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - unpacking_done: - #endif - if (!is_unsigned) { - if (unlikely(val & (((unsigned int) 1) << (sizeof(unsigned int) * 8 - 1)))) - goto raise_overflow; - if (is_negative) - val = ~val; - } - ret = 0; - done: - Py_XDECREF(shift); - Py_XDECREF(mask); - Py_XDECREF(stepval); -#endif - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (unsigned int) -1; - } - } else { - unsigned int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (unsigned int) -1; - val = __Pyx_PyInt_As_unsigned_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to unsigned int"); - return (unsigned int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned int"); - return (unsigned int) -1; -} - -/* CIntFromPy */ -static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(size_t) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (size_t) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - if (unlikely(__Pyx_PyLong_IsNeg(x))) { - goto raise_neg_overflow; - } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_DigitCount(x)) { - case 2: - if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) { - return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - } - break; - case 3: - if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) { - return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - } - break; - case 4: - if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) { - return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - } - break; - } - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (size_t) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if ((sizeof(size_t) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_SignedDigitCount(x)) { - case -2: - if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { - return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case 2: - if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { - return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case -3: - if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { - return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case 3: - if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { - return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case -4: - if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { - return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case 4: - if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { - return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - } - } -#endif - if ((sizeof(size_t) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - size_t val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); -#if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } -#endif - if (likely(v)) { - int ret = -1; -#if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - long idigit; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (unlikely(!PyLong_CheckExact(v))) { - PyObject *tmp = v; - v = PyNumber_Long(v); - assert(PyLong_CheckExact(v)); - Py_DECREF(tmp); - if (unlikely(!v)) return (size_t) -1; - } -#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(x) == 0) - return (size_t) 0; - is_negative = Py_SIZE(x) < 0; -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (size_t) -1; - is_negative = result == 1; - } -#endif - if (is_unsigned && unlikely(is_negative)) { - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - if (unlikely(!stepval)) - return (size_t) -1; - } else { - stepval = __Pyx_NewRef(v); - } - val = (size_t) 0; - mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; - shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(size_t) * 8 - chunk_size; bits += chunk_size) { - PyObject *tmp, *digit; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - val |= ((size_t) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(stepval) == 0) - goto unpacking_done; - #endif - } - idigit = PyLong_AsLong(stepval); - if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1); - if (unlikely(idigit >= (1L << remaining_bits))) - goto raise_overflow; - val |= ((size_t) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - unpacking_done: - #endif - if (!is_unsigned) { - if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1)))) - goto raise_overflow; - if (is_negative) - val = ~val; - } - ret = 0; - done: - Py_XDECREF(shift); - Py_XDECREF(mask); - Py_XDECREF(stepval); -#endif - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (size_t) -1; - } - } else { - size_t val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (size_t) -1; - val = __Pyx_PyInt_As_size_t(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to size_t"); - return (size_t) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to size_t"); - return (size_t) -1; -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const int neg_one = (int) -1, const_zero = (int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; -#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); -#else - PyObject *from_bytes, *result = NULL; - PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; - from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); - if (!from_bytes) return NULL; - py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); - if (!py_bytes) goto limited_bad; - order_str = PyUnicode_FromString(little ? "little" : "big"); - if (!order_str) goto limited_bad; - arg_tuple = PyTuple_Pack(2, py_bytes, order_str); - if (!arg_tuple) goto limited_bad; - if (!is_unsigned) { - kwds = PyDict_New(); - if (!kwds) goto limited_bad; - if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; - } - result = PyObject_Call(from_bytes, arg_tuple, kwds); - limited_bad: - Py_XDECREF(kwds); - Py_XDECREF(arg_tuple); - Py_XDECREF(order_str); - Py_XDECREF(py_bytes); - Py_XDECREF(from_bytes); - return result; -#endif - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(unsigned int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(unsigned int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(unsigned int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; -#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 - return _PyLong_FromByteArray(bytes, sizeof(unsigned int), - little, !is_unsigned); -#else - PyObject *from_bytes, *result = NULL; - PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; - from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); - if (!from_bytes) return NULL; - py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned int)); - if (!py_bytes) goto limited_bad; - order_str = PyUnicode_FromString(little ? "little" : "big"); - if (!order_str) goto limited_bad; - arg_tuple = PyTuple_Pack(2, py_bytes, order_str); - if (!arg_tuple) goto limited_bad; - if (!is_unsigned) { - kwds = PyDict_New(); - if (!kwds) goto limited_bad; - if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; - } - result = PyObject_Call(from_bytes, arg_tuple, kwds); - limited_bad: - Py_XDECREF(kwds); - Py_XDECREF(arg_tuple); - Py_XDECREF(order_str); - Py_XDECREF(py_bytes); - Py_XDECREF(from_bytes); - return result; -#endif - } -} - -/* FormatTypeName */ -#if CYTHON_COMPILING_IN_LIMITED_API -static __Pyx_TypeName -__Pyx_PyType_GetName(PyTypeObject* tp) -{ - PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, - __pyx_n_s_name); - if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { - PyErr_Clear(); - Py_XDECREF(name); - name = __Pyx_NewRef(__pyx_n_s__5); - } - return name; -} -#endif - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const long neg_one = (long) -1, const_zero = (long) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; -#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); -#else - PyObject *from_bytes, *result = NULL; - PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; - from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); - if (!from_bytes) return NULL; - py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); - if (!py_bytes) goto limited_bad; - order_str = PyUnicode_FromString(little ? "little" : "big"); - if (!order_str) goto limited_bad; - arg_tuple = PyTuple_Pack(2, py_bytes, order_str); - if (!arg_tuple) goto limited_bad; - if (!is_unsigned) { - kwds = PyDict_New(); - if (!kwds) goto limited_bad; - if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; - } - result = PyObject_Call(from_bytes, arg_tuple, kwds); - limited_bad: - Py_XDECREF(kwds); - Py_XDECREF(arg_tuple); - Py_XDECREF(order_str); - Py_XDECREF(py_bytes); - Py_XDECREF(from_bytes); - return result; -#endif - } -} - -/* CIntFromPy */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const long neg_one = (long) -1, const_zero = (long) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(long) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - if (unlikely(__Pyx_PyLong_IsNeg(x))) { - goto raise_neg_overflow; - } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_DigitCount(x)) { - case 2: - if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if ((sizeof(long) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_SignedDigitCount(x)) { - case -2: - if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } - } -#endif - if ((sizeof(long) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); -#if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } -#endif - if (likely(v)) { - int ret = -1; -#if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - long idigit; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (unlikely(!PyLong_CheckExact(v))) { - PyObject *tmp = v; - v = PyNumber_Long(v); - assert(PyLong_CheckExact(v)); - Py_DECREF(tmp); - if (unlikely(!v)) return (long) -1; - } -#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(x) == 0) - return (long) 0; - is_negative = Py_SIZE(x) < 0; -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - is_negative = result == 1; - } -#endif - if (is_unsigned && unlikely(is_negative)) { - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - if (unlikely(!stepval)) - return (long) -1; - } else { - stepval = __Pyx_NewRef(v); - } - val = (long) 0; - mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; - shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { - PyObject *tmp, *digit; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - val |= ((long) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(stepval) == 0) - goto unpacking_done; - #endif - } - idigit = PyLong_AsLong(stepval); - if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); - if (unlikely(idigit >= (1L << remaining_bits))) - goto raise_overflow; - val |= ((long) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - unpacking_done: - #endif - if (!is_unsigned) { - if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) - goto raise_overflow; - if (is_negative) - val = ~val; - } - ret = 0; - done: - Py_XDECREF(shift); - Py_XDECREF(mask); - Py_XDECREF(stepval); -#endif - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* FastTypeChecks */ -#if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; -} -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(a, b); -} -static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (cls == a || cls == b) return 1; - mro = cls->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - PyObject *base = PyTuple_GET_ITEM(mro, i); - if (base == (PyObject *)a || base == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - if (exc_type1) { - return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); - } else { - return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } -} -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; i= 0x030B00A4 - return Py_Version & ~0xFFUL; -#else - const char* rt_version = Py_GetVersion(); - unsigned long version = 0; - unsigned long factor = 0x01000000UL; - unsigned int digit = 0; - int i = 0; - while (factor) { - while ('0' <= rt_version[i] && rt_version[i] <= '9') { - digit = digit * 10 + (unsigned int) (rt_version[i] - '0'); - ++i; - } - version += factor * digit; - if (rt_version[i] != '.') - break; - digit = 0; - factor >>= 8; - ++i; - } - return version; -#endif -} -static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { - const unsigned long MAJOR_MINOR = 0xFFFF0000UL; - if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) - return 0; - if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) - return 1; - { - char message[200]; - PyOS_snprintf(message, sizeof(message), - "compile time Python version %d.%d " - "of module '%.100s' " - "%s " - "runtime version %d.%d", - (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), - __Pyx_MODULE_NAME, - (allow_newer) ? "was newer than" : "does not match", - (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) - ); - return PyErr_WarnEx(NULL, message, 1); - } -} - -/* InitStrings */ -#if PY_MAJOR_VERSION >= 3 -static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { - if (t.is_unicode | t.is_str) { - if (t.intern) { - *str = PyUnicode_InternFromString(t.s); - } else if (t.encoding) { - *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); - } else { - *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); - } - } else { - *str = PyBytes_FromStringAndSize(t.s, t.n - 1); - } - if (!*str) - return -1; - if (PyObject_Hash(*str) == -1) - return -1; - return 0; -} -#endif -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION >= 3 - __Pyx_InitString(*t, t->p); - #else - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - if (!*t->p) - return -1; - if (PyObject_Hash(*t->p) == -1) - return -1; - #endif - ++t; - } - return 0; -} - -#include -static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { - size_t len = strlen(s); - if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, "byte string is too long"); - return -1; - } - return (Py_ssize_t) len; -} -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - Py_ssize_t len = __Pyx_ssize_strlen(c_str); - if (unlikely(len < 0)) return NULL; - return __Pyx_PyUnicode_FromStringAndSize(c_str, len); -} -static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { - Py_ssize_t len = __Pyx_ssize_strlen(c_str); - if (unlikely(len < 0)) return NULL; - return PyByteArray_FromStringAndSize(c_str, len); -} -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -#if !CYTHON_PEP393_ENABLED -static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -} -#else -static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (likely(PyUnicode_IS_ASCII(o))) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -} -#endif -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { - return __Pyx_PyUnicode_AsStringAndSize(o, length); - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { - int retval; - if (unlikely(!x)) return -1; - retval = __Pyx_PyObject_IsTrue(x); - Py_DECREF(x); - return retval; -} -static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { - __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); -#if PY_MAJOR_VERSION >= 3 - if (PyLong_Check(result)) { - if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " - "The ability to return an instance of a strict subclass of int is deprecated, " - "and may be removed in a future version of Python.", - result_type_name)) { - __Pyx_DECREF_TypeName(result_type_name); - Py_DECREF(result); - return NULL; - } - __Pyx_DECREF_TypeName(result_type_name); - return result; - } -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", - type_name, type_name, result_type_name); - __Pyx_DECREF_TypeName(result_type_name); - Py_DECREF(result); - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x) || PyLong_Check(x))) -#else - if (likely(PyLong_Check(x))) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = m->nb_int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = m->nb_long(x); - } - #else - if (likely(m && m->nb_int)) { - name = "int"; - res = m->nb_int(x); - } - #endif -#else - if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { - res = PyNumber_Int(x); - } -#endif - if (likely(res)) { -#if PY_MAJOR_VERSION < 3 - if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { -#else - if (unlikely(!PyLong_CheckExact(res))) { -#endif - return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(b); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(__Pyx_PyLong_IsCompact(b))) { - return __Pyx_PyLong_CompactValue(b); - } else { - const digit* digits = __Pyx_PyLong_Digits(b); - const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { - if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { - return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); -#if PY_MAJOR_VERSION < 3 - } else if (likely(PyInt_CheckExact(o))) { - return PyInt_AS_LONG(o); -#endif - } else { - Py_ssize_t ival; - PyObject *x; - x = PyNumber_Index(o); - if (!x) return -1; - ival = PyInt_AsLong(x); - Py_DECREF(x); - return ival; - } -} -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { - return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -/* #### Code section: utility_code_pragmas_end ### */ -#ifdef _MSC_VER -#pragma warning( pop ) -#endif - - - -/* #### Code section: end ### */ -#endif /* Py_PYTHON_H */ diff --git a/pylablib/Andor/utils.pyx b/pylablib/Andor/utils.pyx deleted file mode 100644 index fd87c0b..0000000 --- a/pylablib/Andor/utils.pyx +++ /dev/null @@ -1,43 +0,0 @@ -import cython -from libc.string cimport memcpy - -ctypedef int (*pAT_WaitBuffer)(int Hndl, void **Ptr, int *PtrSize, unsigned int Timeout) noexcept nogil -ctypedef int (*pAT_QueueBuffer)(int Hndl, void *Ptr, int PtrSize) noexcept nogil - -@cython.cdivision(True) -cdef int clooper(int Hndl, unsigned nbuff, void **hbuffers, int esize, int queued, int *looping, unsigned *nread, - pAT_WaitBuffer AT_WaitBuffer, pAT_QueueBuffer AT_QueueBuffer) nogil: - cdef int size=0 - cdef int code=0 - cdef void* buffer=(0) - while looping[0]: - code=AT_WaitBuffer(Hndl,&buffer,&size,300) - if code==13 or code==11: # AT_ERR_TIMEDOUT or AT_ERR_NODATA - continue - if code: - return code - if size!=esize: - return -1 - AT_QueueBuffer(Hndl,hbuffers[(nread[0]+queued)%nbuff],esize) - nread[0]+=1 - return code - -def looper(int Hndl, unsigned nbuff, size_t hbuffers, int esize, int queued, size_t looping, size_t nread, - size_t AT_WaitBuffer, size_t AT_QueueBuffer): - cdef int result=0 - with nogil: - result=clooper(Hndl,nbuff,hbuffers,esize,queued,looping,nread, - AT_WaitBuffer,AT_QueueBuffer) - return result - - -cdef int ccopyframes(unsigned nbuff, char **hbuffers, unsigned size, unsigned start, unsigned ncpy, unsigned off, char *dst) nogil: - cdef unsigned i=0 - for i in range(ncpy): - memcpy(dst,hbuffers[(start+i)%nbuff]+off,size) - dst+=size - return 0 - -def copyframes(unsigned nbuff, size_t hbuffers, unsigned size, unsigned start, unsigned ncpy, unsigned off, size_t dst): - with nogil: - ccopyframes(nbuff,hbuffers,size,start,ncpy,off,dst) \ No newline at end of file