crystod.xrd

Contents

crystod.xrd#

Public powder-diffraction API of CrystOD (the crystod-xrd domain).

Powder X-ray and neutron diffraction patterns of a crystal structure, the Python form of crystod-xrd: the Bragg peaks of a pymatgen Structure for a chosen radiation (a K-alpha doublet such as CuKa with the Ka1 + Ka2 lines in the 2:1 ratio, a single line such as MoKa1, or neutrons of a given wavelength, nuclear scattering only), their broadening into a continuous pattern, the text-table and figure writers the command uses, and the superlattice reflections of a distorted structure indexed on its parent lattice and assigned to parent k points and irreps.

Computing patterns

Superlattice reflections (crystod-xrd –parent)

Broadening and output

  • smear_pattern() – the peaks broadened with a Lorentzian or Gaussian profile of unit area, as (two_theta, intensity) arrays.

  • write_peak_table() – the comma-separated table crystod-xrd writes.

  • plot_xrd_pattern() – the PDF (or PNG, SVG) with tick marks at the peak positions.

Tables

Usage:

from crystod import xrd
from crystod.examples import example_path

structure = xrd.load_structure(str(example_path("221_PPOSCAR_ScF3")))
pattern = xrd.compute_xrd_pattern(structure, "CuKa", (10, 120))
for peak in pattern.peaks[:3]:
    print(peak.hkl, round(peak.two_theta, 3), round(peak.intensity, 2), peak.line)
two_theta, intensity = xrd.smear_pattern(pattern, "lorentzian", width=0.1)

neutron = xrd.compute_xrd_pattern(structure, radiation="neutron", wavelength=1.5)
superlattice = xrd.superlattice_reflections("221_PPOSCAR_SrTiO3.cif",
                                            "140_PPOSCAR_SrTiO3.cif")
for reflection in superlattice.superlattice[:3]:
    print(reflection.hkl_parent_label, reflection.kname,
          reflection.contributions_label)

Attributes resolve lazily (PEP 562): importing this module is instant and pymatgen and matplotlib load only on first use. Functions report bad input as ValueError through this namespace (the implementation module raises SystemExit, as the command line wants).

class crystod.xrd.KPointSummary(kname, kvec, irreps, reflections, diagnostic, extinctions, absent=(), star=-1, shared=())[source]#

Bases: object

The superlattice reflections of one parent k star.

Variables:
  • kname (str) – The k star ("R").

  • kvec (tuple[fractions.Fraction, fractions.Fraction, fractions.Fraction]) – Its representative k vector (parent primitive reciprocal basis).

  • irreps (tuple[tuple[str, float], ...]) – (irrep, amplitude in Angstrom) of the irreps of this star along which the child is distorted, from the symmetry-mode analysis. A complex-type pair whose two irreps sit on the star of k and on the separate star of -k is listed under both stars with the one amplitude of the pair (see shared).

  • reflections (tuple[int, ...]) – Indices into SuperlatticePattern.reflections of the families at this star, in order of 2theta.

  • diagnostic (tuple[tuple[str, tuple[int, ...]], ...]) – (irrep, indices): the families diagnostic for each irrep (share >= DIAGNOSTIC_SHARE).

  • extinctions (tuple[tuple[str, str, tuple[int, ...], int], ...]) – (irrep, rule, indices, n_absent): the families at which an irrep is extinct at first order (indices into SuperlatticePattern.reflections), how many of the families absent in the child are too, and rule, a condition on the parent indices that some reflection of every such family and of no other family of the star fulfils ("|h| = |k| = |l|"), or "".

  • absent (tuple[int, ...]) – Indices into SuperlatticePattern.absent of the families of this star with no intensity in the child.

  • star (int) – Index of the star in analysis.stars (see SuperlatticeReflection.star).

  • shared (tuple[tuple[str, str], ...]) – (irrep, other star): the irreps of irreps that are complex-conjugate pairs spanning this star and the separate star of -k (a parent with no operation taking k to -k), with the other star as "GQ (2/3,0,0)"; their amplitude is that of the pair, listed under both stars and counted once.

