dimcat.steps package#
Subpackages#
- dimcat.steps.analyzers package
- Submodules
- dimcat.steps.analyzers.base module
- dimcat.steps.analyzers.counters module
- dimcat.steps.analyzers.phrases module
- dimcat.steps.analyzers.prevalence module
- dimcat.steps.analyzers.proportions module
- Module contents
- dimcat.steps.extractors package
- dimcat.steps.filters package
- dimcat.steps.groupers package
- dimcat.steps.loaders package
- Submodules
- dimcat.steps.loaders.base module
FacetNameLoadedFacetsLoaderLoader.SchemaLoader.add_package()Loader.basepathLoader.check_resource()Loader.create_dataset()Loader.fit_to_dataset()Loader.from_directory()Loader.from_filepaths()Loader.from_package()Loader.get_basepath()Loader.iter_package_descriptors()Loader.iter_resource_paths()Loader.iter_resources()Loader.process_resource()Loader.sources
PackageLoaderScoreLoaderScoreLoader.SchemaScoreLoader.add_piece_facet_dataframe()ScoreLoader.check_resource()ScoreLoader.descriptor_existsScoreLoader.descriptor_pathScoreLoader.from_directory()ScoreLoader.from_filepaths()ScoreLoader.from_package()ScoreLoader.from_resources()ScoreLoader.get_descriptor_filename()ScoreLoader.get_descriptor_path()ScoreLoader.get_loader_name()ScoreLoader.get_zip_filepath()ScoreLoader.get_zip_path()ScoreLoader.iter_package_descriptors()ScoreLoader.loader_nameScoreLoader.make_and_store_datapackage()ScoreLoader.parse_and_extract()ScoreLoader.processed_idsScoreLoader.zip_file_exists
- dimcat.steps.loaders.m21 module
CollectedElementsMusic21LoaderMusic21Scoredefault_list_dict()make_dataframe()make_metadata()parse_AbstractScale()parse_Barline()parse_Chord()parse_Clef()parse_ConcreteScale()parse_Duration()parse_Dynamic()parse_Editorial()parse_Harmony()parse_Interval()parse_Key()parse_Measure()parse_Microtone()parse_Pitch()parse_TextExpression()parse_Tie()parse_TimeSignature()parse_Volume()parse_m21_object()
- dimcat.steps.loaders.musescore module
- dimcat.steps.loaders.utils module
- Module contents
- dimcat.steps.pipelines package
- dimcat.steps.slicers package
Submodules#
dimcat.steps.base module#
- class dimcat.steps.base.FeatureProcessingStep(features: Optional[Union[Feature, Type[Feature], DimcatConfig, MutableMapping, FeatureName, str, Iterable[Union[Feature, Type[Feature], DimcatConfig, MutableMapping, FeatureName, str]]]] = None, **kwargs)[source]#
Bases:
PipelineStepThis class unites all PipelineSteps that work on one or all features that can be or have been extracted from a Dataset. They can be instantiated with the
featuresargument, with the behaviour defined by class variables.- class Schema(*, only: Optional[Union[Sequence[str], AbstractSet[str]]] = None, exclude: Union[Sequence[str], AbstractSet[str]] = (), many: Optional[bool] = None, load_only: Union[Sequence[str], AbstractSet[str]] = (), dump_only: Union[Sequence[str], AbstractSet[str]] = (), partial: Optional[Union[bool, Sequence[str], AbstractSet[str]]] = None, unknown: Optional[Literal['exclude', 'include', 'raise']] = None)[source]#
Bases:
Schema- exclude: set[Any] | MutableSet[Any]#
- unknown: types.UnknownOption#
- check_dataset(dataset: Dataset) None[source]#
Check if the dataset is eligible for processing.
- Raises:
TypeError – if the given dataset is not a Dataset
EmptyDatasetError – if
applicable_to_empty_datasetsis False and the given dataset is emptyNoFeaturesActiveError – if
requires_at_least_one_featureis True and no features are activeFeatureUnavailableError – if any of the required features is not available in the dataset.
- check_resource(resource: DimcatResource) None[source]#
Check if the resource is eligible for processing.
- Raises:
TypeError – if the given resource is not a DimcatResource
EmptyResourceError – if the given resource is empty
FeatureNotProcessableError – if the given resource cannot be processed by this step
- property features: List[DimcatConfig]#
The Feature objects you want this PipelineStep to process. If not specified, the step will try to process all features in a given Dataset’s Outputs catalog.
- get_feature_specs() List[DimcatConfig][source]#
Return a list of feature names required for this PipelineStep.
- class dimcat.steps.base.PipelineStep[source]#
Bases:
DimcatObjectThis base class unites all classes able to transform some data in a pre-defined way.
The initializer will set some parameters of the processing, and then the
process()method is used to transform an input Data object, returning a copy.- class Schema(*, only: Optional[Union[Sequence[str], AbstractSet[str]]] = None, exclude: Union[Sequence[str], AbstractSet[str]] = (), many: Optional[bool] = None, load_only: Union[Sequence[str], AbstractSet[str]] = (), dump_only: Union[Sequence[str], AbstractSet[str]] = (), partial: Optional[Union[bool, Sequence[str], AbstractSet[str]]] = None, unknown: Optional[Literal['exclude', 'include', 'raise']] = None)[source]#
Bases:
SchemaPipelineSteps do not depend on previously serialized data, so their serialization can be validated by default after dumping them to a dict-like structure. For Data objects, this default is safe only for their PickleSchema, which PipelineSteps do not use.
- exclude: set[Any] | MutableSet[Any]#
- unknown: types.UnknownOption#
- check_dataset(dataset: Dataset) None[source]#
Check if the dataset is eligible for processing.
- Raises:
TypeError – if the given dataset is not a Dataset
EmptyDatasetError – if
applicable_to_empty_datasetsis False and the given dataset is empty
- check_resource(resource: Resource) None[source]#
Check if the resource is eligible for processing.
- Raises:
TypeError – if the given resource is not a DimcatResource
EmptyResourceError – if the given resource is empty
- fit_to_dataset(dataset: Dataset) None[source]#
Adjust the PipelineStep to the passed dataset.
- Parameters:
dataset – The dataset to adjust to.
- property is_transformation: Literal[False]#
True if this PipelineStep transforms features, replacing the dataset.outputs[‘features’] package.
- process(data: D) D[source]#
- process(data: Union[List[D], Tuple[D]]) List[D]
- process(*data: D) List[D]
Same as process_data(), with the difference that arbitrarily many objects are accepted.
- process_data(data: Dataset) Dataset[source]#
- process_data(data: DimcatResource) DR
Perform a transformation on an input Data object. This should never alter the Data or its properties in place, instead returning a copy or view of the input.
- Parameters:
data – The data to be transformed. Must not be altered in place.
- Returns:
A copy of the input Data, potentially transformed or enhanced in some way defined by this PipelineStep.
- class dimcat.steps.base.ResourceTransformation(features: Optional[Union[Feature, Type[Feature], DimcatConfig, MutableMapping, FeatureName, str, Iterable[Union[Feature, Type[Feature], DimcatConfig, MutableMapping, FeatureName, str]]]] = None, **kwargs)[source]#
Bases:
FeatureProcessingStepThe subclasses either transform the features specified upon initialization, returning a Dataset containing only these, or, if no features are specified, transform all resources in the outputs catalog.
- transform_resource(resource: DimcatResource) DataFrame[source]#
Apply the transformation to a Resource and return the transformed dataframe.