/usr/bin/pyFAI-saxs is in pyfai 0.3.5-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | #!/usr/bin/python
# -*- coding: utf8 -*-
#
# Project: Azimuthal integration
# https://forge.epn-campus.eu/projects/azimuthal
#
# File: "$Id$"
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
saxs_integrate is the Saxs script of pyFAI that allows data reduction for Small Angle Scattering.
Parameters:
-p=param.poni PyFAI parameter file
-w=9.31e-11 wavelength (in meter)
-d=-2 dummy value for dead pixels
-dd=-1.1 delta dummy
-mask=mask mask image
-dark=darkImage dark current image
-flat=flatImage name of the file containing the flat field
-background=filename name of the file containing the background
-h print help and exit
Usage:
python saxs_integrate.py -p=param.poni -w=0.154e-9 file.edf file2.edf file3.edf
"""
__author__ = "Jerome Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "30/11/2011"
import os, sys, time
import fabio
import pyFAI
from pyFAI import AzimuthalIntegrator
if __name__ == "__main__":
paramFile = None
processFile = []
wavelength = None
dummy = None
delta_dummy = None
integrator = AzimuthalIntegrator()
for param in sys.argv[1:]:
if param.startswith("--"):
param = param[1:]
if param.startswith("-p="):
paramFile = param.split("=", 1)[1]
elif param.startswith("-w="):
wavelength = float(param.split("=", 1)[1])
elif param.startswith("-d="):
dummy = float(param.split("=", 1)[1])
elif param.startswith("-dd="):
delta_dummy = float(param.split("=", 1)[1])
elif param.startswith("-mask="):
integrator.maskfile = param.split("=", 1)[1]
elif param.startswith("-flat="):
integrator.flatfield = param.split("=", 1)[1]
elif param.startswith("-dark="):
integrator.darkcurrent = param.split("=", 1)[1]
elif param.startswith("-background="):
integrator.background = param.split("=", 1)[1]
elif param.startswith("--version"):
print(pyFAI.version + os.linesep)
sys.exit(0)
elif param.find("-h") in [0, 1]:
print(__doc__)
sys.exit(0)
elif os.path.isfile(param):
processFile.append(param)
if paramFile and processFile:
integrator.load(paramFile)
if wavelength is not None:
integrator.wavelength = wavelength
print integrator
if integrator.maskfile is not None:
fabiomask = fabio.open(integrator.maskfile)
if isinstance(fabiomask, fabio.fit2dmaskimage.fit2dmaskimage):
mask = 1 - fabiomask.data
else:
mask = fabiomask.data
else:
mask = None
for oneFile in processFile:
t0 = time.time()
fabioFile = fabio.open(oneFile)
outFile = os.path.splitext(oneFile)[0] + ".dat"
if fabioFile.nframes > 1:
res = integrator.saxs(data=fabioFile.data,
nbPt=min(fabioFile.data.shape),
dummy=dummy,
delta_dummy=delta_dummy,
filename=outFile,
mask=mask,
variance=fabioFile.next().data,
method="BBox")
else:
res = integrator.saxs(data=fabioFile.data,
nbPt=min(fabioFile.data.shape),
dummy=dummy,
delta_dummy=delta_dummy,
filename=outFile,
mask=mask,
method="BBox")
t1 = time.time()
print("Integration took %6.3fs %s --> %s" % (t1 - t0, oneFile, outFile))
else:
print(__doc__)
|