yt.fields.magnetic_field module

yt.fields.magnetic_field.get_magnetic_normalization(key: str) float[source]
yt.fields.magnetic_field.setup_magnetic_field_aliases(registry, ds_ftype, ds_fields, ftype='gas')[source]

This routine sets up special aliases between dataset-specific magnetic fields and the default magnetic fields in yt so that unit conversions between different unit systems can be handled properly. This is only called from the setup_fluid_fields method (for grid dataset) or the setup_gas_particle_fields method (for particle dataset) of a frontend’s FieldInfoContainer instance.

Parameters:
  • registry (FieldInfoContainer) – The field registry that these definitions will be installed into.

  • ds_ftype (string) – The field type for the fields we’re going to alias, e.g. “flash”, “enzo”, “athena”, “PartType0”, etc.

  • ds_fields (list of strings or string) – The fields that will be aliased. For grid dataset, this should be a list of strings corresponding to the components of magnetic field. For particle dataset, this should be a single string corresponding to the vector magnetic field.

  • ftype (string, optional) – The resulting field type of the fields. Default “gas”.

Examples

>>> from yt.fields.magnetic_field import setup_magnetic_field_aliases
>>> class PlutoFieldInfo(ChomboFieldInfo):
...     def setup_fluid_fields(self):
...         setup_magnetic_field_aliases(
...             self, "chombo", ["bx%s" % ax for ax in [1, 2, 3]]
...         )
>>> class GizmoFieldInfo(GadgetFieldInfo):
...     def setup_gas_particle_fields(self):
...         setup_magnetic_field_aliases(
...             self, "PartType0", "MagneticField", ftype="PartType0"
...         )
yt.fields.magnetic_field.setup_magnetic_field_fields(registry: FieldInfoContainer, ftype: str = 'gas', slice_info=None) None[source]