ALLEN INSTITUTE

# bmtk.builder.auxi package

## Submodules

## bmtk.builder.auxi.edge_connectors module

bmtk.builder.auxi.edge_connectors.connect_random(source, target, nsyn_min=0, nsyn_max=10, distribution=None)

bmtk.builder.auxi.edge_connectors.distance_connector(source, target, d_weight_min, d_weight_max, d_max, nsyn_min, nsyn_max)

## bmtk.builder.auxi.node_params module

class bmtk.builder.auxi.node_params.CellLocations(name, dmin=0.0)

  Bases: `object`

  property CCF_orientation
  add_positions(pop_names, positions_pop)
  add_positions_columnar(pop_names, partitions=[1], N=1, center=[0.0, 50.0, 0.0], height=100.0, min_radius=0.0, max_radius=1.0, method='prog', verbose=False)
  add_positions_ellipsoid(pop_names, partitions=[1], N=1, center=[0.0, 50.0, 0.0], height=50.0, x_length=100.0, z_length=200.0, method='prog', verbose=False)
  add_positions_nrrd(nrrd_filename, max_dens_per_mm3, pop_names, partitions=[1], split_bilateral=None, method='prog', verbose=False)
  add_positions_rect_prism(pop_names, partitions=[1], N=1, center=[0.0, 50.0, 0.0], height=20.0, x_length=100.0, z_length=100.0, method='prog', verbose=False)
  property dmin
  plot_locs()

bmtk.builder.auxi.node_params.hcp(x_n, y_n, z_n, r)

bmtk.builder.auxi.node_params.partition_locations(positions, partitions)

bmtk.builder.auxi.node_params.plot_positions(x, y, z, ax, labels, pop_name=None)

bmtk.builder.auxi.node_params.positions_columinar(N=1, center=[0.0, 50.0, 0.0], height=100.0, min_radius=0.0, max_radius=1.0, plot=False)

  Returns a set of random x,y,z coordinates within a given cylinder or cylindrical ring. Height is given as the y (index 1) coordinates.

  Parameters:

    - N – Number of points to return

    - center – center of sphere

    - height – maximum length of sphere (y coord)

    - min_radius – minimum horizontal radius on x-z plane

    - max_radius – maximum horizontal radius on x-z plane

  Returns:

    A (N, 3) matrix

bmtk.builder.auxi.node_params.positions_columnar(N=1, center=[0.0, 50.0, 0.0], height=100.0, min_radius=0.0, max_radius=1.0, plot=False)

  Returns a set of random x,y,z coordinates within a given cylinder or cylindrical ring. Height is given as the y (index 1) coordinates.

  Parameters:

    - N – Number of points to return

    - center – center of sphere

    - height – maximum length of sphere (y coord)

    - min_radius – minimum horizontal radius on x-z plane

    - max_radius – maximum horizontal radius on x-z plane

  Returns:

    A (N, 3) matrix

bmtk.builder.auxi.node_params.positions_cuboid(N=1, center=[0.0, 0.0, 0.0], height=100.0, xside_length=100.0, yside_length=100.0, min_dist=20.0, plot=False)

  This function distributes the cells in a 3D cuboid (x,y,z sides may have different lengths). The method used assures cells cannot be placed too close to one another (must be > min_dist apart) WARNING: If cell density is high and there is more than 1 population of cells, there is a high chance cells will be placed on top of one another. You can use positions_list() to avoid this…

  Written by Ben Latimer at University of Missouri (latimerb@missouri.edu)

  Returns:

    A (N, 3) matrix

bmtk.builder.auxi.node_params.positions_density_matrix(mat, position_scale=array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), origin=array([0, 0, 0]), plot=False, CCF_orientation=False, dmin=0.0, method='prog', existing_positions=array([], shape=(0, 3), dtype=float64), verbose=False)

  This function places random x,y,z coordinates according to a supplied 3D array of densities (cells/mm^3). The optional position_scale parameter defines a transformation matrix A to physical space such that:

      [x_phys, y_phys, z_phys] = A * [x_mat, y_mat, z_mat]

  Note: position_scale and output coordinates are in units of microns, while density is specified in mm^3.

  Parameters:

    - mat – A 3-dimensional matrix of densities (cells/mm^3)

    - position_scale – A (3, 3) matrix (microns)

    - plot – Generates a plot of the cell locations when set to True

    - CCF_orientation – if True, plot will be oriented for Allen atlas common coordinate framework See https://help.brain-map.org/display/mouseconnectivity/API#API-DownloadAtlas3-DReferenceModels

    - dmin – Minimum distance allowed between cell centers - using this function can severely slow down cell placement, especially as we approach the maximal possible density for this minimum distance

    - verbose – If set to true, prints every 100 units placed for monitoring progress

  Returns:

    A (N, 3) matrix (microns)

