// Make a copy of old coords and overwrite with result
// In this way any extra columns from previous_coords are preserved
new_coords = coords.copy()
for column in result.index.tolist():
// make a new column if necessary, otherwise overwrite
new_coords[column] = result.get(column)
refined[i] = new_coords
After Change
return coords_df
if not pool:
refined = map(_get_refined_coords, [(coords, pos_columns, image, radius, kwargs, has_user_input) for _, coords in coords_df.iterrows()])
else:
refined = pool.map(_get_refined_coords, [(coords, pos_columns, image, radius, kwargs, has_user_input) for _, coords in coords_df.iterrows()])
refined = [ref for ref in refined if ref is not None]
columns = np.unique(np.concatenate((pos_columns, ["r"], coords_df.columns)))
if len(refined) == 0:
warnings.warn("No particles found in the image after refinement.")