Skip to content

Commit

Permalink
Revert "Resolve issue #127"
Browse files Browse the repository at this point in the history
  • Loading branch information
kazunarikudo authored Mar 26, 2020
1 parent 555dce3 commit 6cf83f8
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 137 deletions.
34 changes: 17 additions & 17 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ Currently, Harvester is being developed by the motivated contributors from all o
Where Is The Name From?
***********************

Harvester's name is from the great Flemish painter, Pieter Bruegel the Elder's painting so-called "The Harvesters". You can see the painting in the top of this page. Harvesters harvest a crop every season that has been fully grown and the harvested crop is passed to the consumers. On the other hand, image acquisition libraries acquire images as their crop and the images are passed to the following processes. We found the similarity between them and decided to name our library Harvester.
Harvester's name was coming from the great Flemish painter, Pieter Bruegel the Elder's painting so-called "The Harvesters". You can see the painting in the top of this page. Harvesters harvest a crop every season that has been fully grown and the harvested crop is passed to the consumers. On the other hand, image acquisition libraries acquire images as their crop and the images are passed to the following processes. We found the similarity between them and decided to name our library Harvester.

Apart from anything else, we love its peaceful and friendly name.
Apart from anything else, we love its peaceful and friendly name. We hope you also like it ;-)

----

Expand Down Expand Up @@ -273,13 +273,13 @@ Online Resources
Asking Questions
****************

We have prepared an FAQ page. Perhaps your issue could be resolved just reading through it:
We have opened a chat room for you. Please don't hesitate to leave your message any time when you get a question regarding Harvester!

https://github.com/genicam/harvesters/wiki/FAQ
https://gitter.im/genicam-harvester/chatroom

If any article was not mentioning about the issue you are facing, please try to visit the following page and check if there's a ticket that is relevant to the issue. If nothing has been mentioned, feel free to create an issue ticket so that we can help you:
We have also prepared an FAQ page. Perhaps your issue could be resolved just reading through it.

https://github.com/genicam/harvesters/issues
https://github.com/genicam/harvesters/wiki/FAQ

***************
Important Links
Expand Down Expand Up @@ -577,9 +577,9 @@ The following code block shows Harvester Core is running on IPython. An acquired
In [3]: h = Harvester()
In [4]: h.add_file('/Users/kznr/dev/genicam/bin/Maci64_x64/TLSimu.cti')
In [4]: h.add_cti_file('/Users/kznr/dev/genicam/bin/Maci64_x64/TLSimu.cti')
In [5]: h.update()
In [5]: h.update_device_info_list()
In [6]: len(h.device_info_list)
Out[6]: 4
Expand All @@ -595,7 +595,7 @@ The following code block shows Harvester Core is running on IPython. An acquired
In [11]: ia.remote_device.node_map.PixelFormat.value = 'Mono8'
In [12]: ia.start_acquisition()
In [12]: ia.start_image_acquisition()
In [13]: with ia.fetch_buffer() as buffer:
...: # Let's create an alias of the 2D image component:
Expand Down Expand Up @@ -638,7 +638,7 @@ The following code block shows Harvester Core is running on IPython. An acquired
[130 131 132 133 134 135 136 137]]
AVE: 130.0, MIN: 123, MAX: 137
In [14]: ia.stop_acquisition()
In [14]: ia.stop_image_acquisition()
In [15]: ia.destroy()
Expand Down Expand Up @@ -679,13 +679,13 @@ Producer:
# read "I pointed out a CTI file but Harvester says the image doesn't
# exist (Part 2)."
h.add_file('path/to/gentl_producer.cti')
h.add_cti_file('path/to/gentl_producer.cti')
Note that you can add **one or more CTI files** on a single Harvester Core object. To add another CTI file, just repeat calling ``add_file`` method passing another target CTI file:
Note that you can add **one or more CTI files** on a single Harvester Core object. To add another CTI file, just repeat calling ``add_cti_file`` method passing another target CTI file:
.. code-block:: python
h.add_file('path/to/another_gentl_producer.cti')
h.add_cti_file('path/to/another_gentl_producer.cti')
And the following code will let you know the CTI files that have been loaded
on the Harvester object:
Expand All @@ -698,14 +698,14 @@ In a contrary sense, you can remove a specific CTI file that you have added with
.. code-block:: python
h.remove_file('path/to/gentl_producer.cti')
h.remove_cti_file('path/to/gentl_producer.cti')
And now yol have to update the list of remote devices; it fills up your device
information list and you'll select a remote device to control from the list:
.. code-block:: python
h.update()
h.update_device_info_list()
The following code will let you know the remote devices that you can control:
Expand Down Expand Up @@ -748,7 +748,7 @@ Anyway, then now we start image acquisition:
.. code-block:: python
ia.start_acquisition()
ia.start_image_acquisition()
Once you started image acquisition, you should definitely want to get an image. Images are delivered to the acquirer allocated buffers. To fetch a buffer that has been filled up with an image, you can have 2 options; the first option is to use the ``with`` statement:
Expand All @@ -774,7 +774,7 @@ Okay, then you would stop image acquisition with the following code:
.. code-block:: python
ia.stop_acquisition()
ia.stop_image_acquisition()
And the following code disconnects the connecting remote device from the image acquirer; you'll have to create an image acquirer object again when you have to work with a remote device:
Expand Down
57 changes: 5 additions & 52 deletions src/harvesters/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
from threading import current_thread, main_thread
import time
from urllib.parse import urlparse
from warnings import warn
import weakref
import tempfile

