How astro313/uvmcmcfit works
Main Components Identification
• Input/Setup Module:
• Components: “config.yaml” (configuration file), target image, and uvfits files.
• Related utility modules: setuputil.py, py2yaml.py.
• The user’s working directory (e.g., “uvfit00”, “uvfit01”) is assumed to be the root for a particular run.
• Model Fitting Engine:
• Core processing happens in uvmcmcfit.py which orchestrates the MCMC fitting.
• Other key modules like uvmodel.py and uvutil.py assist by defining the interferometric model and utilities for data manipulation.
• lensutil.py contains functions for handling lens models (e.g., singular isothermal ellipsoid profiles) and source representations (e.g., Gaussian profiles).
• Data Handling and Utilities:
• miriadutil.py, grid.py, and checkvis.py appear to support reading or pre-processing of uvfits (visibilities) or data grid processing.
• Additional modules such as sample_vis.py, modifypdf.py, and visualutil.py provide specific functionalities such as sample visibility creation, posterior PDF modifications, or visualization assistance.
• Visualization/Output:
• Output generation for MCMC results (“posteriorpdf.fits”) is crucial.
• Documentation:
• The “docs” directory holds comprehensive Sphinx-generated documentation including both developer and user guides.
Relationships & Interactions
• User Input (via “config.yaml”, uvfits files, and images) → Setup/Configuration module.
• Setup/Configuration module → initializes and formats the input data, possibly using utilities (setuputil.py, py2yaml.py).
• Processed input data is then fed to the Model Fitting Engine (uvmcmcfit.py), which, in turn, calls various helper modules:
• uvmodel.py: constructs the theoretical model defined by the configuration.
• uvutil.py and miriadutil.py: handle data transformations and computations on the measurements.
• lensutil.py: computes lensing transformations and related modeling.
• The MCMC process iteratively refines parameter estimates and saves them into “posteriorpdf.fits”.
Architectural Patterns & Design Principles
• Modular design: The project is divided into distinct modules for configuration, data processing, model fitting, and visualization.
• Separation of concerns: Each Python file appears to address a specific task (e.g., “uvmcmcfit.py” handles the core fitting, “lensutil.py” manages lens-specific computations).
• Command-line oriented: The entire workflow is driven by scripts that expect a pre-formatted directory structure (with config.yaml and corresponding data files) and then perform batch processing.
• Reusability: The presence of multiple utility scripts (e.g., sample_vis.py, checkvis.py) suggests that functionality is encapsulated to be reused across different types of analysis.