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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m Windows x86

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m Windows x86

File details

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

File metadata

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

File hashes

Hashes for thorcam-0.1.0.tar.gz
Algorithm Hash digest
SHA256 222155d4c60d03d70a0900b9b353287efbf548d04960015f6eb76de049a35b7d
MD5 e39667346896edcb6383355986f9c0c3
BLAKE2b-256 a0dd9f7ff243616ba84c434028f1d51f1f7c692a5282eea965f0d02d2d453683

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thorcam-0.1.0-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/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for thorcam-0.1.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 8323f3fe0c8c99f8b826875d28148679d8707fedb5da81e185ad460582341f3a
MD5 a18f236fda5b2476c4b9d51db93f8961
BLAKE2b-256 e122cc6c8f13a0481c33a74429af6fe1e8f21069586ea04a87f26399804f42d8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thorcam-0.1.0-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/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for thorcam-0.1.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 806c7a883ab377ac3c0f0365ebe13045a055fb039f73d7f15aa99e2e19a18f6f
MD5 0ec6a742dea94a38968a401d8ebfbc5f
BLAKE2b-256 d61917e4a3266194e1e2320ac280ec42a5a93876ced63e9e64444f3b14e6b696

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thorcam-0.1.0-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/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for thorcam-0.1.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 639e570f057e496961ce273dc94bb2c1755150b71730c56a53ef2ac07e605d75
MD5 818a3745e907c5d7c4125033b1c2690d
BLAKE2b-256 82e2e2192b00463bdad06db22cda56584b5f6b26f3f7fe15d572de61cfc390bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thorcam-0.1.0-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/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for thorcam-0.1.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 07c68168f6ead7c80a1d7f07b9e4bfcab1b78fd705f0799e2be38292e4b3756f
MD5 2322279a3c3034ddef62cd1d573dbf36
BLAKE2b-256 bb71986cfee2001135a3fd8cd525845d74fe7bf4cc2fadef6503cc1e47a232d4

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