openmc.ZernikeFilter

class openmc.ZernikeFilter(order, x=0.0, y=0.0, r=1.0, filter_id=None)[source]

Score Zernike expansion moments in space up to specified order.

This filter allows scores to be multiplied by Zernike polynomials of the particle’s position normalized to a given unit circle, up to a user-specified order. The standard Zernike polynomials follow the definition by Born and Wolf, Principles of Optics and are defined as

\[Z_n^m(\rho, \theta) = R_n^m(\rho) \cos (m\theta), \quad m > 0 Z_n^{m}(\rho, \theta) = R_n^{m}(\rho) \sin (m\theta), \quad m < 0 Z_n^{m}(\rho, \theta) = R_n^{m}(\rho), \quad m = 0\]

where the radial polynomials are

\[R_n^m(\rho) = \sum\limits_{k=0}^{(n-m)/2} \frac{(-1)^k (n-k)!}{k! ( \frac{n+m}{2} - k)! (\frac{n-m}{2} - k)!} \rho^{n-2k}. \]

With this definition, the integral of \((Z_n^m)^2\) over the unit disk is \(\frac{\epsilon_m\pi}{2n+2}\) for each polynomial where \(\epsilon_m\) is 2 if \(m\) equals 0 and 1 otherwise.

Specifying a filter with order N tallies moments for all \(n\) from 0 to N and each value of \(m\). The ordering of the Zernike polynomial moments follows the ANSI Z80.28 standard, where the one-dimensional index \(j\) corresponds to the \(n\) and \(m\) by

\[j = \frac{n(n + 2) + m}{2}. \]
Parameters
  • order (int) – Maximum Zernike polynomial order

  • x (float) – x-coordinate of center of circle for normalization

  • y (float) – y-coordinate of center of circle for normalization

  • r (float) – Radius of circle for normalization

Variables
  • order (int) – Maximum Zernike polynomial order

  • x (float) – x-coordinate of center of circle for normalization

  • y (float) – y-coordinate of center of circle for normalization

  • r (float) – Radius of circle for normalization

  • id (int) – Unique identifier for the filter

  • num_bins (int) – The number of filter bins

classmethod from_hdf5(group, **kwargs)[source]

Construct a new Filter instance from HDF5 data.

Parameters

group (h5py.Group) – HDF5 group to read from

Keyword Arguments

meshes (dict) – Dictionary mapping integer IDs to openmc.MeshBase objects. Only used for openmc.MeshFilter objects.

classmethod from_xml_element(elem, **kwargs)[source]

Generate a filter from an XML element

Parameters
  • elem (lxml.etree._Element) – XML element

  • **kwargs – Keyword arguments (e.g., mesh information)

Returns

Filter object

Return type

openmc.Filter

to_xml_element()[source]

Return XML Element representing the filter.

Returns

element – XML element containing Zernike filter data

Return type

lxml.etree._Element