This module outlines the Experimenter base class, which helps with transforming time-attached analytic information to other types.
Bases: object
Run an experiment on an IndexedPiece.
Use the “Experimenter.required_indices” attribute to know which Indexer subclasses should be provided to this Experimenter’s constructor. If the list is None or [], use the “Experimenter.required_experiments” attribute to know which Experimenter should be provided to the constructor.
Create a new Experimenter.
Parameters: |
|
---|
Raises: | RuntimeError, if required settings are not present in the “settings” argument. |
---|
The controllers that deal with indexing data from music21 Score objects.
Bases: object
Create an index of a music21 stream.
Use the requires_score attribute to know whether __init__() requires a list of Part objects. If False, read the documentation to know which indexers’ results it requires.
The name of the indexer, as stored in an IndexedPiece, is the unicode-format version of the class name.
Create a new Indexer.
Parameters: |
|
---|---|
Raises: | TypeError if the score argument is not a list of the right types. |
Raises: | RuntimeError if the required settings are not present in the settings argument. |
Make a new index of the piece.
Returns: | A list of the new indices. The index of each Series corresponds to the index of the Part or Series used to generate it, as given to the constructor. Each element in each Series is a basestring (unless specified otherwise in a subclass). |
---|---|
Return type: | list of pandas.Series |
For a set of streams, find the offsets at which events begin. Used by mp_indexer.
Parameters: | streams (list of music21.stream.Stream) – A list of Streams in which to find the offsets at which events begin. |
---|
Returns: | A list of floating-point numbers representing offsets at which a new event begins in any of the streams. Offsets are sorted from lowest to highest (start to end). |
---|---|
Return type: | list of float |
When there is more than one event at an offset, call this method to ensure parsing simultaneities.
Example: Transforms this... [[1, 2, 3], [1, 2, 3], [1, 2]] ... into this... [[1, 1, 1], [2, 2, 2], [3, 3]]
Perform the indexation of a part or part combination. This is a module-level function designed to ease implementation of multiprocessing with the MPController module.
If your Indexer has settings, use the indexer_func() to adjust for them.
Parameters: |
|
---|
Returns: | The new index where each element is a unicode object and the “index” of the pandas object corresponds to the offset at which each event begins. Index 0 is the argument “pipe_index” unchanged. |
---|---|
Return type: | 2-tuple with “pipe_index” and pandas.Series or pandas.DataFrame |
Raises: | ValueError, if there are multiple events at an offset in any of the inputted Series. |
---|
Perform the indexation of a part or part combination. This is a module-level function designed to ease implementation of multiprocessing.
If your Indexer has settings, use the indexer_func() to adjust for them.
If an offset has multiple events of the correct type, only the “first” discovered results will be included in the output. This may produce misleading results when, for example, a double-stop was imported as two Note objects in the same Part, rather than as a Chord.
Parameters: |
|
---|
Returns: | The “pipe_index” argument and the new index. The new index is a pandas.Series where every element is a unicode object. The Series’ index corresponds to the quarterLength offset of the event in the input Stream. |
---|---|
Return type: | 2-tuple of any and pandas.Series |