Skip to content

Instantly share code, notes, and snippets.

@drussel
Created September 15, 2012 18:23
Show Gist options
  • Save drussel/3729161 to your computer and use it in GitHub Desktop.
Save drussel/3729161 to your computer and use it in GitHub Desktop.
Test script for bad rmf
features = list()
def main():
import RMF
rh = RMF.open_rmf_file_read_only("cylB148_2998.rmf")
scoreFactory = RMF.ScoreConstFactory(rh)
frameCount = rh.get_number_of_frames()
getFeatures(rh, scoreFactory)
print len(features), "features"
for frame in range(frameCount):
for f in features:
showScore(scoreFactory, f, frame)
def getFeatures(rh, scoreFactory):
_processNode(rh.get_root_node(), scoreFactory, 0)
def _processNode(node, scoreFactory, depth):
from RMF import FEATURE, ALIAS
nodeType = node.get_type()
if nodeType == FEATURE:
features.append(node)
#showScore(scoreFactory, node, 0)
for n in node.get_children():
if n.get_type() != ALIAS:
_processNode(n, scoreFactory, depth + 1)
else:
for n in node.get_children():
_processNode(n, scoreFactory, depth + 1)
def showScore(scoreFactory, node, frame):
print "Score", frame, node.get_type(), node,
try:
s = scoreFactory.get(node, frame)
except:
print "No Score"
else:
print s.get_score()
main()
This file has been truncated, but you can view the full file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment