From 220fd5201be8d1a149abcf1637ed8bcc04123dfe Mon Sep 17 00:00:00 2001 From: morefigs Date: Tue, 29 Jan 2019 10:18:57 +1100 Subject: added new usage examples --- examples/get_camera_feature_infos.py | 14 ++++++++++++++ examples/get_camera_feature_values.py | 27 +++++++++++++++++++++++++++ examples/get_interface_feature_infos.py | 14 ++++++++++++++ examples/get_system_feature_values.py | 24 ++++++++++++++++++++++++ examples/set_camera_feature_value.py | 18 ++++++++++++++++++ examples/set_interface_feature_value.py | 19 +++++++++++++++++++ 6 files changed, 116 insertions(+) create mode 100644 examples/get_camera_feature_infos.py create mode 100644 examples/get_camera_feature_values.py create mode 100644 examples/get_interface_feature_infos.py create mode 100644 examples/get_system_feature_values.py create mode 100644 examples/set_camera_feature_value.py create mode 100644 examples/set_interface_feature_value.py (limited to 'examples') diff --git a/examples/get_camera_feature_infos.py b/examples/get_camera_feature_infos.py new file mode 100644 index 0000000..78e2752 --- /dev/null +++ b/examples/get_camera_feature_infos.py @@ -0,0 +1,14 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vmb: + camera = vmb.camera(0) + camera.open() + + for feature_name in camera.feature_names(): + feature = camera.feature(feature_name) + print(feature.info) + + camera.close() diff --git a/examples/get_camera_feature_values.py b/examples/get_camera_feature_values.py new file mode 100644 index 0000000..89f1582 --- /dev/null +++ b/examples/get_camera_feature_values.py @@ -0,0 +1,27 @@ +from pymba import Vimba, VimbaException + + +if __name__ == '__main__': + + with Vimba() as vmb: + camera = vmb.camera(0) + camera.open() + + # get feature value via feature object + for feature_name in camera.feature_names(): + feature = camera.feature(feature_name) + + try: + value = feature.value + + # alternatively the feature value can be read as an object attribute + # value = getattr(camera, feature_name) + # or + # value = camera.someFeatureName + + except VimbaException as e: + value = e + + print(feature_name, '--', value) + + camera.close() diff --git a/examples/get_interface_feature_infos.py b/examples/get_interface_feature_infos.py new file mode 100644 index 0000000..8330a3d --- /dev/null +++ b/examples/get_interface_feature_infos.py @@ -0,0 +1,14 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vmb: + interface = vmb.interface(0) + interface.open() + + for feature_name in interface.feature_names(): + feature = interface.feature(feature_name) + print(feature.info) + + interface.close() diff --git a/examples/get_system_feature_values.py b/examples/get_system_feature_values.py new file mode 100644 index 0000000..c83f292 --- /dev/null +++ b/examples/get_system_feature_values.py @@ -0,0 +1,24 @@ +from pymba import Vimba, VimbaException + + +if __name__ == '__main__': + + with Vimba() as vmb: + system = vmb.system() + + # get feature value via feature object + for feature_name in system.feature_names(): + feature = system.feature(feature_name) + + try: + value = feature.value + + # alternatively the feature value can be read as an object attribute + # value = getattr(system, feature_name) + # or + # value = system.someFeatureName + + except VimbaException as e: + value = e + + print(feature_name, '--', value) diff --git a/examples/set_camera_feature_value.py b/examples/set_camera_feature_value.py new file mode 100644 index 0000000..a33bf88 --- /dev/null +++ b/examples/set_camera_feature_value.py @@ -0,0 +1,18 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vmb: + camera = vmb.camera(0) + camera.open() + + # set a feature value by feature name + feature = camera.feature('ExposureAuto') + print(feature.value) + feature.value = feature.value + + # alternatively the feature value can be set as an object attribute + camera.ExposureAuto = feature.value + + camera.close() diff --git a/examples/set_interface_feature_value.py b/examples/set_interface_feature_value.py new file mode 100644 index 0000000..0fc80a2 --- /dev/null +++ b/examples/set_interface_feature_value.py @@ -0,0 +1,19 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vmb: + interface = vmb.interface(0) + interface.open() + + # set a feature value by feature name + feature = interface.feature('InterfacePingPace') + print(feature.value) + feature.value = 3 + print(feature.value) + + # alternatively the feature value can be set as an object attribute + interface.InterfacePingPace = 3 + + interface.close() -- cgit v1.2.3