absent: tuple[int, ...] = ()#
diagnostic: tuple[tuple[str, tuple[int, ...]], ...]#
extinctions: tuple[tuple[str, str, tuple[int, ...], int], ...]#
irreps: tuple[tuple[str, float], ...]#
kname: str#
kvec: tuple[Fraction, Fraction, Fraction]#
reflections: tuple[int, ...]#
shared: tuple[tuple[str, str], ...] = ()#
star: int = -1#
class crystod.xrd.Peak(hkl, multiplicity, families, d, two_theta, intensity, line)[source]#

Bases: object

One Bragg reflection of a computed pattern.

Variables:
  • hkl (tuple[int, int, int]) – Miller indices (h, k, l) of the first family of planes contributing to the peak. Miller-Bravais indices (h, k, i, l), which pymatgen gives for a hexagonal lattice, are stored without the redundant i = -(h + k).

  • multiplicity (int) – Multiplicity of that family.

  • families (tuple[tuple[tuple[int, int, int], int], ...]) – Every ((h, k, l), multiplicity) that pymatgen merged into this peak because the d spacings coincide (cubic (3 0 0) and (2 2 1), for instance); the first entry is hkl.

  • d (float) – Interplanar spacing in Angstrom.

  • two_theta (float) – Scattering angle 2theta in degrees.

  • intensity (float) – Relative intensity, 100 for the strongest reflection of the line it belongs to (50 for the strongest Ka2 reflection of a doublet).

  • line (str) – The radiation line that produced the peak ("CuKa1").

d: float#
families: tuple[tuple[tuple[int, int, int], int], ...]#
property families_label: str#

every merged family with its multiplicity.

Type:

"(3 0 0) x6 + (2 2 1) x24"

hkl: tuple[int, int, int]#
intensity: float#
line: str#
multiplicity: int#
two_theta: float#
class crystod.xrd.SuperlatticePattern(parent_file, child_file, parent_formula, child_formula, parent_space_group, child_space_group, size, cell_relation, parent_setting, radiation, radiation_name, lines, two_theta_range, reflections, absent, kpoints, child_peaks, parent_peaks, min_intensity=0.0)[source]#

Bases: object

The child powder pattern indexed on the parent lattice.

Variables:
  • parent_file (str) – The parent (high-symmetry) structure file.

  • child_file (str) – The child (distorted) structure file.

  • parent_formula (str) – Reduced formula of the parent.

  • child_formula (str) – Reduced formula of the child.

  • parent_space_group (str) – "Pm-3m (No. 221)".

  • child_space_group (str) – "I4/mcm (No. 140)".

  • size (int) – Primitive-cell multiplication of the child.

  • cell_relation (tuple[tuple[int, int, int], ...]) – The child primitive basis in parent primitive units (rows), as crystod-group --supergroup-cif prints it.

  • parent_setting (numpy.ndarray) – The matrix A (rows: the parent primitive basis in conventional units) that converts the parent indices, h_conv = h_prim A^-T.

  • radiation (str) – "xray" or "neutron".

  • radiation_name (str) – "CuKa", "MoKa1" or "neutron".

  • lines (tuple[tuple[str, float, float], ...]) – ((line, wavelength, weight), ...) of the radiation; the table uses the first line, the drawn pattern all of them.

  • two_theta_range (tuple[float, float]) – The (min, max) window in degrees.

  • reflections (list[crystod.xrd_superlattice.SuperlatticeReflection]) – Every family of the child in the window, in order of 2theta (the k-point summary is built from all of them).

  • absent (list[crystod.xrd_superlattice.SuperlatticeReflection]) – The superlattice families of the child lattice in the window whose child intensity is zero (systematic absences of the child space group); not printed in the table, used for the extinction rules.

  • kpoints (list[crystod.xrd_superlattice.KPointSummary]) – One KPointSummary per parent k star with superlattice reflections in the window, in the order of the symmetry-mode analysis.

  • child_peaks (tuple[numpy.ndarray, numpy.ndarray]) – (2theta, intensity) of every reciprocal-lattice point of the child for every line (weights applied), the input of the drawn pattern.

  • parent_peaks (tuple[numpy.ndarray, numpy.ndarray]) – The same for the parent reference structure.

  • min_intensity (float) – Families weaker than this percentage are left out of the printed and written table (listed), not out of reflections or the k-point summary.

absent: list[SuperlatticeReflection]#
cell_relation: tuple[tuple[int, int, int], ...]#
child_file: str#
child_formula: str#
child_peaks: tuple[ndarray, ndarray]#
child_space_group: str#
property fundamental: list[SuperlatticeReflection]#

