From 2ac23b2510d4083beb9e21beed689b41a09a7557 Mon Sep 17 00:00:00 2001 From: morefigs Date: Mon, 21 Jan 2019 15:28:06 +1100 Subject: added simple usage examples --- examples/check_version.py | 7 +++++++ examples/list_cameras.py | 12 ++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 examples/check_version.py create mode 100644 examples/list_cameras.py (limited to 'examples') diff --git a/examples/check_version.py b/examples/check_version.py new file mode 100644 index 0000000..de8449c --- /dev/null +++ b/examples/check_version.py @@ -0,0 +1,7 @@ +from pymba.vimba import Vimba + + +if __name__ == '__main__': + + vmb = Vimba() + print(vmb.version) diff --git a/examples/list_cameras.py b/examples/list_cameras.py new file mode 100644 index 0000000..0be2e12 --- /dev/null +++ b/examples/list_cameras.py @@ -0,0 +1,12 @@ +from pymba.vimba import Vimba +from time import sleep + + +if __name__ == '__main__': + + with Vimba() as vmb: + # required for discovering GigE cameras + if vmb.system.GeVTLIsPresent: + vmb.system.runFeatureCommand("GeVDiscoveryAllOnce") + sleep(0.2) + print(vmb.camera_ids) -- cgit v1.2.3 From fcf34f86abce5a002babc4f7a3e465f312c7f61b Mon Sep 17 00:00:00 2001 From: morefigs Date: Tue, 22 Jan 2019 17:15:58 +1100 Subject: function rename --- examples/list_cameras.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/list_cameras.py b/examples/list_cameras.py index 0be2e12..1d8258c 100644 --- a/examples/list_cameras.py +++ b/examples/list_cameras.py @@ -7,6 +7,6 @@ if __name__ == '__main__': with Vimba() as vmb: # required for discovering GigE cameras if vmb.system.GeVTLIsPresent: - vmb.system.runFeatureCommand("GeVDiscoveryAllOnce") + vmb.system.run_feature_command("GeVDiscoveryAllOnce") sleep(0.2) print(vmb.camera_ids) -- cgit v1.2.3 From 86b277ea219240171a5befd8ac9a82765f56021d Mon Sep 17 00:00:00 2001 From: morefigs Date: Wed, 23 Jan 2019 14:27:23 +1100 Subject: simple interface list example --- examples/list_cameras.py | 12 ------------ examples/show_cameras.py | 12 ++++++++++++ examples/show_interfaces.py | 7 +++++++ 3 files changed, 19 insertions(+), 12 deletions(-) delete mode 100644 examples/list_cameras.py create mode 100644 examples/show_cameras.py create mode 100644 examples/show_interfaces.py (limited to 'examples') diff --git a/examples/list_cameras.py b/examples/list_cameras.py deleted file mode 100644 index 1d8258c..0000000 --- a/examples/list_cameras.py +++ /dev/null @@ -1,12 +0,0 @@ -from pymba.vimba import Vimba -from time import sleep - - -if __name__ == '__main__': - - with Vimba() as vmb: - # required for discovering GigE cameras - if vmb.system.GeVTLIsPresent: - vmb.system.run_feature_command("GeVDiscoveryAllOnce") - sleep(0.2) - print(vmb.camera_ids) diff --git a/examples/show_cameras.py b/examples/show_cameras.py new file mode 100644 index 0000000..39fffe8 --- /dev/null +++ b/examples/show_cameras.py @@ -0,0 +1,12 @@ +from pymba.vimba import Vimba +from time import sleep + + +if __name__ == '__main__': + + with Vimba() as vmb: + # required for discovering GigE cameras + if vmb.system.GeVTLIsPresent: + vmb.system.run_feature_command("GeVDiscoveryAllOnce") + sleep(0.2) + print(vmb.get_camera_ids()) diff --git a/examples/show_interfaces.py b/examples/show_interfaces.py new file mode 100644 index 0000000..9d95fc1 --- /dev/null +++ b/examples/show_interfaces.py @@ -0,0 +1,7 @@ +from pymba.vimba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vmb: + print(vmb.get_interface_ids()) -- cgit v1.2.3 From 12a2808655b8dfb1b1aa40605cb04dc2a59e3e85 Mon Sep 17 00:00:00 2001 From: morefigs Date: Wed, 23 Jan 2019 14:28:38 +1100 Subject: system show example --- examples/show_system.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 examples/show_system.py (limited to 'examples') diff --git a/examples/show_system.py b/examples/show_system.py new file mode 100644 index 0000000..4ce2807 --- /dev/null +++ b/examples/show_system.py @@ -0,0 +1,7 @@ +from pymba.vimba import Vimba + + +if __name__ == '__main__': + + vmb = Vimba() + print(vmb.system) -- cgit v1.2.3 From f6afc7f17d8a7351f21852f5c1e0994b8eefe690 Mon Sep 17 00:00:00 2001 From: morefigs Date: Sun, 27 Jan 2019 13:22:15 +1100 Subject: update usage examples --- examples/check_version.py | 7 ------- examples/get_camera.py | 16 ++++++++++++++++ examples/get_camera_ids.py | 14 ++++++++++++++ examples/get_interface.py | 9 +++++++++ examples/get_interface_ids.py | 7 +++++++ examples/get_version.py | 7 +++++++ 6 files changed, 53 insertions(+), 7 deletions(-) delete mode 100644 examples/check_version.py create mode 100644 examples/get_camera.py create mode 100644 examples/get_camera_ids.py create mode 100644 examples/get_interface.py create mode 100644 examples/get_interface_ids.py create mode 100644 examples/get_version.py (limited to 'examples') diff --git a/examples/check_version.py b/examples/check_version.py deleted file mode 100644 index de8449c..0000000 --- a/examples/check_version.py +++ /dev/null @@ -1,7 +0,0 @@ -from pymba.vimba import Vimba - - -if __name__ == '__main__': - - vmb = Vimba() - print(vmb.version) diff --git a/examples/get_camera.py b/examples/get_camera.py new file mode 100644 index 0000000..3821053 --- /dev/null +++ b/examples/get_camera.py @@ -0,0 +1,16 @@ +from pymba import Vimba +from time import sleep + + +if __name__ == '__main__': + + with Vimba() as vmb: + + # required for discovering GigE cameras + if vmb.system().GeVTLIsPresent: + vmb.system().run_feature_command("GeVDiscoveryAllOnce") + sleep(0.2) + + # provide camera index or id + camera = vmb.camera(0) + print(camera) diff --git a/examples/get_camera_ids.py b/examples/get_camera_ids.py new file mode 100644 index 0000000..5f3341f --- /dev/null +++ b/examples/get_camera_ids.py @@ -0,0 +1,14 @@ +from pymba import Vimba +from time import sleep + + +if __name__ == '__main__': + + with Vimba() as vmb: + + # required for discovering GigE cameras + if vmb.system().GeVTLIsPresent: + vmb.system().run_feature_command("GeVDiscoveryAllOnce") + sleep(0.2) + + print(vmb.camera_ids()) diff --git a/examples/get_interface.py b/examples/get_interface.py new file mode 100644 index 0000000..797ce85 --- /dev/null +++ b/examples/get_interface.py @@ -0,0 +1,9 @@ +from pymba import Vimba, VimbaException + + +if __name__ == '__main__': + + with Vimba() as vmb: + # provide interface index or id + interface = vmb.interface(0) + print(interface) diff --git a/examples/get_interface_ids.py b/examples/get_interface_ids.py new file mode 100644 index 0000000..e93e7f2 --- /dev/null +++ b/examples/get_interface_ids.py @@ -0,0 +1,7 @@ +from pymba import Vimba, VimbaException + + +if __name__ == '__main__': + + with Vimba() as vmb: + print(vmb.interface_ids()) diff --git a/examples/get_version.py b/examples/get_version.py new file mode 100644 index 0000000..c482b0b --- /dev/null +++ b/examples/get_version.py @@ -0,0 +1,7 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + vmb = Vimba() + print(vmb.version) -- cgit v1.2.3 From 8bea834e445cc503d9800eb7575cd04b7b88812e Mon Sep 17 00:00:00 2001 From: morefigs Date: Sun, 27 Jan 2019 13:26:46 +1100 Subject: added feature name examples --- examples/get_cameras_feature_names.py | 18 ++++++++++++++++++ examples/get_interface_feature_names.py | 11 +++++++++++ 2 files changed, 29 insertions(+) create mode 100644 examples/get_cameras_feature_names.py create mode 100644 examples/get_interface_feature_names.py (limited to 'examples') diff --git a/examples/get_cameras_feature_names.py b/examples/get_cameras_feature_names.py new file mode 100644 index 0000000..8b752e9 --- /dev/null +++ b/examples/get_cameras_feature_names.py @@ -0,0 +1,18 @@ +from pymba import Vimba +from time import sleep + + +if __name__ == '__main__': + + with Vimba() as vmb: + + # required for discovering GigE cameras + if vmb.system().GeVTLIsPresent: + vmb.system().run_feature_command("GeVDiscoveryAllOnce") + sleep(0.2) + + camera = vmb.camera(0) + camera.open() + for feature_name in camera.feature_names(): + print(feature_name) + camera.close() diff --git a/examples/get_interface_feature_names.py b/examples/get_interface_feature_names.py new file mode 100644 index 0000000..83cf1a3 --- /dev/null +++ b/examples/get_interface_feature_names.py @@ -0,0 +1,11 @@ +from pymba import Vimba, VimbaException + + +if __name__ == '__main__': + + with Vimba() as vmb: + interface = vmb.interface(0) + interface.open() + for feature_name in interface.feature_names(): + print(feature_name) + interface.close() -- cgit v1.2.3 From de54bb6b3b656b8185e479be30c5a80acf7fd63f Mon Sep 17 00:00:00 2001 From: morefigs Date: Sun, 27 Jan 2019 13:28:47 +1100 Subject: added system object examples --- examples/get_system.py | 8 ++++++++ examples/get_system_feature_names.py | 9 +++++++++ 2 files changed, 17 insertions(+) create mode 100644 examples/get_system.py create mode 100644 examples/get_system_feature_names.py (limited to 'examples') diff --git a/examples/get_system.py b/examples/get_system.py new file mode 100644 index 0000000..2be6a09 --- /dev/null +++ b/examples/get_system.py @@ -0,0 +1,8 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vmb: + system = vmb.system() + print(system) diff --git a/examples/get_system_feature_names.py b/examples/get_system_feature_names.py new file mode 100644 index 0000000..1d41db2 --- /dev/null +++ b/examples/get_system_feature_names.py @@ -0,0 +1,9 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vmb: + system = vmb.system() + for feature_name in system.feature_names(): + print(feature_name) -- cgit v1.2.3 From c63ba37c7f8da03de4fd8030bd392b966be7f335 Mon Sep 17 00:00:00 2001 From: morefigs Date: Sun, 27 Jan 2019 13:45:27 +1100 Subject: delete old examples --- examples/show_cameras.py | 12 ------------ examples/show_interfaces.py | 7 ------- examples/show_system.py | 7 ------- 3 files changed, 26 deletions(-) delete mode 100644 examples/show_cameras.py delete mode 100644 examples/show_interfaces.py delete mode 100644 examples/show_system.py (limited to 'examples') diff --git a/examples/show_cameras.py b/examples/show_cameras.py deleted file mode 100644 index 39fffe8..0000000 --- a/examples/show_cameras.py +++ /dev/null @@ -1,12 +0,0 @@ -from pymba.vimba import Vimba -from time import sleep - - -if __name__ == '__main__': - - with Vimba() as vmb: - # required for discovering GigE cameras - if vmb.system.GeVTLIsPresent: - vmb.system.run_feature_command("GeVDiscoveryAllOnce") - sleep(0.2) - print(vmb.get_camera_ids()) diff --git a/examples/show_interfaces.py b/examples/show_interfaces.py deleted file mode 100644 index 9d95fc1..0000000 --- a/examples/show_interfaces.py +++ /dev/null @@ -1,7 +0,0 @@ -from pymba.vimba import Vimba - - -if __name__ == '__main__': - - with Vimba() as vmb: - print(vmb.get_interface_ids()) diff --git a/examples/show_system.py b/examples/show_system.py deleted file mode 100644 index 4ce2807..0000000 --- a/examples/show_system.py +++ /dev/null @@ -1,7 +0,0 @@ -from pymba.vimba import Vimba - - -if __name__ == '__main__': - - vmb = Vimba() - print(vmb.system) -- cgit v1.2.3 From 8f6ac20bf8e090cca1ce537f27079bcd5b3dea46 Mon Sep 17 00:00:00 2001 From: morefigs Date: Tue, 29 Jan 2019 10:02:43 +1100 Subject: show pymba version --- examples/get_version.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/get_version.py b/examples/get_version.py index c482b0b..e03fe12 100644 --- a/examples/get_version.py +++ b/examples/get_version.py @@ -1,7 +1,8 @@ -from pymba import Vimba +from pymba import Vimba, PYMBA_VERSION if __name__ == '__main__': + print(f'Pymba version: {PYMBA_VERSION}') vmb = Vimba() - print(vmb.version) + print(f'Vimba version: {vmb.version}') -- cgit v1.2.3 From e3d3291bea56a9c7185aad27ba4084c615f7e661 Mon Sep 17 00:00:00 2001 From: morefigs Date: Tue, 29 Jan 2019 10:18:21 +1100 Subject: clean up and add new examples --- examples/get_camera.py | 7 ------- examples/get_camera_feature_names.py | 13 +++++++++++++ examples/get_camera_ids.py | 7 ------- examples/get_cameras_feature_names.py | 18 ------------------ examples/get_interface.py | 2 +- examples/get_interface_feature_names.py | 4 +++- examples/get_interface_ids.py | 2 +- examples/get_system_feature_names.py | 9 --------- 8 files changed, 18 insertions(+), 44 deletions(-) create mode 100644 examples/get_camera_feature_names.py delete mode 100644 examples/get_cameras_feature_names.py delete mode 100644 examples/get_system_feature_names.py (limited to 'examples') diff --git a/examples/get_camera.py b/examples/get_camera.py index 3821053..5a9285b 100644 --- a/examples/get_camera.py +++ b/examples/get_camera.py @@ -1,16 +1,9 @@ from pymba import Vimba -from time import sleep if __name__ == '__main__': with Vimba() as vmb: - - # required for discovering GigE cameras - if vmb.system().GeVTLIsPresent: - vmb.system().run_feature_command("GeVDiscoveryAllOnce") - sleep(0.2) - # provide camera index or id camera = vmb.camera(0) print(camera) diff --git a/examples/get_camera_feature_names.py b/examples/get_camera_feature_names.py new file mode 100644 index 0000000..fcf6a8a --- /dev/null +++ b/examples/get_camera_feature_names.py @@ -0,0 +1,13 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vmb: + camera = vmb.camera(0) + camera.open() + + for feature_name in camera.feature_names(): + print(feature_name) + + camera.close() diff --git a/examples/get_camera_ids.py b/examples/get_camera_ids.py index 5f3341f..fe37242 100644 --- a/examples/get_camera_ids.py +++ b/examples/get_camera_ids.py @@ -1,14 +1,7 @@ from pymba import Vimba -from time import sleep if __name__ == '__main__': with Vimba() as vmb: - - # required for discovering GigE cameras - if vmb.system().GeVTLIsPresent: - vmb.system().run_feature_command("GeVDiscoveryAllOnce") - sleep(0.2) - print(vmb.camera_ids()) diff --git a/examples/get_cameras_feature_names.py b/examples/get_cameras_feature_names.py deleted file mode 100644 index 8b752e9..0000000 --- a/examples/get_cameras_feature_names.py +++ /dev/null @@ -1,18 +0,0 @@ -from pymba import Vimba -from time import sleep - - -if __name__ == '__main__': - - with Vimba() as vmb: - - # required for discovering GigE cameras - if vmb.system().GeVTLIsPresent: - vmb.system().run_feature_command("GeVDiscoveryAllOnce") - sleep(0.2) - - camera = vmb.camera(0) - camera.open() - for feature_name in camera.feature_names(): - print(feature_name) - camera.close() diff --git a/examples/get_interface.py b/examples/get_interface.py index 797ce85..331f650 100644 --- a/examples/get_interface.py +++ b/examples/get_interface.py @@ -1,4 +1,4 @@ -from pymba import Vimba, VimbaException +from pymba import Vimba if __name__ == '__main__': diff --git a/examples/get_interface_feature_names.py b/examples/get_interface_feature_names.py index 83cf1a3..36bf7be 100644 --- a/examples/get_interface_feature_names.py +++ b/examples/get_interface_feature_names.py @@ -1,4 +1,4 @@ -from pymba import Vimba, VimbaException +from pymba import Vimba if __name__ == '__main__': @@ -6,6 +6,8 @@ if __name__ == '__main__': with Vimba() as vmb: interface = vmb.interface(0) interface.open() + for feature_name in interface.feature_names(): print(feature_name) + interface.close() diff --git a/examples/get_interface_ids.py b/examples/get_interface_ids.py index e93e7f2..92df889 100644 --- a/examples/get_interface_ids.py +++ b/examples/get_interface_ids.py @@ -1,4 +1,4 @@ -from pymba import Vimba, VimbaException +from pymba import Vimba if __name__ == '__main__': diff --git a/examples/get_system_feature_names.py b/examples/get_system_feature_names.py deleted file mode 100644 index 1d41db2..0000000 --- a/examples/get_system_feature_names.py +++ /dev/null @@ -1,9 +0,0 @@ -from pymba import Vimba - - -if __name__ == '__main__': - - with Vimba() as vmb: - system = vmb.system() - for feature_name in system.feature_names(): - print(feature_name) -- cgit v1.2.3 From ed8292a1427a422770c983bace843520b5da46a7 Mon Sep 17 00:00:00 2001 From: morefigs Date: Tue, 29 Jan 2019 10:18:43 +1100 Subject: added new usage examples --- examples/get_interface_feature_values.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 examples/get_interface_feature_values.py (limited to 'examples') diff --git a/examples/get_interface_feature_values.py b/examples/get_interface_feature_values.py new file mode 100644 index 0000000..335b477 --- /dev/null +++ b/examples/get_interface_feature_values.py @@ -0,0 +1,27 @@ +from pymba import Vimba, VimbaException + + +if __name__ == '__main__': + + with Vimba() as vmb: + interface = vmb.interface(0) + interface.open() + + # get feature value via feature object + for feature_name in interface.feature_names(): + feature = interface.feature(feature_name) + + try: + value = feature.value + + # alternatively the feature value can be read as an object attribute + # value = getattr(interface, feature_name) + # or + # value = interface.someFeatureName + + except VimbaException as e: + value = e + + print(feature_name, '--', value) + + interface.close() -- cgit v1.2.3 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 From 2d86dcf99782bc4aa2dc769bde87ef50769b9482 Mon Sep 17 00:00:00 2001 From: morefigs Date: Tue, 29 Jan 2019 13:35:38 +1100 Subject: rename vimba as no longer import vimba module --- examples/get_camera.py | 4 ++-- examples/get_camera_feature_infos.py | 4 ++-- examples/get_camera_feature_names.py | 4 ++-- examples/get_camera_feature_values.py | 4 ++-- examples/get_camera_ids.py | 4 ++-- examples/get_interface.py | 4 ++-- examples/get_interface_feature_infos.py | 4 ++-- examples/get_interface_feature_names.py | 4 ++-- examples/get_interface_feature_values.py | 4 ++-- examples/get_interface_ids.py | 4 ++-- examples/get_system.py | 4 ++-- examples/get_system_feature_values.py | 4 ++-- examples/get_version.py | 4 ++-- examples/set_camera_feature_value.py | 4 ++-- examples/set_interface_feature_value.py | 4 ++-- 15 files changed, 30 insertions(+), 30 deletions(-) (limited to 'examples') diff --git a/examples/get_camera.py b/examples/get_camera.py index 5a9285b..7a830f7 100644 --- a/examples/get_camera.py +++ b/examples/get_camera.py @@ -3,7 +3,7 @@ from pymba import Vimba if __name__ == '__main__': - with Vimba() as vmb: + with Vimba() as vimba: # provide camera index or id - camera = vmb.camera(0) + camera = vimba.camera(0) print(camera) diff --git a/examples/get_camera_feature_infos.py b/examples/get_camera_feature_infos.py index 78e2752..03ad935 100644 --- a/examples/get_camera_feature_infos.py +++ b/examples/get_camera_feature_infos.py @@ -3,8 +3,8 @@ from pymba import Vimba if __name__ == '__main__': - with Vimba() as vmb: - camera = vmb.camera(0) + with Vimba() as vimba: + camera = vimba.camera(0) camera.open() for feature_name in camera.feature_names(): diff --git a/examples/get_camera_feature_names.py b/examples/get_camera_feature_names.py index fcf6a8a..d3415dc 100644 --- a/examples/get_camera_feature_names.py +++ b/examples/get_camera_feature_names.py @@ -3,8 +3,8 @@ from pymba import Vimba if __name__ == '__main__': - with Vimba() as vmb: - camera = vmb.camera(0) + with Vimba() as vimba: + camera = vimba.camera(0) camera.open() for feature_name in camera.feature_names(): diff --git a/examples/get_camera_feature_values.py b/examples/get_camera_feature_values.py index 89f1582..33d454b 100644 --- a/examples/get_camera_feature_values.py +++ b/examples/get_camera_feature_values.py @@ -3,8 +3,8 @@ from pymba import Vimba, VimbaException if __name__ == '__main__': - with Vimba() as vmb: - camera = vmb.camera(0) + with Vimba() as vimba: + camera = vimba.camera(0) camera.open() # get feature value via feature object diff --git a/examples/get_camera_ids.py b/examples/get_camera_ids.py index fe37242..670d71f 100644 --- a/examples/get_camera_ids.py +++ b/examples/get_camera_ids.py @@ -3,5 +3,5 @@ from pymba import Vimba if __name__ == '__main__': - with Vimba() as vmb: - print(vmb.camera_ids()) + with Vimba() as vimba: + print(vimba.camera_ids()) diff --git a/examples/get_interface.py b/examples/get_interface.py index 331f650..0465223 100644 --- a/examples/get_interface.py +++ b/examples/get_interface.py @@ -3,7 +3,7 @@ from pymba import Vimba if __name__ == '__main__': - with Vimba() as vmb: + with Vimba() as vimba: # provide interface index or id - interface = vmb.interface(0) + interface = vimba.interface(0) print(interface) diff --git a/examples/get_interface_feature_infos.py b/examples/get_interface_feature_infos.py index 8330a3d..fefa079 100644 --- a/examples/get_interface_feature_infos.py +++ b/examples/get_interface_feature_infos.py @@ -3,8 +3,8 @@ from pymba import Vimba if __name__ == '__main__': - with Vimba() as vmb: - interface = vmb.interface(0) + with Vimba() as vimba: + interface = vimba.interface(0) interface.open() for feature_name in interface.feature_names(): diff --git a/examples/get_interface_feature_names.py b/examples/get_interface_feature_names.py index 36bf7be..6f0347d 100644 --- a/examples/get_interface_feature_names.py +++ b/examples/get_interface_feature_names.py @@ -3,8 +3,8 @@ from pymba import Vimba if __name__ == '__main__': - with Vimba() as vmb: - interface = vmb.interface(0) + with Vimba() as vimba: + interface = vimba.interface(0) interface.open() for feature_name in interface.feature_names(): diff --git a/examples/get_interface_feature_values.py b/examples/get_interface_feature_values.py index 335b477..fbb59b4 100644 --- a/examples/get_interface_feature_values.py +++ b/examples/get_interface_feature_values.py @@ -3,8 +3,8 @@ from pymba import Vimba, VimbaException if __name__ == '__main__': - with Vimba() as vmb: - interface = vmb.interface(0) + with Vimba() as vimba: + interface = vimba.interface(0) interface.open() # get feature value via feature object diff --git a/examples/get_interface_ids.py b/examples/get_interface_ids.py index 92df889..9a7cbec 100644 --- a/examples/get_interface_ids.py +++ b/examples/get_interface_ids.py @@ -3,5 +3,5 @@ from pymba import Vimba if __name__ == '__main__': - with Vimba() as vmb: - print(vmb.interface_ids()) + with Vimba() as vimba: + print(vimba.interface_ids()) diff --git a/examples/get_system.py b/examples/get_system.py index 2be6a09..2d59001 100644 --- a/examples/get_system.py +++ b/examples/get_system.py @@ -3,6 +3,6 @@ from pymba import Vimba if __name__ == '__main__': - with Vimba() as vmb: - system = vmb.system() + with Vimba() as vimba: + system = vimba.system() print(system) diff --git a/examples/get_system_feature_values.py b/examples/get_system_feature_values.py index c83f292..dd0d178 100644 --- a/examples/get_system_feature_values.py +++ b/examples/get_system_feature_values.py @@ -3,8 +3,8 @@ from pymba import Vimba, VimbaException if __name__ == '__main__': - with Vimba() as vmb: - system = vmb.system() + with Vimba() as vimba: + system = vimba.system() # get feature value via feature object for feature_name in system.feature_names(): diff --git a/examples/get_version.py b/examples/get_version.py index e03fe12..1542845 100644 --- a/examples/get_version.py +++ b/examples/get_version.py @@ -4,5 +4,5 @@ from pymba import Vimba, PYMBA_VERSION if __name__ == '__main__': print(f'Pymba version: {PYMBA_VERSION}') - vmb = Vimba() - print(f'Vimba version: {vmb.version}') + vimba = Vimba() + print(f'Vimba version: {vimba.version}') diff --git a/examples/set_camera_feature_value.py b/examples/set_camera_feature_value.py index a33bf88..020f264 100644 --- a/examples/set_camera_feature_value.py +++ b/examples/set_camera_feature_value.py @@ -3,8 +3,8 @@ from pymba import Vimba if __name__ == '__main__': - with Vimba() as vmb: - camera = vmb.camera(0) + with Vimba() as vimba: + camera = vimba.camera(0) camera.open() # set a feature value by feature name diff --git a/examples/set_interface_feature_value.py b/examples/set_interface_feature_value.py index 0fc80a2..f921c0c 100644 --- a/examples/set_interface_feature_value.py +++ b/examples/set_interface_feature_value.py @@ -3,8 +3,8 @@ from pymba import Vimba if __name__ == '__main__': - with Vimba() as vmb: - interface = vmb.interface(0) + with Vimba() as vimba: + interface = vimba.interface(0) interface.open() # set a feature value by feature name -- cgit v1.2.3 From 01587d8ba4d5a1f8371f44e719eda6547d3ed459 Mon Sep 17 00:00:00 2001 From: morefigs Date: Wed, 30 Jan 2019 13:59:01 +1100 Subject: clean up examples into separate dirs --- examples/camera/get_camera_object.py | 9 +++++ examples/camera/list_camera_ids.py | 7 ++++ examples/camera/list_feature_infos.py | 14 +++++++ examples/camera/list_feature_names.py | 13 +++++++ examples/camera/list_feature_values_and_ranges.py | 34 +++++++++++++++++ examples/camera/opencv_capture_image.py | 34 +++++++++++++++++ .../camera/opencv_capture_image_with_callback.py | 44 ++++++++++++++++++++++ examples/camera/write_feature_value.py | 22 +++++++++++ examples/get_camera.py | 9 ----- examples/get_camera_feature_infos.py | 14 ------- examples/get_camera_feature_names.py | 13 ------- examples/get_camera_feature_values.py | 27 ------------- examples/get_camera_ids.py | 7 ---- examples/get_interface.py | 9 ----- examples/get_interface_feature_infos.py | 14 ------- examples/get_interface_feature_names.py | 13 ------- examples/get_interface_feature_values.py | 27 ------------- examples/get_interface_ids.py | 7 ---- examples/get_system.py | 8 ---- examples/get_system_feature_values.py | 24 ------------ examples/get_version.py | 8 ---- examples/interface/get_interface_object.py | 9 +++++ examples/interface/list_feature_infos.py | 14 +++++++ examples/interface/list_feature_names.py | 13 +++++++ .../interface/list_feature_values_and_ranges.py | 33 ++++++++++++++++ examples/interface/list_interface_ids.py | 7 ++++ examples/interface/write_feature_value.py | 22 +++++++++++ examples/set_camera_feature_value.py | 18 --------- examples/set_interface_feature_value.py | 19 ---------- examples/show_version.py | 8 ++++ examples/system/get_system_object.py | 8 ++++ examples/system/list_feature_values_and_ranges.py | 30 +++++++++++++++ 32 files changed, 321 insertions(+), 217 deletions(-) create mode 100644 examples/camera/get_camera_object.py create mode 100644 examples/camera/list_camera_ids.py create mode 100644 examples/camera/list_feature_infos.py create mode 100644 examples/camera/list_feature_names.py create mode 100644 examples/camera/list_feature_values_and_ranges.py create mode 100644 examples/camera/opencv_capture_image.py create mode 100644 examples/camera/opencv_capture_image_with_callback.py create mode 100644 examples/camera/write_feature_value.py delete mode 100644 examples/get_camera.py delete mode 100644 examples/get_camera_feature_infos.py delete mode 100644 examples/get_camera_feature_names.py delete mode 100644 examples/get_camera_feature_values.py delete mode 100644 examples/get_camera_ids.py delete mode 100644 examples/get_interface.py delete mode 100644 examples/get_interface_feature_infos.py delete mode 100644 examples/get_interface_feature_names.py delete mode 100644 examples/get_interface_feature_values.py delete mode 100644 examples/get_interface_ids.py delete mode 100644 examples/get_system.py delete mode 100644 examples/get_system_feature_values.py delete mode 100644 examples/get_version.py create mode 100644 examples/interface/get_interface_object.py create mode 100644 examples/interface/list_feature_infos.py create mode 100644 examples/interface/list_feature_names.py create mode 100644 examples/interface/list_feature_values_and_ranges.py create mode 100644 examples/interface/list_interface_ids.py create mode 100644 examples/interface/write_feature_value.py delete mode 100644 examples/set_camera_feature_value.py delete mode 100644 examples/set_interface_feature_value.py create mode 100644 examples/show_version.py create mode 100644 examples/system/get_system_object.py create mode 100644 examples/system/list_feature_values_and_ranges.py (limited to 'examples') diff --git a/examples/camera/get_camera_object.py b/examples/camera/get_camera_object.py new file mode 100644 index 0000000..7a830f7 --- /dev/null +++ b/examples/camera/get_camera_object.py @@ -0,0 +1,9 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vimba: + # provide camera index or id + camera = vimba.camera(0) + print(camera) diff --git a/examples/camera/list_camera_ids.py b/examples/camera/list_camera_ids.py new file mode 100644 index 0000000..670d71f --- /dev/null +++ b/examples/camera/list_camera_ids.py @@ -0,0 +1,7 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vimba: + print(vimba.camera_ids()) diff --git a/examples/camera/list_feature_infos.py b/examples/camera/list_feature_infos.py new file mode 100644 index 0000000..03ad935 --- /dev/null +++ b/examples/camera/list_feature_infos.py @@ -0,0 +1,14 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vimba: + camera = vimba.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/camera/list_feature_names.py b/examples/camera/list_feature_names.py new file mode 100644 index 0000000..d3415dc --- /dev/null +++ b/examples/camera/list_feature_names.py @@ -0,0 +1,13 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vimba: + camera = vimba.camera(0) + camera.open() + + for feature_name in camera.feature_names(): + print(feature_name) + + camera.close() diff --git a/examples/camera/list_feature_values_and_ranges.py b/examples/camera/list_feature_values_and_ranges.py new file mode 100644 index 0000000..353d48e --- /dev/null +++ b/examples/camera/list_feature_values_and_ranges.py @@ -0,0 +1,34 @@ +from pymba import Vimba, VimbaException + + +if __name__ == '__main__': + + with Vimba() as vimba: + camera = vimba.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 + range_ = feature.range + + # 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 + range_ = None + + print('\n\t'.join( + str(x) for x in ( + feature_name, + f'value: {value}', + f'range: {range_}') + if x is not None)) + + camera.close() diff --git a/examples/camera/opencv_capture_image.py b/examples/camera/opencv_capture_image.py new file mode 100644 index 0000000..e8bf3d5 --- /dev/null +++ b/examples/camera/opencv_capture_image.py @@ -0,0 +1,34 @@ +import cv2 +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vimba: + camera = vimba.camera(0) + camera.open() + + # setup camera and frame and capture a single image + camera.AcquisitionMode = 'SingleFrame' + frame = camera.create_frame() + frame.announce() + camera.start_capture() + frame.queue_for_capture() + camera.run_feature_command('AcquisitionStart') + camera.run_feature_command('AcquisitionStop') + frame.wait_for_capture() + + # get the image data as a numpy array + image = frame.image_numpy_array() + + # display image + cv2.imshow(camera.camera_id, image) + # waits for user to close image + cv2.waitKey(0) + + # stop capturing and clean up + camera.end_capture() + camera.flush_capture_queue() + camera.revoke_all_frames() + + camera.close() diff --git a/examples/camera/opencv_capture_image_with_callback.py b/examples/camera/opencv_capture_image_with_callback.py new file mode 100644 index 0000000..4d5fa28 --- /dev/null +++ b/examples/camera/opencv_capture_image_with_callback.py @@ -0,0 +1,44 @@ +from time import sleep +import cv2 +from pymba import Vimba +from pymba.frame import Frame + + +def on_callback(completed_frame: Frame): + print('Callback called!') + + # get the image data as a numpy array + image = completed_frame.image_numpy_array() + + # display image + cv2.imshow(camera.camera_id, image) + # waits for user to close image + cv2.waitKey(0) + + +if __name__ == '__main__': + + with Vimba() as vimba: + camera = vimba.camera(0) + camera.open() + + # setup camera and frame and capture a single image + camera.AcquisitionMode = 'SingleFrame' + frame = camera.create_frame() + frame.announce() + camera.start_capture() + frame.queue_for_capture(on_callback) + camera.run_feature_command('AcquisitionStart') + camera.run_feature_command('AcquisitionStop') + + # wait long enough for the frame callback to be called + for _ in range(100): + sleep(0.1) + print('.', end='') + + # stop capturing and clean up + camera.end_capture() + camera.flush_capture_queue() + camera.revoke_all_frames() + + camera.close() diff --git a/examples/camera/write_feature_value.py b/examples/camera/write_feature_value.py new file mode 100644 index 0000000..77f8ce5 --- /dev/null +++ b/examples/camera/write_feature_value.py @@ -0,0 +1,22 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vimba: + camera = vimba.camera(0) + camera.open() + + # read a feature value + feature = camera.feature('ExposureAuto') + value = feature.value + + # set the feature value + feature.value = value + + print(feature.name, '=', feature.value) + + # alternatively the feature value can be set as an object attribute + camera.ExposureAuto = feature.value + + camera.close() diff --git a/examples/get_camera.py b/examples/get_camera.py deleted file mode 100644 index 7a830f7..0000000 --- a/examples/get_camera.py +++ /dev/null @@ -1,9 +0,0 @@ -from pymba import Vimba - - -if __name__ == '__main__': - - with Vimba() as vimba: - # provide camera index or id - camera = vimba.camera(0) - print(camera) diff --git a/examples/get_camera_feature_infos.py b/examples/get_camera_feature_infos.py deleted file mode 100644 index 03ad935..0000000 --- a/examples/get_camera_feature_infos.py +++ /dev/null @@ -1,14 +0,0 @@ -from pymba import Vimba - - -if __name__ == '__main__': - - with Vimba() as vimba: - camera = vimba.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_names.py b/examples/get_camera_feature_names.py deleted file mode 100644 index d3415dc..0000000 --- a/examples/get_camera_feature_names.py +++ /dev/null @@ -1,13 +0,0 @@ -from pymba import Vimba - - -if __name__ == '__main__': - - with Vimba() as vimba: - camera = vimba.camera(0) - camera.open() - - for feature_name in camera.feature_names(): - print(feature_name) - - camera.close() diff --git a/examples/get_camera_feature_values.py b/examples/get_camera_feature_values.py deleted file mode 100644 index 33d454b..0000000 --- a/examples/get_camera_feature_values.py +++ /dev/null @@ -1,27 +0,0 @@ -from pymba import Vimba, VimbaException - - -if __name__ == '__main__': - - with Vimba() as vimba: - camera = vimba.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_camera_ids.py b/examples/get_camera_ids.py deleted file mode 100644 index 670d71f..0000000 --- a/examples/get_camera_ids.py +++ /dev/null @@ -1,7 +0,0 @@ -from pymba import Vimba - - -if __name__ == '__main__': - - with Vimba() as vimba: - print(vimba.camera_ids()) diff --git a/examples/get_interface.py b/examples/get_interface.py deleted file mode 100644 index 0465223..0000000 --- a/examples/get_interface.py +++ /dev/null @@ -1,9 +0,0 @@ -from pymba import Vimba - - -if __name__ == '__main__': - - with Vimba() as vimba: - # provide interface index or id - interface = vimba.interface(0) - print(interface) diff --git a/examples/get_interface_feature_infos.py b/examples/get_interface_feature_infos.py deleted file mode 100644 index fefa079..0000000 --- a/examples/get_interface_feature_infos.py +++ /dev/null @@ -1,14 +0,0 @@ -from pymba import Vimba - - -if __name__ == '__main__': - - with Vimba() as vimba: - interface = vimba.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_interface_feature_names.py b/examples/get_interface_feature_names.py deleted file mode 100644 index 6f0347d..0000000 --- a/examples/get_interface_feature_names.py +++ /dev/null @@ -1,13 +0,0 @@ -from pymba import Vimba - - -if __name__ == '__main__': - - with Vimba() as vimba: - interface = vimba.interface(0) - interface.open() - - for feature_name in interface.feature_names(): - print(feature_name) - - interface.close() diff --git a/examples/get_interface_feature_values.py b/examples/get_interface_feature_values.py deleted file mode 100644 index fbb59b4..0000000 --- a/examples/get_interface_feature_values.py +++ /dev/null @@ -1,27 +0,0 @@ -from pymba import Vimba, VimbaException - - -if __name__ == '__main__': - - with Vimba() as vimba: - interface = vimba.interface(0) - interface.open() - - # get feature value via feature object - for feature_name in interface.feature_names(): - feature = interface.feature(feature_name) - - try: - value = feature.value - - # alternatively the feature value can be read as an object attribute - # value = getattr(interface, feature_name) - # or - # value = interface.someFeatureName - - except VimbaException as e: - value = e - - print(feature_name, '--', value) - - interface.close() diff --git a/examples/get_interface_ids.py b/examples/get_interface_ids.py deleted file mode 100644 index 9a7cbec..0000000 --- a/examples/get_interface_ids.py +++ /dev/null @@ -1,7 +0,0 @@ -from pymba import Vimba - - -if __name__ == '__main__': - - with Vimba() as vimba: - print(vimba.interface_ids()) diff --git a/examples/get_system.py b/examples/get_system.py deleted file mode 100644 index 2d59001..0000000 --- a/examples/get_system.py +++ /dev/null @@ -1,8 +0,0 @@ -from pymba import Vimba - - -if __name__ == '__main__': - - with Vimba() as vimba: - system = vimba.system() - print(system) diff --git a/examples/get_system_feature_values.py b/examples/get_system_feature_values.py deleted file mode 100644 index dd0d178..0000000 --- a/examples/get_system_feature_values.py +++ /dev/null @@ -1,24 +0,0 @@ -from pymba import Vimba, VimbaException - - -if __name__ == '__main__': - - with Vimba() as vimba: - system = vimba.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/get_version.py b/examples/get_version.py deleted file mode 100644 index 1542845..0000000 --- a/examples/get_version.py +++ /dev/null @@ -1,8 +0,0 @@ -from pymba import Vimba, PYMBA_VERSION - - -if __name__ == '__main__': - print(f'Pymba version: {PYMBA_VERSION}') - - vimba = Vimba() - print(f'Vimba version: {vimba.version}') diff --git a/examples/interface/get_interface_object.py b/examples/interface/get_interface_object.py new file mode 100644 index 0000000..0465223 --- /dev/null +++ b/examples/interface/get_interface_object.py @@ -0,0 +1,9 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vimba: + # provide interface index or id + interface = vimba.interface(0) + print(interface) diff --git a/examples/interface/list_feature_infos.py b/examples/interface/list_feature_infos.py new file mode 100644 index 0000000..fefa079 --- /dev/null +++ b/examples/interface/list_feature_infos.py @@ -0,0 +1,14 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vimba: + interface = vimba.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/interface/list_feature_names.py b/examples/interface/list_feature_names.py new file mode 100644 index 0000000..6f0347d --- /dev/null +++ b/examples/interface/list_feature_names.py @@ -0,0 +1,13 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vimba: + interface = vimba.interface(0) + interface.open() + + for feature_name in interface.feature_names(): + print(feature_name) + + interface.close() diff --git a/examples/interface/list_feature_values_and_ranges.py b/examples/interface/list_feature_values_and_ranges.py new file mode 100644 index 0000000..b33c76a --- /dev/null +++ b/examples/interface/list_feature_values_and_ranges.py @@ -0,0 +1,33 @@ +from pymba import Vimba, VimbaException + + +if __name__ == '__main__': + + with Vimba() as vimba: + interface = vimba.interface(0) + interface.open() + + # get feature value via feature object + for feature_name in interface.feature_names(): + feature = interface.feature(feature_name) + try: + value = feature.value + range_ = feature.range + + # alternatively the feature value can be read as an object attribute + # value = getattr(interface, feature_name) + # or + # value = interface.someFeatureName + + except VimbaException as e: + value = e + range_ = None + + print('\n\t'.join( + str(x) for x in ( + feature_name, + f'value: {value}', + f'range: {range_}') + if x is not None)) + + interface.close() diff --git a/examples/interface/list_interface_ids.py b/examples/interface/list_interface_ids.py new file mode 100644 index 0000000..9a7cbec --- /dev/null +++ b/examples/interface/list_interface_ids.py @@ -0,0 +1,7 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vimba: + print(vimba.interface_ids()) diff --git a/examples/interface/write_feature_value.py b/examples/interface/write_feature_value.py new file mode 100644 index 0000000..0c71da2 --- /dev/null +++ b/examples/interface/write_feature_value.py @@ -0,0 +1,22 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vimba: + interface = vimba.interface(0) + interface.open() + + # set a feature value by feature name + feature = interface.feature('InterfacePingPace') + value = feature.value + + # set the feature value + feature.value = value + + print(feature.name, '=', feature.value) + + # alternatively the feature value can be set as an object attribute + interface.InterfacePingPace = 3 + + interface.close() diff --git a/examples/set_camera_feature_value.py b/examples/set_camera_feature_value.py deleted file mode 100644 index 020f264..0000000 --- a/examples/set_camera_feature_value.py +++ /dev/null @@ -1,18 +0,0 @@ -from pymba import Vimba - - -if __name__ == '__main__': - - with Vimba() as vimba: - camera = vimba.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 deleted file mode 100644 index f921c0c..0000000 --- a/examples/set_interface_feature_value.py +++ /dev/null @@ -1,19 +0,0 @@ -from pymba import Vimba - - -if __name__ == '__main__': - - with Vimba() as vimba: - interface = vimba.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() diff --git a/examples/show_version.py b/examples/show_version.py new file mode 100644 index 0000000..1542845 --- /dev/null +++ b/examples/show_version.py @@ -0,0 +1,8 @@ +from pymba import Vimba, PYMBA_VERSION + + +if __name__ == '__main__': + print(f'Pymba version: {PYMBA_VERSION}') + + vimba = Vimba() + print(f'Vimba version: {vimba.version}') diff --git a/examples/system/get_system_object.py b/examples/system/get_system_object.py new file mode 100644 index 0000000..2d59001 --- /dev/null +++ b/examples/system/get_system_object.py @@ -0,0 +1,8 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vimba: + system = vimba.system() + print(system) diff --git a/examples/system/list_feature_values_and_ranges.py b/examples/system/list_feature_values_and_ranges.py new file mode 100644 index 0000000..ef4da34 --- /dev/null +++ b/examples/system/list_feature_values_and_ranges.py @@ -0,0 +1,30 @@ +from pymba import Vimba, VimbaException + + +if __name__ == '__main__': + + with Vimba() as vimba: + system = vimba.system() + + # get feature value via feature object + for feature_name in system.feature_names(): + feature = system.feature(feature_name) + try: + value = feature.value + range_ = feature.range + + # 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 + range_ = None + + print('\n\t'.join( + str(x) for x in ( + feature_name, + f'value: {value}', + f'range: {range_}') + if x is not None)) -- cgit v1.2.3 From 810b1f0a061988b451f9d425d8788596ae39118b Mon Sep 17 00:00:00 2001 From: morefigs Date: Wed, 30 Jan 2019 14:28:00 +1100 Subject: update version example --- examples/show_version.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/show_version.py b/examples/show_version.py index 1542845..643dc1c 100644 --- a/examples/show_version.py +++ b/examples/show_version.py @@ -3,6 +3,4 @@ from pymba import Vimba, PYMBA_VERSION if __name__ == '__main__': print(f'Pymba version: {PYMBA_VERSION}') - - vimba = Vimba() - print(f'Vimba version: {vimba.version}') + print(f'Vimba version: {Vimba.version()}') -- cgit v1.2.3