Painting Catalogs to a Mesh

The MeshSource.paint() function produces the values of the field on the mesh, returning either a RealField or ComplexField. In this section, we focus on the process of interpolating a set of discrete objects in a CatalogSource on to a mesh and how users can customize this procedure.

The Painted Field

The paint() function paints mass-weighted (or equivalently, number-weighted) fields to a mesh. So, when painting a CatalogSource to a mesh, the field \(F(\vx)\) that is painted is:

\[F(\vx) = \left[ 1 + \delta'(\vx) \right] V(\vx),\]

where \(V(\vx)\) represents the field value painted to the mesh and \(\delta'(\vx)\) is the (weighted) overdensity field, given by:

\[\delta'(\vx) = \frac{n(\vx)'}{\bar{n}'} - 1,\]

where \(\bar{n}'\) is the weighted mean number density of objects. Here, quantities denoted with a prime (\('\)) indicate weighted quantities. The unweighted number density field \(n(\vx)\) is related to its weighted counterpart via \(n'(\vx) = W(\vx) n(\vx)\), where \(W(\vx)\) are the weights.

Users can control the behavior of the value \(V(\vx)\) and the weights \(W(\vx)\) when converting a CatalogSource object to a mesh via the to_mesh() function. Specifically, the weight and value keywords allow users to indicate the name of the column in the CatalogSource to use for \(W(\vx)\) and \(V(\vx)\). See Additional Mesh Configuration Options for more details on these keywords.

Default Behavior

The default behavior is \(W(\vx) = 1\) and \(V(\vx) = 1\), in which case the painted field is given by:

\[F^\mathrm{default}(\vx) = 1 + \delta(\vx).\]

In the CatalogSource.to_mesh() function, the default values for the value and weight keywords are the Value and Weight columns, respectively. These are default columns that are in all CatalogSource objects that are set to unity by default.

More Examples

The Painting Recipes section of the cookbook contains several more examples that change the default behavior to paint customized fields to the mesh.

For example, users can set \(V(\vx)\) to a column holding a component of the velocity field, in which case the painted field \(F(\vx)\) would represent the momentum (mass-weighted velocity) field. See the Painting the Line-of-sight Momentum Field recipe for further details.

Another common example is setting the weights \(W(\vx)\) to a column representing mass and painting multiple species of particles to the same mesh using the MultipleSpeciesCatalog object. See the Painting Multiple Species of Particles recipe for more details.