diff --git a/doc/dev_guide/writing_extensions.rst b/doc/dev_guide/writing_extensions.rst index 4761fbe1aa..e87c950d04 100644 --- a/doc/dev_guide/writing_extensions.rst +++ b/doc/dev_guide/writing_extensions.rst @@ -187,6 +187,12 @@ the signal subclass with ``Electron Energy Loss Spectroscopy`` signal type. It is good practice to choose a very explicit ``signal_type`` while leaving acronyms for ``signal_type_aliases``. +Additionally, the optional key ``hidden: True`` can be defined if a signal should +be registered with HyperSpy, but not listed by :meth:`hyperspy.api.print_known_signal_types`. +This option can be used if a signal subclass is needed for certain functionalities, +such as casting to a different signal subclass, but should usually not be set +directly by the user. + Creating new HyperSpy model components -------------------------------------- diff --git a/hyperspy/utils/__init__.py b/hyperspy/utils/__init__.py index b4ac51f241..c88ceae74f 100644 --- a/hyperspy/utils/__init__.py +++ b/hyperspy/utils/__init__.py @@ -74,7 +74,7 @@ def print_known_signal_types(style=None): table.set_style(style) for sclass, sdict in ALL_EXTENSIONS["signals"].items(): # skip lazy signals and non-data-type specific signals - if sdict["lazy"] or not sdict["signal_type"]: + if sdict["lazy"] or sdict.get("hidden", False) or not sdict["signal_type"]: continue aliases = ( ", ".join(sdict["signal_type_aliases"]) diff --git a/upcoming_changes/3302.enhancements.rst b/upcoming_changes/3302.enhancements.rst new file mode 100644 index 0000000000..8fa4ea4bdf --- /dev/null +++ b/upcoming_changes/3302.enhancements.rst @@ -0,0 +1 @@ +Allow setting optional ``hidden`` key in definition of signals extending hyperspy, which prevents them from being shown by ``print_known_signal_types()``.