Skip to content
Open
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
1 change: 1 addition & 0 deletions docs/changes/2926.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
the Jupyter notebook HTML representation of `~ctapipe.core.Container` instances now recursively shows the config of sub-components used in the component instance. This makes it easier to see the full configuration in a user-friendly way.
8 changes: 7 additions & 1 deletion src/ctapipe/core/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def _repr_html_(self):
docstring = publish_parts(clean_doc, writer=writer)["html_body"]
lines = [
'<div style="border:1px solid black; max-width: 700px; padding:2em; word-wrap:break-word;">',
f"<b>{name}</b>",
f"<h3>{name}</h3>",
docstring,
"<table>",
" <colgroup>",
Expand Down Expand Up @@ -292,6 +292,12 @@ def _repr_html_(self):
)
lines.append(" </tbody>")
lines.append("</table>")

for name, val in self.__dict__.items():
if isinstance(val, Component):
lines.append(f"<h4>{name}:</h4>")
lines.append(val._repr_html_())
Comment thread
maxnoe marked this conversation as resolved.

lines.append("</div>")
return "\n".join(lines)

Expand Down
4 changes: 0 additions & 4 deletions src/ctapipe/core/qualityquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ def to_table(self, functions=False):
cols["func"] = ["True"] + self.expressions
return Table(cols)

def _repr_html_(self):
"""display nicely in Jupyter notebooks"""
return self.to_table()._repr_html_()

def __str__(self):
"""Print a formatted string representation of the entire table."""
return str(self.to_table())
Expand Down