The fundamental reflections only.

kpoints: list[KPointSummary]#
lines: tuple[tuple[str, float, float], ...]#
property listed: list[SuperlatticeReflection]#

those at or above min_intensity.

Type:

The families of the table

min_intensity: float = 0.0#
parent_file: str#
parent_formula: str#
parent_peaks: tuple[ndarray, ndarray]#
parent_setting: ndarray#
parent_space_group: str#
radiation: str#
property radiation_label: str#

"CuKa1 = 1.5405929 A" or "neutron, 1.5 A".

radiation_name: str#
reflections: list[SuperlatticeReflection]#
size: int#
property superlattice: list[SuperlatticeReflection]#

The superlattice reflections only.

two_theta_range: tuple[float, float]#
class crystod.xrd.SuperlatticeReflection(two_theta, d, hkl_child, multiplicity, hkl_parent, kname, kvec, intensity, intensity_parent, contributions=(), first_order_extinct=(), equivalents=(), star=-1, k_label='')[source]#

Bases: object

One reflection family of the child structure, indexed on the parent.

Variables:
  • two_theta (float) – Scattering angle 2theta in degrees (the first line of the radiation).

  • d (float) – Interplanar spacing in Angstrom.

  • hkl_child (tuple[int, int, int]) – Miller indices of the family in the conventional cell of the child space group (spglib standard setting).

  • multiplicity (int) – Number of reciprocal-lattice points in the family (the orbit under the child point group plus Friedel partners).

  • hkl_parent (tuple[fractions.Fraction, fractions.Fraction, fractions.Fraction]) – The same reflection on the conventional cell of the parent, as exact fractions.

  • kname (str) – The parent k star the reflection belongs to ("GM" for a fundamental reflection), or the k vector itself when it matches no star of the analysis.

  • kvec (tuple[fractions.Fraction, fractions.Fraction, fractions.Fraction]) – The parent k point, the fractional part of the parent indices in the parent primitive reciprocal basis, as fractions in [0, 1).

  • intensity (float) – Child intensity, the strongest family of the child = 100.

  • intensity_parent (float | None) – For a fundamental reflection, the parent reference structure at the same reflection (same multiplicity, Lorentz factor and scale); None for a superlattice reflection, to which the parent contributes nothing.

  • contributions (tuple[tuple[str, float], ...]) – For a superlattice reflection, (irrep, share) for every irrep of the k star, largest share first (shares sum to 1); empty for a fundamental reflection.

  • first_order_extinct (tuple[str, ...]) – The irreps of the star whose first-order structure factor vanishes at this reflection (see EXTINCT_FIRST_ORDER).

  • equivalents (tuple[tuple[fractions.Fraction, fractions.Fraction, fractions.Fraction], ...]) – The parent indices of every member of the family.

  • star (int) – Index of the k star in the star list of the symmetry-mode analysis (analysis.stars), -1 when the k point matches none. Two stars can share a name (two points of one symmetry line); the index tells them apart.

  • k_label (str) – The k column of the table: kname, followed by the k vector when another star of the analysis has the same name ("DT(0,1/3,0)").

contributions: tuple[tuple[str, float], ...] = ()#
property contributions_label: str#

"R4+ 97 %, R5+ 3 %"; irreps that round to 0 % are left out.

"-" for a fundamental reflection; "higher order" for a superlattice reflection of a star along which the child is not distorted (its intensity comes from higher-order terms of the other stars: harmonics and couplings).

d: float#
property diagnostic: str | None#

The irrep this reflection is diagnostic for, or None.

equivalents: tuple[tuple[Fraction, Fraction, Fraction], ...] = ()#
first_order_extinct: tuple[str, ...] = ()#
hkl_child: tuple[int, int, int]#
property hkl_child_label: str#

child indices and multiplicity.

Type:

"(1 0 3) x8"

hkl_parent: tuple[Fraction, Fraction, Fraction]#
property hkl_parent_label: str#

parent indices with their common denominator.

Type:

"(1 1 3)/2"

intensity: float#
intensity_parent: float | None#
k_label: str = ''#
kname: str#
kvec: tuple[Fraction, Fraction, Fraction]#
multiplicity: int#
star: int = -1#
property superlattice: bool#

