4.1.1.1. rpscripts.lib package¶
4.1.1.1.1. Submodules¶
4.1.1.1.2. rpscripts.lib.base module¶
This module provides RPScripts’ basic classes and methods
- class rpscripts.lib.base.GeneralSubparser(subparser: ArgumentParser)[source]¶
Bases:
object
Argparse subparser abstract class.
- class rpscripts.lib.base.RPData(path=None)[source]¶
Bases:
object
Main Rhythmic Partitioning Data class.
- get_agglomeration_dispersion(partition_str: str) list [source]¶
Find and return a given partition’s agglomeration and dispersion values as a two-element list.
These values must be present in the values_map class attribute and the partition value must be in string format.
- get_events_location(attribute: str) dict [source]¶
Return a dictionary with the event locations where the measure number is the dictionary key, and the pair “offset, element”, the dictionary value. The element is the value in the attribute list.
If the attribute value is partitions, the element is the partition as string. For instance, 1.3, 2^2 and so on.
- get_frequency_counter(attribute: str, proportional=True) dict [source]¶
Return a frequency counter of the values of a given attribute.
- get_probability_counter(attribute: str, exclude_repeats=True, proportional=True) dict [source]¶
Return a probability counter of adjacent values of a given attribute.
- load_from_file() None [source]¶
Load data from the file set into path attribute and fill the other class attributes with this loaded data.
- make_class_graph(attribute: str) Digraph [source]¶
Return a graphviz.Digraph with the adjacent values of a list of values stored in the given attribute.
- rpscripts.lib.base.aux_find_next_measure_number(global_offset: Fraction, offset_map: dict, index=0) tuple [source]¶
Return the nearest measure number that the global offset value is higher than the given one as parameter.
This function also updates and returns the given index.
- rpscripts.lib.base.aux_sum_if_none(a, b)[source]¶
Return the sum if one or two given values is None.
- rpscripts.lib.base.clean_filename(filename: str) str [source]¶
Clean the given filename.
Remove the special characters and spaces.
- rpscripts.lib.base.convert_texture_data_from_json(data: dict) dict [source]¶
Convert texture data from JSON.
The fractions are converted from string to Fraction objects.
- rpscripts.lib.base.convert_texture_data_to_json(data: dict) dict [source]¶
Convert texture data to JSON.
The fractions are converted from Fraction objects to strings.
- rpscripts.lib.base.convert_to_equal_durations(dataframe: DataFrame, offset_map: dict) dict [source]¶
Convert texture data from a given DataFrame to dictionary format with events of the same duration.
For instance, a dataframe with two events with durations 1/2 and 1/3 are converted in 3 events and 2 events of duration 1/6.
- rpscripts.lib.base.file_rename(filename: str, extension: str, suffix=None) str [source]¶
Rename files to change extension value and add optional suffix.
- rpscripts.lib.base.find_nearest_smaller(value, seq: list)[source]¶
Find the smaller nearest value of a given value from a given sequence.
- rpscripts.lib.base.fraction_to_string(value) str [source]¶
Return a given value as a fraction represented as a string format.
- rpscripts.lib.base.get_diff_lcm(seq: list) Fraction [source]¶
Return the lowest common multiple of the differences between the adjacent values of a given list.
- rpscripts.lib.base.get_fractions_denominator_lcm(fractions_lst: list)[source]¶
Return the lowest common multiple value of a list of fractions denominators.
- rpscripts.lib.base.get_number_combinations_pairs(n: int) float [source]¶
Return the number of pair combinations of a list of n elements.
Binomial coefficient.
- rpscripts.lib.base.make_fraction(value) Fraction [source]¶
Return a Fraction object from a given Fraction or float value.
- rpscripts.lib.base.make_general_graph(labels: list, name: str) Digraph [source]¶
Return a graphviz.Digraph with the adjacent values of a given list of labels.
4.1.1.1.3. rpscripts.lib.partition module¶
This module provides classes and functions for rhythmic partitioning analysis. For further information, see Gentil-Nunes 2009.
Gentil-Nunes, Pauxy. 2009. “Análise Particional: uma Mediação entre Composição Musical e a Teoria das Partições.” Ph.D. Dissertation, Universidade Federal do Estado do Rio de Janeiro.
- class rpscripts.lib.partition.PartitionLattice(cardinality=10)[source]¶
Bases:
object
Partition Lattice class. It helps in lattice creating and saving.
- rpscripts.lib.partition.get_lexset(number: int) list [source]¶
Return the lexical set of a given number. The lexical set is the list of all partitions from 1 to number.
- rpscripts.lib.partition.get_partitions(number: int) list [source]¶
Return the partitions of a given number as a list of lists.