hmf.helpers.functional.get_best_param_order

hmf.helpers.functional.get_best_param_order(kls, q='dndm', **kwargs)[source]

Get an optimal parameter order for nested loops.

The underlying idea here is that typically modifying say the redshift has a smaller number of re-computations than modifying the base cosmological parameters. Thus, in a nested loop, the redshift should be the inner loop.

It is not always obvious which order the loops should be, so this function determines that order.

Note

The order is calculated based on actually running one iteration of the loop, so providing arguments which enable a fast calculation is helpful.

Parameters
  • kls (hmf._framwork.Framework class) – An arbitrary framework for which to determine parameter ordering.

  • q (str or list of str) – A string specifying the desired output (e.g. "dndm"), or a list of such strings.

  • kwargs (unpacked-dict) – Arbitrary keyword arguments to the framework initialiser. These are only for determination of parameter order and so may be very poor in resolution to improve efficiency.

Returns

final_list – An ordered list of parameters, with the first corresponding to the outer-most loop.

Return type

list

Examples

>>> from src.hmf import MassFunction
>>> print get_best_param_order(MassFunction,"dndm",transfer_model="BBKS",dlnk=1,dlog10m=1)[::3]
['z2', 'hmf_model', 'delta_wrt', 'growth_params', 'filter_params', 'Mmin', 'transfer_params',
'dlnk', 'cosmo_params']