pyextal.jaxGeo.reflections

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; 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; friedel_reflections() names both, so the label is always among them.

Functions

_as_tuples(gs)

spacegroup_reflections(g_include, constants[, verbose])

Reflections as space-group representatives, the direct beam removed.

friedel_reflections(g_include, constants[, verbose])

Every reflection together with its Friedel mate, the direct beam removed.

select_reflections(chosen, g_include, constants, symmetry)

Turns a reflection choice into OptConfig.reflections.

review_reflections(g_include, experimental, variance)

Shows each reflection's rocking curve and asks whether to keep it.

resolve_reflections(choice, g_include, data[, ...])

Resolves 'review' into a list by asking; anything else passes through.

Module Contents

pyextal.jaxGeo.reflections._as_tuples(gs)
pyextal.jaxGeo.reflections.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.

Parameters:
  • g_include (array-like) – (n, 3) reflections to refine.

  • constants (dict) – From get_bloch_constants; supplies the beam list.

  • verbose (bool) – Report the mapping.

Returns:

(h, k, l) triples, symmetry-unique.

Return type:

tuple

Raises:

SetupError – If nothing survives, which means the reflections and the .dat describe different crystals or orientations.

pyextal.jaxGeo.reflections.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.

Parameters:
  • g_include (array-like) – (n, 3) reflections to refine.

  • constants (dict) – From get_bloch_constants; supplies the beam list.

  • verbose (bool) – Report.

Returns:

(h, k, l) triples, both members of each pair.

Return type:

tuple

Raises:

SetupError – If none of the reflections are in the beam list.

pyextal.jaxGeo.reflections.select_reflections(chosen, g_include, constants, symmetry, verbose=True)

Turns a reflection choice into OptConfig.reflections.

Parameters:
  • chosen – 'exported' (every reflection in g_include), an integer (the N shortest-g, the engine’s own rule), or a list of triples.

  • g_include (array-like) – (n, 3) reflections with data.

  • constants (dict) – Bloch constants.

  • symmetry (str) – 'SpaceGroup' or 'Friedel' – the grouping differs.

  • verbose (bool) – Report the mapping.

Returns:

Ready for OptConfig.reflections.

Return type:

int | tuple

pyextal.jaxGeo.reflections.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.

Parameters:
  • g_include (array-like) – (n, 3) reflections, in the order of the last axis of experimental.

  • experimental (np.ndarray) – (rows, cols, n) rocking curves.

  • variance (np.ndarray) – (rows, cols, n) matching variances, for the signal-to-noise summary. May be None.

  • save_dir (Path, optional) – Write each figure here instead of opening a window. Used automatically when there is no display.

Returns:

The reflections to keep, in the order they were offered.

Return type:

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.

pyextal.jaxGeo.reflections.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.

Parameters:
  • choice – 'review', 'exported', an integer or a list.

  • g_include (np.ndarray) – (n, 3) reflections with data.

  • data (dict) – Supplies experimental_data and variance.

  • review_dir (Path, optional) – Where to write the review figures.

  • dry_run (bool) – Skip the review.

Returns:

'exported', an integer, or a list of triples.