bmtk.builder.auxi.node_params.positions_dmin_lattice(mat, position_scale=array([0, 0, 0]), N=1, vol_tot=None, dmin=0.0, existing_positions=array([], shape=(0, 3), dtype=float64), filter_func=None, verbose=False)

  Packing with a minimum distance, starting from a hexagonal close packing lattice

  Parameters:

    - z_box (x_box, y_box,) – size of each dimension of lattice box to be generated (microns)

    - N – number of points to be placed

bmtk.builder.auxi.node_params.positions_dmin_prog(mat=None, position_scale=array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), N=None, vol_tot=None, sampling_func=None, dmin=0.0, existing_positions=array([], shape=(0, 3), dtype=float64), verbose=False)

  This function places random x,y,z coordinates with a minimal distance according to a supplied 3D array of densities (cells/mm^3) using progressive sampling. The optional position_scale parameter defines a transformation matrix A to physical space such that:

  > [x_phys, y_phys, z_phys] = A * [x_mat, y_mat, z_mat]

  Note: position_scale and output coordinates are in units of microns, while density is specified in mm^3.

  Parameters:

    - mat – A 3-dimensional matrix of densities (cells/mm^3)

    - position_scale – A (3, 3) matrix (microns)

    - plot – Generates a plot of the cell locations when set to True

    - CCF_orientation – if True, plot will be oriented for Allen atlas common coordinate framework See https://help.brain-map.org/display/mouseconnectivity/API#API-DownloadAtlas3-DReferenceModels

    - dmin – Minimum distance allowed between cell centers (microns) - using this function can severely slow down cell placement, especially as we approach the maximal possible density for this minimum distance

  Returns:

    A (N, 3) matrix (microns)

bmtk.builder.auxi.node_params.positions_ellipsoid(N=1, center=[0.0, 50.0, 0.0], height=50, x_length=100.0, z_length=200.0, plot=False)

  Returns a set of random x,y,z coordinates within an ellipsoid. Height is given as the y (index 1) coordinates.

  Parameters:

    - N – Number of points to return

    - center – center of ellipsoid

    - height – height of ellipsoid (y-coordinate)

    - x_length – length of ellipsoid in x

    - z_length – length of ellipsoid in z

  Returns:

    A (N, 3) matrix

bmtk.builder.auxi.node_params.positions_list(positions=array([[0, 0, 0], [0, 0, 1]]))

  This function is designed to be used with an externally supplied array of x,y,z coordinates. It is useful to avoid cell overlap in high density situations or to make some unique geometry. After you create each population, delete those positions from the “master” list of coordinates. This will assure that no cells are placed on top of one another.

  Written by Ben Latimer at University of Missouri (latimerb@missouri.edu)

  Parameters:

    positions

  Returns:

bmtk.builder.auxi.node_params.positions_nrrd(nrrd_filename, max_dens_per_mm3, split_bilateral=None, dmin=0.0, CCF_orientation=True, plot=False, method='prog', existing_positions=array([], shape=(0, 3), dtype=float64), verbose=False)

  Generates random cell positions based on a .nrrd file. Matrix values are interpreted as cell densities for each voxel. The maximum density is scaled to max_dens_per_mm3 (cells/mm^3). If the .nrrd file is a structural mask, cells will be placed uniformly at max_dens_per_mm3 within the structure geometry.

  By default, only one hemisphere is shown, but this can be disabled by setting bilateral=True.

  Parameters:

    - nrrd_filename – path to .nrrd file

    - max_dens_per_mm3 – desired density at maximum value of nrrd array (cells/mm^3)

    - split_bilateral – return only unilateral structure by removing half of the array along the given axis. If no splitting is desired, pass in None

  Returns:

    A (N, 3) matrix (microns)

bmtk.builder.auxi.node_params.positions_rect_prism(N=1, center=[0.0, 50.0, 0.0], height=20.0, x_length=100.0, z_length=100.0, plot=False)

  Returns a set of random x,y,z coordinates within a rectangular prism. Height is given as the y (index 1) coordinates.

  Parameters:

    - N – Number of points to return

    - center – center of rectangular prism

    - height – height of prism (y-coordinate)

    - x_length – length of prism in x

    - z_length – length of prism in z

  Returns:

    A (N, 3) matrix

bmtk.builder.auxi.node_params.xiter_random(N=1, min_x=0.0, max_x=1.0)

## Module contents