Expand Down Expand Up @@ -69,21 +68,6 @@
_sleep_duration_default = 0.000001 # s


def _deprecated(deprecated: object, alternative: object) -> None:
#
items = []
for obj in (deprecated, alternative):
items.append(obj.__name__ + '()' if callable(obj) else obj)

keys = {'deprecated': 0, 'alternative': 1}
warn(
'{0} will be deprecated shortly. Use {1} instead.'.format(
items[keys['deprecated']], items[keys['alternative']]
),
DeprecationWarning, stacklevel=3
)


class Module:
def __init__(self, module=None, node_map=None, parent=None):
self._module = module
Expand Down Expand Up @@ -618,6 +602,7 @@ def mutex(self):
return self._mutex



class ComponentBase:
"""
Is a base class of various data component types.
Expand Down Expand Up @@ -1493,6 +1478,7 @@ def __init__(
else:
self._xml_dir = None


#
try:
node_map = _get_port_connected_node_map(
Expand Down Expand Up @@ -1773,10 +1759,6 @@ def system(self):
return self._system

def is_acquiring_images(self):
_deprecated(self.is_acquiring_images, self.is_acquiring)
return self.is_acquiring()

def is_acquiring(self):
"""
:return: :const:`True` if it's acquiring images. Otherwise :const:`False`.
"""
Expand Down Expand Up @@ -1854,10 +1836,6 @@ def _setup_data_streams(self):
)

def start_image_acquisition(self):
_deprecated(self.start_image_acquisition, self.start_acquisition)
self.start_acquisition()

def start_acquisition(self):
"""
Starts image acquisition.
Expand Down Expand Up @@ -1956,7 +1934,7 @@ def start_acquisition(self):
def worker_image_acquisition(self, context=None):
for event_manager in self._event_new_buffer_managers:
try:
if self.is_acquiring():
if self.is_acquiring_images():
event_manager.update_event_data(
self._timeout_for_image_acquisition
)
Expand Down Expand Up @@ -2279,10 +2257,6 @@ def _queue_announced_buffers(self, data_stream=None, buffers=None):
)

def stop_image_acquisition(self):
_deprecated(self.stop_image_acquisition, self.stop_acquisition)
self.stop_acquisition()

def stop_acquisition(self):
"""
Stops image acquisition.
Expand Down Expand Up @@ -2606,11 +2580,6 @@ def reset(self):

@property
def cti_files(self):
_deprecated('cti_files', 'files')
return self.files

@property
def files(self):
"""
:return: A :class:`list` object containing :class:`str` objects.
"""
Expand Down Expand Up @@ -2761,10 +2730,6 @@ def create_image_acquirer(
return ia

def add_cti_file(self, file_path: str):
_deprecated(self.add_cti_file, self.add_file)
self.add_file(file_path)

def add_file(self, file_path: str):
"""
Adds a CTI file to work with to the CTI file list.
Expand All @@ -2784,10 +2749,6 @@ def add_file(self, file_path: str):
)

def remove_cti_file(self, file_path: str):
_deprecated(self.remove_cti_file, self.remove_file)
self.remove_file(file_path)

def remove_file(self, file_path: str):
"""
Removes the specified CTI file from the CTI file list.
Expand All @@ -2802,10 +2763,6 @@ def remove_file(self, file_path: str):
)

def remove_cti_files(self):
_deprecated(self.remove_cti_files, self.remove_files)
self.remove_files()

def remove_files(self):
"""
Removes all CTI files in the CTI file list.
Expand Down Expand Up @@ -2863,7 +2820,7 @@ def _reset(self):

#
self._logger.info('Started resetting the Harvester object.')
self.remove_files()
self.remove_cti_files()
self._release_gentl_producers()

if self._profiler:
Expand Down Expand Up @@ -2926,10 +2883,6 @@ def _release_device_info_list(self):
self._logger.info('Discarded the device information list.')

def update_device_info_list(self):
_deprecated(self.update_device_info_list, self.update)
self.update()

def update(self):
"""
Updates the device information list. You'll have to call this method
every time you added CTI files or plugged/unplugged devices.
Expand Down Expand Up @@ -2982,7 +2935,7 @@ def _destroy_image_acquirer(self, ia):
id_ = None
if ia.device:
#
ia.stop_acquisition()
ia.stop_image_acquisition()

#
ia._release_data_streams()
Expand Down
4 changes: 2 additions & 2 deletions src/harvesters/test/base_harvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ def setUp(self):

#
self._harvester = Harvester(logger=self._logger)
self._harvester.add_file(self._cti_file_path)
self._harvester.update()
self._harvester.add_cti_file(self._cti_file_path)
self._harvester.update_device_info_list()

def tearDown(self):
#
Expand Down
4 changes: 2 additions & 2 deletions src/harvesters/test/test_acq_frame_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _test_performance_on_image_acquisition(self, sleep_duration=0.0):
)

# Then start image acquisition.
self.ia.start_acquisition()
self.ia.start_image_acquisition()

# Run the image acquisition thread:
thread = ThreadImageAcquisitionStatistics(
Expand All @@ -85,7 +85,7 @@ def _test_performance_on_image_acquisition(self, sleep_duration=0.0):
thread.join()

# Stop image acquisition:
self.ia.stop_acquisition()
self.ia.stop_image_acquisition()

# Destroy the image acquirer:
self.ia.destroy()
Expand Down
Loading

0 comments on commit 6cf83f8

Please sign in to comment.