utils
Utility functions for the argus package.
load_config
resolve_config_paths
Resolve relative paths in configuration relative to config file location.
This function modifies the config object in-place, converting any relative paths to absolute paths based on the directory containing the config file. Absolute paths are left unchanged.
Parameters
config : configparser.ConfigParser Configuration object to modify config_path : str Path to the configuration file (used as base for relative paths)
Returns
configparser.ConfigParser The same config object with resolved paths (modified in-place)
get_noise_parameters
setup_logging
Set up logging configuration.
DEPRECATED: Use io_manager.setup_single_logger() instead for centralized logging. This function is kept for backward compatibility.
Parameters
output_dir : str Directory where log files will be stored config : configparser.ConfigParser Configuration object containing logging settings
Returns
logging.Logger Configured logger instance
check_gpu_availability
get_efac_equad_injections
Load EFAC and EQUAD values from noise parameters file.
Parameters
noise_params_path : str Path to the noise parameters JSON file excluded_psrs : list of str, optional List of pulsar names to exclude from the analysis. Default is an empty list.
Returns
tuple Two JAX arrays containing EFAC and EQUAD values for the included pulsars.
get_psr_noise_injections
Load pulsar noise parameters from pickle file.
Parameters
spin_injections_path : str Path to the spin injections pickle file excluded_psrs : list of str, optional List of pulsar names to exclude from the analysis. Default is an empty list.
Returns
tuple Two JAX arrays containing sigma_p and gamma_p values for the included pulsars.
corner_plot
Create a corner plot for log10_ha parameter from inference results.
Parameters
results : str or object Either a file path (string) to results file, or a results object. For NumPyro: path to NetCDF file or arviz.InferenceData object output_dir : str, optional Directory to save the plot. If None, plot is shown but not saved.
Returns
str or None Path to saved plot file, or None if not saved
diagnostics
Run MCMC diagnostics on NumPyro results.
Parameters:
-
fname
(str
) –Path to NumPyro results NetCDF file
-
output_dir
(str
, default:None
) –Directory to save diagnostics outputs