|
523 | 523 | "execution_count": 14, |
524 | 524 | "id": "4e25006f", |
525 | 525 | "metadata": { |
526 | | - "scrolled": true |
| 526 | + "scrolled": false |
527 | 527 | }, |
528 | 528 | "outputs": [ |
529 | 529 | { |
|
548 | 548 | "print(output_data[\"line\"][\"i_from\"])" |
549 | 549 | ] |
550 | 550 | }, |
| 551 | + { |
| 552 | + "cell_type": "markdown", |
| 553 | + "id": "466082fd", |
| 554 | + "metadata": {}, |
| 555 | + "source": [ |
| 556 | + "#### Accessing batch data\n", |
| 557 | + "\n", |
| 558 | + "It may be a bit unintuitive to read the `output_data` or `update_data` of a component directly as they are a dictionary of 3 dimension data, ie. $ids \\times batches \\times attributes$. Remember that the `output_data` or `update_data` are a dictionary of numpy structured arrays. Hence the component should be indexed first. The index that follows can be [indexed with numpy structured arrays](https://numpy.org/doc/stable/user/basics.rec.html#indexing-structured-arrays)\n", |
| 559 | + "\n", |
| 560 | + "To read the result of a single batch, lets say `1st batch`," |
| 561 | + ] |
| 562 | + }, |
| 563 | + { |
| 564 | + "cell_type": "code", |
| 565 | + "execution_count": 15, |
| 566 | + "id": "a8ad72d8", |
| 567 | + "metadata": {}, |
| 568 | + "outputs": [ |
| 569 | + { |
| 570 | + "name": "stdout", |
| 571 | + "output_type": "stream", |
| 572 | + "text": [ |
| 573 | + " id energized loading p_from q_from i_from \\\n", |
| 574 | + "0 3 1 0.212031 29511.239220 3.508895e+06 193.061627 \n", |
| 575 | + "1 5 1 0.064924 -1267.160636 -1.172098e+06 64.923606 \n", |
| 576 | + "2 8 1 0.156578 19805.345039 2.500724e+06 137.590869 \n", |
| 577 | + "\n", |
| 578 | + " s_from p_to q_to i_to s_to \n", |
| 579 | + "0 3.509019e+06 1267.160636 -3.827902e+06 212.030847 3.827902e+06 \n", |
| 580 | + "1 1.172099e+06 3574.919119 8.320006e+05 46.000611 8.320083e+05 \n", |
| 581 | + "2 2.500802e+06 -3574.919119 -2.832001e+06 156.577603 2.832003e+06 \n" |
| 582 | + ] |
| 583 | + } |
| 584 | + ], |
| 585 | + "source": [ |
| 586 | + "print(pd.DataFrame(output_data[\"line\"][0]))" |
| 587 | + ] |
| 588 | + }, |
| 589 | + { |
| 590 | + "cell_type": "markdown", |
| 591 | + "id": "e25301da", |
| 592 | + "metadata": {}, |
| 593 | + "source": [ |
| 594 | + "Or maybe we wish to find result of a single component, (eg. 1st line) in all batches" |
| 595 | + ] |
| 596 | + }, |
| 597 | + { |
| 598 | + "cell_type": "code", |
| 599 | + "execution_count": 16, |
| 600 | + "id": "7bceccf4", |
| 601 | + "metadata": {}, |
| 602 | + "outputs": [ |
| 603 | + { |
| 604 | + "name": "stdout", |
| 605 | + "output_type": "stream", |
| 606 | + "text": [ |
| 607 | + "[ 193.06162675 248.65360093 368.12834615 510.20016036 662.04311447\n", |
| 608 | + " 819.63118685 981.46004118 1146.90787963 1315.7236725 1487.83778526]\n" |
| 609 | + ] |
| 610 | + } |
| 611 | + ], |
| 612 | + "source": [ |
| 613 | + "print(output_data[\"line\"][\"i_from\"][:,0])" |
| 614 | + ] |
| 615 | + }, |
551 | 616 | { |
552 | 617 | "cell_type": "markdown", |
553 | 618 | "id": "ac217192", |
|
562 | 627 | }, |
563 | 628 | { |
564 | 629 | "cell_type": "code", |
565 | | - "execution_count": 15, |
| 630 | + "execution_count": 17, |
566 | 631 | "id": "041368dc", |
567 | 632 | "metadata": {}, |
568 | 633 | "outputs": [], |
|
597 | 662 | }, |
598 | 663 | { |
599 | 664 | "cell_type": "code", |
600 | | - "execution_count": 16, |
| 665 | + "execution_count": 18, |
601 | 666 | "id": "34338ce3", |
602 | 667 | "metadata": {}, |
603 | 668 | "outputs": [ |
|
628 | 693 | }, |
629 | 694 | { |
630 | 695 | "cell_type": "code", |
631 | | - "execution_count": 17, |
| 696 | + "execution_count": 19, |
632 | 697 | "id": "04e56690", |
633 | 698 | "metadata": {}, |
634 | 699 | "outputs": [], |
|
655 | 720 | }, |
656 | 721 | { |
657 | 722 | "cell_type": "code", |
658 | | - "execution_count": 18, |
| 723 | + "execution_count": 20, |
659 | 724 | "id": "0d5b94c2", |
660 | 725 | "metadata": {}, |
661 | 726 | "outputs": [ |
|
732 | 797 | }, |
733 | 798 | { |
734 | 799 | "cell_type": "code", |
735 | | - "execution_count": 19, |
| 800 | + "execution_count": 21, |
736 | 801 | "id": "b5f10bae", |
737 | 802 | "metadata": {}, |
738 | 803 | "outputs": [ |
|
788 | 853 | }, |
789 | 854 | { |
790 | 855 | "cell_type": "code", |
791 | | - "execution_count": 20, |
| 856 | + "execution_count": 22, |
792 | 857 | "id": "1a221507", |
793 | 858 | "metadata": {}, |
794 | 859 | "outputs": [ |
|
825 | 890 | }, |
826 | 891 | { |
827 | 892 | "cell_type": "code", |
828 | | - "execution_count": 21, |
| 893 | + "execution_count": 23, |
829 | 894 | "id": "541af620", |
830 | 895 | "metadata": {}, |
831 | 896 | "outputs": [ |
|
864 | 929 | }, |
865 | 930 | { |
866 | 931 | "cell_type": "code", |
867 | | - "execution_count": 22, |
| 932 | + "execution_count": 24, |
868 | 933 | "id": "b702eb15", |
869 | 934 | "metadata": {}, |
870 | 935 | "outputs": [ |
|
894 | 959 | ], |
895 | 960 | "metadata": { |
896 | 961 | "kernelspec": { |
897 | | - "display_name": "Python 3.9.13 ('pgm-dev')", |
| 962 | + "display_name": "Python 3 (ipykernel)", |
898 | 963 | "language": "python", |
899 | 964 | "name": "python3" |
900 | 965 | }, |
|
0 commit comments