database

db

exception decitala.database.db.DatabaseException[source]

Bases: Exception

class decitala.database.db.CompositionData(name, part_num, local_filepath)[source]

Bases: sqlalchemy.orm.decl_api.Base

SQLAlchemy model representing the basic composition data for a composition.

Parameters
  • name (str) – Name of the composition.

  • part_num (int) – Part number for the extraction.

  • local_filepath (str) – Local filepath for the searched composition.

TODO: could add a search_constraint column that stores a JSON of the rolling_search parameters.

class decitala.database.db.ExtractionData(fragment, onset_start, onset_stop, retrograde, factor, difference, mod_hierarchy_val, pitch_content, is_spanned_by_slur, slur_count, slur_start_end_count, id_, contiguous_summation)[source]

Bases: sqlalchemy.orm.decl_api.Base

SQLAlchemy model representing a fragment extracted from a composition. Intended to be used with the class method ExtractionData.from_extraction. See decitala.search.Extraction for the relevant information on each column in the database.

classmethod from_extraction(extraction)[source]

Creates an decitala.database.db.ExtractionData object from a decitala.search.Extraction object. This is more durable to accidentally breaking things when adding data to extractions.

decitala.database.db.create_extraction_database(db_path, filepath, table, part_nums=[0], windows=[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], verbose=False)[source]

Function for creating a database from a single filepath. Stores all extracted fragments.

Parameters
  • db_path (str) – Path to the database to be created.

  • filepath (str) – Path to the score to be analyzed.

  • table (list) – A decitala.hash_table.FragmentHashTable object.

  • part_nums (list) – Parts to be analyzed.

  • windows (list) – Possible lengths of the search frames.

  • verbose (bool) – Whether to log the SQL calls. False by default.

decitala.database.db.batch_create_extraction_database(db_path, data_in, table, windows, verbose=False)[source]

This function creates a database from a dictionary of filepaths and desires part_nums to analyze.

Parameters
  • db_path (str) – Path to the database to be created.

  • data_in (dict) – Dictionary of filepaths (key) and part nums in a list (value).

  • table (list) – A decitala.hash_table.FragmentHashTable object.

  • windows (list) – Possible lengths of the search frames.

  • verbose (bool) – Whether to log the SQL calls. False by default.

decitala.database.db.create_path_database(db_path, filepath, part_nums, table, windows=[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], allow_subdivision=False, allow_contiguous_summation=False, algorithm='dijkstra', cost_function_class=<decitala.path_finding.path_finding_utils.CostFunction3D object>, split_dict=None, slur_constraint=False, enforce_earliest_start=False, verbose=False)[source]

Function for creating a database from a single filepath. Stores the extracted path. See decitala.search.path_finder to find the definitions of the relevant parameters.

Parameters

db_path (str) – Path to the database to be created.

decitala.database.db.batch_create_path_database(db_path, data_in, table, windows=[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], allow_subdivision=False, allow_contiguous_summation=False, algorithm='dijkstra', cost_function_class=<decitala.path_finding.path_finding_utils.CostFunction3D object>, split_dict=None, slur_constraint=False, enforce_earliest_start=False, verbose=False)[source]

This function creates a database from a dictionary of filepaths and desires part_nums to analyze. See decitala.search.path_finder to find the definitions of the relevant parameters.

Parameters
  • db_path (str) – Path to the database to be created.

  • data_in (dict) – Dictionary of filepaths (key) and part nums in a list (value).

class decitala.database.db.Species(name)[source]

Bases: object

This class allows a user to access the SubcategoryData results without relying on SQLAlchemy. It only requires a name (and also supports class methods).

aggregated_pc_distribution(normalized=False, as_vector=True)[source]

Returns the aggregate pitch class distribution across all transcriptions in a species.

class decitala.database.db.Transcription(name)[source]

Bases: object

This class allows a user to access the TranscriptionData results without relying on SQLAlchemy. It only requires a name (and also supports class methods).

corpora_models

class decitala.database.corpora_models.DecitalaData(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

SQLAlchemy model representing a decitala fragment from the encoded datasets (given in corpora).

class decitala.database.corpora_models.GreekFootData(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

SQLAlchemy model representing a greek foot fragment from the encoded datasets (given in corpora).

class decitala.database.corpora_models.ProsodicMeterData(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

SQLAlchemy model representing a prosodic meter from the encoded datasets (given in corpora).

class decitala.database.corpora_models.CategoryData(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

Category table of the database, (possibly) holding multiple subcategories, i.e., species.

class decitala.database.corpora_models.SubcategoryData(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

Subcategory table of the database. Holds data for each species.

class decitala.database.corpora_models.TranscriptionData(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

Transcription-level table of the database.