Skip to main content

Python interface to the .NET Thor cameras.

Project description

ThorCam

Github Build Status

A Python interface to the Thor scientific Cameras using .Net.

This library does not support the DCx cameras, only the scientific cameras.

See the docs for more information and to get started.

To install in Anaconda or native Python see the installation instructions.

Basic example

First create a subclass that prints the camera results:

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))

Then use the camera:

>>> # 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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thorcam-0.1.7.tar.gz (16.2 kB view details)

Uploaded Source

Built Distributions

thorcam-0.1.7-cp310-cp310-win_amd64.whl (19.0 MB view details)

Uploaded CPython 3.10 Windows x86-64

thorcam-0.1.7-cp39-cp39-win_amd64.whl (19.0 MB view details)

Uploaded CPython 3.9 Windows x86-64

thorcam-0.1.7-cp38-cp38-win_amd64.whl (19.0 MB view details)

Uploaded CPython 3.8 Windows x86-64

thorcam-0.1.7-cp37-cp37m-win_amd64.whl (19.0 MB view details)

Uploaded CPython 3.7m Windows x86-64

File details

Details for the file thorcam-0.1.7.tar.gz.

File metadata

  • Download URL: thorcam-0.1.7.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for thorcam-0.1.7.tar.gz
Algorithm Hash digest
SHA256 ea00f15ef029ba4828ca41b797cf56aacfcc5400066d9fb9a8d7eef960d21240
MD5 b227455ae278bf6b151b6d5766cc4322
BLAKE2b-256 902d7ed37faa28a8d2e7b09646f8aad1275d4431804cd621c81ca06fa732d433

See more details on using hashes here.

File details

Details for the file thorcam-0.1.7-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: thorcam-0.1.7-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 19.0 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for thorcam-0.1.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 15ef3b986eff83d0176f26af215624541c33d6a500c1e6b911de2c865d60bdc2
MD5 0400e5310b6489ed154a34b7166e68f1
BLAKE2b-256 b74a1887df73be032e06cba2ce1977d4095b0677e00ebb03ef1d1afec54a8f95

See more details on using hashes here.

File details

Details for the file thorcam-0.1.7-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: thorcam-0.1.7-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 19.0 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for thorcam-0.1.7-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f259e0934bfc490b2490bd42fab26a6233e1a40f9c62e0781d538179b45a779c
MD5 cadf155b3e20403585c9dccd69d73283
BLAKE2b-256 789e5650c97368896705a2df15df8bda872e8a31921666aece8a5dd1f95d8116

See more details on using hashes here.

File details

Details for the file thorcam-0.1.7-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: thorcam-0.1.7-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 19.0 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for thorcam-0.1.7-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 efa1251b97e93f3a21f66de757f93ecbec6f424768fc5a6f2c9585e357fbe507
MD5 708ea538632ade96ecd33be223faa2e5
BLAKE2b-256 c223d935408e6e803e364300c9cf2ca4742dde4c664d352943f41f22711a10a1

See more details on using hashes here.

File details

Details for the file thorcam-0.1.7-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: thorcam-0.1.7-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 19.0 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.9

File hashes

Hashes for thorcam-0.1.7-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 713b502b2c0844c6df8b9b266f86dea30774f9496bba90bb4701a7eefa8f3dfc
MD5 4ea1d6e3f071cab4d4141d92b4c1d0c6
BLAKE2b-256 18eee4ecc67f12c29dd4775f7157fed2c146bf7d6155391164b5de8f2aecf7de

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page