Refinement

Analyzing XRD mapping data requires some sort of refinement on each mapping position. To accomplish this, the scimap provides the scimap.xrd_map.refine_mapping_data() method. Once refined, the results are stored in the HDF5 file and can be plotting using scimap.xrd_map.plot_map(). Different approaches are activated using the backend parameter. Many of the options, however, are unfinished or imperfect:

Fullprof

Warning

This backend is functional but fragile.

This backend requires that FullProf refinement be installed and available. The environmental variable $FULLPROF should point to the installation directory.

mymap = scimap.XRDMap(...)
mymap.refine_mapping_data(backend="fullprof")

FullProf refinement creates temporary files that are cleaned up upon successful refinement; if refinement fails, these files will be left behind for troubleshooting.

GSAS-II

Error

This backend is not functional. GSAS-II is under active development and if an API for Pawley refinement becomes available, this backend may be updated.

Pawley

Warning

This backend is incomplete. Us at your own risk.

This backend is an implementation of simple Pawley refinement in python.

Custom-Backends

If none of the available backends suit your needs, a custom backend may be provided. The backend should be a subclass of scimap.base_refinement.BaseRefinement. The predict() method should return the predicted intensities based on 2θ values, and a number of methods should be overridden that accept 2θ values and return refined parameters:

  • goodness_of_fit()
  • background()
  • cell_params()
  • scale_factor()
  • broadenings()
  • phase_fractions()
# Sub-class the base refinement
class CustomRefinement(scimap.BaseRefinement):
    def phase_fractions(self, two_theta, intensities):
        # Do some calculations here
        ...
    # Override the other methods here
    ...

# Now do the refinement
mymap = scimap.XRDMap(...)
mymap.refine_mapping_data(backend=CustomRefinement)