Command-Line Interface¶
Entry points and command-line utilities for XPCS Viewer.
Entry Points¶
The package provides separate entry points for CLI and GUI usage.
GUI Entry Point¶
Launch the graphical interface with xpcsviewer-gui.
The main_gui() function is the primary GUI entry point that provides
interactive XPCS data analysis.
Usage:
# Launch GUI in current directory
xpcsviewer-gui
# Launch with data path
xpcsviewer-gui /path/to/hdf/data
# With debug logging
xpcsviewer-gui --log-level DEBUG
CLI Entry Point¶
Access batch processing commands with xpcsviewer.
The main() function is the CLI entry point for batch processing operations.
Usage:
# Show available commands
xpcsviewer --help
# Run twotime batch processing
xpcsviewer twotime --input /data --output /results --q 0.05
Available Commands¶
Twotime Batch Processing¶
Generate twotime correlation images from HDF5 files.
Batch processing module for twotime correlation data.
- xpcsviewer.cli.twotime_batch.parse_q_phi_pair(q_phi_str)[source]¶
Parse q-phi pair string into q and phi values.
- Parameters:
q_phi_str (str) – String in format “q,phi” (e.g., “0.05,45”)
- Returns:
Tuple of (q_value, phi_value)
- Raises:
ValueError – If string format is invalid
- Return type:
- xpcsviewer.cli.twotime_batch.extract_q_phi_from_label(label)[source]¶
Extract q and phi values from qbin label string.
- xpcsviewer.cli.twotime_batch.find_qbins_for_q(xfile, target_q)[source]¶
Find all qbins with the closest q-value(s) across all phi angles.
- xpcsviewer.cli.twotime_batch.find_qbins_for_phi(xfile, target_phi)[source]¶
Find all qbins with the closest phi-value(s) across all q values.
- xpcsviewer.cli.twotime_batch.find_qbin_for_qphi(xfile, target_q, target_phi)[source]¶
Find single qbin closest to specific q-phi pair.
- xpcsviewer.cli.twotime_batch.create_twotime_plot_matplotlib(c2_matrix, delta_t, title, dpi=300)[source]¶
Create twotime correlation plot using matplotlib.
- xpcsviewer.cli.twotime_batch.generate_output_filename(input_path, q_value, phi_value, output_format='png')[source]¶
Generate standardized output filename.
- xpcsviewer.cli.twotime_batch.process_single_file(file_path, args)[source]¶
Process a single HDF file and generate twotime images.
- xpcsviewer.cli.twotime_batch.find_hdf_files(directory)[source]¶
Find all HDF files in directory recursively.
- xpcsviewer.cli.twotime_batch.process_directory(directory, args)[source]¶
Process all HDF files in directory.
- xpcsviewer.cli.twotime_batch.run_twotime_batch(args)[source]¶
Main entry point for twotime batch processing.
- Parameters:
args – Parsed command line arguments
- Returns:
Exit code (0 for success, 1 for failure)
- Return type:
Command syntax:
xpcsviewer twotime --input INPUT --output OUTPUT (--q Q | --phi PHI | --q-phi Q,PHI)
[--dpi DPI] [--format {png,jpg,pdf,svg}]
Options:
--input, -i: HDF file path or directory containing HDF files--output, -o: Output directory for generated images--q: Q-value to process (generates all phi angles)--phi: Phi-value to process (generates all q values)--q-phi: Specific q-phi pair as ‘q,phi’ (single image)--dpi: Image resolution in DPI (default: 300)--format: Image format: png, jpg, pdf, svg (default: png)
Examples:
# Process all phi angles at a specific q-value
xpcsviewer twotime --input /path/to/data --output /results --q 0.05
# Process all q values at a specific phi angle
xpcsviewer twotime --input /path/to/data --output /results --phi 45
# Generate high-resolution PDF plots
xpcsviewer twotime -i /data -o /results --q 0.05 --dpi 300 --format pdf
Utility Functions¶
safe_shutdown¶
Gracefully shuts down the application, cleaning up resources and thread pools. Called automatically on exit or when handling termination signals.
signal_handler¶
Handles termination signals (SIGTERM, SIGINT) for graceful shutdown. Registered automatically when the CLI or GUI starts.