...
It is possible to access all the integration routines available in DAWN using the Jython scripting interface, but it is not a simple process (in version 1.6, this should be improved in future versions).
All the integration methods can be imported by with the following lines of code:
Code Block | ||
---|---|---|
| ||
from uk.ac.diamond.scisoft.analysis.diffraction.powder import PixelSplittingIntegration as PSI
from uk.ac.diamond.scisoft.analysis.diffraction.powder import NonPixelSplittingIntegration as NPSI
from uk.ac.diamond.scisoft.analysis.diffraction.powder import NonPixelSplittingIntegration2D as NPSI2D
from uk.ac.diamond.scisoft.analysis.diffraction.powder import PixelSplittingIntegration2D as PSI2D
from uk.ac.diamond.scisoft.analysis.roi import ROIProfile
from uk.ac.diamond.scisoft.analysis.diffraction.powder import PixelIntegrationUtils as Putils |
The last two are needed to specify the axis type (q/2 theta/d/pixel), and perform any intensity correction.
To load in the metadata required to integrate the image you also need:
Code Block | ||
---|---|---|
| ||
from uk.ac.diamond.scisoft.analysis.io import NexusDiffractionMetaReader as NexusMetaReader |
With these imports a basic integration can be performed with the following lines of code:
Code Block | ||
---|---|---|
| ||
reader = NexusMetaReader(r"Path/To/Your/Calibration/File.nxs")
meta = reader.getDiffractionMetadataFromNexus(None)
if (not reader.isPartialRead()):
sys.exit("no metadata in file")
#Load image data
data = dnp.io.load(r"Path/To/Your/Data.tiff")['image_name'][...]
#Create object to do integration [In this case pixel split](metadata, then number of bins)
integrator = PSI(meta, 2000)
#integrator = NPSI(meta, 2000)
#integrator = PSI2D(meta, 2000, 360)
###
# 1D Azimuthal
###
#For full image, integrating azimuthally, in q only need to call
out = integrator.integrate(data._jdataset())
#out[0] is axis, out[1] is intensity
dnp.plot.line(out[0],out[1], name="Plot 1", title = "Full Image - non split") |