True unless the reflection indexes to the parent Gamma point (the parent primitive indices are not all integers; the conventional indices of a centred parent can still be, with the parity the centring forbids).

two_theta: float#
class crystod.xrd.XRDPattern(peaks, xray_type, wavelengths, formula, space_group, two_theta_range, structure_name='', radiation='xray', _cache=<factory>)[source]#

Bases: object

A computed powder pattern: the peak list plus what it was computed for.

Variables:
  • peaks (list[crystod.xrd_pattern.Peak]) – The Bragg peaks in order of increasing 2theta.

  • xray_type (str) – The radiation name given ("CuKa", "MoKa1", …).

  • wavelengths (dict[str, float]) – line -> wavelength in Angstrom for every line that contributed (two entries for a doublet).

  • formula (str) – Reduced chemical formula of the structure.

  • space_group (str) – International symbol found by spglib through pymatgen.

  • two_theta_range (tuple[float, float]) – The (min, max) window in degrees the peaks were collected in.

  • structure_name (str) – The file name the structure was read from, used in output names and plot legends (empty when built from a Structure).

  • radiation (str) – "xray" (the default) or "neutron"; for neutrons xray_type and the one key of wavelengths are "neutron".

table_lines()[source]#

The peak table as printed by crystod-xrd, one string per line.

Return type:

list[str]

formula: str#
property intensity: ndarray[tuple[Any, ...], dtype[float64]]#

The relative intensities of the peaks.

peaks: list[Peak]#
radiation: str = 'xray'#
space_group: str#
structure_name: str = ''#
property two_theta: ndarray[tuple[Any, ...], dtype[float64]]#

The 2theta positions of the peaks, in degrees.

two_theta_range: tuple[float, float]#
wavelengths: dict[str, float]#
xray_type: str#
crystod.xrd.compute_xrd_pattern(structure, xray_type='CuKa', two_theta_range=(10.0, 120.0), *, min_intensity=0.0, symprec=0.01, structure_name='', radiation='xray', wavelength=None)[source]#

Compute the powder pattern of a structure for one radiation.

This is crystod-xrd -c POSCAR --xraytype TYPE without the files. Each line of the radiation is run through pymatgen’s XRDCalculator (intensities scaled to 100 for the strongest peak); for a doublet the Ka2 peaks are weighted by 1/2 and the two lists are merged in order of 2theta. With radiation="neutron" the single wavelength wavelength is run through NDCalculator instead (nuclear scattering only; xray_type is then not used).

Parameters:
  • structure – A pymatgen.core.Structure (see load_structure()).

  • xray_type (str) – A K-alpha doublet ("CuKa", the default, "MoKa", …) or a single line ("CuKa1", "CuKb", …); XRAY_TYPES lists them, case-insensitively.

  • two_theta_range (tuple[float, float]) – (min, max) in degrees; peaks outside are dropped.

  • min_intensity (float) – Peaks whose scaled intensity is below this percentage are dropped. 0 keeps every reflection (pymatgen’s own default would hide those below 0.001 %).

  • symprec (float) – Tolerance in Angstrom of the space-group determination used for the printed symbol only; the intensities are computed from the structure as given, without symmetrization.

  • structure_name (str) – Name recorded in the result for output names and legends (the CLI passes the file name).

  • radiation (str) – "xray" (default) or "neutron".

  • wavelength (float | None) – The neutron wavelength in Angstrom (required for neutrons, refused for X-rays).

Returns:

The XRDPattern.

Raises:

SystemExit – Unknown radiation name, or a wavelength that does not fit the radiation (ValueError when called through crystod.xrd).

Return type:

XRDPattern

Example

>>> from crystod import xrd
>>> from crystod.examples import example_path
>>> s = xrd.load_structure(str(example_path("221_PPOSCAR_ScF3")))
>>> pattern = xrd.compute_xrd_pattern(s, "CuKa1", (10, 60))
>>> pattern.space_group, len(pattern.peaks)
('Pm-3m', 6)
>>> peak = pattern.peaks[0]
>>> peak.hkl, round(peak.two_theta, 2), round(peak.intensity, 1)
((1, 0, 0), 21.82, 100.0)
crystod.xrd.format_superlattice_pattern(pattern, files=())[source]#

The report crystod-xrd --parent prints.

Parameters:
Returns:

