polartools#

Read and process data from the APS POLAR beamline (4-ID-D).

polartools is a Python package for working with the data products of the POLAR beamline at the Advanced Photon Source: X-ray absorption (XAS/XMCD), diffraction (Bragg peak fitting, HKL conversions), pressure calibration from Au/Ag standards, area-detector image processing, and import/export of Bluesky databroker/tiled catalogs.

It also ships the beamline’s graphical tools — scan-viewer, flyscan-dichro-gui and xmcd-gui — as console scripts, so they install and update with the library.


Installation

Install from PyPI, conda, or source. Set up a development environment.

Installation
Quickstart

Load a scan, plot it, fit a peak — in five minutes.

Quickstart
Loading data

Read SPEC, CSV, HDF5, databroker, and tiled scans into pandas DataFrames.

Loading data
XAS / XMCD

Edge-step normalize, compute dichroism, plot ±-field spectra.

XAS / XMCD
Diffraction

Fit Bragg peaks (Gaussian / Lorentzian / Voigt) and convert HKL.

Diffraction
Pressure calibration

Au and Ag diffraction-standard pressure calibration.

Pressure calibration
Image processing

Threshold, curvature extraction, and RIXS image-to-spectrum reduction.

Image processing
Database management

Pack/unpack databroker catalogs, export to CSV/JSON.

Database management
Scan viewers

scan-viewer: browse a directory of scans, plot, fit, and open the spectrum and image windows.

Scan viewers
Flyscan dichroism

flyscan-dichro-gui and the reduction behind it: CR/CL difference maps.

Flyscan dichroism
XMCD GUI

The bundled xmcd-gui PyQt application for interactive XMCD processing.

XMCD GUI
API reference

Auto-generated reference for every public function and class.

polartools

Getting help#

Open a discussion or file an issue on the GitHub project. Bug reports are welcome — please include the scan number, the full traceback, and the version of polartools you’re running (python -c "import polartools; print(polartools.__version__)").