Skip to main content

# SIF Reader

This package is designed to read Andor SIF image file.

In addition to raw image data, it provides access to the wavelength axis for spectra, and metadata such as exposure time, gain, recording date etc. Image data can be read as a numpy array or as an [xarray](https://xarray.pydata.org/en/stable/) DataArray, which contains the image data as well as the coordinate axes and labels in a single object. For spectra, the spectral axis can be returned as nanometers, wavenumbers or electron volts.

To the best of our knowledge, this is currently the only Python package that can extract wavelength information from .sif files using only pure Python and numpy (i.e. without relying on any Andor dll libraries).

## Requirements numpy (optionally xarray, pytest to run the unit tests)

## Installation Install with pip: ` >pip install sifreader `

## Usage

Open a file and print the metadata:

` >file = SIFFile('my_image.sif') >print(file) <sifreader.sifreader.sifreader.SIFFile object at 0x30f9eecc0> Original Filename: E:\test_sequence.sif Date: Thu May 10 12:01:48 2018 ... `

Read a single or all frames contained in the file as numpy arrays: ` >first_frame = file.read_block(0) >all_frames = file.read_all() `

The horizontal axis is contained in the x_axis member variable. If the file contains a spectrum, the axis will be the wavelength in namometers, otherwise it will contain the pixel numbers: ` >wavelengths = file.x_axis `

### With the optional xarray package

Read all frames in the file as a DataArray: ` >xarr = file.as_xarray() `

For spectra: make a DataArray that contains the photon energy in eV rather than the default wavelength: ` >spectrum_file = SIFFile('my_spectrum.sif') >xarr = spectrum_file.as_xarray('photon_energy') `

One of the nice features of DataArray is the ability to easily select data and plot it: `python spectrum_file.as_xarray().sel(frames=0, wavelength=slice(749.5, 768.2)).plot() `

## Version History

  • 0.2: Added support for wavelength information, xarray exporting and unit tests

  • 0.1: First release

Metadata

Release files for sifreader 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sifreader 0.2.4
File Size Uploaded Provenance
sifreader-0.2.4.tar.gz 5.6 kB Without provenance Details

Release files / sifreader-0.2.4.tar.gz

Download URL sifreader-0.2.4.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
45a9235e95996a68169c1da1e273c2fbae3ed97865f96ac051650c5a3e63c488
BLAKE2b-256 checksum
How to use checksums
9d09701d6f40d2b4afa9453cef303e7e015798e6c9dffb8739b24104c923389a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for sifreader 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page