gunshotmatch_pipeline.projects

Metadata for project pipelines.

Classes:

GlobalSettings([output_directory, method, …])

Settings applied for all projects.

LoaderMixin()

Mixin class providing load_method() and load_config() methods.

ProjectSettings(name, datafiles[, method, …])

Settings for a specific project.

Projects([global_settings, per_project_settings])

Reference data projects to process through the pipeline.

Functions:

process_projects(projects, output_dir[, …])

Process projects with common methods and config.

class GlobalSettings(output_directory='output', method=None, config=None, data_directory=None)[source]

Bases: libgunshotmatch.method.MethodBase, gunshotmatch_pipeline.projects.LoaderMixin

Settings applied for all projects.

Parameters
  • output_directory (str) – Relative or absolute path to the directory the output files should be placed in. Default 'output'.

  • method (Optional[str]) – Relative or absolute filename to the method TOML file. The table name is “method”. Default None.

  • config (Optional[str]) – Relative or absolute filename to the configuration TOML file. The table name is “config”. Default None.

  • data_directory (Optional[str]) – Relative or absolute path to the directory containing the data files. Default None.

The method and config files may point to the same TOML file.

Attributes:

config

Relative or absolute filename to the configuration TOML file.

data_directory

Relative or absolute path to the directory containing the data files.

method

Relative or absolute filename to the method TOML file.

output_directory

Relative or absolute path to the directory the output files should be placed in.

config

Type:    Optional[str]

Relative or absolute filename to the configuration TOML file. The table name is “gunshotmatch”.

data_directory

Type:    Optional[str]

Relative or absolute path to the directory containing the data files.

method

Type:    Optional[str]

Relative or absolute filename to the method TOML file. The table name is “method”.

output_directory

Type:    str

Relative or absolute path to the directory the output files should be placed in.

class LoaderMixin[source]

Bases: object

Mixin class providing load_method() and load_config() methods.

Methods:

load_config()

Load the configuration for this project from the specified file.

load_method()

Load the method for this project from the specified file.

load_config()[source]

Load the configuration for this project from the specified file.

Return type

Configuration

load_method()[source]

Load the method for this project from the specified file.

Return type

Method

class ProjectSettings(name, datafiles, method=None, config=None, data_directory=None)[source]

Bases: libgunshotmatch.method.MethodBase, gunshotmatch_pipeline.projects.LoaderMixin

Settings for a specific project.

Parameters
  • name (str) – The project name.

  • datafiles (List[str]) – List of input datafiles (paths relative to the data_directory option)

  • method (Optional[str]) – Relative or absolute filename to the method TOML file. The table name is “method”. Default None.

  • config (Optional[str]) – Relative or absolute filename to the configuration TOML file. The table name is “config”. Default None.

  • data_directory (Optional[str]) – Relative or absolute path to the directory containing the data files. Default None.

Attributes:

config

Relative or absolute filename to the configuration TOML file.

data_directory

Relative or absolute path to the directory containing the data files.

datafiles

List of input datafiles (paths relative to the data_directory option)

method

Relative or absolute filename to the method TOML file.

name

The project name.

Methods:

get_datafile_paths()

Returns an iterator over paths to the datafiles.

config

Type:    Optional[str]

Relative or absolute filename to the configuration TOML file. The table name is “config”.

data_directory

Type:    Optional[str]

Relative or absolute path to the directory containing the data files.

datafiles

Type:    List[str]

List of input datafiles (paths relative to the data_directory option)

get_datafile_paths()[source]

Returns an iterator over paths to the datafiles.

The paths start with data_directory if set.

Return type

Iterator[PathPlus]

method

Type:    Optional[str]

Relative or absolute filename to the method TOML file. The table name is “method”.

name

Type:    str

The project name.

class Projects(global_settings=GlobalSettings(output_directory='output', method=None, config=None, data_directory=None), per_project_settings={})[source]

Bases: libgunshotmatch.method.MethodBase

Reference data projects to process through the pipeline.

Parameters
  • global_settings (GlobalSettings) – Settings applied for all projects. Default GlobalSettings(output_directory='output', method=None, config=None, data_directory=None).

  • per_project_settings (Dict[str, ProjectSettings]) – Settings for specific projects. Default {}.

Methods:

from_json(json_string)

Parse a Projects from a JSON string.

from_toml(toml_string)

Parse a Projects from a TOML string.

get_project_settings(project_name)

Returns the settings for the given project, taking into account the global settings.

has_common_config()

Returns whether all projects have common configuration.

has_common_method()

Returns whether all projects have a common method.

iter_loaded_projects()

Iterate Project objects loaded from disk.

iter_project_settings()

Iterate over the per-project settings, taking into account the global settings.

load_project(project_name)

Load a previously created project.

to_toml()

Convert a Configuration to a TOML string.

Attributes:

global_settings

Settings applied for all projects.

per_project_settings

Settings for specific projects.

classmethod from_json(json_string)[source]

Parse a Projects from a JSON string.

Parameters

json_string (str)

Return type

Projects

classmethod from_toml(toml_string)[source]

Parse a Projects from a TOML string.

Parameters

toml_string (str)

Return type

Projects

get_project_settings(project_name)[source]

Returns the settings for the given project, taking into account the global settings.

Parameters

project_name (str)

Return type

ProjectSettings

global_settings

Type:    GlobalSettings

Settings applied for all projects.

has_common_config()[source]

Returns whether all projects have common configuration.

Return type

bool

has_common_method()[source]

Returns whether all projects have a common method.

Return type

bool

iter_loaded_projects()[source]

Iterate Project objects loaded from disk.

Return type

Iterator[Project]

iter_project_settings()[source]

Iterate over the per-project settings, taking into account the global settings.

Return type

Iterator[ProjectSettings]

load_project(project_name)[source]

Load a previously created project.

Parameters

project_name (str)

Return type

Project

per_project_settings

Type:    Dict[str, ProjectSettings]

Settings for specific projects.

to_toml()[source]

Convert a Configuration to a TOML string.

Return type

str

process_projects(projects, output_dir, recreate=False)[source]

Process projects with common methods and config.

Parameters
Return type

Iterator[Project]