Python interface to the .NET Thor cameras.
Project description
ThorCam
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.3.tar.gz
(15.0 kB
view hashes)
Built Distributions
thorcam-0.1.3-cp38-cp38-win32.whl
(13.4 MB
view hashes)
Close
Hashes for thorcam-0.1.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2295dda2714e261c7c953d4957198b1c6879bf01637c6a9e1cd0b69dfde233da |
|
MD5 | d43daab38d05e9859371d90575fbd645 |
|
BLAKE2b-256 | a2d589ad9b1909d5e3123809f7f3dd598dc6f0cf535b80ea710edca484bc3207 |
Close
Hashes for thorcam-0.1.3-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03dda87b31ac6d2ce079c062a8b1b7acd0aee2004cafe90e6f1e05e61802a80c |
|
MD5 | 26f9fdf313d001264f0abfee3621e456 |
|
BLAKE2b-256 | 22b95919586e0e515705b38e71b77328a3dc08a27bdd64fc168c7eb08c34bf78 |
Close
Hashes for thorcam-0.1.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e00f72741831ddeac4c670296a96f03d6fbae0b1c23aeb63dcc6c5615ecc71af |
|
MD5 | cfbb93ccc9962182ca617137aa30d8f7 |
|
BLAKE2b-256 | 4b4f9dacb279e83f15cba8d99fab3a1e960049e4061226d93f7c548066183935 |
Close
Hashes for thorcam-0.1.3-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e97a1cf151be376ec9de3c6a382e5aaedfc306b5c6b5c3430c5ce60a77dea9f |
|
MD5 | a13df440b440d3f26115fc1a1874a0a4 |
|
BLAKE2b-256 | 9523901127fe53c476199236aaea1a91f6c185cfc38985b6163cb338464c6d08 |
Close
Hashes for thorcam-0.1.3-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ec7f4cebab4f8bc0aa5d0439a5cdf55207cec24cb76f8c69e78271b20f8f65a |
|
MD5 | 01a2799b9d462581aa6fb8e9c5ec626b |
|
BLAKE2b-256 | ab9120967f5f73d5d487ce2387420093b485cac1920cd6ef540d66cdd680d627 |
Close
Hashes for thorcam-0.1.3-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 830bbcb87c4d18e7eb9e4b0938d2b477f05f733e2007afd467930139e6d027b8 |
|
MD5 | 36ba08fdd39c0e4a88d65a19261a9fa1 |
|
BLAKE2b-256 | 9efcfc6020295910263972425db340f0a1ef2787eaa9d4ec2701d13d2ac20965 |