From 24cf1a5ad19bd9f4e04770619d752c59d986129e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Wed, 27 Sep 2023 16:28:24 +0200 Subject: [PATCH] Remove code no longer needed --- holonote/annotate/annotator.py | 53 ---------------------------------- holonote/annotate/table.py | 13 --------- 2 files changed, 66 deletions(-) diff --git a/holonote/annotate/annotator.py b/holonote/annotate/annotator.py index 45e72ed..34c43dd 100644 --- a/holonote/annotate/annotator.py +++ b/holonote/annotate/annotator.py @@ -680,22 +680,6 @@ def overlay(self, layers.append(self.region_editor().opts(*region_style)) return hv.Overlay(layers).collate() - # def _point_indicators(self, filtered_df, dimensionality, invert_axes=False): - # if dimensionality == '1d': - # return Indicator.points_1d(filtered_df, None, invert_axes=invert_axes) - # else: - # return Indicator.points_2d(filtered_df, None, invert_axes=invert_axes) - - # def _range_indicators(self, filtered_df, dimensionality, invert_axes=False): - # # fields_mask = self.annotator.annotation_table._field_df.index.isin(filtered_df['_id']) - # # field_df = self.annotator.annotation_table._field_df[fields_mask] # Currently assuming 1-to-1 - # if dimensionality == '1d': - # vectorized = Indicator.ranges_1d(filtered_df, self.annotator.annotation_table._field_df, invert_axes=invert_axes) - # else: - # vectorized = Indicator.ranges_2d(filtered_df, self.annotator.annotation_table._field_df, invert_axes=invert_axes) - # return vectorized.opts(tools=[self._build_hover_tool()]) - - @property def static_indicators(self): data = self.annotator.get_dataframe(self.kdims) @@ -719,43 +703,6 @@ def static_indicators(self): return indicator - # if len(self.kdims) == 1: - # dim_mask = self.annotator.annotation_table._mask1D(self.kdims) - # points_df = self.annotator.annotation_table._filter(dim_mask, "point") - # ranges_df = self.annotator.annotation_table._filter(dim_mask, "range") - # if len(points_df) == 0: - # return self._range_indicators(ranges_df, '1d', invert_axes=invert_axes) - # elif len(ranges_df) == 0: - # return self._point_indicators(points_df, '1d', invert_axes=invert_axes) - # else: - # raise NotImplementedError # FIXME: Both in overlay - - # if len(self.kdims) > 1: - - # # FIXME: SHH, Converting new region_df format into old format - # df_dim = self.annotator.annotation_table._collapse_region_df(columns=self.kdims) - # if df_dim.empty: - # ranges_df = pd.DataFrame({"_id": [], "value": []}) - # else: - # order = [ - # f"start[{self.kdims[0]}]", - # f"end[{self.kdims[0]}]", - # f"start[{self.kdims[1]}]", - # f"end[{self.kdims[1]}]" - # ] - # df2 = df_dim.dropna(axis=0) - # value = tuple(df2[order].values) - - # # Convert to accepted format for further processing - # ranges_df = pd.DataFrame({"_id": df2.index, "value": value}) - # points_df = [] # self.annotator.annotation_table._filter(dim_mask, "Point") - # if len(points_df) == 0: - # return self._range_indicators(ranges_df, '2d', invert_axes=invert_axes) - # elif len(ranges_df) == 0: - # return self._point_indicators(points_df, '2d', invert_axes=invert_axes) - # else: - # raise NotImplementedError # FIXME: Both in overlay - def selected_dim_expr(self, selected_value, non_selected_value): self._selected_values.append(selected_value) self._selected_options.append({i:selected_value for i in self.annotator.selected_indices}) diff --git a/holonote/annotate/table.py b/holonote/annotate/table.py index b78b245..fb49334 100644 --- a/holonote/annotate/table.py +++ b/holonote/annotate/table.py @@ -389,19 +389,6 @@ def get_dataframe(self, kdims: list[str] | None=None, spec: SpecDict | None=None df = df.reindex(field_df.index) return df - # def _filter(self, dim_mask, region_type): - # region_mask = self._region_df["region"] == region_type - # return self._region_df[region_mask & dim_mask] - - # def _mask1D(self, kdims): - # return self._region_df["dim"] == str(kdims[0]) - - # def _mask2D(self, kdims): - # dim1_name, dim2_name = str(kdims[0]), str(kdims[1]) - # return np.logical_and( - # self._region_df["dim1"] == dim1_name, self._region_df["dim2"] == dim2_name - # ) - def load_annotation_table(self, conn: Connector, fields: list[str], spec: SpecDict) -> None: """Load the AnnotationTable region and field DataFrame from a connector.