pyextal.jaxJoint.params

The joint parameter tree, and each dataset’s view of it.

G = {'shared':   [OrderedDict(key -> {xfre, xfim, afre, afim})  per layer],
     'datasets': [{thickness, intensity_scale, background, probe_sigma,
                   probe_gamma[, oversub_offset, oversub_leak]}  per dataset]}

shared holds one entry per canonical key (jaxJoint.link), in physical units: the structure factors are not normalised (reflections_normalize is off), so a dataset’s values are a fixed linear map of the shared ones. The per-dataset scalars stay normalised with that dataset’s own bounds.

local_params rebuilds exactly the tree setup_optimization_params made for a dataset – same keys, same order – so its loss, the geometry objective, the simulation and save_refinement all take it unchanged. It is a JAX function of G, so a dataset’s gradient with respect to G comes straight through it.

Attributes

Functions

_term(coef, x)

apply_link(m, value)

M @ value for one structure factor.

local_params(G, index, links)

Dataset index's parameter tree, as setup_optimization_params builds it.

shared_value(m, value)

The canonical value, M.T @ value (M is orthogonal).

freeze_mask(G, configs, locals_, sf_mask, frozen_layers)

Which leaves of G Adam holds (True) -- the joint create_freeze_mask.

Module Contents

pyextal.jaxJoint.params.COMPONENTS = ('xfre', 'xfim', 'afre', 'afim')
pyextal.jaxJoint.params._term(coef, x)

M @ value for one structure factor.

Zero entries are skipped and +-1 entries are a copy or a negation, so a phase of 0 or pi links values exactly and a single dataset’s refinement is bit for bit the one jaxGeo runs.

Parameters:
  • m (sequence) – (4, 4) link map.

  • value (dict) – xfre/xfim/afre/afim.

Returns:

OrderedDict

pyextal.jaxJoint.params.local_params(G, index, links)

Dataset index’s parameter tree, as setup_optimization_params builds it.

Parameters:
  • G (dict) – The joint tree.

  • index (int) – The dataset.

  • links (list) – (local key, canonical key, M) in the dataset’s own reflection order (metadata['reflection_list']).

Returns:

beams (one OrderedDict per layer) and the dataset’s scalars.

Return type:

dict

pyextal.jaxJoint.params.shared_value(m, value)

The canonical value, M.T @ value (M is orthogonal).

pyextal.jaxJoint.params.freeze_mask(G, configs, locals_, sf_mask, frozen_layers)

Which leaves of G Adam holds (True) – the joint create_freeze_mask.

Parameters:
  • G (dict) – The joint tree.

  • configs (list) – Each dataset’s OptConfig.

  • locals (list) – Each dataset’s local_params (for the scalar flags).

  • sf_mask (tuple) – Which of (xfre, xfim, afre, afim) are free.

  • frozen_layers (tuple) – 0-based layers whose structure factors are held.

Returns:

Same structure as G.

Return type:

dict