pyextal.jaxGeo.config ===================== .. py:module:: pyextal.jaxGeo.config .. autoapi-nested-parse:: Assembling the `OptConfig`, and what it will cost. Functions --------- .. autoapisummary:: pyextal.jaxGeo.config.window pyextal.jaxGeo.config.build_config pyextal.jaxGeo.config.set_layer_fractions pyextal.jaxGeo.config.report_cost Module Contents --------------- .. py:function:: window(value, frac) Bounds ``frac`` either side of ``value``, ordered even if ``value`` < 0. .. py:function:: build_config(data, g_include, constants, reflections, settings) The OptConfig for a dataset. :param data: From `jaxGeo.io.load_dataset`. :type data: dict :param g_include: (n_beams, 3) labels of the experimental beam axis. :type g_include: np.ndarray :param constants: From `get_bloch_constants`. :type constants: dict :param reflections: From `jaxGeo.reflections.select_reflections`. :param settings: Resolved settings. Uses ``imag``, ``symmetry``, ``layers``, ``frozen_layers``, ``diagonalise_measured``, ``tile``, ``kernel_radius``, ``voigt``, ``lr``, ``steps``, ``warmup`` and the three windows. :type settings: RefineSettings :returns: Ready for `setup_optimization_params`. :rtype: OptConfig :raises SetupError: If the beam axis does not match the ``.dat``'s output list. .. py:function:: 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). :param params: Normalised parameters; ``thickness`` is replaced. :type params: dict :param metadata: Supplies the thickness bounds. :type metadata: dict :param config: Supplies ``thickness_normalize``. :type config: OptConfig :param fractions: One per layer. :type fractions: sequence :returns: ``params``, updated in place. :rtype: dict .. py:function:: 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``. :param constants: Bloch constants, after `setup_optimization_params` has filled in ``ndiag``. :type constants: dict :param config: The assembled configuration. :type config: OptConfig :param memory_warn: Warn above this footprint, GB. :type memory_warn: float :returns: Estimated footprint of the tilts in flight, GB. :rtype: float