The report, * ... * blocks separated by blank lines.

Return type:

str

crystod.xrd.load_structure(path)[source]#

Read a POSCAR into a pymatgen Structure.

Parameters:

path (str) – The structure file (VASP POSCAR/CONTCAR format).

Returns:

The pymatgen.core.Structure.

Raises:

SystemExit – The file does not exist or cannot be parsed (ValueError when called through crystod.xrd).

crystod.xrd.plot_superlattice_pattern(pattern, path, profile='lorentzian', width=0.1, show=False)[source]#

Draw the parent and child patterns with the superlattice reflections marked.

The child pattern (black) is drawn over the parent reference pattern (grey), both broadened like crystod-xrd patterns; tick marks below the curves mark the fundamental reflections (grey) and the superlattice reflections coloured by k star, and diagnostic reflections carry the name of their irrep.

Parameters:
  • pattern (SuperlatticePattern) – From superlattice_reflections().

  • path (str) – Output file; the extension selects the format.

  • profile (str) – "lorentzian" or "gaussian".

  • width (float) – Profile width in degrees.

  • show (bool) – Open an interactive matplotlib window as well.

Returns:

path.

Return type:

str

crystod.xrd.plot_xrd_pattern(pattern, path, profile='lorentzian', width=0.1, two_theta_range=None, show=False)[source]#

Draw the broadened pattern with tick marks at the Bragg positions.

Parameters:
  • pattern (XRDPattern) – The peaks to draw.

  • path (str) – Output file; the extension selects the format (.pdf, .png, .svg, … as matplotlib supports).

  • profile (str) – Broadening profile, see smear_pattern().

  • width (float) – Profile width in degrees, see smear_pattern().

  • two_theta_range (tuple[float, float] | None) – The window to draw; the pattern’s own by default.

  • show (bool) – Open an interactive matplotlib window as well.

Returns:

path.

Return type:

str

crystod.xrd.radiation_lines(radiation='xray', xray_type=None, wavelength=None)[source]#

The lines of a radiation: (name, ((line, wavelength, weight), ...)).

Parameters:
  • radiation (str) – "xray" (default) or "neutron", case-insensitively.

  • xray_type (str | None) – For X-rays, a doublet or line name of XRAY_TYPES ("CuKa" when None); must be None for neutrons.

  • wavelength (float | None) – For neutrons, the wavelength in Angstrom (required); must be None for X-rays, whose wavelength the line name fixes.

Returns:

("CuKa", (("CuKa1", 1.5405929, 1.0), ("CuKa2", 1.5444274, 0.5))) for X-rays, ("neutron", (("neutron", 1.5, 1.0),)) for neutrons.

Raises:

SystemExit – Unknown radiation or line name, a wavelength given for X-rays, an X-ray type given for neutrons, or a missing or non-positive neutron wavelength (ValueError when called through crystod.xrd).

Return type:

tuple[str, tuple[tuple[str, float, float], …]]

Example

>>> from crystod import xrd
>>> xrd.radiation_lines("neutron", wavelength=1.5)
('neutron', (('neutron', 1.5, 1.0),))
crystod.xrd.smear_pattern(pattern, profile='lorentzian', width=0.1, npoints=5000, two_theta_range=None)[source]#

Broaden the peaks into a continuous pattern.

Every peak becomes a unit-area profile of the same width scaled by its intensity: a Lorentzian (w/pi) / ((x - x0)^2 + w^2) or a Gaussian exp(-(x - x0)^2 / (2 w^2)) / (w sqrt(2 pi)). The two profiles share the same integrated intensity per peak, so they can be compared directly.

Parameters:
  • pattern (XRDPattern) – The peaks, from compute_xrd_pattern().

  • profile (str) – "lorentzian" (default) or "gaussian".

  • width (float) – The profile parameter w in degrees (Lorentzian half width at half maximum, Gaussian standard deviation); 0.1 by default.

  • npoints (int) – Number of 2theta samples.

  • two_theta_range (tuple[float, float] | None) – The window to sample; the pattern’s own by default.

Returns:

(two_theta, intensity) arrays of length npoints.

Raises:

SystemExit – Unknown profile name or non-positive width (ValueError when called through crystod.xrd).

Return type:

tuple[ndarray[tuple[Any, …], dtype[float64]], ndarray[tuple[Any, …], dtype[float64]]]

