Giter Club home page Giter Club logo

Comments (3)

marnunez avatar marnunez commented on June 14, 2024

Is this inherited from BTK? FindChild() used to segfault in python when asked for the contents of a node that did not exist. I favoured GetChild()

from openma.

Alzathar avatar Alzathar commented on June 14, 2024

@marnunez There is a confusion between the method btk::MetaData::FindChild() and the method ma::Node::findChild(). Both are not related.

The latter is used to retrieve any child in a tree-like structure. For example, the output of the line my_root = ma::io::read('myfile.ext') is a tree structure like in the following image.

openma-tree-trial

Usages of ma::Node::findChild() in Python to access data can be:

ts1 = root.findChild(ma.T_TimeSequence,‘my_ts1’);
evt1 = trial.findChild(ma.T_Event,‘my_evt1’);

The Python documentation is not available (every contribution is welcomed!). However, the C++ documentation ma::node::findChild may help you to understand its behaviour. The difference between both is the way to manage the template parameter. The first parameter of the Python method corresponds to the template parameter passed in C++. For example

// C++
auto ts1 = root.findChild<ma::TimeSequence>(‘my_ts1’);
# Python
ts1 = root.findChild(ma.T_TimeSequence,‘my_ts1’);

from openma.

marnunez avatar marnunez commented on June 14, 2024

@Alzathar Thanks for the clarification! This looks far more versatile. I'll play around some more as soon as I get the python bindings compiled.

from openma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.