gunz_cm.reconstructions.preprocs package

Submodules

gunz_cm.reconstructions.preprocs.points module

Module.

Examples

gunz_cm.reconstructions.preprocs.points.downsample_points(points: ndarray, ds_ratio: int, def_coor: float = nan) ndarray[source]

Downsamples the given points by a specified ratio.

  • The function ensures that the ds_ratio is greater than 1.

  • Points with all NaN values are ignored during downsampling.

  • The resulting array is filled with def_coor for indices without valid points.

pointsnp.ndarray

The array of points to be downsampled.

ds_ratioint

The downsampling ratio. Must be greater than 1.

def_coorfloat, optional

The default coordinate value for indices without valid points, by default np.nan.

np.ndarray

The downsampled points array.

Examples

gunz_cm.reconstructions.preprocs.points.filter_points(points: ndarray, ret_mask: bool = False) ndarray | Tuple[ndarray, ndarray][source]

Filters out points with any NaN values.

  • If ret_mask is True, the function returns both the filtered points and the mask used for filtering.

  • If ret_mask is False, only the filtered points are returned.

pointsnp.ndarray

The array of points to be filtered.

ret_maskbool, optional

Whether to return the mask used for filtering, by default False.

np.ndarray or Tuple[np.ndarray, np.ndarray]

The filtered points, and optionally the mask used for filtering.

Examples

gunz_cm.reconstructions.preprocs.points.filter_valid_points(points: ndarray, cm_df: DataFrame, ds_ratio: int = 1) ndarray[source]

Filters valid points based on the provided DataFrame and downsampling ratio. This function is used when the coordinates of the points covers also the empty regions.

  • The function ensures that the ds_ratio is a positive integer.

  • It extracts unique row and column IDs from the DataFrame and filters the points accordingly.

  • If ds_ratio is greater than 1, it performs downsampling by averaging points within the same low-resolution ID.

pointsnp.ndarray

The array of points to be filtered.

cm_dfpd.DataFrame

The DataFrame containing row and column IDs.

ds_ratioint, optional

The downsampling ratio, by default 1. Must be a positive integer.

np.ndarray

The filtered and optionally downsampled points.

Examples

gunz_cm.reconstructions.preprocs.points.mask_points(points: ndarray, cm_df: DataFrame, ds_ratio: int = 1) ndarray[source]

Masks points based on the provided DataFrame and downsampling ratio.

This function processes the input points and masks them based on the unique row and column IDs from the DataFrame. If the downsampling ratio is greater than 1, it further processes the points to downsample them.

pointsnp.ndarray

The array of points to be masked.

cm_dfpd.DataFrame

The DataFrame containing row and column IDs.

ds_ratioint, optional

The downsampling ratio, by default 1. Must be an integer greater than or equal to 1.

np.ndarray

The masked points array.

Examples

gunz_cm.reconstructions.preprocs.points.plot_points(points: ndarray, cm_df: DataFrame | None = None, colorscale: str = 'Viridis', trace_size: int = 5, fig_width: int = 1000, fig_height: int = 1000, fig_title: str = '3D Reconstruction') None[source]

Plots 3D points using Plotly.

This function plots the points in the array P in a 3D scatter plot. If cm_df is provided, it first extracts the relevant points using the extract_points function. The plot is displayed with the specified colorscale, trace size, and dimensions.

pointsnp.ndarray

The array of points to plot.

cm_dft.Optional[pd.DataFrame], optional

The DataFrame containing row and column IDs, by default None.

colorscalestr, optional

The colorscale to use for the plot, by default ‘Viridis’.

trace_sizeint, optional

The size of the markers and lines, by default 5.

fig_widthint, optional

The width of the plot, by default 1000.

fig_heightint, optional

The height of the plot, by default 1000.

None

Examples

Module contents