power-grid-model 1.10.74__py3-none-win_amd64.whl → 1.12.119__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of power-grid-model might be problematic. Click here for more details.
- power_grid_model/__init__.py +54 -29
- power_grid_model/_core/__init__.py +3 -3
- power_grid_model/_core/buffer_handling.py +507 -478
- power_grid_model/_core/data_handling.py +195 -141
- power_grid_model/_core/data_types.py +142 -0
- power_grid_model/_core/dataset_definitions.py +109 -109
- power_grid_model/_core/enum.py +226 -0
- power_grid_model/_core/error_handling.py +215 -202
- power_grid_model/_core/errors.py +134 -0
- power_grid_model/_core/index_integer.py +17 -17
- power_grid_model/_core/options.py +71 -69
- power_grid_model/_core/power_grid_core.py +577 -597
- power_grid_model/_core/power_grid_dataset.py +545 -528
- power_grid_model/_core/power_grid_meta.py +262 -244
- power_grid_model/_core/power_grid_model.py +1025 -692
- power_grid_model/_core/power_grid_model_c/__init__.py +3 -0
- power_grid_model/_core/power_grid_model_c/bin/power_grid_model_c.dll +0 -0
- power_grid_model/_core/power_grid_model_c/get_pgm_dll_path.py +63 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/basics.h +251 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/buffer.h +108 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset.h +332 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset_definitions.h +1060 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/handle.h +111 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/meta_data.h +189 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/model.h +130 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/options.h +142 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/serialization.h +118 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c.h +36 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/basics.hpp +65 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/buffer.hpp +61 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/dataset.hpp +224 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/handle.hpp +108 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/meta_data.hpp +84 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/model.hpp +63 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/options.hpp +52 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/serialization.hpp +124 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/utils.hpp +81 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp.hpp +19 -0
- power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelConfig.cmake +37 -0
- power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelConfigVersion.cmake +65 -0
- power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelTargets-release.cmake +19 -0
- power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelTargets.cmake +144 -0
- power_grid_model/_core/power_grid_model_c/lib/power_grid_model_c.lib +0 -0
- power_grid_model/_core/power_grid_model_c/share/LICENSE +292 -0
- power_grid_model/_core/power_grid_model_c/share/README.md +15 -0
- power_grid_model/_core/serialization.py +319 -317
- power_grid_model/_core/typing.py +20 -0
- power_grid_model/{_utils.py → _core/utils.py} +798 -783
- power_grid_model/data_types.py +321 -319
- power_grid_model/enum.py +27 -214
- power_grid_model/errors.py +37 -123
- power_grid_model/typing.py +43 -48
- power_grid_model/utils.py +529 -400
- power_grid_model/validation/__init__.py +25 -14
- power_grid_model/validation/_rules.py +1167 -904
- power_grid_model/validation/_validation.py +1172 -980
- power_grid_model/validation/assertions.py +93 -92
- power_grid_model/validation/errors.py +602 -520
- power_grid_model/validation/utils.py +313 -318
- {power_grid_model-1.10.74.dist-info → power_grid_model-1.12.119.dist-info}/METADATA +162 -171
- power_grid_model-1.12.119.dist-info/RECORD +65 -0
- {power_grid_model-1.10.74.dist-info → power_grid_model-1.12.119.dist-info}/WHEEL +1 -1
- power_grid_model-1.12.119.dist-info/entry_points.txt +3 -0
- power_grid_model/_core/_power_grid_core.dll +0 -0
- power_grid_model-1.10.74.dist-info/RECORD +0 -32
- power_grid_model-1.10.74.dist-info/top_level.txt +0 -1
- {power_grid_model-1.10.74.dist-info → power_grid_model-1.12.119.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,141 +1,195 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
-
#
|
|
3
|
-
# SPDX-License-Identifier: MPL-2.0
|
|
4
|
-
|
|
5
|
-
"""
|
|
6
|
-
Data handling
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
from power_grid_model._core.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
1
|
+
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
Data handling
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Literal, overload
|
|
10
|
+
|
|
11
|
+
import numpy as np
|
|
12
|
+
|
|
13
|
+
from power_grid_model._core.data_types import (
|
|
14
|
+
BatchDataset,
|
|
15
|
+
Dataset,
|
|
16
|
+
DenseBatchArray,
|
|
17
|
+
SingleArray,
|
|
18
|
+
SingleColumnarData,
|
|
19
|
+
SingleDataset,
|
|
20
|
+
)
|
|
21
|
+
from power_grid_model._core.dataset_definitions import ComponentType, ComponentTypeVar, DatasetType
|
|
22
|
+
from power_grid_model._core.enum import CalculationType, ComponentAttributeFilterOptions
|
|
23
|
+
from power_grid_model._core.errors import PowerGridUnreachableHitError
|
|
24
|
+
from power_grid_model._core.power_grid_dataset import CConstDataset, CMutableDataset
|
|
25
|
+
from power_grid_model._core.power_grid_meta import initialize_array, power_grid_meta_data
|
|
26
|
+
from power_grid_model._core.typing import ComponentAttributeMapping, ComponentAttributeMappingDict
|
|
27
|
+
from power_grid_model._core.utils import process_data_filter
|
|
28
|
+
from power_grid_model.data_types import DenseBatchColumnarData
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def get_output_type(*, calculation_type: CalculationType, symmetric: bool) -> DatasetType:
|
|
32
|
+
"""
|
|
33
|
+
Get the output type based on the provided arguments.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
calculation_type:
|
|
37
|
+
request the output type for a specific calculation type (power_flow, state_estimation, ...)
|
|
38
|
+
symmetric:
|
|
39
|
+
True: three-phase symmetric calculation, even for asymmetric loads/generations
|
|
40
|
+
False: three-phase asymmetric calculation
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
the output type that fits the format requested by the output type
|
|
44
|
+
"""
|
|
45
|
+
if calculation_type in (CalculationType.power_flow, CalculationType.state_estimation):
|
|
46
|
+
return DatasetType.sym_output if symmetric else DatasetType.asym_output
|
|
47
|
+
|
|
48
|
+
if calculation_type == CalculationType.short_circuit:
|
|
49
|
+
return DatasetType.sc_output
|
|
50
|
+
|
|
51
|
+
raise NotImplementedError
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def prepare_input_view(input_data: SingleDataset) -> CConstDataset:
|
|
55
|
+
"""
|
|
56
|
+
Create a view of the input data in a format compatible with the PGM core libary.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
input_data:
|
|
60
|
+
the input data to create the view from
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
instance of CConstDataset ready to be fed into C API
|
|
64
|
+
"""
|
|
65
|
+
return CConstDataset(input_data, dataset_type=DatasetType.input)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def prepare_update_view(update_data: Dataset) -> CConstDataset:
|
|
69
|
+
"""
|
|
70
|
+
Create a view of the update data, or an empty view if not provided, in a format compatible with the PGM core libary.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
update_data:
|
|
74
|
+
the update data to create the view from. Defaults to None
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
instance of CConstDataset ready to be fed into C API
|
|
78
|
+
"""
|
|
79
|
+
return CConstDataset(update_data, dataset_type=DatasetType.update)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def prepare_output_view(output_data: Dataset, output_type: DatasetType) -> CMutableDataset:
|
|
83
|
+
"""
|
|
84
|
+
create a view of the output data in a format compatible with the PGM core libary.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
output_data:
|
|
88
|
+
the output data to create the view from
|
|
89
|
+
output_type:
|
|
90
|
+
the output type of the output_data
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
instance of CMutableDataset ready to be fed into C API
|
|
94
|
+
"""
|
|
95
|
+
return CMutableDataset(output_data, dataset_type=output_type)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@overload
|
|
99
|
+
def create_output_data(
|
|
100
|
+
output_component_types: None | set[ComponentTypeVar] | list[ComponentTypeVar],
|
|
101
|
+
output_type: DatasetType,
|
|
102
|
+
all_component_count: dict[ComponentType, int],
|
|
103
|
+
is_batch: Literal[False],
|
|
104
|
+
batch_size: int,
|
|
105
|
+
) -> dict[ComponentType, SingleArray]: ...
|
|
106
|
+
@overload
|
|
107
|
+
def create_output_data(
|
|
108
|
+
output_component_types: None | set[ComponentTypeVar] | list[ComponentTypeVar],
|
|
109
|
+
output_type: DatasetType,
|
|
110
|
+
all_component_count: dict[ComponentType, int],
|
|
111
|
+
is_batch: Literal[True],
|
|
112
|
+
batch_size: int,
|
|
113
|
+
) -> dict[ComponentType, DenseBatchArray]: ...
|
|
114
|
+
@overload
|
|
115
|
+
def create_output_data(
|
|
116
|
+
output_component_types: ComponentAttributeFilterOptions,
|
|
117
|
+
output_type: DatasetType,
|
|
118
|
+
all_component_count: dict[ComponentType, int],
|
|
119
|
+
is_batch: Literal[False],
|
|
120
|
+
batch_size: int,
|
|
121
|
+
) -> dict[ComponentType, SingleColumnarData]: ...
|
|
122
|
+
@overload
|
|
123
|
+
def create_output_data(
|
|
124
|
+
output_component_types: ComponentAttributeFilterOptions,
|
|
125
|
+
output_type: DatasetType,
|
|
126
|
+
all_component_count: dict[ComponentType, int],
|
|
127
|
+
is_batch: Literal[True],
|
|
128
|
+
batch_size: int,
|
|
129
|
+
) -> dict[ComponentType, DenseBatchColumnarData]: ...
|
|
130
|
+
@overload
|
|
131
|
+
def create_output_data(
|
|
132
|
+
output_component_types: ComponentAttributeMappingDict,
|
|
133
|
+
output_type: DatasetType,
|
|
134
|
+
all_component_count: dict[ComponentType, int],
|
|
135
|
+
is_batch: Literal[False],
|
|
136
|
+
batch_size: int,
|
|
137
|
+
) -> SingleDataset: ...
|
|
138
|
+
@overload
|
|
139
|
+
def create_output_data(
|
|
140
|
+
output_component_types: ComponentAttributeMappingDict,
|
|
141
|
+
output_type: DatasetType,
|
|
142
|
+
all_component_count: dict[ComponentType, int],
|
|
143
|
+
is_batch: Literal[True],
|
|
144
|
+
batch_size: int,
|
|
145
|
+
) -> BatchDataset: ...
|
|
146
|
+
def create_output_data(
|
|
147
|
+
output_component_types: ComponentAttributeMapping,
|
|
148
|
+
output_type: DatasetType,
|
|
149
|
+
all_component_count: dict[ComponentType, int],
|
|
150
|
+
is_batch: bool,
|
|
151
|
+
batch_size: int,
|
|
152
|
+
) -> Dataset:
|
|
153
|
+
"""
|
|
154
|
+
Create the output dataset based on component and batch size from the model; and output attributes requested by user.
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
output_component_types (ComponentAttributeMapping):
|
|
158
|
+
the output components the user seeks to extract
|
|
159
|
+
output_type:
|
|
160
|
+
the type of output that the user will see (as per the calculation options)
|
|
161
|
+
all_component_count:
|
|
162
|
+
the amount of components in the grid (as per the input data)
|
|
163
|
+
is_batch:
|
|
164
|
+
if the dataset is batch
|
|
165
|
+
batch_size:
|
|
166
|
+
the batch size
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
Dataset: output dataset
|
|
170
|
+
"""
|
|
171
|
+
processed_output_types = process_data_filter(output_type, output_component_types, list(all_component_count.keys()))
|
|
172
|
+
|
|
173
|
+
all_component_count = {k: v for k, v in all_component_count.items() if k in processed_output_types}
|
|
174
|
+
|
|
175
|
+
# create result dataset
|
|
176
|
+
result_dict: Dataset = {}
|
|
177
|
+
|
|
178
|
+
for name, count in all_component_count.items():
|
|
179
|
+
shape: tuple[int, int] | int = (batch_size, count) if is_batch else count
|
|
180
|
+
|
|
181
|
+
requested_component = processed_output_types[name]
|
|
182
|
+
dtype = power_grid_meta_data[output_type][name].dtype
|
|
183
|
+
if dtype.names is None:
|
|
184
|
+
raise PowerGridUnreachableHitError
|
|
185
|
+
if requested_component is None:
|
|
186
|
+
result_dict[name] = initialize_array(output_type, name, shape=shape, empty=True)
|
|
187
|
+
elif requested_component in [
|
|
188
|
+
ComponentAttributeFilterOptions.everything,
|
|
189
|
+
ComponentAttributeFilterOptions.relevant,
|
|
190
|
+
]:
|
|
191
|
+
result_dict[name] = {attr: np.empty(shape=shape, dtype=dtype[attr]) for attr in dtype.names}
|
|
192
|
+
elif isinstance(requested_component, list | set):
|
|
193
|
+
result_dict[name] = {attr: np.empty(shape=shape, dtype=dtype[attr]) for attr in requested_component}
|
|
194
|
+
|
|
195
|
+
return result_dict
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
Data types involving PGM datasets.
|
|
7
|
+
|
|
8
|
+
Data types for library-internal use. In an attempt to clarify type hints, some types
|
|
9
|
+
have been defined and explained in this file.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from typing import TypedDict, TypeVar
|
|
13
|
+
|
|
14
|
+
import numpy as np
|
|
15
|
+
|
|
16
|
+
from power_grid_model._core.dataset_definitions import ComponentType, ComponentTypeVar
|
|
17
|
+
|
|
18
|
+
type SingleArray = np.ndarray
|
|
19
|
+
|
|
20
|
+
type AttributeType = str
|
|
21
|
+
|
|
22
|
+
type SingleColumn = np.ndarray
|
|
23
|
+
type DenseBatchArray = np.ndarray
|
|
24
|
+
|
|
25
|
+
SingleColumnarData = dict[AttributeType, SingleColumn]
|
|
26
|
+
|
|
27
|
+
_SingleComponentData = TypeVar("_SingleComponentData", SingleArray, SingleColumnarData) # deduction helper
|
|
28
|
+
SingleComponentData = SingleArray | SingleColumnarData
|
|
29
|
+
|
|
30
|
+
SingleRowBasedDataset = dict[ComponentTypeVar, SingleArray]
|
|
31
|
+
SingleColumnarDataset = dict[ComponentTypeVar, SingleColumnarData]
|
|
32
|
+
SingleDataset = dict[ComponentTypeVar, _SingleComponentData]
|
|
33
|
+
|
|
34
|
+
BatchList = list[SingleDataset]
|
|
35
|
+
|
|
36
|
+
type BatchColumn = np.ndarray
|
|
37
|
+
|
|
38
|
+
DenseBatchColumnarData = dict[AttributeType, BatchColumn]
|
|
39
|
+
|
|
40
|
+
type IndexPointer = np.ndarray
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class SparseBatchColumnarData(TypedDict):
|
|
44
|
+
"""
|
|
45
|
+
Sparse batch columnar data is a dictionary containing the keys `indptr` and `data`.
|
|
46
|
+
|
|
47
|
+
- data: a :class:`SingleColumnarData`. The exact supported attribute columns depend on the component type.
|
|
48
|
+
- indptr: an :class:`IndexPointer` representing the start and end indices for each batch scenario.
|
|
49
|
+
|
|
50
|
+
- Examples:
|
|
51
|
+
|
|
52
|
+
- structure: {"indptr": :class:`IndexPointer`, "data": :class:`SingleColumnarData`}
|
|
53
|
+
- concrete example: {"indptr": [0, 2, 2, 3], "data": {"id": [0, 1, 0], "status": [1, 1, 0]}}
|
|
54
|
+
|
|
55
|
+
- the scenario 0 sets the status of components with ids 0 and 1 to 1
|
|
56
|
+
(and keeps defaults for other components)
|
|
57
|
+
- scenario 1 keeps the default values for all components
|
|
58
|
+
- scenario 2 sets the status of component with id 0 to 0 (and keeps defaults for other components)
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
indptr: IndexPointer
|
|
62
|
+
data: SingleColumnarData
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class SparseBatchArray(TypedDict):
|
|
66
|
+
"""
|
|
67
|
+
A sparse batch array is a dictionary containing the keys `indptr` and `data`.
|
|
68
|
+
|
|
69
|
+
- data: a :class:`SingleArray`. The exact dtype depends on the type of component.
|
|
70
|
+
- indptr: an :class:`IndexPointer` representing the start and end indices for each batch scenario.
|
|
71
|
+
|
|
72
|
+
- Examples:
|
|
73
|
+
|
|
74
|
+
- structure: {"indptr": :class:`IndexPointer`, "data": :class:`SingleArray`}
|
|
75
|
+
- concrete example: {"indptr": [0, 2, 2, 3], "data": [(0, 1, 1), (1, 1, 1), (0, 0, 0)]}
|
|
76
|
+
|
|
77
|
+
- the scenario 0 sets the statuses of components with ids 0 and 1 to 1
|
|
78
|
+
(and keeps defaults for other components)
|
|
79
|
+
- scenario 1 keeps the default values for all components
|
|
80
|
+
- scenario 2 sets the statuses of component with id 0 to 0 (and keeps defaults for other components)
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
indptr: IndexPointer
|
|
84
|
+
data: SingleArray
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
SparseBatchData = SparseBatchArray | SparseBatchColumnarData
|
|
88
|
+
|
|
89
|
+
type SparseDataComponentType = str
|
|
90
|
+
|
|
91
|
+
BatchColumnarData = DenseBatchColumnarData | SparseBatchColumnarData
|
|
92
|
+
|
|
93
|
+
ColumnarData = SingleColumnarData | BatchColumnarData
|
|
94
|
+
BatchArray = DenseBatchArray | SparseBatchArray
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
BatchComponentData = BatchArray | BatchColumnarData
|
|
98
|
+
|
|
99
|
+
_BatchComponentData = TypeVar("_BatchComponentData", BatchArray, BatchColumnarData) # deduction helper
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
BatchDataset = dict[ComponentTypeVar, _BatchComponentData]
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
DataArray = SingleArray | BatchArray
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
_ComponentData = TypeVar("_ComponentData", SingleComponentData, BatchComponentData) # deduction helper
|
|
109
|
+
ComponentData = DataArray | ColumnarData
|
|
110
|
+
|
|
111
|
+
Dataset = dict[ComponentTypeVar, _ComponentData]
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
DenseBatchData = DenseBatchArray | DenseBatchColumnarData
|
|
115
|
+
|
|
116
|
+
# overloads that only match on latest PGM type
|
|
117
|
+
SingleRowBasedOutputDataset = dict[ComponentType, SingleArray]
|
|
118
|
+
SingleColumnarOutputDataset = dict[ComponentType, SingleColumnarData]
|
|
119
|
+
SingleOutputDataset = dict[ComponentType, SingleComponentData]
|
|
120
|
+
DenseBatchRowBasedOutputDataset = dict[ComponentType, DenseBatchArray]
|
|
121
|
+
DenseBatchColumnarOutputDataset = dict[ComponentType, DenseBatchColumnarData]
|
|
122
|
+
DenseBatchOutputDataset = dict[ComponentType, DenseBatchData]
|
|
123
|
+
OutputDataset = dict[ComponentType, ComponentData]
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
NominalValue = int
|
|
127
|
+
|
|
128
|
+
RealValue = float
|
|
129
|
+
|
|
130
|
+
AsymValue = tuple[RealValue, RealValue, RealValue]
|
|
131
|
+
|
|
132
|
+
AttributeValue = RealValue | NominalValue | AsymValue
|
|
133
|
+
|
|
134
|
+
Component = dict[AttributeType, AttributeValue | str]
|
|
135
|
+
|
|
136
|
+
ComponentList = list[Component]
|
|
137
|
+
|
|
138
|
+
SinglePythonDataset = dict[ComponentTypeVar, ComponentList]
|
|
139
|
+
|
|
140
|
+
BatchPythonDataset = list[SinglePythonDataset]
|
|
141
|
+
|
|
142
|
+
PythonDataset = SinglePythonDataset | BatchPythonDataset
|