sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def update_port_side(self): """Updates the initial position of the port The port side is ignored but calculated from the port position. Then the port position is limited to the four side lines of the state. """ from rafcon.utils.geometry import point_left_of_line p = (s...
Updates the initial position of the port The port side is ignored but calculated from the port position. Then the port position is limited to the four side lines of the state.
entailment
def _solve(self): """ Calculates the correct position of the port and keeps it aligned with the binding rect """ # As the size of the containing state may has changed we need to update the distance to the border self.update_distance_to_border() px, py = self._point ...
Calculates the correct position of the port and keeps it aligned with the binding rect
entailment
def limit_pos(p, se_pos, nw_pos): """ Limits position p to stay inside containing state :param p: Position to limit :param se_pos: Bottom/Right boundary :param nw_pos: Top/Left boundary :return: """ if p > se_pos: _update(p, se_pos) eli...
Limits position p to stay inside containing state :param p: Position to limit :param se_pos: Bottom/Right boundary :param nw_pos: Top/Left boundary :return:
entailment
def get_adjusted_border_positions(self): """ Calculates the positions to limit the port movement to :return: Adjusted positions nw_x, nw_y, se_x, se_y """ nw_x, nw_y = self._rect[0] se_x, se_y = self._rect[1] nw_x += self._distance_to_border nw_y += self....
Calculates the positions to limit the port movement to :return: Adjusted positions nw_x, nw_y, se_x, se_y
entailment
def set_nearest_border(self): """Snaps the port to the correct side upon state size change """ px, py = self._point nw_x, nw_y, se_x, se_y = self.get_adjusted_border_positions() if self._port.side == SnappedSide.RIGHT: _update(px, se_x) elif self._port.side =...
Snaps the port to the correct side upon state size change
entailment
def remove_obsolete_folders(states, path): """Removes obsolete state machine folders This function removes all folders in the file system folder `path` that do not belong to the states given by `states`. :param list states: the states that should reside in this very folder :param str path: the...
Removes obsolete state machine folders This function removes all folders in the file system folder `path` that do not belong to the states given by `states`. :param list states: the states that should reside in this very folder :param str path: the file system path to be checked for valid folders
entailment
def clean_path_from_deprecated_naming(base_path): """ Checks if the base path includes deprecated characters/format and returns corrected version The state machine folder name should be according the universal RAFCON path format. In case the state machine path is inside a mounted library_root_path also the...
Checks if the base path includes deprecated characters/format and returns corrected version The state machine folder name should be according the universal RAFCON path format. In case the state machine path is inside a mounted library_root_path also the library_path has to have this format. The library path is...
entailment
def clean_path(base_path): """ This function cleans a file system path in terms of removing all not allowed characters of each path element. A path element is an element of a path between the path separator of the operating system. :param base_path: the path to be cleaned :return: the clean pat...
This function cleans a file system path in terms of removing all not allowed characters of each path element. A path element is an element of a path between the path separator of the operating system. :param base_path: the path to be cleaned :return: the clean path
entailment
def save_state_machine_to_path(state_machine, base_path, delete_old_state_machine=False, as_copy=False): """Saves a state machine recursively to the file system The `as_copy` flag determines whether the state machine is saved as copy. If so (`as_copy=True`), some state machine attributes will be left untou...
Saves a state machine recursively to the file system The `as_copy` flag determines whether the state machine is saved as copy. If so (`as_copy=True`), some state machine attributes will be left untouched, such as the `file_system_path` or the `dirty_flag`. :param rafcon.core.state_machine.StateMachine sta...
entailment
def save_script_file_for_state_and_source_path(state, state_path_full, as_copy=False): """Saves the script file for a state to the directory of the state. The script name will be set to the SCRIPT_FILE constant. :param state: The state of which the script file should be saved :param str state_path_ful...
Saves the script file for a state to the directory of the state. The script name will be set to the SCRIPT_FILE constant. :param state: The state of which the script file should be saved :param str state_path_full: The path to the file system storage location of the state :param bool as_copy: Temporar...
entailment
def save_semantic_data_for_state(state, state_path_full): """Saves the semantic data in a separate json file. :param state: The state of which the script file should be saved :param str state_path_full: The path to the file system storage location of the state """ destination_script_file = os.path...
Saves the semantic data in a separate json file. :param state: The state of which the script file should be saved :param str state_path_full: The path to the file system storage location of the state
entailment
def save_state_recursively(state, base_path, parent_path, as_copy=False): """Recursively saves a state to a json file It calls this method on all its substates. :param state: State to be stored :param base_path: Path to the state machine :param parent_path: Path to the parent state :param bool...
Recursively saves a state to a json file It calls this method on all its substates. :param state: State to be stored :param base_path: Path to the state machine :param parent_path: Path to the parent state :param bool as_copy: Temporary storage flag to signal that the given path is not the new fil...
entailment
def load_state_machine_from_path(base_path, state_machine_id=None): """Loads a state machine from the given path :param base_path: An optional base path for the state machine. :return: a tuple of the loaded container state, the version of the state and the creation time :raises ValueError: if the provi...
Loads a state machine from the given path :param base_path: An optional base path for the state machine. :return: a tuple of the loaded container state, the version of the state and the creation time :raises ValueError: if the provided path does not contain a valid state machine
entailment
def load_state_recursively(parent, state_path=None, dirty_states=[]): """Recursively loads the state It calls this method on each sub-state of a container state. :param parent: the root state of the last load call to which the loaded state will be added :param state_path: the path on the filesystem w...
Recursively loads the state It calls this method on each sub-state of a container state. :param parent: the root state of the last load call to which the loaded state will be added :param state_path: the path on the filesystem where to find the meta file for the state :param dirty_states: a dict of s...
entailment
def load_data_file(path_of_file): """ Loads the content of a file by using json.load. :param path_of_file: the path of the file to load :return: the file content as a string :raises exceptions.ValueError: if the file was not found """ if os.path.exists(path_of_file): return storage_util...
Loads the content of a file by using json.load. :param path_of_file: the path of the file to load :return: the file content as a string :raises exceptions.ValueError: if the file was not found
entailment
def limit_text_max_length(text, max_length, separator='_'): """ Limits the length of a string. The returned string will be the first `max_length/2` characters of the input string plus a separator plus the last `max_length/2` characters of the input string. :param text: the text to be limited :p...
Limits the length of a string. The returned string will be the first `max_length/2` characters of the input string plus a separator plus the last `max_length/2` characters of the input string. :param text: the text to be limited :param max_length: the maximum length of the output string :param sepa...
entailment
def clean_path_element(text, max_length=None, separator='_'): """ Replace characters that conflict with a free OS choice when in a file system path. :param text: the string to be cleaned :param max_length: the maximum length of the output string :param separator: the separator used for rafcon.core.stor...
Replace characters that conflict with a free OS choice when in a file system path. :param text: the string to be cleaned :param max_length: the maximum length of the output string :param separator: the separator used for rafcon.core.storage.storage.limit_text_max_length :return:
entailment
def limit_text_to_be_path_element(text, max_length=None, separator='_'): """ Replace characters that are not in the valid character set of RAFCON. :param text: the string to be cleaned :param max_length: the maximum length of the output string :param separator: the separator used for rafcon.core.storag...
Replace characters that are not in the valid character set of RAFCON. :param text: the string to be cleaned :param max_length: the maximum length of the output string :param separator: the separator used for rafcon.core.storage.storage.limit_text_max_length :return:
entailment
def get_storage_id_for_state(state): """ Calculates the storage id of a state. This ID can be used for generating the file path for a state. :param rafcon.core.states.state.State state: state the storage_id should is composed for """ if global_config.get_config_value('STORAGE_PATH_WITH_STATE_NAME'): ...
Calculates the storage id of a state. This ID can be used for generating the file path for a state. :param rafcon.core.states.state.State state: state the storage_id should is composed for
entailment
def pane_position_check(self): """ Update right bar pane position if needed Checks calculates if the cursor is still visible and updates the pane position if it is close to not be seen. In case of an un-docked right-bar this method does nothing. :return: """ text_buffer ...
Update right bar pane position if needed Checks calculates if the cursor is still visible and updates the pane position if it is close to not be seen. In case of an un-docked right-bar this method does nothing. :return:
entailment
def push_call_history_item(self, state, call_type, state_for_scoped_data, input_data=None): """Adds a new call-history-item to the history item list A call history items stores information about the point in time where a method (entry, execute, exit) of certain state was called. :param...
Adds a new call-history-item to the history item list A call history items stores information about the point in time where a method (entry, execute, exit) of certain state was called. :param state: the state that was called :param call_type: the call type of the execution step, ...
entailment
def push_return_history_item(self, state, call_type, state_for_scoped_data, output_data=None): """Adds a new return-history-item to the history item list A return history items stores information about the point in time where a method (entry, execute, exit) of certain state returned. :...
Adds a new return-history-item to the history item list A return history items stores information about the point in time where a method (entry, execute, exit) of certain state returned. :param state: the state that returned :param call_type: the call type of the execution step, ...
entailment
def push_concurrency_history_item(self, state, number_concurrent_threads): """Adds a new concurrency-history-item to the history item list A concurrent history item stores information about the point in time where a certain number of states is launched concurrently (e.g. in a barrier co...
Adds a new concurrency-history-item to the history item list A concurrent history item stores information about the point in time where a certain number of states is launched concurrently (e.g. in a barrier concurrency state). :param state: the state that launches the state group ...
entailment
def update_hash_from_dict(obj_hash, object_): """Updates an existing hash object with another Hashable, list, set, tuple, dict or stringifyable object :param obj_hash: The hash object (see Python hashlib documentation) :param object_: The value that should be added to the hash (can be another H...
Updates an existing hash object with another Hashable, list, set, tuple, dict or stringifyable object :param obj_hash: The hash object (see Python hashlib documentation) :param object_: The value that should be added to the hash (can be another Hashable or a dictionary)
entailment
def mutable_hash(self, obj_hash=None): """Creates a hash with the (im)mutable data fields of the object Example: >>> my_obj = type("MyDerivedClass", (Hashable,), { "update_hash": lambda self, h: h.update("RAFCON") })() >>> my_obj_hash = my_obj.mutable_hash() >>> prin...
Creates a hash with the (im)mutable data fields of the object Example: >>> my_obj = type("MyDerivedClass", (Hashable,), { "update_hash": lambda self, h: h.update("RAFCON") })() >>> my_obj_hash = my_obj.mutable_hash() >>> print('Hash: ' + my_obj_hash.hexdigest()) ...
entailment
def emit(self, record): """Logs a new record If a logging view is given, it is used to log the new record to. The code is partially copied from the StreamHandler class. :param record: :return: """ try: # Shorten the source name of the record ...
Logs a new record If a logging view is given, it is used to log the new record to. The code is partially copied from the StreamHandler class. :param record: :return:
entailment
def get_meta_data_editor(self, for_gaphas=True): """Returns the editor for the specified editor This method should be used instead of accessing the meta data of an editor directly. It return the meta data of the editor available (with priority to the one specified by `for_gaphas`) and converts ...
Returns the editor for the specified editor This method should be used instead of accessing the meta data of an editor directly. It return the meta data of the editor available (with priority to the one specified by `for_gaphas`) and converts it if needed. :param bool for_gaphas: True (default...
entailment
def set_meta_data_editor(self, key, meta_data, from_gaphas=True): """Sets the meta data for a specific key of the desired editor :param str key: The meta data key, separated by dots if it is nested :param meta_data: The value to be set :param bool from_gaphas: If the data comes from a g...
Sets the meta data for a specific key of the desired editor :param str key: The meta data key, separated by dots if it is nested :param meta_data: The value to be set :param bool from_gaphas: If the data comes from a gaphas editor
entailment
def meta_data_hash(self, obj_hash=None): """Creates a hash with the meta data of the model :param obj_hash: The hash object (see Python hashlib) :return: The updated hash object """ if obj_hash is None: obj_hash = hashlib.sha256() self.update_meta_data_hash(o...
Creates a hash with the meta data of the model :param obj_hash: The hash object (see Python hashlib) :return: The updated hash object
entailment
def prepare_destruction(self): """Prepares the model for destruction """ self._Observer__PROP_TO_METHS.clear() self._Observer__METH_TO_PROPS.clear() self._Observer__PAT_TO_METHS.clear() self._Observer__METH_TO_PAT.clear() self._Observer__PAT_METH_TO_KWARGS.clear(...
Prepares the model for destruction
entailment
def limit_value_string_length(value): """This method limits the string representation of the value to MAX_VALUE_LABEL_TEXT_LENGTH + 3 characters. :param value: Value to limit string representation :return: String holding the value with a maximum length of MAX_VALUE_LABEL_TEXT_LENGTH + 3 """ if isin...
This method limits the string representation of the value to MAX_VALUE_LABEL_TEXT_LENGTH + 3 characters. :param value: Value to limit string representation :return: String holding the value with a maximum length of MAX_VALUE_LABEL_TEXT_LENGTH + 3
entailment
def get_col_rgba(color, transparency=None, opacity=None): """This class converts a Gdk.Color into its r, g, b parts and adds an alpha according to needs If both transparency and opacity is None, alpha is set to 1 => opaque :param Gdk.Color color: Color to extract r, g and b from :param float | None t...
This class converts a Gdk.Color into its r, g, b parts and adds an alpha according to needs If both transparency and opacity is None, alpha is set to 1 => opaque :param Gdk.Color color: Color to extract r, g and b from :param float | None transparency: Value between 0 (opaque) and 1 (transparent) or None...
entailment
def get_side_length_of_resize_handle(view, item): """Calculate the side length of a resize handle :param rafcon.gui.mygaphas.view.ExtendedGtkView view: View :param rafcon.gui.mygaphas.items.state.StateView item: StateView :return: side length :rtype: float """ from rafcon.gui.mygaphas.items...
Calculate the side length of a resize handle :param rafcon.gui.mygaphas.view.ExtendedGtkView view: View :param rafcon.gui.mygaphas.items.state.StateView item: StateView :return: side length :rtype: float
entailment
def draw_data_value_rect(cairo_context, color, value_size, name_size, pos, port_side): """This method draws the containing rect for the data port value, depending on the side and size of the label. :param cairo_context: Draw Context :param color: Background color of value part :param value_size: Size (...
This method draws the containing rect for the data port value, depending on the side and size of the label. :param cairo_context: Draw Context :param color: Background color of value part :param value_size: Size (width, height) of label holding the value :param name_size: Size (width, height) of label ...
entailment
def draw_connected_scoped_label(context, color, name_size, handle_pos, port_side, port_side_size, draw_connection_to_port=False): """Draw label of scoped variable This method draws the label of a scoped variable connected to a data port. This is represented by drawing a bigger ...
Draw label of scoped variable This method draws the label of a scoped variable connected to a data port. This is represented by drawing a bigger label where the top part is filled and the bottom part isn't. :param context: Draw Context :param Gdk.Color color: Color to draw the label in (border and bac...
entailment
def draw_port_label(context, port, transparency, fill, label_position, show_additional_value=False, additional_value=None, only_extent_calculations=False): """Draws a normal label indicating the port name. :param context: Draw Context :param port: The PortView :param transparency: T...
Draws a normal label indicating the port name. :param context: Draw Context :param port: The PortView :param transparency: Transparency of the text :param fill: Whether the label should be filled or not :param label_position: Side on which the label should be drawn :param show_additional_value:...
entailment
def draw_label_path(context, width, height, arrow_height, distance_to_port, port_offset): """Draws the path for an upright label :param context: The Cairo context :param float width: Width of the label :param float height: Height of the label :param float distance_to_port: Distance to the port rela...
Draws the path for an upright label :param context: The Cairo context :param float width: Width of the label :param float height: Height of the label :param float distance_to_port: Distance to the port related to the label :param float port_offset: Distance from the port center to its border :p...
entailment
def prepare_destruction(self, recursive=True): """Prepares the model for destruction Recursively un-registers all observers and removes references to child models """ self.destruction_signal.emit() try: self.unregister_observer(self) except KeyError: # Might...
Prepares the model for destruction Recursively un-registers all observers and removes references to child models
entailment
def _load_input_data_port_models(self): """Reloads the input data port models directly from the the state""" if not self.state_copy_initialized: return self.input_data_ports = [] for input_data_port_m in self.state_copy.input_data_ports: new_ip_m = deepcopy(input_...
Reloads the input data port models directly from the the state
entailment
def _load_output_data_port_models(self): """Reloads the output data port models directly from the the state""" if not self.state_copy_initialized: return self.output_data_ports = [] for output_data_port_m in self.state_copy.output_data_ports: new_op_m = deepcopy(o...
Reloads the output data port models directly from the the state
entailment
def _load_income_model(self): """Reloads the income model directly from the state""" if not self.state_copy_initialized: return self.income = None income_m = deepcopy(self.state_copy.income) income_m.parent = self income_m.income = income_m.income self...
Reloads the income model directly from the state
entailment
def _load_outcome_models(self): """Reloads the outcome models directly from the state""" if not self.state_copy_initialized: return self.outcomes = [] for outcome_m in self.state_copy.outcomes: new_oc_m = deepcopy(outcome_m) new_oc_m.parent = self ...
Reloads the outcome models directly from the state
entailment
def show_content(self): """Check if content of library is to be shown Content is shown, if the uppermost state's meta flag "show_content" is True and the library hierarchy depth (up to MAX_VISIBLE_LIBRARY_HIERARCHY level) is not to high. :return: Whether the content is ...
Check if content of library is to be shown Content is shown, if the uppermost state's meta flag "show_content" is True and the library hierarchy depth (up to MAX_VISIBLE_LIBRARY_HIERARCHY level) is not to high. :return: Whether the content is to be shown :rtype: bool
entailment
def prepare_destruction(self): """Prepares the model for destruction Unregisters the model from observing itself. """ if self.core_element is None: logger.verbose("Multiple calls of prepare destruction for {0}".format(self)) self.destruction_signal.emit() try...
Prepares the model for destruction Unregisters the model from observing itself.
entailment
def model_changed(self, model, prop_name, info): """This method notifies the parent state about changes made to the state element """ if self.parent is not None: self.parent.model_changed(model, prop_name, info)
This method notifies the parent state about changes made to the state element
entailment
def meta_changed(self, model, prop_name, info): """This method notifies the parent state about changes made to the meta data """ if self.parent is not None: msg = info.arg # Add information about notification to the signal message notification = Notification(m...
This method notifies the parent state about changes made to the meta data
entailment
def on_config_value_changed(self, config_m, prop_name, info): """Callback when a config value has been changed :param ConfigModel config_m: The config model that has been changed :param str prop_name: Should always be 'config' :param dict info: Information e.g. about the changed config ...
Callback when a config value has been changed :param ConfigModel config_m: The config model that has been changed :param str prop_name: Should always be 'config' :param dict info: Information e.g. about the changed config key
entailment
def disable(self): """ Relieve all state machines that have no active execution and hide the widget """ self.ticker_text_label.hide() if self.current_observed_sm_m: self.stop_sm_m_observation(self.current_observed_sm_m)
Relieve all state machines that have no active execution and hide the widget
entailment
def on_state_execution_status_changed_after(self, model, prop_name, info): """ Show current execution status in the widget This function specifies what happens if the state machine execution status of a state changes :param model: the model of the state that has changed (most likely it...
Show current execution status in the widget This function specifies what happens if the state machine execution status of a state changes :param model: the model of the state that has changed (most likely its execution status) :param prop_name: property name that has been changed ...
entailment
def execution_engine_model_changed(self, model, prop_name, info): """Active observation of state machine and show and hide widget. """ if not self._view_initialized: return active_sm_id = rafcon.gui.singleton.state_machine_manager_model.state_machine_manager.active_state_machine_id ...
Active observation of state machine and show and hide widget.
entailment
def register_observer(self): """ Register all observable which are of interest """ self.execution_engine.add_observer(self, "start", notify_before_function=self.on_start) self.execution_engine.add_observer(self, "pause", notify_before_function=self.on_pause) self.execution_engine...
Register all observable which are of interest
entailment
def register_states_of_state_machine(self, state_machine): """ This functions registers all states of state machine. :param state_machine: the state machine to register all states of :return: """ root = state_machine.root_state root.add_observer(self, "state_execution_sta...
This functions registers all states of state machine. :param state_machine: the state machine to register all states of :return:
entailment
def recursively_register_child_states(self, state): """ A function tha registers recursively all child states of a state :param state: :return: """ self.logger.info("Execution status observer add new state {}".format(state)) if isinstance(state, ContainerState): ...
A function tha registers recursively all child states of a state :param state: :return:
entailment
def on_add_state_machine_after(self, observable, return_value, args): """ This method specifies what happens when a state machine is added to the state machine manager :param observable: the state machine manager :param return_value: the new state machine :param args: :return: ...
This method specifies what happens when a state machine is added to the state machine manager :param observable: the state machine manager :param return_value: the new state machine :param args: :return:
entailment
def on_state_execution_status_changed_after(self, observable, return_value, args): """ This function specifies what happens if the state machine execution status of a state changes :param observable: the state whose execution status changed :param return_value: the new execution status :...
This function specifies what happens if the state machine execution status of a state changes :param observable: the state whose execution status changed :param return_value: the new execution status :param args: a list of all arguments of the observed function :return:
entailment
def _initialize_hierarchy(self): """ This function covers the whole initialization routine before executing a hierarchy state. :return: """ logger.debug("Starting execution of {0}{1}".format(self, " (backwards)" if self.backward_execution else "")) # reset variables self...
This function covers the whole initialization routine before executing a hierarchy state. :return:
entailment
def run(self): """ This defines the sequence of actions that are taken when the hierarchy is executed. A hierarchy state executes all its child states recursively. Principally this code collects all input data for the next child state, executes it, stores its output data and determines the next ...
This defines the sequence of actions that are taken when the hierarchy is executed. A hierarchy state executes all its child states recursively. Principally this code collects all input data for the next child state, executes it, stores its output data and determines the next state based on the ...
entailment
def _handle_backward_execution_before_child_execution(self): """ Sets up all data after receiving a backward execution step from the execution engine :return: a flag to indicate if normal child state execution should abort """ self.backward_execution = True last_history_item = se...
Sets up all data after receiving a backward execution step from the execution engine :return: a flag to indicate if normal child state execution should abort
entailment
def _execute_current_child(self): """ Collect all data for a child state and execute it. :return: """ self.child_state.input_data = self.get_inputs_for_state(self.child_state) self.child_state.output_data = self.create_output_dictionary_for_state(self.child_state) # pro...
Collect all data for a child state and execute it. :return:
entailment
def _handle_backward_execution_after_child_execution(self): """Cleanup the former child state execution and prepare for the next state execution in the backward execution case. :return: a flag to indicate if normal child state execution should abort """ self.child_state.state_exe...
Cleanup the former child state execution and prepare for the next state execution in the backward execution case. :return: a flag to indicate if normal child state execution should abort
entailment
def _handle_forward_execution_after_child_execution(self): """ Cleanup the former child state execution and prepare for the next state execution in the forward execution case. :return: a flag to indicate if normal child state execution should abort """ self.add_state_execution_ou...
Cleanup the former child state execution and prepare for the next state execution in the forward execution case. :return: a flag to indicate if normal child state execution should abort
entailment
def _finalize_hierarchy(self): """ This function finalizes the execution of a hierarchy state. It sets the correct status and manages the output data handling. :return: """ if self.last_child: self.last_child.state_execution_status = StateExecutionStatus.INACTIVE ...
This function finalizes the execution of a hierarchy state. It sets the correct status and manages the output data handling. :return:
entailment
def rotate_and_detach_tab_labels(self): """Rotates tab labels of a given notebook by 90 degrees and makes them detachable. :param notebook: GTK Notebook container, whose tab labels are to be rotated and made detachable """ icons = {'Libraries': constants.SIGN_LIB, 'States Tree': constan...
Rotates tab labels of a given notebook by 90 degrees and makes them detachable. :param notebook: GTK Notebook container, whose tab labels are to be rotated and made detachable
entailment
def bring_tab_to_the_top(self, tab_label): """Find tab with label tab_label in list of notebooks and set it to the current page. :param tab_label: String containing the label of the tab to be focused """ found = False for notebook in self.left_bar_notebooks: for i in...
Find tab with label tab_label in list of notebooks and set it to the current page. :param tab_label: String containing the label of the tab to be focused
entailment
def add_transitions_from_selected_state_to_parent(): """ Generates the default success transition of a state to its parent success port :return: """ task_string = "create transition" sub_task_string = "to parent state" selected_state_m, msg = get_selected_single_state_model_and_check_for_its_p...
Generates the default success transition of a state to its parent success port :return:
entailment
def add_transitions_to_closest_sibling_state_from_selected_state(): """ Generates the outcome transitions from outcomes with positive outcome_id to the closest next state :return: """ task_string = "create transition" sub_task_string = "to closest sibling state" selected_state_m, msg = get_sele...
Generates the outcome transitions from outcomes with positive outcome_id to the closest next state :return:
entailment
def add_coordinates(network): """ Add coordinates to nodes based on provided geom Parameters ---------- network : PyPSA network container Returns ------- Altered PyPSA network container ready for plotting """ for idx, row in network.buses.iterrows(): wkt_geom = to_shape...
Add coordinates to nodes based on provided geom Parameters ---------- network : PyPSA network container Returns ------- Altered PyPSA network container ready for plotting
entailment
def plot_line_loading( network, timesteps=range(1,2), filename=None, boundaries=[], arrows=False): """ Plots line loading as a colored heatmap. Line loading is displayed as relative to nominal capacity in %. Parameters ---------- network : PyPSA netw...
Plots line loading as a colored heatmap. Line loading is displayed as relative to nominal capacity in %. Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis timesteps : range Defines which timesteps are consi...
entailment
def plot_line_loading_diff(networkA, networkB, timestep=0): """ Plot difference in line loading between two networks (with and without switches) as color on lines Positive values mean that line loading with switches is bigger than without Plot switches as small dots Parameters --------...
Plot difference in line loading between two networks (with and without switches) as color on lines Positive values mean that line loading with switches is bigger than without Plot switches as small dots Parameters ---------- networkA : PyPSA network container Holds topology of grid...
entailment
def network_expansion(network, method = 'rel', ext_min=0.1, ext_width=False, filename=None, boundaries=[]): """Plot relative or absolute network extension of AC- and DC-lines. Parameters ---------- network: PyPSA network container Holds topology of grid including resul...
Plot relative or absolute network extension of AC- and DC-lines. Parameters ---------- network: PyPSA network container Holds topology of grid including results from powerflow analysis method: str Choose 'rel' for extension relative to s_nom and 'abs' for absolute extension...
entailment
def network_expansion_diff (networkA, networkB, filename=None, boundaries=[]): """Plot relative network expansion derivation of AC- and DC-lines. Parameters ---------- networkA: PyPSA network container Holds topology of grid including results from powerflow analysis networkB: PyPSA netw...
Plot relative network expansion derivation of AC- and DC-lines. Parameters ---------- networkA: PyPSA network container Holds topology of grid including results from powerflow analysis networkB: PyPSA network container Holds topology of grid including results from powerflow analysis...
entailment
def full_load_hours(network, boundaries=[], filename=None, two_cb=False): """Plot loading of lines in equivalten full load hours. Parameters ---------- network: PyPSA network container Holds topology of grid including results from powerflow analysis filename: str or None Save fi...
Plot loading of lines in equivalten full load hours. Parameters ---------- network: PyPSA network container Holds topology of grid including results from powerflow analysis filename: str or None Save figure in this direction boundaries: array Set boundaries of heatmap axi...
entailment
def plot_q_flows(network): """Plot maximal reactive line load. Parameters ---------- network: PyPSA network container Holds topology of grid including results from powerflow analysis """ cmap_line = plt.cm.jet q_flows_max = abs(network.lines_t.q0.abs().max()/(network.line...
Plot maximal reactive line load. Parameters ---------- network: PyPSA network container Holds topology of grid including results from powerflow analysis
entailment
def max_load(network, boundaries=[], filename=None, two_cb=False): """Plot maximum loading of each line. Parameters ---------- network: PyPSA network container Holds topology of grid including results from powerflow analysis filename: str or None Save figure in this direct...
Plot maximum loading of each line. Parameters ---------- network: PyPSA network container Holds topology of grid including results from powerflow analysis filename: str or None Save figure in this direction boundaries: array Set boundaries of heatmap axis two_cb: boo...
entailment
def load_hours(network, min_load=0.9, max_load=1, boundaries=[0, 8760]): """Plot number of hours with line loading in selected range. Parameters ---------- network: PyPSA network container Holds topology of grid including results from powerflow analysis min_load: float Cho...
Plot number of hours with line loading in selected range. Parameters ---------- network: PyPSA network container Holds topology of grid including results from powerflow analysis min_load: float Choose lower bound of relative load max_load: float Choose upper bound of r...
entailment
def plot_residual_load(network): """ Plots residual load summed of all exisiting buses. Parameters ---------- network : PyPSA network containter """ renewables = network.generators[ network.generators.carrier.isin(['wind_onshore', 'wind_offshore', ...
Plots residual load summed of all exisiting buses. Parameters ---------- network : PyPSA network containter
entailment
def plot_stacked_gen(network, bus=None, resolution='GW', filename=None): """ Plot stacked sum of generation grouped by carrier type Parameters ---------- network : PyPSA network container bus: string Plot all generators at one specific bus. If none, sum is calulated for all bus...
Plot stacked sum of generation grouped by carrier type Parameters ---------- network : PyPSA network container bus: string Plot all generators at one specific bus. If none, sum is calulated for all buses resolution: string Unit for y-axis. Can be either GW/MW/KW Return...
entailment
def plot_gen_diff( networkA, networkB, leave_out_carriers=[ 'geothermal', 'oil', 'other_non_renewable', 'reservoir', 'waste']): """ Plot difference in generation between two networks grouped by carrier type Parameters ---------- networkA : PyPSA ...
Plot difference in generation between two networks grouped by carrier type Parameters ---------- networkA : PyPSA network container with switches networkB : PyPSA network container without switches leave_out_carriers : list of carriers to leave out (default to all small carriers) Returns ...
entailment
def plot_voltage(network, boundaries=[]): """ Plot voltage at buses as hexbin Parameters ---------- network : PyPSA network container boundaries: list of 2 values, setting the lower and upper bound of colorbar Returns ------- Plot """ x = np.array(network.buses['x']) ...
Plot voltage at buses as hexbin Parameters ---------- network : PyPSA network container boundaries: list of 2 values, setting the lower and upper bound of colorbar Returns ------- Plot
entailment
def curtailment(network, carrier='solar', filename=None): """ Plot curtailment of selected carrier Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis carrier: str Plot curtailemt of this carrier filename:...
Plot curtailment of selected carrier Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis carrier: str Plot curtailemt of this carrier filename: str or None Save figure in this direction Returns ...
entailment
def storage_distribution(network, scaling=1, filename=None): """ Plot storage distribution as circles on grid nodes Displays storage size and distribution in network. Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow ana...
Plot storage distribution as circles on grid nodes Displays storage size and distribution in network. Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis filename : str Specify filename If not given, f...
entailment
def storage_expansion(network, basemap=True, scaling=1, filename=None): """ Plot storage distribution as circles on grid nodes Displays storage size and distribution in network. Parameters ---------- network : PyPSA network container Holds topology of grid including results from pow...
Plot storage distribution as circles on grid nodes Displays storage size and distribution in network. Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis filename : str Specify filename If not given, fi...
entailment
def gen_dist_diff( networkA, networkB, techs=None, snapshot=0, n_cols=3, gen_size=0.2, filename=None, buscmap=plt.cm.jet): """ Difference in generation distribution Green/Yellow/Red colors mean that the generation at a location is bigger wi...
Difference in generation distribution Green/Yellow/Red colors mean that the generation at a location is bigger with switches than without Blue colors mean that the generation at a location is smaller with switches than without Parameters ---------- networkA : PyPSA network container ...
entailment
def gen_dist( network, techs=None, snapshot=1, n_cols=3, gen_size=0.2, filename=None): """ Generation distribution Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis tec...
Generation distribution Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis techs : dict type of technologies which shall be plotted snapshot : int snapshot n_cols : int number of columns of the...
entailment
def nodal_gen_dispatch( network, networkB=None, techs=['wind_onshore', 'solar'], item='energy', direction=None, scaling=1, filename=None): """ Plot nodal dispatch or capacity. If networkB is given, difference in dispatch is plotted. Parameters...
Plot nodal dispatch or capacity. If networkB is given, difference in dispatch is plotted. Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis networkB : PyPSA network container If given and item is 'energy', di...
entailment
def nodal_production_balance( network, snapshot='all', scaling=0.00001, filename=None): """ Plots the nodal difference between generation and consumption. Parameters ---------- network : PyPSA network container Holds topology of grid including results ...
Plots the nodal difference between generation and consumption. Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis snapshot : int or 'all' Snapshot to plot. default 'all' scaling : int Scaling t...
entailment
def storage_p_soc(network, mean='1H', filename = None): """ Plots the dispatch and state of charge (SOC) of extendable storages. Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis mean : str Defines over h...
Plots the dispatch and state of charge (SOC) of extendable storages. Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis mean : str Defines over how many snapshots the p and soc values will averaged. filename :...
entailment
def storage_soc_sorted(network, filename = None): """ Plots the soc (state-pf-charge) of extendable storages Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis filename : path to folder """ sbatt = n...
Plots the soc (state-pf-charge) of extendable storages Parameters ---------- network : PyPSA network container Holds topology of grid including results from powerflow analysis filename : path to folder
entailment
def register(self): """ Change the state machine that is observed for new selected states to the selected state machine. :return: """ # logger.debug("StateMachineEditionChangeHistory register state_machine old/new sm_id %s/%s" % # (self.__my_selected_sm_id, s...
Change the state machine that is observed for new selected states to the selected state machine. :return:
entailment
def register_actions(self, shortcut_manager): """Register callback methods for triggered actions :param rafcon.gui.shortcut_manager.ShortcutManager shortcut_manager: """ shortcut_manager.add_callback_for_action("undo", self.undo) shortcut_manager.add_callback_for_action("redo", ...
Register callback methods for triggered actions :param rafcon.gui.shortcut_manager.ShortcutManager shortcut_manager:
entailment
def undo(self, key_value, modifier_mask): """Undo for selected state-machine if no state-source-editor is open and focused in states-editor-controller. :return: True if a undo was performed, False if focus on source-editor. :rtype: bool """ # TODO re-organize as request to contr...
Undo for selected state-machine if no state-source-editor is open and focused in states-editor-controller. :return: True if a undo was performed, False if focus on source-editor. :rtype: bool
entailment
def update(self, model, prop_name, info): """ The method updates the history (a Gtk.TreeStore) which is the model of respective TreeView. It functionality is strongly depends on a consistent history-tree hold by a ChangeHistory-Class. """ # logger.debug("History changed %s\n%s\n%s" % (mo...
The method updates the history (a Gtk.TreeStore) which is the model of respective TreeView. It functionality is strongly depends on a consistent history-tree hold by a ChangeHistory-Class.
entailment
def exception_message(self) -> Union[str, None]: """ On Lavalink V3, if there was an exception during a load or get tracks call this property will be populated with the error message. If there was no error this property will be ``None``. """ if self.has_error: ...
On Lavalink V3, if there was an exception during a load or get tracks call this property will be populated with the error message. If there was no error this property will be ``None``.
entailment
async def load_tracks(self, query) -> LoadResult: """ Executes a loadtracks request. Only works on Lavalink V3. Parameters ---------- query : str Returns ------- LoadResult """ self.__check_node_ready() url = self._uri + quote(str...
Executes a loadtracks request. Only works on Lavalink V3. Parameters ---------- query : str Returns ------- LoadResult
entailment
async def get_tracks(self, query) -> Tuple[Track, ...]: """ Gets tracks from lavalink. Parameters ---------- query : str Returns ------- Tuple[Track, ...] """ if not self._warned: log.warn("get_tracks() is now deprecated. Plea...
Gets tracks from lavalink. Parameters ---------- query : str Returns ------- Tuple[Track, ...]
entailment
def get_data_files_tuple(*rel_path, **kwargs): """Return a tuple which can be used for setup.py's data_files :param tuple path: List of path elements pointing to a file or a directory of files :param dict kwargs: Set path_to_file to True is `path` points to a file :return: tuple of install directory an...
Return a tuple which can be used for setup.py's data_files :param tuple path: List of path elements pointing to a file or a directory of files :param dict kwargs: Set path_to_file to True is `path` points to a file :return: tuple of install directory and list of source files :rtype: tuple(str, [str])
entailment
def get_data_files_recursively(*rel_root_path, **kwargs): """ Adds all files of the specified path to a data_files compatible list :param tuple rel_root_path: List of path elements pointing to a directory of files :return: list of tuples of install directory and list of source files :rtype: list(tuple(...
Adds all files of the specified path to a data_files compatible list :param tuple rel_root_path: List of path elements pointing to a directory of files :return: list of tuples of install directory and list of source files :rtype: list(tuple(str, [str]))
entailment
def generate_data_files(): """ Generate the data_files list used in the setup function :return: list of tuples of install directory and list of source files :rtype: list(tuple(str, [str])) """ assets_folder = path.join('source', 'rafcon', 'gui', 'assets') share_folder = path.join(assets_folder,...
Generate the data_files list used in the setup function :return: list of tuples of install directory and list of source files :rtype: list(tuple(str, [str]))
entailment
def extendable(network, args, line_max): """ Function that sets selected components extendable 'network' for all lines, links and transformers 'german_network' for all lines, links and transformers located in Germany 'foreign_network' for all foreign lines, links and transformers 'transformers...
Function that sets selected components extendable 'network' for all lines, links and transformers 'german_network' for all lines, links and transformers located in Germany 'foreign_network' for all foreign lines, links and transformers 'transformers' for all transformers 'storages' for extendable s...
entailment
def extension_preselection(network, args, method, days = 3): """ Function that preselects lines which are extendend in snapshots leading to overloading to reduce nubmer of extension variables. Parameters ---------- network : :class:`pypsa.Network Overall container of PyPSA ...
Function that preselects lines which are extendend in snapshots leading to overloading to reduce nubmer of extension variables. Parameters ---------- network : :class:`pypsa.Network Overall container of PyPSA args : dict Arguments set in appl.py method: str Choose...
entailment