MCPcopy Create free account
hub / github.com/MTG/essentia / algorithmInfo

Function algorithmInfo

src/python/globalfuncs.cpp:377–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375
376template <typename T>
377PyObject* algorithmInfo(T* algo) {
378 PyObject* result = PyDict_New();
379
380 vector<string> info(3, "");
381 PyObject* sublist = PyList_New(0);
382
383 // add general description & version number
384 AlgorithmInfo<T> staticInfo = EssentiaFactory<T>::getInfo(algo->name());
385
386 PyDict_SetItemString(result, "description", PyString_FromString(staticInfo.description.c_str()));
387
388 // add inputs
389 typename T::InputMap inputs = algo->inputs();
390 for (typename T::InputMap::const_iterator it = inputs.begin();
391 it != inputs.end();
392 ++it) {
393 string name = it->first;
394 info[0] = name;
395 info[1] = edtToString( typeInfoToEdt( it->second->typeInfo() ) );
396 info[2] = algo->inputDescription[name];
397
398 PyList_Append(sublist, VectorString::toPythonCopy(&info));
399 }
400 PyDict_SetItemString(result, "inputs", sublist);
401
402 // add outputs
403 sublist = PyList_New(0);
404 typename T::OutputMap outputs = algo->outputs();
405 for (typename T::OutputMap::const_iterator it = outputs.begin();
406 it != outputs.end();
407 ++it) {
408 string name = it->first;
409 info[0] = name;
410 info[1] = edtToString( typeInfoToEdt( it->second->typeInfo() ) );
411 info[2] = algo->outputDescription[name];
412
413 PyList_Append(sublist, VectorString::toPythonCopy(&info));
414 }
415 PyDict_SetItemString(result, "outputs", sublist);
416
417 // add parameters
418 sublist = PyList_New(0);
419 info.resize(4);
420 ParameterMap pm = algo->defaultParameters();
421
422 for (ParameterMap::const_iterator it=pm.begin(); it != pm.end(); ++it) {
423 string name = it->first;
424 info[0] = name;
425 info[1] = algo->parameterDescription[name];
426 info[2] = algo->parameterRange[name];
427 if (it->second.isConfigured()) {
428 info[3] = it->second.toString();
429 }
430 else {
431 info[3] = "";
432 }
433
434 PyList_Append(sublist, VectorString::toPythonCopy(&info));

Callers 2

streaming_infoFunction · 0.85
standard_infoFunction · 0.85

Calls 7

edtToStringFunction · 0.85
typeInfoToEdtFunction · 0.85
nameMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
resizeMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected