Skip to main content

Library to analyse, plot, and export data taken at the REIXS Beamline at the Canadian Light Source, Saskatoon, Canada.

Project description

CLS REIXS Analysis

This is a library to analyse, plot, and export REIXS beamline data. The package is meant to provide a framework to load data into jupyter and enable data interaction.

Further beamline information is available on the Website of the Canadian Light Source.

Installation

Install the package from PyPi with the pip package manager. This is the recommended way to obtain a copy for your local machine and will install all required dependencies.

    $ pip install reixs

You will also need Jupyter Notebook together with python 3 on your local machine.

In case that certain widgets aren't rendered properly, make sure to enable the appropriate jupyter extensions

    $ jupyter nbextension enable --py widgetsnbextension

Running

Launch your local jupyter installation with

    $ jupyter notebook

Examples

Load the required module

Before you start, you will need to import the required reixs package, enable bokeh plotting, and set the base directory.

## Define base directory
basedir = "/home/braun/ownCloud/Beamtime/example_data/"

## Setup necessarry inputs
from reixs.LoadData import *
from bokeh.io import show, output_notebook
output_notebook(hide_banner=True)

1d plots

General Loader1d

sca = Load1d()
sca.load(basedir,'FileName.dat','x_stream','y_stream',1,2,3,4)  # Loads multiple scans individually
sca.add(basedir,'FileName.dat','x_stream','y_stream',1,2,3,4)  # Adds multiple scans
sca.subtract(basedir,'FileName.dat','x_stream','y_stream',1,2,3,4,norm=False) # Subtracts scans from the first scan
sca.xlim(lower_lim,upper_lim) # Sets the horizontal axis plot region
sca.ylim(lower_lim,upper_lim) # Sets the vertical axis plot region
sca.plot_legend("pos string as per bokeh") # Determines a specific legend position
sca.vline(position) # Draws a vertical line
sca.hline(position) # Draws a horizontal line
sca.label(pos_x,pos_y,'Text') # Adds a label to the plot
sca.plot() # Plots the defined object
sca.exporter() # Exports the data by calling an exporter widget
  1. Create "Loader" object

  2. Specify the variable for the base directory (basedir)

  3. Enter the file name of the scan to analyse ('FileName.dat')

  4. Options for x_stream quantities include:

  • All quantities in the header file
  • Mono Energy for the excitation energy
  • MCP Energy (uncalibrated)
  • SDD Energy (uncalibrated)
  • XEOL Energy (uncalibrated, actually the wavelength scale)
  • Points (by index)
  1. Options for y_stream quantities include:
  • All quantities in the header file
  • TEY (Total Electron Yield: sample normalized by mesh)
  • TFY (Total Fluorescence Yield, normalized by mesh)
  • PFY and iPFY (Partial Fluorescence Yield and Inverse Partial Fluorescence Yield, both normalized by mesh) Specify ROI with brackets, either by XAS edge or energy: e.g. PFY[O] for PFY at the O K edge e.g. PFY[490:560] for PFY from 490eV to 560eV
  • specPFY (spectrometer PFY, normalized by mesh) specify energy range e.g. specPFY[500:520]
  • XES and rXES (X-Ray emission and resonant x-ray emission at selected energies from the spectrometer MCP data) e.g. rXES[560:565]
  • XRF and rXRF (X-Ray fluorescence and resonant x-ray fluorescence at selected energies from the SDD data) e.g. rXRF[550:570]
  • XEOL and rXEOL (XEOL data from the optical spectrometer)
  • POY and TOY (Partial optical yield and total optical yield, normalized by mesh) e.g. POY[300:750]
  • EY or Sample (Sample current, not normalized by mesh)
  • Mesh (Mesh current)
  • ET (Energy Transfer data, integrates over energy loss ROI and probes constant final states, sometimes referred to as CET scan) specify energy transfer region e.g. ET[-2:5] to probe mostly scattering close to the elastic line
  • rLOSS (Resonantly excited emission data on energy loss scale, integrates over incident energy ROIS and probes constant intermediate states, sometimes referred to as CIE scan) specify incident energy region e.g. rLOSS[620:640]
  1. List all scans to analyse (comma-separated)

  2. Set optional flags. Options include:

  • norm (Normalizes to [0,1])
  • xcoffset (Defines a constant shift in the x-stream)
  • xoffset (Takes a list of tuples and defines a polynomial fit of the x-stream)
  • ycoffset (Defines a constant shift in the y-stream)
  • yoffset (Takes a list of tuples and defines a polynomial fit of the y-stream) e.g. offset = [(100,102),(110,112),(120,121)]
  • background (Subtracts a XEOL background from XEOL scans) Set to True, uses the getXEOLback function with the background data stored (only supported with HDF5) Specify scan number, subtracts the XEOL scan taken at this particular scan
  • energyloss (Transfers the resultant MCP scale to energy loss Set to True, then takes mean of mono energy array Specify float with the incident photon energy
  • grid_x (Takes a list with three arguments to apply 1d interpolation gridding) e.g. grid_x = [Start Energy, Stop Energy, Delta]
  • savgol (Takes a list with two or three arguments to apply data smoothing and derivatives) e.g. savgol = [Window length, Polynomial order, deriavtive] as specified in the scipy Savitzky-Golay filter
  • binsize (int, allows to perform data binning to improve Signal-to-Noise)
  • legend_items (dict={scan_number:"name"}, overwrites generic legend names; works for the load method)
  • legend_item (str, overwrites generic legend name in the add/subtract method)

Absorption Scans

xas = XASLoader()
xas.load(basedir,'Plate2a.dat','TEY',1,4,6)
xas.load(basedir,'Plate2a.dat','PFY[O]',1,4)
xas.add(basedir,'Plate2a.dat','PFY[500:520]',1,4)
xas.subtract(basedir,'Plate2a.dat','specPFY[500:520]',1,4,6)
xas.plot()
xas.exporter()

Emission Scans (MCP)

xes = XESLoader()
# Options: XES, rXES
xes.load(basedir,'Plate2a.dat','XES',3,xoffset=[(515,520),(520,525),(530,535)])
xes.load(basedir,'Plate2a.dat','rXES[520:560]',4)
xes.add(basedir,'Plate2a.dat','XES',1,4)
xes.subtract(basedir,'Plate2a.dat','XES',1,4)
xes.plot()
xes.exporter()

XRF Scans (SDD)

xrf = XRFLoader()
# Options XRF,rXRF
xrf.load(basedir,'Plate2a.dat','XRF',3)
xrf.load(basedir,'Plate2a.dat','rXRF[520:560]',4)
xrf.add(basedir,'Plate2a.dat','XRF',1,4,)
xrf.subtract(basedir,'Plate2a.dat','XRF',1,4)
xrf.plot()
xrf.exporter()

XEOL Scans (Optical Spectrometer)

xeol = XEOLLoader()
#Options: XEOL, rXEOL
xeol.load(basedir,'RIXS_ES_QA.dat','XEOL',1,2,3,4,background=3)
xeol.load(basedir,'RIXS_ES_QA.dat','XEOL',1,2,3,4,background=True)
xeol.plot()

2d Images

General loader for MCA detector data

Note: Can only load one scan at a time!

load2d = Load2d()
load2d.load(basedir,'Filename.dat','x_stream','y_stream','detector',1)
load2d.plot()
load2d.exporter()
  1. Create "Loader" object

  2. Specify the variable for the base directory (basedir)

  3. Enter the file name of the scan to analyse ('FileName.dat')

  4. Options for x_stream quantities include:

  • All quantities in the header file
  • Mono Energy for the excitation energy
  1. Options for y_stream quantities include:
  • SDD Energy (Energy scale of the SDD detector)
  • MCP Energy (Energy scale of the MCP detector)
  • XEOL Energy (Wavelength scale of the XEOL optical spectrometer)
  1. Options for detector quantities include:
  • SDD (SDD detector MCA)
  • MCP (MCP detector MCA)
  • XEOL (XEOL optical spectrometer MCA)
  1. List all scans to analyse (comma-separated)

  2. Set optional flags. Options include:

  • norm (Normalizes to [0,1])
  • xcoffset (Defines a constant shift in the x-stream)
  • xoffset (Takes a list of tuples and defines a polynomial fit of the x-stream)
  • ycoffset (Defines a constant shift in the y-stream)
  • yoffset (Takes a list of tuples and defines a polynomial fit of the y-stream) e.g. offset = [(100,102),(110,112),(120,121)]
  • background (Subtracts a XEOL background from XEOL scans) Set to True, uses the getXEOLback function with the background data stored (only supported with HDF5) Specify scan number, subtracts the XEOL scan taken at this particular scan
  • energyloss (Transfers the excitation-emission map to energy loss scale
  • grid_x (Takes a list with three arguments to apply 1d interpolation gridding) e.g. grid_x = [Start Energy, Stop Energy, Delta]

EEMs (normalized by mesh current, special version of the general 2d image loader)

Note: Can only load one scan at a time!

eems = EEMsLoader()
eems.load(basedir,'Plate2a.dat','SDD',1)
eems.load(basedir,'Plate2a.dat','MCP',1)
eems.load(basedir,'RIXS_ES_QA.dat','XEOL',2,background=3)
eems.plot()
eems.exporter()

Mesh Scans (Plots a 2d histogram)

mesh = LoadMesh()
mesh.load(basedir,'Filename.txt','x_stream','y_stream','z_stream',24)
mesh.plot()
mesh.exporter()
  1. Create "Loader" object

  2. Specify the variable for the base directory (basedir)

  3. Enter the file name of the scan to analyse ('FileName.dat')

  4. Options for x_stream quantities include:

  • All quantities in the header file
  • Mono Energy for the excitation energy
  • SDD Energy (Energy scale of the SDD detector)
  • MCP Energy (Energy scale of the MCP detector)
  • XEOL Energy (Wavelength scale of the XEOL optical spectrometer)
  1. Options for y_stream quantities include:
  • All quantities in the header file
  • Mono Energy for the excitation energy
  • SDD Energy (Energy scale of the SDD detector)
  • MCP Energy (Energy scale of the MCP detector)
  • XEOL Energy (Wavelength scale of the XEOL optical spectrometer)
  1. Options for z_stream quantities include:
  • All quantities in the header file
  • All special quantities as specified for the Load1d() function
  1. List all scans to analyse (comma-separated)

  2. Set optional flags. Options include:

  • norm (Normalizes to [0,1])
  • xcoffset (Defines a constant shift in the x-stream)
  • xoffset (Takes a list of tuples and defines a polynomial fit of the x-stream)
  • ycoffset (Defines a constant shift in the y-stream)
  • yoffset (Takes a list of tuples and defines a polynomial fit of the y-stream) e.g. offset = [(100,102),(110,112),(120,121)]
  • background (Subtracts a XEOL background from XEOL scans) Set to True, uses the getXEOLback function with the background data stored (only supported with HDF5) Specify scan number, subtracts the XEOL scan taken at this particular scan

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reixs-0.6.8.tar.gz (40.6 kB view details)

Uploaded Source

Built Distribution

reixs-0.6.8-py3-none-any.whl (43.5 kB view details)

Uploaded Python 3

File details

Details for the file reixs-0.6.8.tar.gz.

File metadata

  • Download URL: reixs-0.6.8.tar.gz
  • Upload date:
  • Size: 40.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for reixs-0.6.8.tar.gz
Algorithm Hash digest
SHA256 1336b5891293737c12fb2e9824b201bc86ec18b28fb84fd4d1e1a866d86f1ae2
MD5 63648c78183a2124982e88e48250a772
BLAKE2b-256 a90747e55dd516c00f63bd37ca75adcc8c258a5c4485550b82c0ae4517a47d1a

See more details on using hashes here.

File details

Details for the file reixs-0.6.8-py3-none-any.whl.

File metadata

  • Download URL: reixs-0.6.8-py3-none-any.whl
  • Upload date:
  • Size: 43.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for reixs-0.6.8-py3-none-any.whl
Algorithm Hash digest
SHA256 a79265bbb557dde40feb967c78d834fd4078bbce7ae0a0a037e277435864d1c1
MD5 644e287e9a28a416b6311dc954ec5256
BLAKE2b-256 81be8e3334e629df547c354b93e3059aa321e39e2490dee5ee20605d80569b16

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page