How bayesianstellarevolution/base-cpp works
Project Type & Purpose
• Purpose: BASE-9 recovers star cluster and stellar parameters using Bayesian techniques (MCMC for cluster-level parameters and brute-force numerical integration for stellar quantities).
• Type: This is a research/scientific command-line application that leverages advanced numerical methods and simulation. It is modular in design and supports R interfacing (via the BASE9-Rcpp submodule) for easier usability in the R statistical environment.
File Structure for Architectural Components
• Core Engine (base9 directory):
• Contains the heart of the stellar and white dwarf models (e.g., various wd atmosphere/cooling models, isochrone handling, matrix operations).
• Implements key algorithms such as MCMC samplers, filters, star clustering, and transformation methods.
• Houses configuration headers, exception handling, and utility functions.
• R Interface (BASE9-Rcpp directory):
• Provides Rcpp bindings to expose core functionalities to R users. Includes R functions (R/RcppExports.R) and Rcpp generated files.
• Specialized MCMC & Simulation Modules:
• Directories such as multiPopMcmc, singlePopMcmc, sampleMass, sampleWDMass, and simCluster each contain specific executables (with their individual CMakeLists.txt files) tailored to run separate simulation tasks or MCMC implementations.
• Build & Deployment Infrastructure:
• CMakeLists.txt at the top level and within several subdirectories.
• Shell build scripts (build.sh, build_local.sh), Docker configuration, and additional deployment scripts.
• Documentation & Scripts:
• docs directory for manuals and how-to guides.
• scripts directory contains plotting, database, and analysis scripts to aid in deployment and debugging.
Main Components & Their Interactions
• Input/Configuration Module:
• Uses YAML and CMake config files (e.g., conf/base9.yaml, Base9Config.h.in) to set parameters and compile-time configurations.
• Core Computational Library:
• The base9 library provides the building blocks: stellar models, white dwarf atmosphere/cooling models, and mathematical tools.
• Modules are structured into “Models,” “Utilities,” “I/O” operations, and “Samplers.”
• MCMC and Simulation Modules:
• Independent executables such as multiPopMcmc, singlePopMcmc, sampleMass, etc., that call into the core library.
• Each of these components initializes and orchestrates the MCMC run or simulation while interacting with shared libraries.
• R Interface Layer:
• The BASE9-Rcpp submodule wraps core functionalities for R integration, allowing statistical analysis and further processing within the R ecosystem.
• External Dependencies & Libraries:
• Dependencies include GSL, Boost, and C++11 std libraries, which are used throughout the project for numerical integration, concurrency, and more.
• Build & Deployment System:
• CMake and shell/docker scripts manage the build process and packaging, ensuring consistency across environments.