posydon.CLI.popsyn
posydon.CLI.popsyn.check
Module for checking the status of a population synthesis run.
- posydon.CLI.popsyn.check.analyze_missing_batch_logs(run_folder, str_met, missing_indices)[source]
Analyze log files for missing batches to determine failure reasons.
- posydon.CLI.popsyn.check.check_batch(run_folder, metallicity, batch_folder_name)[source]
Check batch files for a specific metallicity when the population file is missing.
- Parameters:
- Returns:
Dictionary with batch information including: - status: str (‘complete’, ‘incomplete’, ‘folder_missing’, etc.) - expected_count: int or None - found_count: int - metallicity: float - batch_folder: str - missing_indices: set or None
- Return type:
- posydon.CLI.popsyn.check.check_binary_counts(run_folder, metallicities, expected_count)[source]
Check if each population file has the expected number of binaries.
- Parameters:
- Returns:
bool – True if all counts match, False otherwise
dict – Dictionary with metallicity as key and binary count as value
- posydon.CLI.popsyn.check.check_popsyn_function(args)[source]
Function to check the status of a population run.
- Parameters:
args (argparse.Namespace) – The arguments passed to the function
- posydon.CLI.popsyn.check.check_population_files(run_folder, metallicities)[source]
Check if all merged population files exist.
- posydon.CLI.popsyn.check.check_run_status(run_folder, metallicities, number_of_binaries)[source]
Check whether the population files exist and if they have the expected number of binary counts.
- posydon.CLI.popsyn.check.find_missing_batch_indices(batch_folder, expected_count)[source]
Find which batch indices are missing.
- posydon.CLI.popsyn.check.get_batches_status(run_folder, missing_files, synpop_params)[source]
Get the status of batch files for missing populations.
- posydon.CLI.popsyn.check.get_binary_params(ini_file)[source]
Read the binary population parameters from the INI file
- Parameters:
ini_file (str) – The path to the INI file
- Returns:
int – The number of metallicities
int – The number of binaries
list of floats – The list of metallicities in solar units
dict – The dictionary of population synthesis parameters from the INI file
- posydon.CLI.popsyn.check.get_expected_batch_count(run_folder, str_met)[source]
Parse SLURM script to get expected batch count.
- posydon.CLI.popsyn.check.get_ini_file(args)[source]
Find and select the INI file for the population synthesis run.
- Parameters:
args (argparse.Namespace) – Command line arguments that needs to containing the run_folder path.
- Returns:
Path to the selected INI file.
- Return type:
- Raises:
FileNotFoundError – If no INI file is found in the run folder.
- posydon.CLI.popsyn.check.get_run_configuration(args)[source]
Get and validate the run configuration from the run folder.
- Parameters:
args (argparse.Namespace) – Arguments containing run_folder path
- Returns:
(ini_file, num_metallicities, number_of_binaries, metallicities, synpop_params)
- Return type:
- Raises:
FileNotFoundError – If folder validation or INI file retrieval fails
- posydon.CLI.popsyn.check.get_user_confirmation(prompt, valid_yes=None, valid_no=None)[source]
Get user confirmation with validation.
- posydon.CLI.popsyn.check.handle_batches_complete(args, missing_files, batch_status)[source]
Handle the case where all batch files are complete.
- Parameters:
args (argparse.Namespace) – Command line arguments
missing_files (dict) – Dictionary of metallicities with missing files
batch_status (dict) – Batch status information
- Returns:
True if merge jobs were handled (resubmitted or user declined), False if batches incomplete
- Return type:
- posydon.CLI.popsyn.check.print_batch_status(str_met, expected_count, actual_count, missing_indices)[source]
Print the batch comparison status.
- Parameters:
- Returns:
Status string: ‘unknown_expected_count’, ‘incomplete’, ‘complete’, or ‘extra_files’
- Return type:
- posydon.CLI.popsyn.check.read_batch_log_file(log_file_path, batch_index, str_met, jobID)[source]
Read and analyze a batch log file to determine failure reason.
- posydon.CLI.popsyn.check.select_job_id(run_folder, str_met)[source]
Find and select a job ID from available log files.
posydon.CLI.popsyn.setup
Utility functions for POSYDON population synthesis command line interface.
- posydon.CLI.popsyn.setup.check_SN_MODEL_validity(ini_file, verbose_on_fail=True)[source]
Checks if the step_SN model is valid for this script
- posydon.CLI.popsyn.setup.setup_popsyn_function(args)[source]
Function to setup the population synthesis run
- Parameters:
args (argparse.Namespace) – the arguments passed to the function
- posydon.CLI.popsyn.setup.validate_ini_file(ini_file)[source]
Validates the ini file for population synthesis
- Parameters:
ini_file (str) – the path to the ini file
- Raises:
FileNotFoundError – if the ini file does not exist
ValueError – if the step_SN MODEL is not valid for this script