EnBiD_ananke package#

EnBiD#

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

How to use#

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

EnBiD_ananke.make_path_of_name(name=None)[source]#

Generate the folders structure representing a given name as a path, or generate a temporary one.

Call signature:

path = run_enbid(name=None)
Parameters:

name (string) – Path representing a folders structure. Default to None.

Returns:

path – Path corresponding to given name, or to new temporary one.

Return type:

pathlib.Path

EnBiD_ananke.write_for_enbid(points, name=None)[source]#

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

Call signature:

path = write_for_enbid(points, name=None)
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.

Returns:

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

Return type:

pathlib.Path

EnBiD_ananke.run_enbid(name=None, ngb=64, verbose=True, **kwargs)[source]#

Run EnBiD using input files in name.

Call signature:

path = run_enbid(name=None, ngb=64, **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.

  • 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=None)[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, **kwargs)[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.

  • **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#