.. _sphx_glr_auto_examples_c_fields: :orphan: Core Modules: Fields ==================== This gallery showcases examples based on the :mod:`fields` module, PyMetric's core abstraction for physical quantities defined over space—scalars, vectors, tensors, and more. The :mod:`fields` module provides a unified interface for working with field components, units, buffers, and coordinate-aware differential operations. These examples walk through how to: - Construct scalar, vector, and tensor fields over structured grids, - Manage physical units and buffer types (e.g., NumPy, unyt, HDF5), - Broadcast, expand, reduce, and reshape field components, - Apply differential geometry operations like gradients, divergence, and Laplacians, - Combine symbolic metadata with numerical buffers for hybrid workflows. From initializing a field from an analytic expression to computing its divergence in curved space, these examples demonstrate the expressive and extensible field API at the heart of PyMetric. .. hint:: For complete documentation, see :ref:`fields`. .. raw:: html
.. thumbnail-parent-div-open .. raw:: html
.. only:: html .. image:: /auto_examples/c_fields/images/thumb/sphx_glr_plot_elem_lap_nfw_thumb.png :alt: :ref:`sphx_glr_auto_examples_c_fields_plot_elem_lap_nfw.py` .. raw:: html
NFW Density from Potential
.. raw:: html
.. only:: html .. image:: /auto_examples/c_fields/images/thumb/sphx_glr_plot_elem_wise_diff_thumb.png :alt: :ref:`sphx_glr_auto_examples_c_fields_plot_elem_wise_diff.py` .. raw:: html
Elementwise Partial Derivative (2D Cosine)
.. raw:: html
.. only:: html .. image:: /auto_examples/c_fields/images/thumb/sphx_glr_plot_nfw_symmetry_break_thumb.png :alt: :ref:`sphx_glr_auto_examples_c_fields_plot_nfw_symmetry_break.py` .. raw:: html
NFW Density in Oblate Coordinates
.. thumbnail-parent-div-close .. raw:: html
.. toctree:: :hidden: /auto_examples/c_fields/plot_elem_lap_nfw /auto_examples/c_fields/plot_elem_wise_diff /auto_examples/c_fields/plot_nfw_symmetry_break