Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
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
import uk.ac.diamond.scisoft.analysis.roi.XAxis as axis

The last two are needed to specify the axis type (q/2 theta/d/pixel), and perform any intensity correction.

...

Code Block
languagepy
from uk.ac.diamond.scisoft.analysis.io import NexusDiffractionMetaReaderNexusDiffractionCalibrationReader as NexusMetaReader

 


With these imports a basic integration can be performed with the following lines of code:

Code Block
languagepy
readermeta = NexusMetaReader.getDiffractionMetadataFromNexus(r"Path/To/Your/Calibration/File.nxs")
meta = reader.getDiffractionMetadataFromNexus(None)
if (not reader.isPartialRead()):
    sys.exit("no metadata in file")
    
,None)

#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)
#integrator.setAxisType(axis.ANGLE)

###
# 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")

Other options can be explored using methods on the integrator object or in the PixelIntegrationUtils class.