:tocdepth: 1 Modularity & Expandability ========================== Description oimodeler modules ----------------------------- As described below and shown in the diagram, **oimodeler** is a modular software: - Models are created with the :mod:`oimModel ` module and base components in :mod:`oimComponent `, which include model parameters from :mod:`oimParam `. - Interferometric data can be loaded from standard OIFITS files using the :mod:`oimData ` module. This also supports loading flux/spectra in various formats with the :func:`oimData.oimFluxData ` class, which can be optionally filtered by the :func:`oimData.oimDataFilter ` class, using filters from the :mod:`oimDataFilter ` module. - Data simulation and calculation are handled by the :mod:`oimSimulator ` module, which takes :func:`oimData.oimData ` and :func:`oimModel.oimModel ` objects as input to simulate data at the same spatial and spectral coordinates as the observations. It also computes model/data chi2. - Model fitting is performed by fitters in the :mod:`oimFitter ` module, which also takes :func:`oimData.oimData ` and :func:`oimModel.oimModel ` classes as input. - The :mod:`oimPlots ` module provides plotting functions for OIFITS data and **oimodeler** objects. - The :mod:`oimUtils ` module contains various utility functions for manipulating OIFITS data. .. image:: _static/diagram.png :alt: Alternative text oimModel ^^^^^^^^ The :mod:`oimModel ` module focuses on creating models for optical interferometry. Models are modular and consist of one or more :func:`oimComponent.oimComponent ` objects. They can generate complex coherent fluxes and images, which can then be integrated into an :func:`oimSimulator ` object and/or any fitter in the :mod:`oimFitter ` module for data analysis and modeling. See the :ref:`model` section for more details. oimComponent ^^^^^^^^^^^^ The :mod:`oimComponent ` module manages model components that can be defined analytically in the Fourier plan (e.g., Uniform Disks, 2D Gaussian distributions) or in the image plane (useful when no analytical Fourier formula exists). An :mod:`oimComponent ` can also wrap external code, such as functions computing images, radial profiles, or hyperspectral cubes, or image-fit files (e.g., from radiative transfer models). Additionally, components can be easily inherited to create new custom components. oimParam ^^^^^^^^ The :mod:`oimParam ` module contains basic model parameters. Its :func:`oimParam.oimParam ` class defines component parameters (based on base classes from the :mod:`oimComponent ` module). It also includes parameter linkers (:func:`oimParam.oimParamLinker `), normalizers (:func:`oimParam.oimParamNormalize `), and advanced interpolators (:func:`oimParam.oimParamInterpolator `) that enable building chromatic and time-dependent models. oimData ^^^^^^^ The :mod:`oimData` module allows to encapsulate interferometric (also photometric and spectroscopic) data. The :func:`oimData.oimData ` class contains the original OIFITS data as a list of `astropy.io.fits.hdulist `_ but also provide optimization of the data as vector/structure for faster model fitting. oimFluxData ^^^^^^^^^^^ The :mod:`oimData ` module encapsulates interferometric, photometric, and spectroscopic data. The :func:`oimData.oimData ` class holds the original OIFITS data as a list of `astropy.io.fits.hdulist `_ objects and also provides optimized data structures (vectors) for faster model fitting. oimDataFilter ^^^^^^^^^^^^^ The :mod:`oimDataFilter ` module handles filtering and modifying data within :func:`oimData.oimData ` classes. It supports data selection (truncation, array removal, flagging) based on criteria like wavelength or SNR, as well as data manipulation methods such as smoothing, binning, and error computation. oimSimulator ^^^^^^^^^^^^ The :mod:`oimSimulator ` module is the core for comparing models (:func:`oimModel.oimModel `) and data (:func:`oimData.oimData `). It simulates datasets with matching quantities and spatial/spectral coordinates from both data and model. It also computes :math:`\chi^2_r` for comparison. The :func:`oimSimulator.oimSimulator ` class is fully compatible with OIFITS2 and can simulate any data type from an OIFITS file (e.g., VIS2DATA, VISAMP in absolute, differential, and correlated flux). oimFitter ^^^^^^^^^ The :mod:`oimFitter ` module is dedicated to model fitting. The parent class :func:`oimFitter.oimFitter ` is an abstract class to be inherited for implementing various fitters. Current fitters include an MCMC sampler based on the popular emcee library, a simple grid search, and a minimizer using the scipy minimize function. oimPlots ^^^^^^^^ The :mod:`oimPlots ` module provides plotting tools for OIFITS data and **oimodeler** objects. The :func:`oimPlots.oimAxes ` subclass extends `matplotlib.pyplot.Axes `_ with methods tailored to plot OIFITS data from the `astropy.io.fits.hdulist `_ format. oimUtils ^^^^^^^^ The :mod:`oimUtils ` module contains functions to manipulate OIFITS data, such as: - Retrieving baseline names, lengths, orientations, and spatial frequencies - Creating new OIFITS arrays in `astropy.io.fits.hdulist `_ format and more. Expandability ------------- **oimodeler** is designed for easy implementation of new model components, fitters, data filters, parameter interpolators, data importers (e.g., for non-OIFITS formats), and plotting tools. Feel free to contact `Anthony Meilland `_ if you develop custom features and would like them included in the **oimodeler** distribution. Alternatively, submit a pull request on the `GitHub repository `_ and become an **oimodeler** contributor. For bug reports and feature requests, please use the `GitHub issue tracker `_.