Skip to main content

Setup & analyze data from ALS BL 4.0.2 diffractometer

Project description

ALS.Milo (version 0.18)

Overview

Milo is a suite of Python modules used to read, process, and analyze data that was collected on the Scattering Chamber located at Beamline 4.0.2 (a.k.a. BL402) of the Advanced Light Source (Berkeley, CA USA).

It is distributed under the namespace package, ALS.

How to cite this software

If you use this software in your research, please include the following citation in your publication:

Installation

Install from PyPI

ALS.Milo can be installed from PyPI using pip. The following example shows how.

>> sudo python -m pip install ALS.Milo -vv

Install from Anaconda

ALS.Milo can be installed from Anaconda Cloud. The following example shows how.

>> conda config --add channels padraicshafer    # Required for ALS.Milo
>> conda config --add channels pshafer  # Required for dependency
>> conda install ALS.Milo

Install from local repository (download)

ALS.Milo can be installed from a local copy of the project repository using pip. The following example shows how.

>> cd ALS.Milo-0.18.1/  # Local directory of project repository
>> sudo pip install .

Background information

Data from the BL402 Scattering Chamber is stored in two types of files:

  • FITS files: Each image captured by the CCD (a.k.a. the camera) is stored in a separate file using the FITS format. More details below. https://fits.gsfc.nasa.gov/fits_documentation.html

  • Scan summary files: When a scan sequence is run to collect data, a text file is created to summarize the parameters of the scan and the data collected.

    Every scan summary file contains a header that describes the scan and the types of data recorded, followed by data rows -- one row per data point. An Instrument Scan provides an image filename in each data row that can be used to access the CCD images recorded during the scan.

Usage

class CcdImageFromFITS encapsulates the operations of loading CCD data from a FITS file (including header information), accessing that data, and converting CCD screen coordinates (pixels) into reciprocal space coordinates.

The following command can be used to access the CcdImageFromFITS class in the qimage module.

from als.milo.qimage import CcdImageFromFITS

To read a FITS file use the constructor:
CcdImageFromFITS(filename) ,
where filename is a reachable (relative or absolute) file path to the FITS file.

The two-dimensional array of data can be accessed through the instance member, data.

ccd_image = CcdImageFromFITS("NiFe_8044-00024.fits")
ccd_image.data  # 2D array with shape (num_rows, num_columns)

Reciprocal space coordinates are calculated for each pixel using the member function, qvalues_df(). The return value is a PANDAS dataframe (df) where each row corresponds to a single pixel. The columns ["Qx", "Qy", "Qz"] are the diffractometer coordinates of the reciprocal space vector in units of nm-1 (Q = 2π / d). Intensity of each pixel is in column, "Counts".

ccd_image = CcdImageFromFITS("NiFe_8044-00024.fits")
q_ccd_df = ccd_image.qvalues_df()
q_ccd_df["Qx", "Qy", "Qz", "Counts"]    # CCD data in reciprocal space

Copyright Notice

ALS.Milo: BL402 RSXD Data Analysis, Copyright (c) 2014-2021, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Intellectual Property Office at IPO@lbl.gov.

NOTICE. This Software was developed under funding from the U.S. Department of Energy and the U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform publicly and display publicly, and to permit other to do so.

Project details


Download files

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

Source Distribution

ALS.Milo-0.18.1.tar.gz (53.1 kB view hashes)

Uploaded Source

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