Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docstring of EventSource #2419

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions ctapipe/core/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,16 @@ def from_name(cls, name, config=None, parent=None, **kwargs):
@classmethod
def non_abstract_subclasses(cls):
"""
get dict{name: cls} of non abstract subclasses,
subclasses can possibly be definded in plugins
Get a dict of all non-abstract subclasses of this class.

This method is using the entry-point plugin system
to also check for registered plugin implementations.

Returns
-------
subclasses : dict[str, type]
A dict mapping the name to the class of all found,
non-abstract subclasses of this class.
"""
if hasattr(cls, "plugin_entry_point"):
detect_and_import_plugins(cls.plugin_entry_point)
Expand Down
2 changes: 2 additions & 0 deletions ctapipe/io/eventsource.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ class EventSource(Component):
An ``EventSource`` can also be created through the configuration system,
by passing ``config`` or ``parent`` as appropriate.
E.g. if using ``EventSource`` inside of a ``Tool``, you would do:

>>> self.source = EventSource(parent=self) # doctest: +SKIP

To loop through the events in a file:

>>> source = EventSource(input_url="dataset://gamma_prod5.simtel.zst", max_events=2)
>>> for event in source:
... print(event.count)
Expand Down