Skip to content

[FEATURE] lookup functions for ID's from the C++ core #129

@TonyXiang8787

Description

@TonyXiang8787

Intention

When we have the calculation results, it is in a numpy structured array. For example for the node you have:

Input
id    u_pu    ...
 7     1.05    ...
 10   1.07    ...
 8   1.07    ...
103  1.0      ...

Say we want to retrieve a sub-array with node id 10 and 103. To do this, we need to translate the list of id's to list of position numbers in the original numpy array. The C++ core already has hash table to do the lookup.

API

Say we have a numpy array a = [10, 103]. We should be able to retrieve the position number by using the following call:

position = model.get_indexer('node', a)

The returned value should be [1, 3].

We can then for example to retrieve the u_pu for these two nodes by:

u_pu_sub_array = node_result['u_pu'][position]

The result u_pu_sub_array should be [1.07, 1.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions