PYME.Analysis.points.surfit module¶

PYME.Analysis.points.surfit.
f
(p, x, y, z)¶

PYME.Analysis.points.surfit.
filter_quad_results
(fits, data, radius=50, proj_threshold=0.85)¶

PYME.Analysis.points.surfit.
fitPtA
(kdt, pts, i)¶

PYME.Analysis.points.surfit.
fitPts
(pts, NFits=0)¶

PYME.Analysis.points.surfit.
fitPtsA
(pts, NFits=0)¶

PYME.Analysis.points.surfit.
fitPtsAP
(pts, NFits=0)¶

PYME.Analysis.points.surfit.
fitPtsAt
(pts, kdt, ivals, res, pos, nPs)¶

PYME.Analysis.points.surfit.
fit_quad_surf
(pts, control_pt, fitPos=True)¶  Fit a quadratic surface to a control point and a neighbourhood of points (both supplied)
Parameters: pts : ndararay[N,3] coordinates of point neighbourhood. This should normally include the control point
control_pt: ndararay[3] x,y,z coordinates of control point fitPos : bool, allow the fit surface to depart from the control point

PYME.Analysis.points.surfit.
fit_quad_surf_to_neighbourbood
(data, kdt, i, radius=100, fitPos=True)¶ Perform a single fit of a quadratic surface to a point and it’s neighbours, extracting both the control point and it’s neighbours from the full dataset
Parameters: data : [N,3] ndarray of points
kdt : scipy.spatial.cKDTree object
i : index in points of control point to define fit support
radius : radius in nm of neighbours to query for fit support
fitPos : bool, allow the fit to depart from the control point

PYME.Analysis.points.surfit.
fit_quad_surfaces
(data, radius, fitPos=False)¶

PYME.Analysis.points.surfit.
fit_quad_surfaces_P
(data, radius, fitPos=False, NFits=0)¶

PYME.Analysis.points.surfit.
fit_quad_surfaces_Pr
(data, radius, fitPos=False, NFits=0)¶ Fits quadratic surfaces to each point in the data set using the neighbouring points within a radius r to define the surface. This version distributes the processing across multiple processes in order to speed things up.
Parameters: data: [N,3] ndarray
The point positions
radius: float
The radius in nm around each point to use as support for the surface through that point. The surface patch will be fit to all points within this radius. Implicitly this sets the scale of the smoothing  i.e. the scale over which the true object surface can be assumed to have quadratic form.
fitPos: bool
Should the surface be allowed to depart from the control point (i.e. the point which was used to define the fit support neighbourhood). A value of False constrains the surface such that it always passes through the control point, whereas True lets the surface move. True should give more accurate surfaces when the point density is high and surfaces are well separated, False results in a better constrained fit and deals somewhat better with the case when multiple surfaces are close by (forces the fit into the local minimum corresponding to the surface that the control point is on).
NFits: int
Only fit the first NFits points. Largely exists for debugging to allow faster and more interactive computation.
Returns: a numpy array of results with the dtype surfit.SURF_PATCH_FLAT

PYME.Analysis.points.surfit.
fit_quad_surfaces_t
(data, kdt, ivals, res, pos, nPs, radius=100, fitPos=True)¶

PYME.Analysis.points.surfit.
fit_quad_surfaces_tr
(data, kdt, ivals, results, radius=100, fitPos=True)¶ Fit surfaces to point data using a presupplied kdtree for calculating neighbourhoods and save the results into the supplied results array.
Note: the _tr indicates that this version uses a supplied tree and saves it’s results into the passed results array
Parameters: data : [N,3] ndarray of point positions. Note that this should be all positions, not just the control points which we are responsible
for fitting (see ivals) as neighbourhoods will likely include points which are not in our set of control points
kdt : a scipy.spatial.cKDTree object used for fast neighbour queries
ivals : indices of the points to use as control points in our fits
results : a numpy array in which to save the results (pass by reference)
radius : the support radius / neighbourhood size in nm
fitPos : should we constrain the fit to pass through the control point

PYME.Analysis.points.surfit.
gen_quad_rot_surf
(p, xr, yr)¶

PYME.Analysis.points.surfit.
get_normals
(p)¶

PYME.Analysis.points.surfit.
gp
(p, x, y, z)¶

PYME.Analysis.points.surfit.
gpn
(p, x, y, z)¶

PYME.Analysis.points.surfit.
gpnA
(p, A)¶

PYME.Analysis.points.surfit.
gpnA2
(p, A)¶

PYME.Analysis.points.surfit.
mf
(p, x, y, z)¶

PYME.Analysis.points.surfit.
mf2
(p, x, y, z)¶

PYME.Analysis.points.surfit.
mfA
(p, A, A2)¶

PYME.Analysis.points.surfit.
mfA1
(p, A, x, y, z, A2)¶

PYME.Analysis.points.surfit.
quad_rot_surf_misfit
(p, pts, pos=None)¶

PYME.Analysis.points.surfit.
reconstruct_quad_surf
(p, control_point, N, radius=50, step=10.0)¶ Reconstruct a fitted surface by generating a number of virtual localizations on that surface
Parameters: p : the fit results for this control point
control_point : the control point
N : the number of points contributing to the surface (this is just copied to the output so that t can be used later
as a quality metric)
radius : the radius over which to reconstruct
step : the spacing at which to sample the surface (in nm).
Returns: an array of points
Notes
Reconstruction occurs on a uniformly sampled grid in u,v space (using the terminology introduce in fit_quad_surf). For low surface curvatures (small A & B) this will be approximately uniformly sampled on the surface, but the sampling will become less uniform as curvature increases. This is not anticipated to be a significant issue, especially if the ensemble surfaces will be binarized (e.g. by histograming and thresholding) later, as denser sampling (if needed) can be achieved by decreasing the grid spacing.

PYME.Analysis.points.surfit.
reconstruct_quad_surf_region_cropped
(p, control_point, N, kdt, data, radius=50, step=10.0, fit_radius=100.0)¶ Like reconstruct_quad_surf, but additionally masks the reconstruction points to the convex hull of the points used to generate the fit.
Parameters: p
control_point
N
kdt
data
radius
step
fit_radius

PYME.Analysis.points.surfit.
reconstruct_quad_surfaces
(fits, radius)¶

PYME.Analysis.points.surfit.
reconstruct_quad_surfaces_P
(fits, radius)¶

PYME.Analysis.points.surfit.
reconstruct_quad_surfaces_P_region_cropped
(fits, radius, data, fit_radius=100.0)¶

PYME.Analysis.points.surfit.
reconstruct_quad_surfaces_Pr
(fits, radius)¶ Reconstruct surfaces from fit results. This is a helper function which calls reconstruct_quad_surf repeatedly for each fit in the data set
Parameters: fits
radius

PYME.Analysis.points.surfit.
reconstruct_quad_surfaces_Pr_region_cropped
(fits, radius, data, fit_radius=100.0)¶

PYME.Analysis.points.surfit.
rend
(p, po, r, X, Y, Z, im, xm, ym, zm, xs, ys, zs, sc=1.0)¶

PYME.Analysis.points.surfit.
rendSurfs
(surfs, pts, vs=5)¶

PYME.Analysis.points.surfit.
rendSurfsT
(res, pos, nPs, pts)¶