enbid_ananke package#

enbid_ananke#

Provides a set of utilities to run the kernel density estimator EnBiD (Sharma & Steinmetz 2011 <http://ascl.net/1109.012>).

How to use#

enbid_ananke comes with the function enbid, please refer to its documentation for further help.

enbid_ananke.write_for_enbid(points: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], name: str | Path | None = None, caching: bool = False) Path[source]#

Writes the input files for EnBiD given the input particles 3D coordinates.

Call signature:

path = write_for_enbid(points, name=None, caching=False)
Parameters:
  • points (array_like) – Contains 3D coordinates of the input particles, must be of shape (N,3) for any given N integer.

  • name (string) – Name of folder where to place EnBiD input files. Default to None.

  • caching (bool) – If True, check if EnBiD input file already exists and ignore writing if it does. Default to False.

Returns:

path – Path of folder where EnBiD input files are located.

Return type:

pathlib.Path

enbid_ananke.run_enbid(name: str | Path | None = None, ngb: int = 64, verbose: bool = True, caching: bool = False, **kwargs: Dict[str, Any]) Path[source]#

Run EnBiD using input files in name.

Call signature:

path = run_enbid(name=None, ngb=64, verbose=True,
                 caching=False, **kwargs)
Parameters:
  • name (string) – Name of folder where EnBiD input files are located. Default to None.

  • ngb (int) – Number of neighbouring particles EnBiD should consider in the smoothing for the density estimation. Default to 64.

  • verbose (bool) – Verbose boolean flag to allow EnBiD to print what it’s doing to stdout. Default to True.

  • caching (bool) – If True, check if EnBiD paramfile and usedvalues files already exist, and ignore running if parameters from the previous run are the same. Default to False.

  • spatial_scale (float) – Scaling between position and velocity space where the scaling goes as velocity = position/spatial_scale if spatial_scale is set strictly positive, or velocity = position/std(position) if spatial_scale is set to 0 (with std representing the standard deviation for each coordinate). Default to 1 - TODO currently not implemented.

  • part_bounday (int) – Minimum number of particles which a node must contain to have a boundary correction applied to its surfaces during tree generation. Optimum choice should be whichever the higher between 7 or d+1 where d is the dimensionality of the space considered. Default to 7.

  • node_splitting_criterion (int (0, 1)) – Flag to allow for the node splitting to always split in priority the dimension with lowest Shannon entropy. If set to 0, the criteria splits each dimension alternately. Default to 1.

  • cubic_cells (int (0, 1)) – Flag to allow the node splitting to use position or velocity subspaces rather than individual dimensions when generating cells. Only work for 3 & 6 dimensional spaces. Default to 0 - TODO currently not implemented.

  • median_splitting_on (int (0, 1)) – Flag to allow for cell splitting to happen at the mean of data points when building the tree for faster estimates. Default to 0 - TODO currently not implemented.

  • type_of_smoothing (int (0, 1, 2, 3, 4, 5)) –

    Type of smoothing used:
    1. None

    2. FiEstAS

    3. Normal isotropic spherical kernel

    4. Adaptive metric spherical kernel

    5. Normal isotropic product form kernel

    6. Adaptive metric product form kernel

    Default to 3.

  • vol_corr (int (0, 1)) – Flag to enable a correction that avoid underestimating density when the smoothing box extends outside the boundary. Default to 1.

  • type_of_kernel (int (0, 1, 2, 3, 4, 5)) –

    Type of the kernel profile used:
    1. B-spline

    2. Top hat

    3. Bi-weight (1-x^2)^2

    4. Epanechikov

    5. Cloud in cell

    6. Triangular shaped cloud

    Default to 3.

  • kernel_bias_correction (int (0, 1)) – Flag to enable corrections that displace central data points when computing densities, and reduce bias caused by irregularly distributed data. Default to 1.

  • anisotropy_kernel (int (0, 1)) – Flag to enable the use of anisotropic kernels which can have both shear and rotation. Kerels become then rotated ellipsoids in the density computation. With it on, type_of_smoothing should be either 2 or 3. Default to 0.

  • anisotropy (float) – Minimum allowable minor to major axis ratio of the kernel smoothing lengths for computational management. Default to 0.

  • ngb_a (int) – Number of neighbouring particles EnBiD should consider when computing the anisotropic kernel. Default to ngb.

  • type_list_on (int (0, 1)) – Flag to extend the number of particle types on which EnBiD can run independent density estimations from the default 6 types of GADGET formated data. Default to 0 - TODO currently not implemented.

  • periodic_boundary_on (int (0, 1)) – Flag to allow periodic boundary conditions. Default to 0 - TODO currently not implemented.

Returns:

path – Path of folder where EnBiD output files are located.

Return type:

pathlib.Path

enbid_ananke.return_enbid(name: str | Path | None = None) ndarray[Any, dtype[_ScalarType_co]][source]#

Read EnBiD output file and returns the associated kernel density estimates after running the EnBiD estimator.

Call signature:

rho = return_enbid(name=None)
Parameters:

name (string) – Name of folder where EnBiD saved its output files. Default to None.

Returns:

rho – Array representing the kernel density estimates output by EnBiD

Return type:

array_like

enbid_ananke.enbid(*args: Tuple[Any], **kwargs: Dict[str, Any]) ndarray[Any, dtype[_ScalarType_co]][source]#

Returns kernel density estimates given a set of particle 3D coordinates.

Call signature:

rho = enbid(points, name=None, **kwargs)
Parameters:
  • points (array_like) – Contains 3D coordinates of the input particles, must be of shape (N,3) for any given N integer.

  • name (string) – Name of folder where to save the input/output files for the EnBiD estimator. Default to None.

  • caching (bool) – Only to be used with a given folder under argument name. If True, check if EnBiD had already been used to produce the kernel density estimates. If it hasn’t, compute the estimates, otherwise, load the existing data that had previously been cached. Default to False.

  • **kwargs (dict) – Refer to function run_enbid documentation for additional keyword arguments.

Returns:

rho – Array representing kernel density estimates for the input particles

Return type:

array_like

Submodules#