@@ -89,7 +89,7 @@ def list_to_string(lst, max_size=6):
8989
9090 return txt
9191
92- def _repr_header (self , parent_name = None ):
92+ def _repr_header (self , display_name = True ):
9393 num_segments = self .get_num_segments ()
9494 num_channels = self .get_num_channels ()
9595 dtype = self .get_dtype ()
@@ -105,7 +105,7 @@ def _repr_header(self, parent_name=None):
105105 # Khz for high sampling rate and Hz for LFP
106106 sampling_frequency_repr = f"{ (sf_hz / 1000.0 ):0.1f} kHz" if sf_hz > 10_000.0 else f"{ sf_hz :0.1f} Hz"
107107
108- if parent_name is None or parent_name != self .name :
108+ if display_name and self . name != self .__class__ . __name__ :
109109 name = f"{ self .name } ({ self .__class__ .__name__ } )"
110110 else :
111111 name = self .__class__ .__name__
@@ -123,11 +123,11 @@ def _repr_header(self, parent_name=None):
123123
124124 return txt
125125
126- def _repr_html_ (self , parent_name = None ):
126+ def _repr_html_ (self , display_name = True ):
127127 common_style = "margin-left: 10px;"
128128 border_style = "border:1px solid #ddd; padding:10px;"
129129
130- html_header = f"<div style='{ border_style } '><strong>{ self ._repr_header (parent_name )} </strong></div>"
130+ html_header = f"<div style='{ border_style } '><strong>{ self ._repr_header (display_name )} </strong></div>"
131131
132132 html_segments = ""
133133 if self .get_num_segments () > 1 :
@@ -148,26 +148,8 @@ def _repr_html_(self, parent_name=None):
148148 html_channel_ids = f"<details style='{ common_style } '> <summary><strong>Channel IDs</strong></summary><ul>"
149149 html_channel_ids += f"{ self .channel_ids } </details>"
150150
151- html_annotations = f"<details style='{ common_style } '> <summary><strong>Annotations</strong></summary><ul>"
152- for key , value in self ._annotations .items ():
153- html_annotations += f"<li> <strong> { key } </strong>: { value } </li>"
154- html_annotations += "</ul> </details>"
155-
156- html_properties = f"<details style='{ common_style } '><summary><strong>Channel Properties</strong></summary><ul>"
157- for key , value in self ._properties .items ():
158- # Add a further indent for each property
159- value_formatted = np .asarray (value )
160- html_properties += f"<details><summary> <strong> { key } </strong> </summary>{ value_formatted } </details>"
161- html_properties += "</ul></details>"
162-
163- if self .get_parent ():
164- html_parent = f"<details style='{ common_style } '> <summary><strong>Parent</strong></summary><ul>"
165- html_parent += self .get_parent ()._repr_html_ (parent_name = self .name )
166- html_parent += "</ul></details>"
167- else :
168- html_parent = ""
169-
170- html_repr = html_header + html_segments + html_channel_ids + html_annotations + html_properties + html_parent
151+ html_extra = self ._get_common_repr_html (common_style )
152+ html_repr = html_header + html_segments + html_channel_ids + html_extra
171153 return html_repr
172154
173155 def get_num_segments (self ) -> int :
0 commit comments