crystod.xrd.superlattice_reflections(parent_file, child_file, radiation='xray', xray_type='CuKa', wavelength=None, two_theta_range=(10.0, 120.0), tolerance=0.01, *, min_intensity=0.0)[source]#

Index the powder pattern of a distorted structure on its parent.

This is crystod-xrd --parent PARENT -c CHILD without the files. The two structures are paired by the symmetry-mode analysis; every reflection family of the child in the window is indexed on the parent lattice, classified as fundamental or superlattice, assigned to its parent k star, and (superlattice) split among the irreps of that star.

Parameters:
  • parent_file (str) – High-symmetry structure (CIF or POSCAR).

  • child_file (str) – Distorted structure (CIF or POSCAR) whose primitive cell is an integer multiple of the parent’s.

  • radiation (str) – "xray" (default) or "neutron".

  • xray_type (str) – X-ray line or doublet (XRAY_TYPES); the table uses its first line (Ka1 of a doublet). Not used for neutrons.

  • wavelength (float | None) – Neutron wavelength in Angstrom (required for neutrons, refused for X-rays).

  • two_theta_range (tuple[float, float]) – (min, max) in degrees.

  • tolerance (float) – Symmetry tolerance (Angstrom) of the symmetry-mode analysis and of the child point group.

  • min_intensity (float) – Families weaker than this percentage of the strongest child family are left out of the table (SuperlatticePattern.listed); the k-point summary is built from every family.

Returns:

The SuperlatticePattern.

Raises:

SystemExit – Bad radiation options or window, unreadable files, a child that cannot be mapped onto the parent, or an element without scattering data (ValueError when called through crystod.xrd).

Return type:

SuperlatticePattern

Example

>>> from crystod import xrd
>>> pattern = xrd.superlattice_reflections(
...     "221_PPOSCAR_SrTiO3.cif", "140_PPOSCAR_SrTiO3.cif")
>>> first = pattern.superlattice[0]
>>> first.hkl_parent_label, first.kname, first.contributions_label
('(3 1 1)/2', 'R', 'R5- 100 %')
crystod.xrd.write_peak_table(pattern, path)[source]#

Write the peak list as a comma-separated text table.

Columns: h, k, l, multiplicity, d, two_theta, intensity, line, families – the last holds every merged family ((3 0 0) x6 + (2 2 1) x24) and is the only non-numeric column besides line. The header lines record the structure, the radiation and the wavelength(s).

Parameters:
  • pattern (XRDPattern) – The peaks to write.

  • path (str) – Output file name.

Returns:

path.

Return type:

str

crystod.xrd.write_superlattice_table(pattern, path)[source]#

Write the reflection table as comma-separated text.

Columns: two_theta, d, h_child, k_child, l_child, multiplicity, h_parent, k_parent, l_parent, k point, I_child, I_parent, contributions; the parent indices are fractions (1/2), the k point is SuperlatticeReflection.k_label with spaces for its commas (DT(0 1/3 0)), I_parent is empty for a superlattice reflection, the contributions are irrep share pairs separated by ; (empty for a fundamental reflection and for a star along which the child is not distorted). Only the listed families are written.

Parameters:
Returns:

path.

Return type:

str

crystod.xrd.WAVELENGTHS#

X-ray wavelengths in Angstrom, from the RIETAN-FP manual (F. Izumi and K. Momma). Keys are the names --xraytype accepts for a single line; the doublets of KALPHA_DOUBLETS are built from these.

crystod.xrd.KALPHA_DOUBLETS#

K-alpha doublets: name -> ((line, weight), (line, weight)). The Ka2 pattern enters with half the weight of Ka1, the 2:1 ratio of the two lines.

crystod.xrd.XRAY_TYPES = ('CuKa', 'AgKa', 'MoKa', 'CoKa', 'FeKa', 'CrKa', 'CuKa1', 'CuKa2', 'CuKb', 'AgKa1', 'AgKa2', 'MoKa1', 'MoKa2', 'CoKa1', 'CoKa2', 'FeKa1', 'FeKa2', 'CrKa1', 'CrKa2')#

Every name --xraytype accepts, doublets first.

crystod.xrd.PEAK_PROFILES = ('lorentzian', 'gaussian')#

The broadening profiles of smear_pattern().