Skip to content

ando-lab/saxs-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DOI

saxs-tools

Simple command-line tools for SAXS data processing and analysis

Versions

  • 0.0.1 -- First public release. Pip-installable. Includes saxs.emd.

Installation

pip install git+https://github.com/ando-lab/saxs-tools.git

Tool Chest

saxs.emd

Compute the Earth Mover's Distance (EMD, or Wasserstein-1 metric) between model and data P(r) functions.

Usage

# --help or -h flags to print usage info
saxs.emd --help
positional arguments:
  fit_file              The .fit file to process
  dmax                  The maximum dimension for IFT

options:
  -h, --help            show this help message and exit
  -v, --verbose         Enable verbose output (default: False)
  -s, --smoothness SMOOTHNESS
                        Smoothness for IFT (default: 1.0)
  -n, --numpoints NUMPOINTS
                        Number of real space points for IFT (default: 51)
  --qmin QMIN           Minimum q-value (default: 0.0)
  --qmax QMAX           Maximum q-value (default: inf)

Example data

Many fit files have been posted to the SASBDB. Let's grab the Crysol fit to SASDPQ4, an excellent Urate Oxidase example from the round-robin paper.

# download Ureate Oxidase fit file from the SASBDB
curl -O https://www.sasbdb.org/media/fitting_files/SASDPQ4_fit2.fit 

Example 1: simple output

# Estimate the EMD. Second argument is the maximum dimension (Å)
saxs.emd SASDPQ4_fit2.fit 92

Output:

emd (Å): 0.1737, x2: 40.6738, x2_ift: 2.6933

Example 2: verbose output, custom q-range

# --verbose or -v flag prints more information
# --qmin and --qmax to trim the q-range
saxs.emd SASDPQ4_fit2.fit 92 -v --qmin 0.02 --qmax 0.25

Output:

Loading model and data profiles from: SASDPQ4_fit2.fit
  In file:   498 points from 0.006000 to 1.000000
  Truncated: 116 points from 0.020000 to 0.250000
  Calculating IFT (dmax=92.0, numpoints=51, smoothness=1.0)
  Reduced chi-squared of the model-data fit: 134.2172
  Reduced chi-squared of the regularized residual: 4.4268
  Earth Mover's Distance (EMD): 0.1799 Å

About

Simple command-line tools for SAXS data processing and analysis

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages