跳转到主要内容

Python接口到.NET Thor相机。

项目描述

ThorCam

Github Build Status

使用.Net的Python接口,用于Thor科学相机。

此库不支持DCx相机,仅支持科学相机

有关更多信息和使用方法,请参阅文档

要在Anaconda原生Python中安装,请参阅安装说明

基本示例

首先创建一个子类,该子类将打印相机结果

from thorcam.camera import ThorCam
class MyThorCam(ThorCam):
    def received_camera_response(self, msg, value):
        super(MyThorCam, self).received_camera_response(msg, value)
        if msg == 'image':
            return
        print('Received "{}" with value "{}"'.format(msg, value))
    def got_image(self, image, count, queued_count, t):
        print('Received image "{}" with time "{}" and counts "{}", "{}"'
              .format(image, t, count, queued_count))

然后使用相机

>>> # create camera
>>> cam = MyThorCam()
<__main__.MyThorCam at 0x25a72f6a748>
>>> # start the server etc.
>>> cam.start_cam_process()
>>> # get list of attached cams
>>> cam.refresh_cameras()
Received "serials" with value "['03756']"
>>> # open the camera
>>> cam.open_camera('03756')
Received "settings" with value "{'binning_x': 1, 'binning_x_range': [1, 24], ..."
Received "cam_open" with value "None"
>>> cam.exposure_range
[0.0, 1000000.0]
>>> cam.exposure_ms
241.948
>>> # update the exposure value
>>> cam.set_setting('exposure_ms', 150)
Received "settings" with value "{'exposure_ms': 150.0}"
>>> cam.exposure_ms
150.0
>>> # now play the camera
>>> cam.play_camera()
Received "playing" with value "True"
Received image "<ffpyplayer.pic.Image object at 0x000001D1D8D67900>" with time "2e-07" and counts "1", "1"
Received image "<ffpyplayer.pic.Image object at 0x000001D1D8D67990>" with time "0.2310473" and counts "2", "1"
Received image "<ffpyplayer.pic.Image object at 0x000001D1D8D67A68>" with time "0.4735178" and counts "3", "1"
Received image "<ffpyplayer.pic.Image object at 0x000001D1D8D67B40>" with time "0.7157285" and counts "4", "1"
Received image "<ffpyplayer.pic.Image object at 0x000001D1D8D67C18>" with time "0.9583721" and counts "5", "1"
>>> # now stop playing
>>> cam.stop_playing_camera()
Received "playing" with value "False"
>>> # close the camera
>>> cam.close_camera()
Received "cam_closed" with value "None"
>>> # close the server and everything
>>> cam.stop_cam_process(join=True)

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分布

thorcam-0.1.7.tar.gz (16.2 kB 查看哈希值)

上传于 源代码

构建分发版

thorcam-0.1.7-cp310-cp310-win_amd64.whl (19.0 MB 查看哈希值)

上传于 CPython 3.10 Windows x86-64

thorcam-0.1.7-cp39-cp39-win_amd64.whl (19.0 MB 查看哈希值)

上传于 CPython 3.9 Windows x86-64

thorcam-0.1.7-cp38-cp38-win_amd64.whl (19.0 MB 查看哈希值)

上传于 CPython 3.8 Windows x86-64

thorcam-0.1.7-cp37-cp37m-win_amd64.whl (19.0 MB 查看哈希值)

上传于 CPython 3.7m Windows x86-64

由以下组织支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面