Skip to main content

Python interface to the .NET Thor cameras.

Project description

ThorCam

Github Build Status

Python interface for the Thor scientific Cameras using .Net.

For more information and to get started: https://matham.github.io/thorcam/index.html.

To install https://matham.github.io/thorcam/installation.html.

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 "['05761']"
>>> # open the camera
>>> cam.open_camera('05761')
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.1.tar.gz (14.8 kB view details)

Uploaded Source

Built Distributions

thorcam-0.1.1-cp37-cp37m-win_amd64.whl (15.2 MB view details)

Uploaded CPython 3.7m Windows x86-64

thorcam-0.1.1-cp37-cp37m-win32.whl (12.9 MB view details)

Uploaded CPython 3.7m Windows x86

thorcam-0.1.1-cp36-cp36m-win_amd64.whl (15.2 MB view details)

Uploaded CPython 3.6m Windows x86-64

thorcam-0.1.1-cp36-cp36m-win32.whl (12.9 MB view details)

Uploaded CPython 3.6m Windows x86

File details

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

File metadata

  • Download URL: thorcam-0.1.1.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for thorcam-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7b8ba1652a07a44ca63ed6f88d4ca9fe756872bfca7728720dfdb478567b3cec
MD5 a4d65e9a9eba9c6665d496c09f9841d6
BLAKE2b-256 1b83373609b060b76703545dbc3bfddb752c7a85863523cbc7cd455827640eab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thorcam-0.1.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 15.2 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for thorcam-0.1.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 8567d61a3b9dfced1041c2ed475fb2c552aca53c5b472b37d3be582243205a6d
MD5 64957008d97150d1e89f2d173d02805a
BLAKE2b-256 98ace7dfcde9eec0654180fbf6f46d963b91a34ddbcd83073a8cd6a8de073eeb

See more details on using hashes here.

File details

Details for the file thorcam-0.1.1-cp37-cp37m-win32.whl.

File metadata

  • Download URL: thorcam-0.1.1-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 12.9 MB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for thorcam-0.1.1-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 fb4f14dac723e9cfb66f6451a1ecf80914a7115d70b87b1e35494903ee649d16
MD5 c1f0d79141ca8fefa6dd589906c73070
BLAKE2b-256 f9324e8611e63c60496331854618a06a26ad3a2e8df011b17ecd57ff0d981d53

See more details on using hashes here.

File details

Details for the file thorcam-0.1.1-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: thorcam-0.1.1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 15.2 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for thorcam-0.1.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 d1970247bf9be2e9ecdb3dcc4b141b379e9534412dcdab857f064a1d512e73c6
MD5 b73f1567e10f9db1a6fb5d4aed375b95
BLAKE2b-256 293c7ab12e6ba4d95a43ff262959e38719e245648f9ca20861d494e93a410013

See more details on using hashes here.

File details

Details for the file thorcam-0.1.1-cp36-cp36m-win32.whl.

File metadata

  • Download URL: thorcam-0.1.1-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 12.9 MB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for thorcam-0.1.1-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 366a3132c116213198897e2d73b704140d7d7d1892c7222127823f516f78a7ea
MD5 e25820c47f0d3de334db608e5d2729cc
BLAKE2b-256 d38dd5c89aa097ad882fe600efcd964c1f591e5691a15b77e9fb96897cf1bae5

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