|
10 | 10 | "\n", |
11 | 11 | "It is by no means intended to provide complete documentation on the topic, but only to show how such conversions could be done.\n", |
12 | 12 | "\n", |
13 | | - "This example uses `pyarrow.RecordBatch` to demonstrate zero copy operations. The user can choose a `pyarrow.Table` or other structures based on the requirement.\n", |
| 13 | + "This example uses `pyarrow.RecordBatch` to demonstrate zero-copy operations. The user can choose a `pyarrow.Table` or other structures based on the requirement.\n", |
14 | 14 | "\n", |
15 | 15 | "**NOTE:** To run this example, the optional `examples` dependencies are required:\n", |
16 | 16 | "\n", |
|
78 | 78 | "\n", |
79 | 79 | "Construct the input data for the model and construct the actual model.\n", |
80 | 80 | "\n", |
81 | | - "Arrow uses a columnar data format while the power-grid-model offers both: row based or columnar data format.\n", |
| 81 | + "Arrow uses a columnar data format while the power-grid-model offers support for both row based and columnar data format.\n", |
82 | 82 | "Because of this, the columnar data format of power-grid-model provides a zero-copy interface for Arrow data. This differs from the row-based data format, for which conversions always require a copy." |
83 | 83 | ] |
84 | 84 | }, |
|
123 | 123 | "metadata": {}, |
124 | 124 | "source": [ |
125 | 125 | "The primitive types of each attribute in the arrow tables need to match to make the operation efficient.\n", |
126 | | - "A zero copy is not guaranteed if the data types from power_grid_meta_data / initialize_array are not used.\n", |
| 126 | + "Zero-copy conversion is not guaranteed if the data types provided via the PGM via `power_grid_meta_data` are not used.\n", |
127 | 127 | "Note that the asymmetric type of attribute in power-grid-model has a shape of `(3,)` along with a specific type. These represent the 3 phases of electrical system.\n", |
128 | | - "Hence asymmetric attributes need to be handled specially. \n", |
| 128 | + "Hence, special care is required when handling asymmetric attributes. \n", |
129 | 129 | "\n", |
130 | | - "In this tutorial we use the respective primitive types for the symmetrical attributes and a `FixedSizeListArray` of the primitive types with length 3 for asymmetrical attributes. This results in them being stored as contigious memory which would enable zero copy conversion. There might be other ways to approach this problem too." |
| 130 | + "In this example, we use the respective primitive types for the symmetrical attributes and a `FixedSizeListArray` of the primitive types with length 3 for asymmetrical attributes. This results in them being stored as contiguous memory which would enable zero-copy conversion. Other possible solutions to this problem are beyond the scope of this example." |
131 | 131 | ] |
132 | 132 | }, |
133 | 133 | { |
|
179 | 179 | " return pa.schema(schemas)\n", |
180 | 180 | "\n", |
181 | 181 | "\n", |
182 | | - "print(\"-------node combined asym scehma-------\")\n", |
| 182 | + "print(\"-------node combined asym schema-------\")\n", |
183 | 183 | "print(pgm_schema(DatasetType.input, ComponentType.node))\n", |
184 | | - "print(\"-------asym load combined asym scehma-------\")\n", |
| 184 | + "print(\"-------asym load combined asym schema-------\")\n", |
185 | 185 | "print(pgm_schema(DatasetType.input, ComponentType.asym_load))" |
186 | 186 | ] |
187 | 187 | }, |
|
269 | 269 | "Converting Arrow data to columnar NumPy arrays is recommended to leverage the columnar nature of Arrow data. \n", |
270 | 270 | "This conversion can be done with zero-copy operations.\n", |
271 | 271 | "\n", |
272 | | - "Similar approach be adopted by the user to convert to row based data.\n", |
| 272 | + "A similar approach be adopted by the user to convert to row based data.\n", |
273 | 273 | "\n", |
274 | 274 | "```{note}\n", |
275 | 275 | "The option of `zero_copy_only` in the function below is added in this demo to verify no copies are made. Its usage is not mandatory to do zero copy conversion.\n", |
|
0 commit comments