Skip to content

Add numpy arrays to Python Tree object #1299

@jeromekelleher

Description

@jeromekelleher

It will be useful for some applications to have direct access to the underling parent, left_child etc arrays in the quintuply linked tree representation. We can do this by adding some (read only) numpy arrays that use these pointers defined in the C structs, i.e.,

typedef struct {
    PyObject_HEAD
    TreeSequence *tree_sequence;
    tsk_tree_t *tree;
    PyObject *left_array;
    PyObject *right_array; // etc
} Tree;

Then in Tree_init we can create the required numpy views, and make them available to Python following the steps here

Metadata

Metadata

Labels

Python APIIssue is about the Python APIenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions