fiftyone.operators.operations¶
FiftyOne operator execution.
Classes:
|
Interface to trigger builtin operations on an execution context. |
-
class
fiftyone.operators.operations.
Operations
(ctx)¶ Bases:
object
Interface to trigger builtin operations on an execution context.
- Parameters
Methods:
Clone the selected samples in the App.
clone_sample_field
(field_name, new_field_name)Clone a sample field to a new field name.
rename_sample_field
(field_name, new_field_name)Rename a sample field to a new field name.
clear_sample_field
(field_name)Clear the contents of a sample field.
Delete the selected samples in the App.
Delete the selected labels in the App.
delete_sample_field
(field_name)Delete a sample field.
print_stdout
(message)Print a message to the standard output.
list_files
([path, list_filesystems])List files in a directory or list filesystems.
Reload the sample grid in the App.
Reload the dataset in the App.
Clear selected samples in the App.
Copy the current view in the App as JSON.
Set the view in the App from JSON present in clipboard.
clear_panel_state
([panel_id])Clear the state of the specified panel in the App.
clear_panel_data
([panel_id])Clear the data of the specified panel in the App.
set_panel_state
(state[, panel_id])Set the entire state of the specified panel in the App.
set_panel_data
(data[, panel_id])Set the entire data of the specified panel in the App.
patch_panel_state
(state[, panel_id])Patch the state of the specified panel in the App.
patch_panel_data
(data[, panel_id])Patch the state of the specified panel in the App.
reduce_panel_state
(reducer[, panel_id])Reduce the state of the specified panel in the App.
apply_panel_state_path
(path[, panel_id])Force update the state for path in the specified panel in the App.
show_panel_output
(output[, panel_id])Show output in the specified panel in the App.
open_panel
(name[, is_active, layout, force, …])Open a panel with the given name and layout options in the App.
register_panel
(name, label[, help_markdown, …])Registers a panel with the given name and lifecycle callbacks.
Open all available panels in the App.
close_panel
([name, id])Close the given panel in the App.
Close all open panels in the App.
split_panel
(name, layout)Split the panel with the given layout in the App.
open_dataset
(dataset_name)Open the specified dataset in the App.
Clear the view bar in the App.
Clear all filters in the App’s sidebar.
Clear all selections, filters, and view stages from the App.
Refresh the colors used in the App’s UI.
Show the samples that are currently selected in the App.
Convert the extended selection to selected samples in the App.
set_selected_samples
(samples)Select the specified samples in the App.
set_view
([view, name])Set the current view in the App.
show_samples
(samples[, use_extended_selection])Show specific samples, optionally using extended selection in the App.
console_log
(message)Log a message to the console.
show_output
(outputs, results)Show output in the App’s UI.
set_progress
([label, progress, variant])Set the progress indicator in the App’s UI.
test_operator
(operator, raw_params)Test the operator with given parameters.
set_selected_labels
(labels)Set the selected labels in the App.
Clear the selected labels in the App.
notify
(message[, variant])Show a notification in the App.
set_extended_selection
([selection, scope, …])Sets the extended selection in the App.
set_spaces
([spaces, name])Sets the current spaces in the App.
set_active_fields
([fields])Set the active fields in the App.
track_event
(event[, properties])Track an event in the App.
set_panel_title
([id, title])Set the title of the specified panel in the App.
set_group_slice
(slice)Set the active group slice in the App.
-
clone_selected_samples
()¶ Clone the selected samples in the App.
-
clone_sample_field
(field_name, new_field_name)¶ Clone a sample field to a new field name.
- Parameters
field_name – the name of the field to clone
new_field_name – the name for the new field
-
rename_sample_field
(field_name, new_field_name)¶ Rename a sample field to a new field name.
- Parameters
field_name – the name of the field to rename
new_field_name – the new name for the field
-
clear_sample_field
(field_name)¶ Clear the contents of a sample field.
- Parameters
field_name – the name of the field to clear
-
delete_selected_samples
()¶ Delete the selected samples in the App.
-
delete_selected_labels
()¶ Delete the selected labels in the App.
-
delete_sample_field
(field_name)¶ Delete a sample field.
- Parameters
field_name – the name of the field to delete
-
print_stdout
(message)¶ Print a message to the standard output.
- Parameters
message – the message to print
-
list_files
(path=None, list_filesystems=False)¶ List files in a directory or list filesystems.
- Parameters
path (None) – the path to list files from, or None to list filesystems
list_filesystems (False) – whether to list filesystems instead of files
-
reload_samples
()¶ Reload the sample grid in the App.
-
reload_dataset
()¶ Reload the dataset in the App.
-
clear_selected_samples
()¶ Clear selected samples in the App.
-
copy_view_as_json
()¶ Copy the current view in the App as JSON.
-
view_from_json
()¶ Set the view in the App from JSON present in clipboard.
-
clear_panel_state
(panel_id=None)¶ Clear the state of the specified panel in the App.
- Parameters
panel_id (None) – the optional ID of the panel to clear. If not provided, the
ctx.panel_id
will be used
-
clear_panel_data
(panel_id=None)¶ Clear the data of the specified panel in the App.
- Parameters
panel_id (None) – the optional ID of the panel to clear. If not provided, the
ctx.panel_id
will be used
-
set_panel_state
(state, panel_id=None)¶ Set the entire state of the specified panel in the App.
- Parameters
state – the state to set
panel_id (None) – the optional ID of the panel to clear. If not provided, the
ctx.panel_id
will be used
-
set_panel_data
(data, panel_id=None)¶ Set the entire data of the specified panel in the App.
- Parameters
data – the data to set
panel_id (None) – the optional ID of the panel to clear. If not provided, the
ctx.panel_id
will be used
-
patch_panel_state
(state, panel_id=None)¶ Patch the state of the specified panel in the App.
- Parameters
state – the state to set
panel_id (None) – the optional ID of the panel to clear. If not provided, the
ctx.panel_id
will be used
-
patch_panel_data
(data, panel_id=None)¶ Patch the state of the specified panel in the App.
- Parameters
data – the data to set
panel_id (None) – the optional ID of the panel to clear. If not provided, the
ctx.panel_id
will be used
-
reduce_panel_state
(reducer, panel_id=None)¶ Reduce the state of the specified panel in the App.
- Parameters
reducer – the reducer to apply
panel_id (None) – the optional ID of the panel to clear. If not provided, the
ctx.panel_id
will be used
-
apply_panel_state_path
(path, panel_id=None)¶ Force update the state for path in the specified panel in the App.
- Parameters
path (str) – the path to force update
-
show_panel_output
(output, panel_id=None)¶ Show output in the specified panel in the App.
- Parameters
output – the output to show
panel_id (None) – the optional ID of the panel to clear. If not provided, the
ctx.panel_id
will be used
-
open_panel
(name, is_active=True, layout=None, force=False, force_duplicate=False)¶ Open a panel with the given name and layout options in the App.
- Parameters
name – the name of the panel to open
is_active (True) – whether to activate the panel immediately
layout (None) – the layout orientation
("horizontal", "vertical")
, if applicableforce (False) – whether to force open the panel. Skips the check to see if a panel with the same name exists or whether the panel declares
allow_multiple=False
force_duplicate (False) – whether to force open the panel even if it is already open. Only applicable if force is
True
-
register_panel
(name, label, help_markdown=None, icon=None, light_icon=None, dark_icon=None, surfaces='grid', reload_on_navigation=False, on_load=None, on_unload=None, on_change=None, on_change_ctx=None, on_change_view=None, on_change_dataset=None, on_change_current_sample=None, on_change_selected=None, on_change_selected_labels=None, on_change_extended_selection=None, on_change_group_slice=None, allow_duplicates=False)¶ Registers a panel with the given name and lifecycle callbacks.
- Parameters
name – the name of the panel
help_markdown (None) – help text associated with the panel in markdown format
label – the display name of the panel
icon (None) – the icon to show in the panel’s tab
light_icon (None) – the icon to show in the panel’s tab when the App is in light mode
dark_icon (None) – the icon to show in the panel’s tab when the App is in dark mode
surfaces ('grid') – surfaces in which to show the panel. Must be one of ‘grid’, ‘modal’, or ‘grid modal’
reload_on_navigation (False) – whether to reload the panel when the user navigates to a new page. This is only applicable to panels that are not shown in a modal
on_load (None) – an operator to invoke when the panel is loaded
on_unload (None) – an operator to invoke when the panel is unloaded
on_change (None) – an operator to invoke when the panel state changes
on_change_ctx (None) – an operator to invoke when the panel execution context changes
on_change_view (None) – an operator to invoke when the current view changes
on_change_dataset (None) – an operator to invoke when the current dataset changes
on_change_current_sample (None) – an operator to invoke when the current sample changes
on_change_selected (None) – an operator to invoke when the current selected samples changes
on_change_selected_labels (None) – an operator to invoke when the current selected labels changes
on_change_extended_selection (None) – an operator to invoke when the current extended selection changes
on_change_group_slice (None) – an operator to invoke when the group slice changes
allow_duplicates (False) – whether to allow multiple instances of the panel to the opened
-
open_all_panels
()¶ Open all available panels in the App.
-
close_panel
(name=None, id=None)¶ Close the given panel in the App.
- Parameters
name (None) – the name of the panel to close
id (None) – the ID of the panel to close
-
close_all_panels
()¶ Close all open panels in the App.
-
split_panel
(name, layout)¶ Split the panel with the given layout in the App.
- Parameters
name – the name of the panel to split
layout – the layout orientation
("horizontal", "vertical")
-
open_dataset
(dataset_name)¶ Open the specified dataset in the App.
- Parameters
dataset_name – the name of the dataset to open
-
clear_view
()¶ Clear the view bar in the App.
Clear all filters in the App’s sidebar.
-
clear_all_stages
()¶ Clear all selections, filters, and view stages from the App.
-
refresh_colors
()¶ Refresh the colors used in the App’s UI.
-
show_selected_samples
()¶ Show the samples that are currently selected in the App.
-
convert_extended_selection_to_selected_samples
()¶ Convert the extended selection to selected samples in the App.
-
set_selected_samples
(samples)¶ Select the specified samples in the App.
- Parameters
samples – a list of sample IDs to select
-
set_view
(view=None, name=None)¶ Set the current view in the App.
- Parameters
view (None) – a
fiftyone.core.view.DatasetView
to loadname (None) – the name of a saved view to load
-
show_samples
(samples, use_extended_selection=False)¶ Show specific samples, optionally using extended selection in the App.
- Parameters
samples – a list of sample IDs to show
use_extended_selection (False) – whether to use the extended selection feature
-
console_log
(message)¶ Log a message to the console.
- Parameters
message – the message to log
-
show_output
(outputs, results)¶ Show output in the App’s UI.
- Parameters
outputs – outputs to show
results – results to display
-
set_progress
(label=None, progress=None, variant=None)¶ Set the progress indicator in the App’s UI.
- Parameters
label (None) – a label for the progress indicator
progress (None) – a progress value to set
variant (None) – the type of indicator
("linear", "circular")
-
test_operator
(operator, raw_params)¶ Test the operator with given parameters.
- Parameters
operator – the operator to test
raw_params – raw parameters for the operator
-
set_selected_labels
(labels)¶ Set the selected labels in the App.
- Parameters
labels – the labels to select
-
clear_selected_labels
()¶ Clear the selected labels in the App.
-
notify
(message, variant='info')¶ Show a notification in the App.
Variants are “info”, “success”, “warning”, and “error”.
- Parameters
message – the message to show
variant ("info") – the type of notification
-
set_extended_selection
(selection=None, scope=None, clear=False, reset=False)¶ Sets the extended selection in the App.
- Parameters
selection (None) – the selection to set
scope (None) – the scope of the selection
clear (None) – whether to clear the selection
reset (None) – whether to reset the selection
-
set_spaces
(spaces=None, name=None)¶ Sets the current spaces in the App.
- Parameters
spaces (None) – a
fiftyone.core.odm.workspace.Space
to loadname (None) – the name of the workspace to load
-
set_active_fields
(fields=None)¶ Set the active fields in the App.
- Parameters
fields (None) – the possibly-empty list of fields or
embedded.fields
to set
-
track_event
(event, properties=None)¶ Track an event in the App.
- Parameters
event – the event to track
properties (None) – the properties to track
-
set_panel_title
(id=None, title=None)¶ Set the title of the specified panel in the App.
- Parameters
id (None) – the ID of the panel to set the title
title (None) – the title to set
-
set_group_slice
(slice)¶ Set the active group slice in the App.
- Parameters
slice – the group slice to activate