pyextal.jaxGeo.config

Assembling the OptConfig, and what it will cost.

Functions

window(value, frac)

Bounds frac either side of value, ordered even if value < 0.

build_config(data, g_include, constants, reflections, ...)

The OptConfig for a dataset.

set_layer_fractions(params, metadata, config, fractions)

Shares the starting thickness between the layers.

report_cost(constants, config[, memory_warn])

Prints what this beam list implies for time and memory.

Module Contents

pyextal.jaxGeo.config.window(value, frac)

Bounds frac either side of value, ordered even if value < 0.

pyextal.jaxGeo.config.build_config(data, g_include, constants, reflections, settings)

The OptConfig for a dataset.

Parameters:
  • data (dict) – From jaxGeo.io.load_dataset.

  • g_include (np.ndarray) – (n_beams, 3) labels of the experimental beam axis.

  • constants (dict) – From get_bloch_constants.

  • reflections – From jaxGeo.reflections.select_reflections.

  • settings (RefineSettings) – Resolved settings. Uses imag, symmetry, layers, frozen_layers, diagonalise_measured, tile, kernel_radius, voigt, lr, steps, warmup and the three windows.

Returns:

Ready for setup_optimization_params.

Return type:

OptConfig

Raises:

SetupError – If the beam axis does not match the .dat’s output list.

pyextal.jaxGeo.config.set_layer_fractions(params, metadata, config, fractions)

Shares the starting thickness between the layers.

setup_optimization_params gives every layer 1/nlayers of the thickness; this replaces that with fractions (entrance first, summing to one).

Parameters:
  • params (dict) – Normalised parameters; thickness is replaced.

  • metadata (dict) – Supplies the thickness bounds.

  • config (OptConfig) – Supplies thickness_normalize.

  • fractions (sequence) – One per layer.

Returns:

params, updated in place.

Return type:

dict

pyextal.jaxGeo.config.report_cost(constants, config, memory_warn=2.0)

Prints what this beam list implies for time and memory.

Memory follows nbeams**2 per tilt in flight: the forward model gathers rows of the structure matrix over the whole beam list for each tilt. It evaluates a chunk’s tilts tilt_batch at a time (see jaxEngine.model.batched_forward), so that, not the tile, sets the footprint; a larger tile only wastes less of each chunk on the Voigt margin. Time follows the diagonalised size, ndiag.

Parameters:
  • constants (dict) – Bloch constants, after setup_optimization_params has filled in ndiag.

  • config (OptConfig) – The assembled configuration.

  • memory_warn (float) – Warn above this footprint, GB.

Returns:

Estimated footprint of the tilts in flight, GB.

Return type:

float