Skip to content

Canadian-Light-Source/sgmdata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b93f4ce · Oct 8, 2024
Mar 20, 2024
Apr 4, 2024
Oct 8, 2024
Mar 9, 2022
Mar 4, 2020
Jan 25, 2022
Apr 5, 2023
Mar 9, 2022
Oct 3, 2024
Jan 17, 2024

Repository files navigation

Helper module for working with data from the SGM Beamline

Documentation:

The complete docs are hosted on readthedocs.

Installation:

Using pip:

pip install sgm-data

or from source:

git clone https://github.com/Canadian-Light-Source/sgmdata.git ./sgmdata
cd sgmdata
python setup.py install

Usage:

First import the package, and select data to load in.

import sgmdata 
data = sgmdata.SGMData(["file1.hdf5", "file2.hdf5", "..."])

This will identify the independent axis, signals and other data within the files listed. The file load list also works with hsds domains.

data = sgmdata.SGMData(["file1.data.sgm-hdf5.lightsource.ca", "..."])

Useful functions:

data.scans  #contains a dictionary of the identified data arrays loaded from your file list
data.interpolate(start=270, stop=2000, resolution=0.5) #bin the data in scans dictionary and interpolates missing points
data.mean() #average data with the same sample name, and spec command together. 

Working with individual scans:

df = data.scans['FilePrefix'].entry1.interpolate(start=270, stop=2000, resolution=0.1) #bin data for a single scan.
df2 = data.scans['FilePrefix'].entry1.fit_mcas() #perform batch gaussian fitting of interpolated SDD signal

Plotting (with Bokeh):

data.scans['FilePrefix'].entry1.plot()
data.average.plot()