aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormorefigs <morefigs@gmail.com>2019-03-26 13:50:21 +1100
committermorefigs <morefigs@gmail.com>2019-03-26 13:50:21 +1100
commitf72ed83f43664274b2161ccbdb8993507aecdd30 (patch)
tree2020f903dd4c86fe8c5110a2d8d77a5917be00b6
parent91d599433c65a4b55864682131337ed29c2b8d9c (diff)
downloadpymba-f72ed83f43664274b2161ccbdb8993507aecdd30.tar.gz
pymba-f72ed83f43664274b2161ccbdb8993507aecdd30.zip
Word wrapping to 100 chars
-rw-r--r--pymba/camera.py38
-rw-r--r--pymba/feature.py7
-rw-r--r--pymba/frame.py10
-rw-r--r--pymba/system.py3
-rw-r--r--pymba/vimba.py10
-rw-r--r--pymba/vimba_exception.py6
-rw-r--r--pymba/vimba_object.py15
7 files changed, 51 insertions, 38 deletions
diff --git a/pymba/camera.py b/pymba/camera.py
index 45d769e..3df3ebc 100644
--- a/pymba/camera.py
+++ b/pymba/camera.py
@@ -64,8 +64,8 @@ def _camera_infos() -> List[vimba_c.VmbCameraInfo]:
def _camera_info(id_string: str) -> vimba_c.VmbCameraInfo:
"""
Gets camera info object of specified camera.
- :param id_string: the ID of the camera object to get. This can be an ID or e.g. a serial number. Check the Vimba
- documentation for other possible values.
+ :param id_string: the ID of the camera object to get. This can be an ID or e.g. a serial number.
+ Check the Vimba documentation for other possible values.
"""
vmb_camera_info = vimba_c.VmbCameraInfo()
error = vimba_c.vmb_camera_info_query(id_string.encode(),
@@ -176,21 +176,25 @@ class Camera(VimbaObject):
def new_frame(self) -> Frame:
"""
- Creates and returns a new frame object. Multiple frames per camera can therefore be returned.
+ Creates and returns a new frame object. Multiple frames per camera can therefore be
+ returned.
"""
return Frame(self)
- def arm(self, mode: str, callback: Optional[Callable] = None, frame_buffer_size: Optional[int] = 10) -> None:
+ def arm(self, mode: str, callback: Optional[Callable] = None,
+ frame_buffer_size: Optional[int] = 10) -> None:
"""
Arm the camera by starting the capture engine and creating frames.
- :param mode: Either 'SingleFrame' to acquire a single frame or 'Continuous' for streaming frames.
- :param callback: A function reference to call when each frame is ready. Applies to 'Continuous' acquisition
- mode only. The callback function should execute relatively quickly to avoid dropping frames (if the camera
- captures a frame but no frame is currently queued for capture then the frame will be dropped. Therefore the
- callback function should execute (on average) at least as fast as the camera frame rate. It may be desirable
- for the callback to copy frame data and pass the data to a separate thread/process for processing.
- :param frame_buffer_size: number of frames to create and use for the acquisition buffer. Increasing this may
- help if frames are being dropped.
+ :param mode: Either 'SingleFrame' to acquire a single frame or 'Continuous' for streaming
+ frames.
+ :param callback: A function reference to call when each frame is ready. Applies to
+ 'Continuous' acquisition mode only. The callback function should execute relatively quickly
+ to avoid dropping frames (if the camera captures a frame but no frame is currently queued
+ for capture then the frame will be dropped. Therefore the callback function should execute
+ (on average) at least as fast as the camera frame rate. It may be desirable for the
+ callback to copy frame data and pass the data to a separate thread/process for processing.
+ :param frame_buffer_size: number of frames to create and use for the acquisition buffer.
+ Increasing this may help if frames are being dropped.
"""
if self._is_armed:
raise VimbaException(VimbaException.ERR_INVALID_CAMERA_MODE)
@@ -219,9 +223,9 @@ class Camera(VimbaObject):
def acquire_frame(self) -> Frame:
"""
- Acquire and return a single frame when the camera is armed in 'SingleFrame' acquisition mode. Can be called
- multiple times in a row, but don't call again until the frame has been copied or processed the internal frame
- object is reused.
+ Acquire and return a single frame when the camera is armed in 'SingleFrame' acquisition
+ mode. Can be called multiple times in a row, but don't call again until the frame has been
+ copied or processed the internal frame object is reused.
"""
if not self._is_armed or self._acquisition_mode != SINGLE_FRAME:
raise VimbaException(VimbaException.ERR_INVALID_CAMERA_MODE)
@@ -250,8 +254,8 @@ class Camera(VimbaObject):
def start_frame_acquisition(self) -> None:
"""
- Acquire and stream frames (to the specified callback function) indefinitely when the camera is armed in
- 'Continuous' acquisition mode.
+ Acquire and stream frames (to the specified callback function) indefinitely when the camera
+ is armed in 'Continuous' acquisition mode.
"""
# no need to check self._is_acquiring
if not self._is_armed or self._acquisition_mode != CONTINUOUS:
diff --git a/pymba/feature.py b/pymba/feature.py
index 571f2b5..9f04666 100644
--- a/pymba/feature.py
+++ b/pymba/feature.py
@@ -42,7 +42,9 @@ class Feature:
@property
def range(self) -> Union[None, Tuple[int, int], Tuple[float, float], Tuple[str, str]]:
# only some types actually have a range
- if self.info.featureDataType in (_FEATURE_DATA_INT, _FEATURE_DATA_FLOAT, _FEATURE_DATA_ENUM):
+ if self.info.featureDataType in (_FEATURE_DATA_INT,
+ _FEATURE_DATA_FLOAT,
+ _FEATURE_DATA_ENUM):
return self._access_func('range', self.info.featureDataType)()
return None
@@ -52,7 +54,8 @@ class Feature:
def _access_func(self, func_type: str, data_type: int) -> Callable:
"""
- Get the correct function needed to access the feature attribute based on the feature's data type.
+ Get the correct function needed to access the feature attribute based on the feature's data
+ type.
:param func_type: One of 'get', 'set', or 'range'.
:param data_type: Data type as defined in VmbFeatureDataType.
"""
diff --git a/pymba/frame.py b/pymba/frame.py
index 871d22d..bde0512 100644
--- a/pymba/frame.py
+++ b/pymba/frame.py
@@ -28,8 +28,8 @@ class Frame:
def announce(self) -> None:
"""
- Announce frames to the API that may be queued for frame capturing later. Should be called after the frame is
- created. Call startCapture after this method.
+ Announce frames to the API that may be queued for frame capturing later. Should be called
+ after the frame is created. Call startCapture after this method.
"""
# allocate memory for the frame and keep a reference to keep alive
self._c_memory = create_string_buffer(self._camera.PayloadSize)
@@ -59,9 +59,9 @@ class Frame:
def queue_for_capture(self, frame_callback: Optional[Callable] = None) -> None:
"""
- Queue frames that may be filled during frame capturing. Call after announceFrame and startCapture. Callback
- must accept argument of type frame. Remember to requeue the frame by calling frame.queue_capture() at the end
- of your callback function.
+ Queue frames that may be filled during frame capturing. Call after announceFrame and
+ startCapture. Callback must accept argument of type frame. Remember to requeue the frame by
+ calling frame.queue_capture() at the end of your callback function.
"""
self._frame_callback = frame_callback
diff --git a/pymba/system.py b/pymba/system.py
index cc1d799..06bedae 100644
--- a/pymba/system.py
+++ b/pymba/system.py
@@ -3,7 +3,8 @@ from .vimba_object import VimbaObject
class System(VimbaObject):
"""
- A Vimba system object. This class provides the minimal access to Vimba functions required to control the system.
+ A Vimba system object. This class provides the minimal access to Vimba functions required to
+ control the system.
"""
def __init__(self, vimba):
super().__init__(vimba, handle=1)
diff --git a/pymba/vimba.py b/pymba/vimba.py
index 37584a5..9822782 100644
--- a/pymba/vimba.py
+++ b/pymba/vimba.py
@@ -80,7 +80,8 @@ class Vimba:
def interface(self, interface_id: Union[str, int]) -> Interface:
"""
- Gets interface object based on interface ID string or index. Will not recreate interface object if it already exists.
+ Gets interface object based on interface ID string or index. Will not recreate interface
+ object if it already exists.
:param interface_id: the ID or the index of the interface.
"""
# if index is provided, look up the camera id using the index
@@ -102,9 +103,10 @@ class Vimba:
def camera(self, camera_id: Union[str, int]) -> Camera:
"""
- Gets camera object based on camera ID string or index. Will not recreate camera object if it already exists.
- :param camera_id: the ID or the index of the camera object to get. This can be an ID or e.g. a serial number.
- Check the Vimba documentation for other possible values.
+ Gets camera object based on camera ID string or index. Will not recreate camera object if
+ it already exists.
+ :param camera_id: the ID or the index of the camera object to get. This can be an ID or
+ e.g. a serial number. Check the Vimba documentation for other possible values.
"""
# if index is provided, look up the camera id using the index
if isinstance(camera_id, int):
diff --git a/pymba/vimba_exception.py b/pymba/vimba_exception.py
index 0e19da3..faf32eb 100644
--- a/pymba/vimba_exception.py
+++ b/pymba/vimba_exception.py
@@ -46,7 +46,8 @@ class VimbaException(Exception):
ERR_STRUCT_SIZE_INVALID: 'The given struct size is not valid for this version of the API.',
ERR_DATA_TOO_LARGE: 'More data was returned in a string/list than space was provided.',
ERR_FEATURE_TYPE_WRONG: 'The feature type for this access function was wrong.',
- ERR_VALUE_INVALID: 'The value was not valid; either out of bounds or not an increment of the minimum.',
+ ERR_VALUE_INVALID: 'The value was not valid; either out of bounds or not an increment of '
+ 'the minimum.',
ERR_TIMEOUT: 'Timeout during wait.',
ERR_OTHER_ERROR: 'Other error.',
ERR_RESOURCE_NOT_AVAILABLE: 'Resources not available (e.g. memory).',
@@ -60,7 +61,8 @@ class VimbaException(Exception):
ERR_UNDEFINED_ERROR_CODE: 'Undefined error code',
ERR_FRAME_BUFFER_MEMORY: 'Not enough memory to assign frame buffer.',
ERR_NOT_IMPLEMENTED_IN_PYMBA: 'This function is not yet implemented in Pymba.',
- ERR_COMMAND_MUST_BE_CALLED: 'Cannot get or set the value of a command feature type, call the command instead.',
+ ERR_COMMAND_MUST_BE_CALLED: 'Cannot get or set the value of a command feature type, call '
+ 'the command instead.',
ERR_INVALID_CAMERA_MODE: 'Invalid camera mode for the requested operation.',
}
diff --git a/pymba/vimba_object.py b/pymba/vimba_object.py
index 58657f8..ca91bd3 100644
--- a/pymba/vimba_object.py
+++ b/pymba/vimba_object.py
@@ -8,8 +8,8 @@ from . import vimba_c
class VimbaObject:
"""
- A Vimba object has a handle and features associated with it. Objects include System, Camera, Interface and
- AncillaryData. Features are automatically readable as instance attributes.
+ A Vimba object has a handle and features associated with it. Objects include System, Camera,
+ Interface and AncillaryData. Features are automatically readable as instance attributes.
"""
VMB_ACCESS_MODE_NONE = 0
@@ -53,7 +53,8 @@ class VimbaObject:
def _feature_infos(self) -> List[vimba_c.VmbFeatureInfo]:
"""
- Gets feature info of all available features. Will cause error if object/camera/etc is not opened.
+ Gets feature info of all available features. Will cause error if object/camera/etc is not
+ opened.
"""
# call once to get number of available features
vmb_feature_info = vimba_c.VmbFeatureInfo()
@@ -132,8 +133,8 @@ class VimbaObject:
# todo test
def read_register(self, address: int) -> int:
- # note that the underlying Vimba function allows reading of an array of registers, but only one address/value
- # at a time is implemented here
+ # note that the underlying Vimba function allows reading of an array of registers, but only
+ # one address/value at a time is implemented here
"""
Read from a register of the module (camera) and return its value.
:param address: the address of the register to read.
@@ -154,8 +155,8 @@ class VimbaObject:
# todo test
def write_register(self, address: int, value: int) -> None:
- # note that the underlying Vimba function allows writing of an array of registers, but only one address/value
- # at a time is implemented here
+ # note that the underlying Vimba function allows writing of an array of registers, but only
+ # one address/value at a time is implemented here
"""
Write to a register of the module (camera).
:param address: the address of the register to read.