argus API Documentation
Inits src directory.
Submodules
argus.analysis
argus.bayesian_inference
argus.data_loader
argus.gravitational_waves
Module which holds all functions which are related to the properties of the gravitational wave.
- argus.gravitational_waves.pairwise_angular_separation(ra_rad, dec_rad)[source]
Compute the pairwise angular separations for a set of celestial coordinates in radians.
This function takes arrays of right ascension (RA) and declination (Dec), both in radians, and returns an NxN matrix of angular separations, where N is the length of the input arrays. Each entry (i, j) in the output is the angular separation between the coordinate pair (ra_rad[i], dec_rad[i]) and (ra_rad[j], dec_rad[j]).
- Parameters:
ra_rad (numpy.ndarray) – 1D array of right ascensions in radians, of length N.
dec_rad (numpy.ndarray) – 1D array of declinations in radians, of length N.
- Returns:
sep_rad – NxN matrix (2D array) of pairwise angular separations in radians.
- Return type:
numpy.ndarray
Notes
The spherical distance formula used is:
- cos(theta) = sin(dec1) * sin(dec2)
cos(dec1) * cos(dec2) * cos(ra1 - ra2)
where (ra1, dec1) and (ra2, dec2) are coordinate pairs in radians.
- argus.gravitational_waves.hellings_downs(θ)[source]
Compute the Hellings–Downs function for an angle θ (in radians).
- Parameters:
θ (np.ndarray or float) – Angular separation between pulsars in radians
- Returns:
Hellings-Downs correlation values
- Return type:
np.ndarray or float
- class argus.gravitational_waves.GW(universe_i, PTA)[source]
Bases:
objectFor a population of M black holes, calculate the per-pulsar redshift timeseries a^{(n)}(t).
- Parameters:
universe_i – the realisation of the universe, i.e. the BH-BH population
PTA – The PTA configuration used to observe the GWs from the BH-BH population
argus.inference_runners
argus.io_manager
I/O and file management utilities for the argus package.
- argus.io_manager.setup_output_directory(config, use_gw, timestamp=None)[source]
Set up output directory for the inference run.
- Parameters:
config – Configuration object
use_gw (bool) – Whether to include gravitational wave model
timestamp (str) – Optional timestamp to use for output directory
- Returns:
str
- Return type:
output_dir path
- argus.io_manager.copy_config_file(config_path, output_dir, logger)[source]
Copy configuration file to output directory.
- Parameters:
config_path (str) – Path to the configuration file
output_dir (str) – Output directory path
logger – Logger object
- Returns:
str
- Return type:
Path to copied config file
- argus.io_manager.save_numpyro_results(inf_data, output_dir, output_id, logger)[source]
Save NumPyro/ArviZ results.
- Parameters:
inf_data – ArviZ InferenceData object
output_dir – Output directory path
output_id – Output identifier for naming
logger – Logger object
- Returns:
str
- Return type:
Path to saved results file
- argus.io_manager.save_jaxns_results(ns, termination_reason, state, output_dir, output_id, logger)[source]
Save the JAXNS nested sampling results.
- Parameters:
ns – NestedSampler object
termination_reason – Termination reason from sampling
state – Final state from sampling
output_dir – Output directory path
output_id – Output identifier for naming
logger – Logger object
- Returns:
str
- Return type:
Path to saved results file
- argus.io_manager.setup_single_logger(config, output_dir=None, enable_file_logging=True)[source]
Set up a single, properly configured logger for the entire application.
This function creates a centralized logger that eliminates duplicate messages and provides consistent logging throughout the application. It supports both console and file logging.
- Parameters:
config – Configuration object
output_dir (str, optional) – Directory for log files. Required if enable_file_logging=True
enable_file_logging (bool) – Whether to enable file logging. Default True.
- Returns:
logging.Logger
- Return type:
Configured logger instance for the entire application
- Raises:
ValueError – If enable_file_logging=True but output_dir is None:
- argus.io_manager.get_argus_logger()[source]
Get the centralized argus logger.
This function provides consistent access to the main application logger throughout the codebase. The logger should be initialized first using setup_single_logger().
- Returns:
logging.Logger
- Return type:
The centralized argus logger
- Raises:
RuntimeError – If the logger hasn’t been initialized with setup_single_logger():
- argus.io_manager.setup_console_logging(config)[source]
Set up console-only logging.
DEPRECATED: Use setup_single_logger() instead for centralized logging. This function is kept for backward compatibility.
- Parameters:
config – Configuration object
- Returns:
logging.Logger
- Return type:
Configured logger instance