forked from soft-matter/trackpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add refine function and expand unit tests
- Loading branch information
Ruben Verweij
committed
Feb 11, 2019
1 parent
dbb8b54
commit 1908263
Showing
5 changed files
with
124 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from .center_of_mass import refine_com, refine_com_arr | ||
from .least_squares import refine_leastsq | ||
from .brightfield_ring import refine_brightfield_ring |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import numpy as np | ||
import pandas as pd | ||
|
||
from ..utils import (validate_tuple, guess_pos_columns, default_pos_columns) | ||
|
||
|
||
def refine_brightfield_ring(image, radius, coords_df, pos_columns=None): | ||
"""Find the center of mass of a brightfield feature starting from an | ||
estimate. | ||
Parameters | ||
---------- | ||
image : array (any dimension) | ||
processed image, used for locating center of mass | ||
coords_df : DataFrame | ||
estimated positions | ||
pos_columns: list of strings, optional | ||
Column names that contain the position coordinates. | ||
Defaults to ``['y', 'x']`` or ``['z', 'y', 'x']``, if ``'z'`` exists. | ||
""" | ||
if pos_columns is None: | ||
pos_columns = guess_pos_columns(coords_df) | ||
|
||
radius = validate_tuple(radius, image.ndim) | ||
|
||
if pos_columns is None: | ||
pos_columns = default_pos_columns(image.ndim) | ||
|
||
columns = pos_columns + ['size'] | ||
|
||
if len(coords_df) == 0: | ||
return pd.DataFrame(columns=columns) | ||
|
||
refined = coords_df | ||
|
||
return refined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters