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.6.tar.gz (16.1 kB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.8 Windows x86-64

thorcam-0.1.6-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.6.tar.gz.

File metadata

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

File hashes

Hashes for thorcam-0.1.6.tar.gz
Algorithm Hash digest
SHA256 170e853d89d1660375025bc28a2550ac9f6a63c1a6628dba3787e91881a7bb9a
MD5 3839c7c6cd69a51052bff929801b80e9
BLAKE2b-256 678e7ec0074c4198a753f5f444cad8018db220298aeaab21b5453beb7bdb1fb2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thorcam-0.1.6-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.5

File hashes

Hashes for thorcam-0.1.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e2cffc33fb5752550facdb9dcb4236719db67d48aed33a9521bfbc50989b465f
MD5 bb77f9e9d1bedefd2211e0639c3cac36
BLAKE2b-256 59bccb89af72a871118edb510e38b919e72994ebfc0a4e4a254125adb8f4a6a4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thorcam-0.1.6-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.6-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2189aac952eae4dd741cc43892e7c7c1506c4893e80f90ecd7ea8e0e861067b7
MD5 2d6b4af02386a1d4124a8d51363eae0f
BLAKE2b-256 45ec4161d9467c26ec4af2bc63bfa273047125edfe0036b4742ebe9e8f6d2424

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thorcam-0.1.6-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.6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4171e23ea9077cda8a08c0bb3e96a3f56ac8bf8262011ed386406859ba9b5555
MD5 3683dc5b96600b6168fb332d1533a1f8
BLAKE2b-256 d2bb3fe9d6d9283d7869b082f21b8dea67a791380674f6ddd82f977c0f5dbb88

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thorcam-0.1.6-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.6-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 775ed00cbf34260a805500662abbb46c942bb3779399879e4848a98e495264d4
MD5 de2d359196527782bfafed077c7ac0cd
BLAKE2b-256 ed1273d2b1d7c7c17963908588c00ea287655a36598234c39b0bc74594195d81

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