Skip to content

dans_diffraction

Full documentation pages are generated for docstring reference only and may contain symbols imported from other modules. Imported symbols are not distinguished from locally defined symbols and will appear in any module that they are imported into. For better information on where symbols should be imported from, review the sourcecode on the github.

FoSpy.plotting.diffraction.engines.dans_diffraction

available module-attribute

available = True

CIF_engine

Source code in FoSpy/plotting/diffraction/engines/_base.py
class CIF_engine:
    def _to_frame(self, two_theta, intensity):
        from ....config import values as cfg
        x_label = cfg.diffraction.x_label
        return pd.DataFrame({x_label:two_theta, 'int':intensity})

    def get_pattern(self, **kwargs):
        from ....config import values as cfg

        params = cfg.diffraction.pattern_parameters().copy()
        params.update(kwargs)
        return params

_to_frame

_to_frame(two_theta, intensity)
Source code in FoSpy/plotting/diffraction/engines/_base.py
4
5
6
7
def _to_frame(self, two_theta, intensity):
    from ....config import values as cfg
    x_label = cfg.diffraction.x_label
    return pd.DataFrame({x_label:two_theta, 'int':intensity})

get_pattern

get_pattern(**kwargs)
Source code in FoSpy/plotting/diffraction/engines/_base.py
def get_pattern(self, **kwargs):
    from ....config import values as cfg

    params = cfg.diffraction.pattern_parameters().copy()
    params.update(kwargs)
    return params

Engine

Bases: CIF_engine

Source code in FoSpy/plotting/diffraction/engines/dans_diffraction.py
class Engine(CIF_engine):
    def __init__(self, cif_path, **kwargs):
        if not available:
            raise ImportError("Diffraction Engine: Dans_Diffraction could not be imported. Please install it using pip install Dans_Diffraction")
        self.xtl = ddf.Crystal(cif_path)
        self.sim =  self.xtl.Scatter
        self.sim.setup_scatter(**kwargs)

    def get_pattern(self, two_theta_range:tuple=None,**kwargs):
        two_theta, intensity, reflections = self.sim.powder(**kwargs)
        return self._to_frame(two_theta, intensity)

sim instance-attribute

sim = self.xtl.Scatter

xtl instance-attribute

xtl = ddf.Crystal(cif_path)

__init__

__init__(cif_path, **kwargs)
Source code in FoSpy/plotting/diffraction/engines/dans_diffraction.py
def __init__(self, cif_path, **kwargs):
    if not available:
        raise ImportError("Diffraction Engine: Dans_Diffraction could not be imported. Please install it using pip install Dans_Diffraction")
    self.xtl = ddf.Crystal(cif_path)
    self.sim =  self.xtl.Scatter
    self.sim.setup_scatter(**kwargs)

get_pattern

get_pattern(two_theta_range=None, **kwargs)
Source code in FoSpy/plotting/diffraction/engines/dans_diffraction.py
def get_pattern(self, two_theta_range:tuple=None,**kwargs):
    two_theta, intensity, reflections = self.sim.powder(**kwargs)
    return self._to_frame(two_theta, intensity)