Reading Renishaw WiRE files#

This example shows how to read a Renishaw WiRE files (.wdf format).

The spectral data used has been downloaded from alchem0x2A/py-wdf-reader (MIT License) and stored in the local directory ramandata/wire.

The examples given here is a modified version of the original examples: See alchem0x2A/py-wdf-reader

Import the package

import spectrochempy as scp

Read a single spectrum#

dataset = scp.read_wire("ramandata/wire/sp.wdf")
_ = dataset.plot()
plot read renishaw

Read a depth series#

dataset = scp.read_wdf("ramandata/wire/depth.wdf")
_ = dataset.plot(method="image")
plot read renishaw

Handle diverging colormaps#

A diverging colormap is triggered when negative values are present. Enforce a sequential colormap explicitly:

_ = dataset.plot_image(cmap="cividis")
plot read renishaw

Alternatively, adjust diverging_margin to keep the default colormap:

_ = dataset.plot(method="image", diverging_margin=0.1)
plot read renishaw

Filter blank spectra#

dataset = dataset[dataset.data.mean(axis=1) > 0]
_ = dataset.plot_image()
plot read renishaw

Read line scan and grid scan data#

Line scan from a StreamLine HR measurement:

dataset = scp.read("ramandata/wire/line.wdf")
_ = dataset.plot_image()
plot read renishaw

Grid scan data: This sample mapping does not store an explicit map-area type. SpectroChemPy therefore warns and assumes the usual XY column-major scan order.

dataset = scp.read_wdf("ramandata/wire/mapping.wdf")
_ = dataset.sum(dim=2).plot_image(equal_aspect=True)
_ = dataset[..., 1529.0].plot_image(equal_aspect=True)
  • plot read renishaw
  • plot read renishaw
/home/runner/work/spectrochempy/spectrochempy/src/spectrochempy/core/readers/read_wire.py:198: UserWarning: Map area type is not specified, will assume a xy (column major) scan for the mapping data.
  warning_(

Uncomment the following line to display all figures when running the script directly with Python.

# scp.show()

Total running time of the script: (0 minutes 6.326 seconds)