CXIExplorer#
- class cdiutils.io.CXIExplorer(cxi_file)[source]#
Bases:
objectInteractive explorer for CXI file inspection and visualisation.
Provides tools for navigating CXI file hierarchies, viewing metadata, and visualising array data. Requires Jupyter environment with ipywidgets for interactive features.
- cxi#
CXIFile instance being explored.
- paths#
List of all dataset/group paths in file.
- soft_links#
Dictionary mapping soft link names to targets.
The CXIExplorer class provides an interactive widget for exploring CXI files. See the CXI explorer tutorial for usage examples.
- max_number_of_values_printed = 100#
- tree_max_string_length = 15#
- tree_max_array_size = 5#
- __init__(cxi_file)[source]#
Initialise the CXI explorer with either a path to a CXI file or a CXIFile object.
- Parameters:
cxi_file (str | CXIFile) – Either a string path to a CXI file
object (or a CXIFile)
- Raises:
ImportError – If ipywidgets is not installed (required for interactive features)
- tree(max_depth=None, show_attributes=False)[source]#
Print a tree view of the CXI file structure similar to the Linux ‘tree’ command.
- Parameters:
max_depth (int) – Maximum depth to traverse (None for unlimited). Defaults to None.
show_attributes (bool) – whether to show attributes. Defaults
False. (to)
- tabbed_print(text, **kwargs)[source]#
Print text with optional tabbing.
- Parameters:
text (str) – Text to print.
- show(path, show_attributes=False, tab=0)[source]#
Visualise a specific dataset from the CXI file.
Notes: This function only prints the content of the subset without going any deeper into the tree, except for soft links, for which it will print the target content and its content. If the target content of a group or dataset is a soft link, it will not print the target content.
- Parameters:
path (str) – Path to the dataset within the CXI file.
show_attributes (bool) – Whether to show attributes.
tab (int) – Initial tab level.
Examples#
Exploring CXI file:
from cdiutils.io import CXIExplorer
# Create explorer (opens file automatically)
explorer = CXIExplorer("results.cxi")
# Show interactive widget in Jupyter notebook
# This displays file tree and interactive data viewer
explorer.show()
# Close when done
explorer.close()
# Or use context manager
with CXIExplorer("results.cxi") as explorer:
explorer.show()
See Also#
CXIFile : Low-level CXI file access
cdiutils.plot.plot_volume_slices() : 2D slice viewer for arrays