UNA

The top-level UNA class is the entry point for every analysis. It owns a Settings instance and a Topology instance, and dispatches to the appropriate engine when you call one of its Run* methods.

class UNA(verbosity=1)[source]

Bases: object

Parameters:

verbosity (int)

topology: Topology
accessibility = None
flow = None
composite_result = None
settings: Settings
has_flow_results = False
has_centrality_results = False
PrintSettings()[source]
Return type:

None

LoadSettings(file_path=None)[source]
Parameters:

file_path (str)

Return type:

None

SaveSettings(file_path=None)[source]
Parameters:

file_path (str)

Return type:

None

DataValidation()[source]
Return type:

None

RunBatch(analysis, pairing_file=None)[source]

Run an analysis (accessibility or flow) for every entry in self.projects.

A “project” in UNA is a saved list of Settings snapshots (this method’s self.projects list). An “analysis” is which engine family each row represents — “accessibility” or “flow” — so calling RunBatch(“flow”) runs every project row as a Flow analysis. See DESIGN.md § Terminology.

If pairing_file is provided, self.projects is replaced by loading that file first. Accepts .csv, .tsv, or .json (array exported by ExportProjectAsJSON / ExportProjectAsCSV). When no file is given, whatever is already in self.projects is used — build it with SaveSettingsToProject() first.

Parameters:
  • analysis (str) – “accessibility” or “flow”

  • pairing_file (str) – optional path to a .csv / .tsv / .json batch file

Return type:

None

RunAccessibility()[source]
Return type:

None

RunODM(format='Sqlite', speed=5.0, file_name=None)[source]

Compute and export an origin-destination distance/duration matrix.

Completely independent — builds its own network topology and engine. Does not require RunAccessibility() to have been called first.

Requires settings.origin_uid_column and settings.destination_id_column to be set so the output rows are labelled with real identifiers.

Parameters:
  • format (str) – Output format — “Sqlite”, “feather”, “csv”, or “tsv”.

  • speed (float) – Walking speed in km/h used to compute duration column.

  • file_name (str) – Output file stem; defaults to settings.output_file_name.

Return type:

None

RunFlow()[source]
Return type:

None

ConvertProject_csv_to_json(csv_file, json_file=None, compact=True)[source]

Convert a project pairing CSV/TSV to a JSON array of settings objects.

Each row becomes one element in the JSON array containing only the settings values that were present in that row.

Parameters:
  • csv_file (str) – Path to the pairing CSV or TSV file.

  • json_file (str) – Output path. Defaults to the same path as csv_file with a .json extension.

  • compact (bool) – If True (default), each object contains only fields that differ from their default value. If False, every settings field is written out — useful for documentation.

Returns:

The path to the written JSON file.

Return type:

None

SaveSettingsToProject()[source]
Return type:

None

ClearProject()[source]
Return type:

None

ExportProjectAsJSON(folder=None, file_name='project', compact=True)[source]

Export the project settings list to a JSON file.

Parameters:
  • folder (str) – Output folder. Defaults to the current working directory.

  • file_name (str) – File name without extension.

  • compact (bool) – If True (default), only non-default fields are written.

Return type:

None

ExportProjectAsCSV(file_name='project')[source]

Export the project settings list to a CSV file.

NOTE: The CSV is written to settings.data_folder so the project file stays alongside the data files it references. Set settings.data_folder before calling if you need a specific output location.

Parameters:

file_name (str) – File name without extension.

Return type:

None

ConvertGeoJson_to_Feather(geojson_file, feather_file)[source]