asp_plot.processing_parameters#
Attributes#
Classes#
Extract and manage processing parameters from ASP log files. |
Module Contents#
- class asp_plot.processing_parameters.ProcessingParameters(processing_directory, bundle_adjust_directory=None, stereo_directory=None)#
Extract and manage processing parameters from ASP log files.
This class extracts parameters from ASP processing log files, including bundle adjustment, stereo, and point2dem logs. It provides methods to parse these logs and obtain command lines, run times, and other relevant processing information.
Examples
>>> params = ProcessingParameters('/path/to/asp', 'ba', 'stereo') >>> params_dict = params.from_log_files() >>> print(params_dict['bundle_adjust']) # Print bundle adjustment command line >>> print(params_dict['stereo_run_time']) # Print stereo processing time
- from_bundle_adjust_log()#
Extract parameters from the bundle adjustment log file.
Parses the bundle adjustment log file to extract the command line, identifies the reference DEM, and calculates the run time.
- Returns:
A tuple containing (bundle_adjust_params, run_time, reference_dem) where: - bundle_adjust_params: str, the bundle adjustment command line - run_time: str, formatted run time (e.g., “2 hours and 15 minutes”) - reference_dem: str, path to the reference DEM used
- Return type:
- Raises:
ValueError – If the bundle adjustment log file cannot be found
- from_log_files()#
Extract processing parameters from log files.
Parses the bundle adjustment, stereo, and point2dem log files to extract command lines, run times, and other parameters.
- Returns:
Dictionary containing processing parameters: - processing_timestamp: When processing was performed - reference_dem: Path to reference DEM - bundle_adjust: Bundle adjustment command line - bundle_adjust_run_time: Time to run bundle adjustment - stereo: Stereo command line - stereo_run_time: Time to run stereo - point2dem: point2dem command line - point2dem_run_time: Time to run point2dem
- Return type:
Notes
If bundle adjustment was not run, its command and run time are set to placeholder values. Reference DEM is searched for in either bundle adjustment or stereo logs, depending on availability.
- from_point2dem_log()#
Extract parameters from the point2dem log file.
Parses the point2dem log file to extract the command line and calculates the run time.
- Returns:
A tuple containing (point2dem_params, run_time) where: - point2dem_params: str, the point2dem command line - run_time: str, formatted run time (e.g., “0 hours and 45 minutes”)
- Return type:
- Raises:
ValueError – If the point2dem log file cannot be found
- from_stereo_log(search_for_reference_dem=False)#
Extract parameters from the stereo log files.
Parses the stereo log files to extract command lines, processing timestamp, and optionally searches for reference DEM information. This method uses both the preprocessing (pprc) and triangulation (tri) logs to get start/end times and stereo parameters.
- Parameters:
search_for_reference_dem (bool, optional) – Whether to search for reference DEM in the log files, default is False
- Returns:
If search_for_reference_dem is False, returns: (processing_timestamp, stereo_params, run_time) where: - processing_timestamp: datetime, when processing started - stereo_params: str, the stereo command line - run_time: str, formatted run time
If search_for_reference_dem is True, additionally returns: - reference_dem: str, path to the reference DEM used
- Return type:
- Raises:
ValueError – If stereo log files cannot be found
Notes
The stereo process proceeds through several steps: 1. stereo_pprc - preprocessing 2. stereo_corr - correlation 3. stereo_blend - tile blending (logs in tile/ dirs) 4. stereo_rfne - refinement (logs in tile/ dirs) 5. stereo_fltr - filtering 6. stereo_tri - triangulation
This method uses the pprc log for start time and the tri log for end time to calculate total runtime.
- get_asp_version()#
Extract the ASP version string from the first available log file.
- Returns:
ASP version string (e.g., “3.4.0-alpha”), or “N/A” if not found.
- Return type:
- get_reference_dem(logfile, starting_string='DEM:')#
Extract reference DEM path from a log file.
Searches for the reference DEM path in a log file using a pattern matching approach.
- Parameters:
- Returns:
Path to the reference DEM if found, empty string otherwise
- Return type:
Notes
This is a helper method used by from_bundle_adjust_log and from_stereo_log to extract reference DEM information. Different log file types use different patterns to indicate reference DEMs, hence the configurable starting_string parameter.
- get_run_time(logfiles)#
Calculate the run time from timestamps in log files.
Extracts the earliest timestamp from the first log file and the latest timestamp from the last log file to compute the total execution time.
- Parameters:
logfiles (list of str) – Paths to log files to analyze. The first file is used to find the start time, and the last file is used to find the end time.
- Returns:
Formatted run time as “X hours and Y minutes”, or “N/A” if timestamps couldn’t be found
- Return type:
Notes
This is a helper method used by other methods to calculate processing run times. It expects log files to have timestamps in the format “YYYY-MM-DD HH:MM:SS”.
If only one log file is provided, it will be used for both start and end times. This is useful for single-stage processes.
- bundle_adjust_directory = None#
- full_ba_directory#
- full_stereo_directory#
- processing_directory#
- processing_parameters_dict#
- stereo_directory = None#
- asp_plot.processing_parameters.logger#