{"id":24586,"library":"silx","title":"silx","description":"silx is a collection of Python packages to support the development of data assessment, reduction and analysis applications at synchrotron radiation facilities. It provides tools for reading HDF5/NeXus files, histogramming, fitting, 1D/2D visualization, and image processing. Current version is 3.0.0, with releases approximately every 6–12 months.","status":"active","version":"3.0.0","language":"python","source_language":"en","source_url":"https://github.com/silx-kit/silx","tags":["synchrotron","hdf5","nexus","data analysis","histogram","visualization","opencl"],"install":[{"cmd":"pip install silx","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Required for reading/writing detector image formats (e.g., EDF, TIFF, CBF).","package":"fabio","optional":false},{"reason":"Required for HDF5/NeXus file I/O.","package":"h5py","optional":false},{"reason":"Core dependency for arrays and math operations.","package":"numpy","optional":false},{"reason":"Optional GPU acceleration for image processing and histogramming.","package":"pyopencl","optional":true}],"imports":[{"note":"","wrong":"","symbol":"silx","correct":"import silx"},{"note":"Avoid star imports; use explicit symbols.","wrong":"from silx.utils import *","symbol":"utils","correct":"from silx import utils"},{"note":"In older versions (pre-2.0) the module was named fabioh5; renamed to fabio_h5.","wrong":"from silx.io import fabioh5","symbol":"io","correct":"from silx.io import fabio_h5"},{"note":"The plotting module moved to silx.gui.plot in version 1.0.0.","wrong":"from silx.plot import ...","symbol":"plot","correct":"from silx.gui import plot"},{"note":"OpenCL support is under silx.opencl, not top-level.","wrong":"from silx import ocl","symbol":"OpenCL","correct":"from silx.opencl import ocl"}],"quickstart":{"code":"import silx\nimport numpy as np\nfrom silx import sx\nfrom silx.io import fabio_h5\nfrom silx.gui import plot\n\n# Read a HDF5/NeXus image\nimport os\nfilepath = os.environ.get('SILX_TEST_FILE', 'example.h5')\nif os.path.exists(filepath):\n    data = fabio_h5.open(filepath)\n    print(type(data))\n\n# Simple histogram\nx = np.random.normal(size=1000)\nhist, edges = sx.histogram(x, bins=10)\nprint('histogram:', hist)\n\n# Create a 1D plot window (GUI only if interactive)\n# plot1D = plot.Plot1D()\n# plot1D.addCurve(x, y)\n# plot1D.show()","lang":"python","description":"Basic imports and usage of silx: reading files, histogram, and plotting (GUI)."},"warnings":[{"fix":"Update imports: silx.gui.plot instead of silx.plot; silx.io.fabio_h5 instead of silx.io.fabioh5; silx.math.histogram moved to silx.sx.histogram.","message":"In silx 1.0.0, the old top-level modules (silx.plot, silx.io.fabioh5, silx.math) were reorganized. Code using old import paths will break.","severity":"breaking","affected_versions":"<1.0"},{"fix":"Use silx.sx.fit or external fitting libraries. Use silx.io.fabio_h5 or h5py directly for SPEC files.","message":"silx 2.0.0 dropped Python 2 support and removed deprecated APIs like silx.math.fit and silx.io.specfile.","severity":"breaking","affected_versions":"<2.0"},{"fix":"Install a Qt binding: pip install silx[gui] or pip install PyQt5 (or PySide6).","message":"silx.gui.plot requires a Qt backend. If no Qt bindings are installed (PyQt5, PySide2, etc.), importing silx.gui will raise an ImportError.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace calls: silx.math.histogram → silx.sx.histogram.","message":"Functions in silx.math (like silx.math.histogram) are deprecated in favor of silx.sx functions.","severity":"deprecated","affected_versions":">=2.0, <=3.0"},{"fix":"Use fr = fabio_h5.open('file'); data = fr.data.","message":"silx.io.fabio_h5.open() returns a FabioFrame, not a numpy array. Access the data via .data attribute.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install a Qt binding: pip install silx[gui] or pip install PyQt5.","cause":"Qt bindings not installed.","error":"ModuleNotFoundError: No module named 'silx.gui'"},{"fix":"Change import to: from silx.io import fabio_h5.","cause":"The module was renamed from fabioh5 to fabio_h5 in silx 1.0.","error":"ImportError: cannot import name 'fabioh5' from 'silx.io'"},{"fix":"Use from silx.gui import plot instead.","cause":"The top-level silx.plot module was removed in silx 1.0.","error":"AttributeError: module 'silx' has no attribute 'plot'"},{"fix":"Disable online access or set environment variable SILX_DISABLE_NET=1.","cause":"silx tries to download a test file or load an online resource without internet.","error":"OSError: [Errno 101] Network is unreachable: 'https://...'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}