py21cmfast.utils

Utilities for interacting with 21cmFAST data structures.

Functions

recursive_difference(dct1, dct2[, cmprules])

Return the recursive difference between two dicts.

show_references(inputs[, print_to_stdout])

Print out all the relevant references for a simulation based on input parameters.

Module Contents

py21cmfast.utils.recursive_difference(dct1, dct2, cmprules=None)[source]

Return the recursive difference between two dicts.

This is an asymmetric difference, i.e. we only end with values from dct1, and only if it is not exactly the same as in dct2. Entries in dct2 that are not in dct1 are ignored.

Only dictionaries (and their subclasses) are recursed – all other containers are treated as primitive types to be compared. If you need to recurse into custom structures, first “unstructure” your objects into dictionaries (e.g. with attrs.asdict(obj)) then use this function.

Parameters:
  • dct1 (dict | Any)

  • dct2 (dict | Any)

  • cmprules (dict[type, callable] | None)

Return type:

dict

py21cmfast.utils.show_references(inputs, print_to_stdout=True)[source]

Print out all the relevant references for a simulation based on input parameters.

Parameters:

inputs (py21cmfast.wrapper.inputs.InputParameters)