pyextal.jaxGeo.simulate ======================= .. py:module:: pyextal.jaxGeo.simulate .. autoapi-nested-parse:: A memory-safe `jaxEngine.utils.simulate`. Functions --------- .. autoapisummary:: pyextal.jaxGeo.simulate.simulate_safely Module Contents --------------- .. py:function:: simulate_safely(params, metadata, config, constants, batch=None, memory_gb=1.5) Runs `simulate`, sizing the batch to fit and halving it on OOM. The forward model holds a ``(batch, nbeams, nbeams)`` structure matrix, so the footprint is ``batch * nbeams**2 * 16`` bytes -- with 565 beams that is 5.1 MB per pixel, and `simulate`'s default batch of 4096 asks for 20 GB. That is what fails after a refinement that itself ran fine, because training chunks are far smaller than the simulation batch. :param params: Normalised parameters. :type params: dict :param metadata: From `setup_optimization_params`. :type metadata: dict :param config: The configuration used. :type config: OptConfig :param constants: Bloch constants; supplies ``nbeams``. :type constants: dict :param batch: Pixels per batch. Sized from ``memory_gb`` when None. :type batch: int, optional :param memory_gb: GB to aim for per batch. :type memory_gb: float :returns: The simulated intensities. :rtype: np.ndarray :raises RuntimeError: If even the smallest batch runs out of memory.