pyextal.jaxGeo.reflections ========================== .. py:module:: pyextal.jaxGeo.reflections .. autoapi-nested-parse:: Which structure factors are refined. The engine refines one structure factor per symmetry group and matches the requested reflections by exact tuple against its own label for each group, so a reflection has to be named the way the engine names it or it is silently left at its tabulated value: * ``SpaceGroup`` labels each group by its `GroupSymmetry` representative; :func:`spacegroup_reflections` maps every reflection onto that. * ``Friedel`` pairs U(-g) = U(g)* and labels each pair by whichever of g and -g it meets first in the beam list; :func:`friedel_reflections` names both, so the label is always among them. Functions --------- .. autoapisummary:: pyextal.jaxGeo.reflections._as_tuples pyextal.jaxGeo.reflections.spacegroup_reflections pyextal.jaxGeo.reflections.friedel_reflections pyextal.jaxGeo.reflections.select_reflections pyextal.jaxGeo.reflections.review_reflections pyextal.jaxGeo.reflections.resolve_reflections Module Contents --------------- .. py:function:: _as_tuples(gs) .. py:function:: spacegroup_reflections(g_include, constants, verbose=True) Reflections as space-group representatives, the direct beam removed. The direct beam anchors the intensity scaling and is not a refinable structure factor. Each remaining reflection is replaced by the representative of its symmetry group: ``(2,0,0)`` passed literally would be silently left static while ``(-2,0,0)`` -- the representative of that same group -- is the one the engine recognises. Equivalent reflections collapse together, so the count returned is usually smaller than the count passed in. :param g_include: (n, 3) reflections to refine. :type g_include: array-like :param constants: From `get_bloch_constants`; supplies the beam list. :type constants: dict :param verbose: Report the mapping. :type verbose: bool :returns: ``(h, k, l)`` triples, symmetry-unique. :rtype: tuple :raises SetupError: If nothing survives, which means the reflections and the ``.dat`` describe different crystals or orientations. .. py:function:: friedel_reflections(g_include, constants, verbose=True) Every reflection together with its Friedel mate, the direct beam removed. Whichever of the two the engine uses to label the pair is then in the list. Each pair is one (possibly complex) parameter. :param g_include: (n, 3) reflections to refine. :type g_include: array-like :param constants: From `get_bloch_constants`; supplies the beam list. :type constants: dict :param verbose: Report. :type verbose: bool :returns: ``(h, k, l)`` triples, both members of each pair. :rtype: tuple :raises SetupError: If none of the reflections are in the beam list. .. py:function:: select_reflections(chosen, g_include, constants, symmetry, verbose=True) Turns a reflection choice into ``OptConfig.reflections``. :param chosen: ``'exported'`` (every reflection in ``g_include``), an integer (the N shortest-g, the engine's own rule), or a list of triples. :param g_include: (n, 3) reflections with data. :type g_include: array-like :param constants: Bloch constants. :type constants: dict :param symmetry: ``'SpaceGroup'`` or ``'Friedel'`` -- the grouping differs. :type symmetry: str :param verbose: Report the mapping. :type verbose: bool :returns: Ready for ``OptConfig.reflections``. :rtype: int | tuple .. py:function:: review_reflections(g_include, experimental, variance, save_dir=None) Shows each reflection's rocking curve and asks whether to keep it. Pruning in the notebook is a statistic; this is the eye. Each reflection is displayed in turn with its signal-to-noise summary, and the answer decides whether its structure factor is refined. :param g_include: (n, 3) reflections, in the order of the last axis of ``experimental``. :type g_include: array-like :param experimental: (rows, cols, n) rocking curves. :type experimental: np.ndarray :param variance: (rows, cols, n) matching variances, for the signal-to-noise summary. May be None. :type variance: np.ndarray :param save_dir: Write each figure here instead of opening a window. Used automatically when there is no display. :type save_dir: Path, optional :returns: The reflections to keep, in the order they were offered. :rtype: list[tuple] :raises SetupError: Without an interactive terminal, or if nothing was kept. .. note:: Answers are ``y`` (keep, the default), ``n`` (drop), ``a`` (keep this and all remaining), ``s`` (drop this and all remaining) and ``q`` (stop and use what has been decided so far). The direct beam is never offered: it anchors the intensity scaling rather than being refined. .. py:function:: resolve_reflections(choice, g_include, data, review_dir=None, dry_run=False) Resolves ``'review'`` into a list by asking; anything else passes through. Under ``dry_run`` the review is skipped and ``'exported'`` is used instead, so validating a command does not mean sitting through every rocking curve. :param choice: ``'review'``, ``'exported'``, an integer or a list. :param g_include: (n, 3) reflections with data. :type g_include: np.ndarray :param data: Supplies ``experimental_data`` and ``variance``. :type data: dict :param review_dir: Where to write the review figures. :type review_dir: Path, optional :param dry_run: Skip the review. :type dry_run: bool :returns: ``'exported'``, an integer, or a list of triples.