erlab.io.igor¶
Backend for Igor Pro files.
Functions
|
Load waves from an Igor experiment file( |
|
Load a HDF5 file exported by Igor Pro into an |
|
Load an |
|
Load a wave from Igor binary format. |
|
Save a wave to an Igor binary file. |
|
Apply a scale to the specified dimension of the DataArray. |
Classes
Backend for Igor Pro files. |
- class erlab.io.igor.IgorBackendEntrypoint[source]¶
Bases:
BackendEntrypointBackend for Igor Pro files.
This backend supports “.pxt”, “.pxp”, and “.ibw” files through igor2.
Partial support for Igor Pro text files (
itx) is also provided, allowing loadingitxfiles that contain a single wave and well-definedSetScalecommands.HDF5 files exported from Igor Pro are also partially supported.
- description: typing.ClassVar[str] = 'Open Igor Pro files (.pxt, .pxp, .ibw, and .itx) in Xarray'¶
- url: typing.ClassVar[str] = 'https://erlabpy.readthedocs.io/en/stable/generated/erlab.io.igor.html'¶
- supports_groups: typing.ClassVar[bool] = True¶
- erlab.io.igor.load_experiment(filename, folder=None, *, prefix=None, ignore=None, recursive=False, **kwargs)[source]¶
Load waves from an Igor experiment file(
pxpandpxt).Use
xarray.load_dataset()withbackend="erlab-igor"for consistency.- Parameters:
folder (
str|None, default:None) – Target folder within the experiment, given as a slash-separated string. IfNone, defaults to the root.prefix (
str|None, default:None) – If given, only include waves with names that starts with the given string.ignore (
Iterable[str] |None, default:None) – List of wave names to ignore.recursive (
bool, default:False) – IfTrue, includes waves in child directories.**kwargs – Extra arguments to
load_wave().
- Returns:
xarray.Dataset– Dataset containing the waves.- Return type:
- erlab.io.igor.load_igor_hdf5(filename)[source]¶
Load a HDF5 file exported by Igor Pro into an
xarray.Dataset.Use
xarray.load_dataset()withbackend="erlab-igor"for consistency.- Parameters:
- Returns:
xarray.Dataset– The loaded data.- Return type:
- erlab.io.igor.load_text(filename, dtype=float, *, without_values=False)[source]¶
Load an
itxfile containing a single wave into axarray.DataArray.This function reads basic
itxfiles exported from Igor Pro. Currently, it only supports files with a single wave and does not handle complex structures like multiple waves or nested structures.- Parameters:
- Returns:
DataArray– The loaded data.- Return type:
- erlab.io.igor.load_wave(wave, data_dir=None)[source]¶
Load a wave from Igor binary format.
Use
xarray.load_dataarray()withbackend="erlab-igor"for consistency.- Parameters:
wave (
dict|WaveRecord|str|PathLike) – The wave to load. It can be provided as a dictionary, an instance ofigor2.record.WaveRecord, or a string representing the path to the wave file.data_dir (
str|PathLike|None, default:None) – The directory where the wave file is located. This parameter is only used ifwaveis a string orPathLikeobject. IfNone,wavemust be a valid path.
- Returns:
xarray.DataArray– The loaded wave.- Raises:
ValueError – If the wave file cannot be found or loaded.
TypeError – If the wave argument is of an unsupported type.
- Return type:
- erlab.io.igor.save_wave(darr, filename)[source]¶
Save a wave to an Igor binary file.
This function saves a single DataArray to an Igor binary file. It is the inverse of
load_wave(). Only supports simple 1D, 2D, 3D, and 4D DataArrays without any associated coordinates and non-dimensional coordinates.- Parameters:
Example
>>> import xarray as xr >>> import erlab >>> darr = xr.DataArray([1, 2, 3], dims=["x"], coords={"x": [0, 1, 2]}) >>> erlab.io.igor.save_wave(darr, "output.ibw")
- erlab.io.igor.set_scale(darr, method, dim, num1, num2, units_str=None, wave_name=None)[source]¶
Apply a scale to the specified dimension of the DataArray.
This is the Python equivalent of Igor Pro’s
SetScalecommand.- Parameters:
darr (
DataArray) – The DataArray to which the scale will be applied.method (
'/I','/P', orNone) – The method of scaling. See the Igor Pro documentation for details.dim (
'd','t','x','y', or'z') – The dimension to which the scale will be applied. For ‘d’, nothing is done.num1 (
strorfloat) – The first number for the scale. If a string, it will be converted to float.num2 (
strorfloat) – The second number for the scale. If a string, it will be converted to float.units_str (
str, optional) – If provided, the dimension will be renamed to this string.wave_name (
str, optional) – Has no effect in this implementation, but can be used for consistency with Igor Pro.
- Returns:
DataArray– The DataArray with the scale applied to the specified dimension.- Return type: