Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
unit_registry_to_human_readable, unit_registry_from_human_readable )
""" Serializes ReactionDiffusion instance to json format.
Parameters ---------- rd: ReactionDiffusion instance dest: file object or path string
Notes ----- Attributes ignored are: N, x, bin_k_factor, geom, logy, logt
(geometrical factors and choice of variables) """
else: fh = dest
'n': rd.n, 'stoich_active': rd.stoich_active, 'stoich_prod': rd.stoich_prod, 'k': list(rd._k), 'D': list(rd._D), 'mobility': list(rd._mobility), # 'x': rd.x.tolist(), 'stoich_inactv': rd.stoich_inactv, 'units': unit_registry_to_human_readable(rd.units), 'g_values': list(rd._g_values), 'g_value_parents': rd.g_value_parents, # 'fields': fields }
""" Creates a `RD` instance from json serialized data (where `RD` is an implementation of ReactionDiffusion)
Parameters ---------- source: file object or path string RD: subclass of ReactionDiffusion (default: ReactionDiffusion) \*\*kwargs override parameters in source with kwargs """
else: fh = source
data.get('units', None)) units, 'electrical_mobility') zip(data['g_values'], RD.g_units( units, data['g_value_parents']))] get_unit(units, 'time') for order in reaction_orders] |