PYME.Analysis.points.coordinate_tools module¶
- PYME.Analysis.points.coordinate_tools.cart2sph(x, y, z)¶
- PYME.Analysis.points.coordinate_tools.cartesian_to_spherical(x, y, z, azimuth_0=0, zenith_0=0)¶
- PYME.Analysis.points.coordinate_tools.direction_to_nearest_n_points(x, y, z, x0, y0, z0, n, subsample_fraction=1.0)¶
- Parameters
- x
- y
- z
- x0
- y0
- z0
- n
- subsample_fraction: float
fraction of points to randomly subsample before querying. This can be helpful / necessary when len(x) >= 100,000
- Returns
- azimuthndarray
azimuth (angle in x,y plane)
- zenithndarray
elevation (angle from z axis)
- rndarray
distance to center of mass for n nearest points for each point queried
- cartesian_vector: ndarray
Unit vectors pointing to nearest n points for each point queried
- PYME.Analysis.points.coordinate_tools.distance_to_image_mask(mask, points)¶
Calculate the distance from point positions to the edge of an image mask.
- Parameters
- maskPYME.IO.ImageStack
Binary mask where True denotes inside of the mask. Can be integers too, e.g. from an image of labels where 0 denotes unlabeled, but this will be compressed into a single mask of inside object(s) and outside. Edge of the mask is considered the first pixel which is False.
- pointsPYME.IO.tabular.TabularBase
points to query distance with respect to mask
- Returns
- distancendarray
Distance from each point to the edge of the mask in units of nanometers. Negative values denote being inside of the mask.
- PYME.Analysis.points.coordinate_tools.find_points_within_cone(x, y, z, x0, y0, z0, azimuth, zenith, d_omega=0.15, cutoff_r=1500)¶
- PYME.Analysis.points.coordinate_tools.find_points_within_cylinder(x, y, z, x0, y0, z0, radius, length, v0, v1, v2)¶
- Parameters
- x
- y
- z
- x0
- y0
- z0
- v0ndarray
cartesian vector defining the ‘axial axis’ of the cylinder
- v1ndarray
cartesian vector orthogonal to the axial axis
- v2ndarray
cartesian vector othogonal to the previous two
- Returns
- PYME.Analysis.points.coordinate_tools.find_principle_axes(x, y, z, sample_fraction=None)¶
- Parameters
- x: list-like
x positions
- y: list-like
y positions
- z: list-like
z positions
- sample_fraction: float
[optional] fraction of points to choose randomly and use for principal axes calculations, reducing computation. Default of None uses all points.
- Returns
- standard_deviations: ndarray
standard deviations of the input positions along the principle axes
- eigen_vectors: ndarray
principle axes
- PYME.Analysis.points.coordinate_tools.pixel_index_of_points_in_image(image, points)¶
Map positions into indices of an image
- Parameters
- image: PYME.IO.image.ImageStack
image with complete metadata
- points: PYME.IO.tabular.TabularBase
- Returns
- x_index: ndarray
x pixel index in image for each point
- y_index: ndarray
y pixel index in image for each point
- z_index: ndarray
z pixel index in image for each point
- PYME.Analysis.points.coordinate_tools.scaled_projection(x, y, z, scaling_factors, scaling_axes)¶
- PYME.Analysis.points.coordinate_tools.spherical_to_cartesian(az, el, r)¶
Convert spherical coordinates into cartesian
- Parameters
- azndarray
azimuth (angle in x,y plane)
- elndarray
elevation (angle from z axis)
- rndarray
radius
- Returns
- x, y, z