ELVIS-Project / vis-framework

Thoroughly modern symbolic musical data analysis suite.
http://elvisproject.ca/
31 stars 6 forks source link

Indexer_funcs are called element-wise instead of dataframe-wise. #374

Closed alexandermorgan closed 8 years ago

alexandermorgan commented 8 years ago

Every indexer curently passes over the entire piece in each combination sent to the indexer. This would be orders of magnitude more efficient by using the indexer_func on an entire dataframe representing the piece at the same time with df.applymap(indexer_func). It will be easiest to begin with the stream indexers (noterest, duration, measure, fermata, beatstrength) because they take no settings and only look at one moment in one voice at a time. The slight exception is the duration indexer which occasionally needs to accumulate the values of notes that are tied together. I'm not sure how this one will work out yet. If we have a dataframe of music21 event objects (see issue #373) we could first filter this for the types needed by an indexer. For example the measure indexer could first filter for measure-type objects, and change all others to None using df.applymap(). Then drop the Nones leaving a df of measures. Then use the measure indexer indexer_func to this filtered dataframe of music21 measure objects. Since most of the stream indexers need the intermediary df of music21 note and rest objects, we should probably store that one too, in addition to the main music21 object df described in issue #373.

alexandermorgan commented 8 years ago

This solution will undergo further minor refactoring, but in any event this problem is sorted out on alex_devel with this commit: ca6b29ca7357ceddf0bc7b68757bd44f95f9118e