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

Uploaded Source

Built Distributions

thorcam-0.1.2-cp37-cp37m-win_amd64.whl (16.1 kB view details)

Uploaded CPython 3.7m Windows x86-64

thorcam-0.1.2-cp36-cp36m-win32.whl (16.1 kB view details)

Uploaded CPython 3.6m Windows x86

File details

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

File metadata

  • Download URL: thorcam-0.1.2.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.8

File hashes

Hashes for thorcam-0.1.2.tar.gz
Algorithm Hash digest
SHA256 72a61cdaecc6039434ee22bce5c41d89798398c79f7007a977a8d75c49db74ff
MD5 f0a1530f84228b1a4210020838647999
BLAKE2b-256 cdbf4160aa257b2f949666a5908c37c02a1cac1879c0694171218b58209664e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thorcam-0.1.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

File hashes

Hashes for thorcam-0.1.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 7d276276b462b5e210fdd088766c953c9f2d50ebde12527ef38bd50bca680bc0
MD5 9715bed90f34d95b6e45c9aca4aa8437
BLAKE2b-256 b63f0178dad32f02a7271558b3dddcf784537a1c1b6d5066504fc65287719149

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thorcam-0.1.2-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.8

File hashes

Hashes for thorcam-0.1.2-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 6ba4e2b40d20cde68ea67a76696250348d7f676e1c446080867aa56cb27ff8af
MD5 3661a78eda114ad9e0e3efba921e0b45
BLAKE2b-256 0d954131569da9482a058e584a2b2d6425005ac472f9764b2db9df2b1657f589

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