diplomat.wx_gui.probability_displayer.ProbabilityDisplayer

class diplomat.wx_gui.probability_displayer.ProbabilityDisplayer(*args: Any, **kwargs: Any)[source]

Bases: Control

A custom wx.Control which displays a list of probabilities in the form of a line segment plot. Uses native colors to match other native widgets in the UI.

__init__(parent, data: ndarray = None, bad_locations: ndarray = None, text: str = None, height: int = 50, visible_probs: int = 100, style=wx.BORDER_DEFAULT, name='ProbabilityDisplayer', **kwargs)[source]

Construct a new ProbabilityDisplayer….

Parameters:
  • parent – The parent widget.

  • data – The probability data, a 1D numpy array of number type values.

  • text – The text to display in the top left corner of this probability display, or None to display no text.

  • w_id – wx ID of the window, and integer. Defaults to wx.ID_ANY.

  • height – The minimum height of the probability display. Defaults to 50 pixels.

  • visible_probs – The max number of probabilities to show on screen at once. Defaults to 100.

  • pos – WX Position of control. Defaults to wx.DefaultPosition.

  • size – WX Size of the control. Defaults to wx.DefaultSize.

  • style – WX Control Style. See wx.Control docs for possible options. (Defaults to wx.BORDER_DEFAULT).

  • validator – WX Validator, defaults to

  • name – WX internal name of widget.

Methods

DoGetBestSize()

__init__(parent[, data, bad_locations, ...])

Construct a new ProbabilityDisplayer....

get_bad_locations()

Get the list of indexes specifying poorly annotated locations during the video.

get_data()

Get all the data.

get_data_at(frame)

Get the data at a given index or frame within the probability display.

get_location()

Get the current location of the probability display, or the index to which the arrow is pointing.

get_next_bad_location([location, ...])

Get the next bad location based on the current location in the probability display.

get_prev_bad_location([location, ...])

Get the previous bad location based on the current location in the probability display.

get_prior_modified_user_locations()

get_text()

Get the display text for this probability display.

get_user_modified_locations()

Get the current user modified locations...

on_draw(dc)

For internal use! Executed on drawing update, redraws the probability display.

on_paint(event)

PRIVATE: Triggered on a wx paint event, redraws the probability display...

set_bad_locations(locations)

Set the list of indexes specifying poorly annotated locations during the video.

set_data(data)

Set all of the data.

set_data_at(frame, value)

Set the data at the given frame to the given value.

set_location(location)

Set the current location of the probability display, or the index to which the arrow is pointing.

set_prior_modified_user_locations(value)

set_segment_fix_frames(value)

set_segment_starts(value)

set_text(value)

Set the display text of this probability display.

Attributes

DEF_HEIGHT

MIN_PROB_STEP

TOP_PADDING

TRIANGLE_SIZE

VISIBLE_PROBS

_compute_points(height: int, width: int) DrawingInfo[source]

PRIVATE: Computes the points to be rendered to the screen given the probability data.

Parameters:
  • height – The height of the control.

  • width – The width of the control.

Returns:

An iterable of tuples of (str, int, int, numpy array), which represent: - The center of the widget horizontally. - The current highlighted index or selected index within the point list returned. - A numpy array of shape (N, 2). Representing the X, Y locations of points. These can be directly

drawn to the widget.

get_bad_locations() ndarray[source]

Get the list of indexes specifying poorly annotated locations during the video.

Returns:

A read only view of the numpy array storing indexes of poorly annotated frames.

get_data() ndarray[source]

Get all the data.

Returns:

Numpy array of numbers, the data of this probability display. The returned array is a read only view…

get_data_at(frame: int) float[source]

Get the data at a given index or frame within the probability display.

Parameters:

frame – The index or frame to get the probability data of.

Returns:

A float, being the data at the given frame.

get_location() int[source]

Get the current location of the probability display, or the index to which the arrow is pointing.

Returns:

A integer, being the frame or index of the currently pointed to location.

get_next_bad_location(location: int = None, orig_location=None, moves_done=0) int[source]

Get the next bad location based on the current location in the probability display.

Returns:

An integer, the index of the nearest next bad location.

get_prev_bad_location(location: int = None, orig_location=None, moves_done=0) int[source]

Get the previous bad location based on the current location in the probability display.

Returns:

An integer, the index of the nearest previous bad location.

get_text() str[source]

Get the display text for this probability display.

Returns:

A string, being the display text.

get_user_modified_locations() ndarray[source]

Get the current user modified locations…

on_draw(dc: wx.DC)[source]

For internal use! Executed on drawing update, redraws the probability display. Expects a wx.DC for drawing to.

on_paint(event: wx.PaintEvent)[source]

PRIVATE: Triggered on a wx paint event, redraws the probability display…

set_bad_locations(locations: ndarray)[source]

Set the list of indexes specifying poorly annotated locations during the video.

Parameters:

locations – List of integers, the indexes of poorly annotated locations within the video.

set_data(data: ndarray)[source]

Set all of the data.

Parameters:

data – Numpy array of numbers, will be copied over into the internal data store and displayed on next redraw.

set_data_at(frame: int, value: float)[source]

Set the data at the given frame to the given value.

Parameters:
  • frame – The frame or index to set the data value at.

  • value – A float or number, the value to assign at the data point.

set_location(location: int)[source]

Set the current location of the probability display, or the index to which the arrow is pointing.

Parameters:

location – A integer, being the frame or index to make this probability display center and point to.

set_text(value: str)[source]

Set the display text of this probability display.

Parameters:

value – The string value to set the display text to…