pykanto.app.main
pykanto.app.main#
Source code for pykanto’s interactive labelling app.
Functions
|
Builds the legend for the main interactive plot. |
|
Maps a list of markers to labels. |
Parses a boolean. |
|
|
Prepares the legend for the scatterplot. |
|
Sets the range of the scatterplot. |
|
Updates the feedback text for the user. |
- pykanto.app.main.get_markers(marker_types: List[str], mapping: numpy.ndarray) List[str] [source]#
Maps a list of markers to labels.
- Parameters
marker_types (List[str]) – List of marker types.
mapping (np.ndarray) – List of labels.
- Returns
List of markers.
- Return type
List[str]
- pykanto.app.main.prepare_legend(source: bokeh.models.sources.ColumnDataSource, palette: List[str], labs: List[str], grouping_labels: str = 'auto_class') tuple[List[str], list[str], bokeh.core.property.dataspec.field] [source]#
Prepares the legend for the scatterplot.
- Parameters
source (ColumnDataSource) – Data source for the scatterplot.
palette (List[str]) – Colour palette for the scatterplot.
labs (List[str]) – List of labels.
grouping_labels (str, optional) – Column name for the labels. Defaults to
"auto_class". –
- Returns
Tuple of the colour palette, marker types and the colour field.
- Return type
tuple[List[str], list[str], field]
- pykanto.app.main.build_legend(source, html_markers, span_mk_sizes, mk_colours)[source]#
Builds the legend for the main interactive plot.
- Parameters
source (ColumnDataSource) – Data source for the scatterplot.
html_markers (dict) – Dictionary of HTML markers.
span_mk_sizes (dict) – Dictionary of marker sizes.
mk_colours (dict) – Dictionary of marker colours.
- Returns
HTML for the legend.
- Return type
str
- pykanto.app.main.update_feedback_text(indv_list, remaining_indvs)[source]#
Updates the feedback text for the user.
- Parameters
indv_list (list) – List of individuals.
remaining_indvs (list) – List of remaining individuals.
- Returns
Feedback text.
- Return type
str
- pykanto.app.main.parse_boolean(b)[source]#
Parses a boolean.
- Parameters
b (str) – String to parse.
- Returns
Boolean.
- Return type
bool
- pykanto.app.main.set_range(sdata, ax_percentage=5)[source]#
Sets the range of the scatterplot.
- Parameters
sdata (pd.DataFrame) – Dataframe with the scatterplot data.
ax_percentage (int, optional) – Percentage of the axis to extend. Defaults to 5.
- Returns
Tuple of the x and y ranges.
- Return type
tuple