# pymatgen.analysis.xas.spectrum module

This module defines classes to represent all xas and stitching methods

class XAS(x, y, structure, absorbing_element, edge='K', spectrum_type='XANES', absorbing_index=None)

  Bases: `pymatgen.core.spectrum.Spectrum`

  Basic XAS object.

  Parameters

    - x – A sequence of x-ray energies in eV

    - y – A sequence of mu(E)

    - structure (Structure) – Structure associated with the spectrum

    - absorbing_element (Element) – Element associated with the spectrum

    - edge (str) – Absorption edge associated with the spectrum

    - spectrum_type (str) – ‘XANES’ or ‘EXAFS’

    - absorbing_index (None or int) – If None, the spectrum is assumed to be a site-weighted spectrum, which is comparable to experimental one. Otherwise, it indicates that the absorbing_index for a site-wise spectrum.

  Initializes a spectrum object.

  XLABEL = 'Energy'
  YLABEL = 'Intensity'
  stitch(other: pymatgen.analysis.xas.spectrum.XAS, num_samples: int = 500, mode: Literal['XAFS', 'L23'] = 'XAFS') → pymatgen.analysis.xas.spectrum.XAS

    Stitch XAS objects to get the full XAFS spectrum or L23 edge XANES spectrum depending on the mode.

    1. Use XAFS mode for stitching XANES and EXAFS with same absorption edge.

         The stitching will be performed based on wavenumber, k. for k <= 3, XAS(k) = XAS[XANES(k)] for 3 < k < max(xanes_k), will interpolate according to

         > XAS(k)=f(k)*mu[XANES(k)]+(1-f(k))*mu[EXAFS(k)] where f(k)=cos^2((pi/2) (k-3)/(max(xanes_k)-3)

         for k > max(xanes_k), XAS(k) = XAS[EXAFS(k)]

    2. Use L23 mode for stitching L2 and L3 edge XANES for elements with

         atomic number <=30.

    Parameters

      - other – Another XAS object.

      - num_samples (int) – Number of samples for interpolation.

      - mode ("XAFS" | "L23") – Either XAFS mode for stitching XANES and EXAFS or L23 mode for stitching L2 and L3.

    Returns

      The stitched spectrum.

    Return type

      XAS object

site_weighted_spectrum(xas_list: List[pymatgen.analysis.xas.spectrum.XAS], num_samples: int = 500) → pymatgen.analysis.xas.spectrum.XAS

  Obtain site-weighted XAS object based on site multiplicity for each absorbing index and its corresponding site-wise spectrum.

  Parameters

    - xas_list ([XAS]) – List of XAS object to be weighted

    - num_samples (int) – Number of samples for interpolation

  Returns

    The site-weighted spectrum

  Return type

    XAS object