MCPcopy Create free account

hub / github.com/PowerGridModel/power-grid-model-ds / functions

Functions625 in github.com/PowerGridModel/power-grid-model-ds

↓ 96 callersMethodzeros
Construct an array filled with zeros. If 'empty_id' is True, the 'id' column will be filled with EMPTY_ID values.
src/power_grid_model_ds/_core/model/arrays/base/array.py:194
↓ 87 callersMethodappend
Append an array to the grid. Both 'grid arrays' and 'grid.graphs' will be updated. Args: array (FancyArray): The array to append.
src/power_grid_model_ds/_core/model/grids/base.py:195
↓ 53 callersMethodempty
Create an empty grid Args: graph_model (type[BaseGraphModel], optional): The graph model to use. Defaults to RustworkxGraphModel.
src/power_grid_model_ds/_core/model/grids/base.py:182
↓ 43 callersMethodget
( self: Self, *args: int | Iterable[int] | np.ndarray, mode_: Literal["AND", "OR"] = "
src/power_grid_model_ds/_core/model/arrays/base/array.py:275
↓ 36 callersMethodadd_branch
Add a branch to the grid Args: branch (BranchArray): The branch to add
src/power_grid_model_ds/_core/model/grids/base.py:207
↓ 35 callersMethodadd_node
Add a new node to the grid Args: node (NodeArray): The node to add
src/power_grid_model_ds/_core/model/grids/base.py:239
↓ 35 callersMethodhas_branch
Check if a branch exists between two nodes.
src/power_grid_model_ds/_core/model/graphs/models/base.py:125
↓ 30 callersMethodfilter
( self: Self, *args: int | Iterable[int] | np.ndarray, mode_: Literal["AND", "OR"] = "
src/power_grid_model_ds/_core/model/arrays/base/array.py:259
↓ 26 callersFunctiondo_performance_test
Generalized performance test runner.
tests/performance/_helpers.py:11
↓ 21 callersMethodall_arrays
Returns all arrays in the container.
src/power_grid_model_ds/_core/model/containers/base.py:43
↓ 21 callersMethodexternal_to_internal
Convert external node id to internal node id (internal) Raises: MissingNodeError: if the external node id does not exist in the g
src/power_grid_model_ds/_core/model/graphs/models/base.py:50
↓ 17 callersMethodexclude
( self: Self, *args: int | Iterable[int] | np.ndarray, mode_: Literal["AND", "OR"] = "
src/power_grid_model_ds/_core/model/arrays/base/array.py:267
↓ 13 callersMethodcalculate_power_flow
Initialize the PowerGridModel and calculate power flow over input data. If input data is not available, self.create_input_from_grid() will be
src/power_grid_model_ds/_core/load_flow.py:86
↓ 12 callersMethodfrom_txt
Build a grid from a list of strings See the documentation for the expected format of the txt_lines Args: *args (str): Th
src/power_grid_model_ds/_core/model/grids/base.py:412
↓ 10 callersMethoddelete_node
Remove a node from the grid Args: node (NodeArray): The node to remove
src/power_grid_model_ds/_core/model/grids/base.py:249
↓ 10 callersMethodexclude_mask
( self: Self, *args: int | Iterable[int] | np.ndarray, mode_: Literal["AND", "OR"] = "
src/power_grid_model_ds/_core/model/arrays/base/array.py:291
↓ 10 callersMethodfilter_mask
( self: Self, *args: int | Iterable[int] | np.ndarray, mode_: Literal["AND", "OR"] = "
src/power_grid_model_ds/_core/model/arrays/base/array.py:283
↓ 10 callersMethodupdate_by_id
(self: Self, ids: ArrayLike, allow_missing: bool = False, **kwargs)
src/power_grid_model_ds/_core/model/arrays/base/array.py:302
↓ 9 callersMethodcheck_ids
(self: Self, return_duplicates: bool = False)
src/power_grid_model_ds/_core/model/arrays/base/array.py:315
↓ 9 callersMethodcreate_input_from_grid
Create input for the PowerGridModel
src/power_grid_model_ds/_core/load_flow.py:57
↓ 8 callersMethodcache
Cache Grid to a folder Args: cache_dir (Path): The directory to save the cache to. cache_name (str): The name of the
src/power_grid_model_ds/_core/model/grids/base.py:362
↓ 8 callersMethoddelete_branch
Remove a branch from the grid Args: branch (BranchArray): The branch to remove
src/power_grid_model_ds/_core/model/grids/base.py:218
↓ 8 callersMethodget_connected
Find all nodes connected to the node_id Args: node_id: node id to start the search from inclusive: whether to include
src/power_grid_model_ds/_core/model/graphs/models/base.py:275
↓ 8 callersMethodget_dtype
(cls)
src/power_grid_model_ds/_core/model/arrays/base/array.py:79
↓ 8 callersMethodget_typed_branches
Find a matching LineArray, LinkArray or TransformerArray for the given branch_ids Raises: ValueError: - If no bra
src/power_grid_model_ds/_core/model/grids/base.py:143
↓ 8 callersFunctionis_sequence
Returns True for lists, tuples, sets, arrays Return False for strings, dicts
src/power_grid_model_ds/_core/utils/misc.py:13
↓ 7 callersMethodget_shortest_path
Calculate the shortest path between two nodes Example: given this graph: [1] - [2] - [3] - [4] >>> graph.get_shortes
src/power_grid_model_ds/_core/model/graphs/models/base.py:215
↓ 7 callersMethodrun
Run the generator to create a random radial grid. if a seed is provided, this will be used to set rng.
src/power_grid_model_ds/_core/data_source/generator/grid_generators.py:41
↓ 6 callersMethod_has_node
(self, node_id)
src/power_grid_model_ds/_core/model/graphs/models/base.py:386
↓ 6 callersFunctionbuild_basic_grid
Build a basic grid
tests/fixtures/grids.py:24
↓ 6 callersFunctionempty
Returns the empty value for the given dtype.
src/power_grid_model_ds/_core/model/constants.py:10
↓ 6 callersMethodfrom_arrays
Build from arrays
src/power_grid_model_ds/_core/model/graphs/container.py:144
↓ 6 callersMethodfrom_cache
Read from cache and build .graphs from arrays Args: cache_path (Path): The path to the cache load_graphs (bool, optio
src/power_grid_model_ds/_core/model/grids/base.py:387
↓ 6 callersMethodinternal_to_external
Convert internal id (internal) to external node id
src/power_grid_model_ds/_core/model/graphs/models/base.py:58
↓ 6 callersMethodrun
Generate nodes in a grid with two possible load scenarios
src/power_grid_model_ds/_core/data_source/generator/arrays/node.py:16
↓ 6 callersMethodset_feeder_ids
Sets feeder and substation id properties in the grids arrays
src/power_grid_model_ds/_core/model/grids/base.py:438
↓ 5 callersMethod_internals_to_externals
Convert a list of internal nodes to external nodes
src/power_grid_model_ds/_core/model/graphs/models/base.py:359
↓ 5 callersMethodfind_array_field
Find the Field that holds an array of type array_type. Args: array_type(type[FancyArray]): FancyArray subclass. Raises:
src/power_grid_model_ds/_core/model/containers/base.py:52
↓ 5 callersMethodhas_node
Check if a node exists.
src/power_grid_model_ds/_core/model/graphs/models/base.py:69
↓ 5 callersMethodtmp_remove_nodes
Context manager that temporarily removes nodes and their branches from the graph. Example: >>> with graph.tmp_remove_nodes([1, 2,
src/power_grid_model_ds/_core/model/graphs/models/base.py:194
↓ 4 callersMethod_append
(self, array: FancyArray)
src/power_grid_model_ds/_core/model/graphs/container.py:164
↓ 4 callersMethod_externals_to_internals
Convert a list of external nodes to internal nodes
src/power_grid_model_ds/_core/model/graphs/models/base.py:363
↓ 4 callersMethoddetermine_number_of_routes
Decide on a number of routes based on expected route-size
src/power_grid_model_ds/_core/data_source/generator/arrays/line.py:70
↓ 4 callersMethodfind_first_connected
Find the first connected node to the node_id from the candidate_node_ids Note: If multiple candidate nodes are connected to the n
src/power_grid_model_ds/_core/model/graphs/models/base.py:300
↓ 4 callersMethodget_branches_in_path
Returns all branches within a path of nodes Args: nodes_in_path (list[int]): The nodes in the path Returns:
src/power_grid_model_ds/_core/model/grids/base.py:301
↓ 4 callersMethodget_components
Returns all separate components when the substation_nodes are removed of the graph as lists
src/power_grid_model_ds/_core/model/graphs/models/base.py:256
↓ 4 callersFunctionget_filter_mask
Returns a mask that matches the input parameters.
src/power_grid_model_ds/_core/model/arrays/base/_filters.py:14
↓ 4 callersFunctionget_pickle_path
Returns the path to the pickle file. If ony a .gz-file is available, the .gz-file is unpacked.
src/power_grid_model_ds/_core/utils/pickle.py:26
↓ 4 callersMethodis_empty
Check if a column is filled with 'empty' values.
src/power_grid_model_ds/_core/model/arrays/base/array.py:227
↓ 4 callersMethodmake_inactive
Make a branch inactive. This is done by setting from or to status to 0. Args: branch (BranchArray): The branch to make inactive
src/power_grid_model_ds/_core/model/grids/base.py:283
↓ 4 callersFunctionparse_branch_array
Parse the branch array.
src/power_grid_model_ds/_core/visualizer/parsers.py:38
↓ 4 callersMethodreverse_branches
Reverse the direction of the branches.
src/power_grid_model_ds/_core/model/grids/base.py:161
↓ 4 callersMethodset_empty
Set a column to its 'empty' value.
src/power_grid_model_ds/_core/model/arrays/base/array.py:238
↓ 3 callersFunction_rows_to_strings
(rows: "FancyArray", column_widths: list[tuple[str, int]])
src/power_grid_model_ds/_core/model/arrays/base/_string.py:49
↓ 3 callersMethodadd_branch_array
Add a branch to all graphs
src/power_grid_model_ds/_core/model/graphs/container.py:75
↓ 3 callersMethodadd_node_array
Add a node to all graphs
src/power_grid_model_ds/_core/model/graphs/container.py:60
↓ 3 callersMethodas_table
(self: Self, column_width: int | str = "auto", rows: int = 10)
src/power_grid_model_ds/_core/model/arrays/base/array.py:318
↓ 3 callersMethodcopy
Return a copy of this array including its data
src/power_grid_model_ds/_core/model/arrays/base/array.py:189
↓ 3 callersMethodcreate_grid_from_input_data
Create Grid object from PowerGridModel input. Note that for some arrays, not all fields are available in the PowerGridModel input.
src/power_grid_model_ds/_core/load_flow.py:66
↓ 3 callersMethodin_branches
Return all branches that have the node as an endpoint.
src/power_grid_model_ds/_core/model/graphs/models/base.py:78
↓ 3 callersFunctionparse_node_array
Parse the nodes.
src/power_grid_model_ds/_core/visualizer/parsers.py:12
↓ 3 callersMethodre_order
(self: Self, new_order: ArrayLike, column: str = "id")
src/power_grid_model_ds/_core/model/arrays/base/array.py:299
↓ 3 callersMethodrun
Generate routes, lines and normally open points (NOPs)
src/power_grid_model_ds/_core/data_source/generator/arrays/line.py:28
↓ 3 callersMethodsearch_for_id
Attempts to find a record across all id-arrays within the container. This method is only intended for debugging purposes since it is very ine
src/power_grid_model_ds/_core/model/containers/base.py:145
↓ 3 callersMethodset_unconnected_nodes
From a line array and total set of nodes determine which are not yet connected
src/power_grid_model_ds/_core/data_source/generator/arrays/line.py:115
↓ 2 callersFunction_add_branch_array
Add a branch array to the grid
src/power_grid_model_ds/_core/model/grids/base.py:444
↓ 2 callersFunction_array_to_dict
Stringify the record (required by Dash).
src/power_grid_model_ds/_core/visualizer/parsers.py:56
↓ 2 callersFunction_center_and_truncate
(string: str, width: int)
src/power_grid_model_ds/_core/model/arrays/base/_string.py:82
↓ 2 callersFunction_check_missing_columns
(array_columns: tuple[str, ...], defaults: dict[str, np.generic], provided_columns: set[str])
src/power_grid_model_ds/_core/model/arrays/base/_build.py:57
↓ 2 callersFunction_get_branch3_branches
(branch3: Branch3Array)
src/power_grid_model_ds/_core/model/graphs/models/base.py:426
↓ 2 callersMethod_get_empty_fields
(cls)
src/power_grid_model_ds/_core/model/containers/base.py:195
↓ 2 callersMethod_match_dtypes
(first_dtype: np.dtype, second_dtype: np.dtype)
src/power_grid_model_ds/_core/load_flow.py:154
↓ 2 callersMethod_setup_model
(self)
src/power_grid_model_ds/_core/load_flow.py:157
↓ 2 callersFunction_to_data_table
(data: dict[str, Any])
src/power_grid_model_ds/_core/visualizer/callbacks/element_selection.py:28
↓ 2 callersMethodadd_branch3
Add a branch to all graphs
src/power_grid_model_ds/_core/model/graphs/container.py:96
↓ 2 callersMethodadd_branch3_array
Add a branch to all graphs
src/power_grid_model_ds/_core/model/graphs/container.py:90
↓ 2 callersMethodadd_branch_array
Add all branches in the branch array to the graph.
src/power_grid_model_ds/_core/model/graphs/models/base.py:164
↓ 2 callersMethodadd_node
Add a node to the graph.
src/power_grid_model_ds/_core/model/graphs/models/base.py:86
↓ 2 callersMethodappend
Append the given asset_array to the corresponding field of ArrayContainer and generate ids. Args: array(FancyArray): the asset_ar
src/power_grid_model_ds/_core/model/containers/base.py:111
↓ 2 callersFunctionapply_filter
Return an array with the records that match the input parameters. Note: output could be an empty array.
src/power_grid_model_ds/_core/model/arrays/base/_filters.py:38
↓ 2 callersMethodconnect_nodes
Add a new line between an active and inactive line
src/power_grid_model_ds/_core/data_source/generator/arrays/line.py:78
↓ 2 callersMethodcreate_nop_lines
Create the inactive lines between different routes (Normally Open Points)
src/power_grid_model_ds/_core/data_source/generator/arrays/line.py:98
↓ 2 callersMethodcreate_routes
Create a number of lines from the substation to unconnected nodes
src/power_grid_model_ds/_core/data_source/generator/arrays/line.py:51
↓ 2 callersMethoddelete_branch3
Remove a branch3 from the grid Args: branch (Branch3Array): The branch3 to remove
src/power_grid_model_ds/_core/model/grids/base.py:230
↓ 2 callersMethoddelete_branch_array
Delete all branches in branch_array from the graph.
src/power_grid_model_ds/_core/model/graphs/models/base.py:181
↓ 2 callersMethoddelete_node
Remove a node from the graph. Args: ext_node_id(int): id of the node to remove raise_on_fail(bool): whether to raise
src/power_grid_model_ds/_core/model/graphs/models/base.py:95
↓ 2 callersMethodfilter_parallel
Return branches that have n_parallel connections. Args: branches: BranchArray. n_parallel: the number of connections
src/power_grid_model_ds/_core/model/arrays/pgm_arrays.py:61
↓ 2 callersMethodfind_fundamental_cycles
Find all fundamental cycles in the graph. Returns: list[list[int]]: list of cycles, each cycle is a list of (external) node ids
src/power_grid_model_ds/_core/model/graphs/models/base.py:340
↓ 2 callersMethodget_all_paths
Retrieves all paths between two (external) nodes. Returns a list of paths, each path containing a list of external nodes.
src/power_grid_model_ds/_core/model/graphs/models/base.py:242
↓ 2 callersFunctionget_app_layout
Get the app layout.
src/power_grid_model_ds/_core/visualizer/app.py:68
↓ 2 callersFunctionget_cytoscape_html
Get the Cytoscape HTML element
src/power_grid_model_ds/_core/visualizer/layout/cytoscape_html.py:19
↓ 2 callersMethodget_defaults
(cls)
src/power_grid_model_ds/_core/model/arrays/base/array.py:74
↓ 2 callersMethodget_downstream_nodes
Get the downstream nodes from a node. Assuming each node has a single feeding substation and the grid is radial Example:
src/power_grid_model_ds/_core/model/grids/base.py:332
↓ 2 callersMethodget_empty_value
(self, column: str)
src/power_grid_model_ds/_core/model/arrays/base/array.py:234
↓ 2 callersFunctionget_inherited_attrs
Get the attribute from the object and all its parents
src/power_grid_model_ds/_core/utils/misc.py:26
↓ 2 callersMethodget_nearest_substation_node
Find the nearest substation node. Args: node_id(int): The id of the node to find the nearest substation node for. Return
src/power_grid_model_ds/_core/model/grids/base.py:312
↓ 2 callersMethodget_updated_by_id
(self: Self, ids: ArrayLike, allow_missing: bool = False, **kwargs)
src/power_grid_model_ds/_core/model/arrays/base/array.py:308
↓ 2 callersFunctiongzip2file
unzip a gzip (.gz) file
src/power_grid_model_ds/_core/utils/zip.py:53
↓ 2 callersMethodload_from_txt
Load a grid from text
src/power_grid_model_ds/_core/model/grids/_text_sources.py:37
↓ 2 callersMethodmake_active
Make a branch active Args: branch (BranchArray): The branch to make active
src/power_grid_model_ds/_core/model/grids/base.py:267
next →1–100 of 625, ranked by callers