Created
September 15, 2012 18:23
-
-
Save drussel/3729161 to your computer and use it in GitHub Desktop.
Test script for bad rmf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment