PYRA is a Python wrapper designed to facilitate and optimize the use of MiRA (Multi-aperture Image Reconstruction Algorithm), developed by the JMMC. This tool enables efficient and random scanning of the parameter space for image reconstruction.
Requirements:
- MiRA
- Python 3.8+
- Linux/Ubuntu environment
PYRA helps automate and enhance MiRA's functionality by exploring key parameters related to image reconstruction. The parameters scanned include:
- Pixel size
- Field of View (FoV)
- Hyperparameter (( \mu ))
- Regularization-specific parameters:
- For Compactness: gamma (FWHM of the prior distribution of light)
- For Hyperbolic: tau (edge-preserving threshold)
These parameters are selected within specific intervals, ensuring compatibility with interferometric observations.
Parameter Search Intervals
- Pixel Size ((\text{pixelsize}))
Defined by the interferometric resolution:
[λ_min / 6B_max, λ_min / 2B_max]
The pixelsize search interval is defined based on the interferometric resolution of the user observations. Assuming the hyper-resolution to be lambda_min/4B_max, and knowing that to avoid aliasing issue, MiRA does not accept pixelsize larger than lambda_min/2B_max, the parameter is randomly chosen in between [lambda/6B, lambda/2B]. By experience, it is useful also to probe smaller pixelsize than the interferometric pixel-size at lambda/4B that is why lambda/6B is used,
- Field of View (FoV)
Defined based on the interferometric field of view:
[0.7 × FoV, 1 × FoV]
The FoV search interval is defined based on the interferometric field of view of the user observations defined as FoV=lambda_max/B_min. The parameter is then randomly chosen in between [0.7FoV,1FoV],
- Tau ((\tau))
Edge-preserving threshold for hyperbolic regularization:
[(pixelsize/FoV)^2 × 10^-4, (pixelsize/FoV)^2 × 10^4]
The tau (edge preserving threshold), if we assume an uniform image, the mean pixel value should be equal to flux*(pixelsize/FoV)^2, assuming a nromalized flux, we have then (pixelsize/FoV)^2. So this value is used as the lower boundary of the interval. The higher boundary has been arbitrarly defined as (pixelsize/FoV)^2 * 10^4. So the tau value is randomly searched in between [(pixelsize/FoV)^210^-4, (pixelsize/FoV)^210^4],
- Gamma ((\gamma))
FWHM of prior light distribution for compactness regularization:
[0.3 × FoV, 0.8 × FoV]
The gamma (full width at half maximum (FWHM) of the prior distribution of light), the boundary as been arbitraly defined as: [0.3FoV,0.8FoV].
- Hyperparameter ((\mu))
Weight for the regularization function in the total chi-square minimization:
Typically
[10^3, 10^9]
The hyperparameter (mu) is the weight given to the regularization function in the given formula for the chi2 minimization: chi2_TOT = chi2_DATA + mu*f_regularization. The mu interval is defined by the user but the ideal value is usually between 10^2 and 10^6. We usually first want to scan in between [10^3,10^9] to have a broad overview of the impact of our hyperparameter on the output of the image reconstruction.
The primary script contains variables you need to configure before running. Below is a list of key variables and their purposes:
| Variable | Description |
|---|---|
path_data |
Full path to the .fits file containing observations. If multiple .fits files exist, merge them before running the script (e.g., using Python or OIFits Explorer). |
path_results_tmp |
Path to the directory for storing results. |
target_name |
Subfolder name where outputs will be stored. |
num_cores |
Number of CPU cores dedicated to the routine. |
iter_rec |
Number of parameter sets to generate. For example, hyperparameters_numb=10 and iter_rec=100 will generate 1,000 models. |
pix_min_factor, pix_max_factor |
Define the bounds of minimum and maximum factor to which you mulitply the minimum pixelsize defined as the interferometric pixelsize lambda_min/2B_max. Ex: 1/2,1 will probe the parameterspace in between 1/2xlambda/2B and 1xlambda/2B |
FoV_min_factor, FoV_max_factor |
Define the bounds of minimum and maximum factor to which you mulitply the interferometric field of view defined as lambda_max/B_min. Ex: 1,1.5 will probe the parameterspace in between 1/2xlambda/B and 1xlambda/B |
h_min, h_max |
Define the bounds of the hyperparameter space as powers of 10. Ex: 3,7 will probe the hyperparameter space in between 10^3 and 10^7. |
compactness_min_factor, compactness_max_factor |
Define the bounds of the regularization parameter space for the compactness regularization which corresponds to the FHWM of the gaussian in which the flux will be constrained in term of fraction of the FoV. Ex: 0.3,0.8 will search inside the FWHM parameter space in between 0.3xFoV and 0.8xFoV. |
regularization |
Choose one regularization methods among: 'compactness', 'hyperbolic' |
prior_image |
Specify the prior image: "Dirac" or a .fits file containing the model image. |
maxeval |
Maximum number of evaluations for MiRA to stop if convergence is not achieved (default: 50). |
- Configure the above variables in the script.
- Run the script:
python3 OBJECT_INSTRU_MiRA_v3.pyResults are stored in subfolders within path_results_tmp, organized by:
- Regularization methods
- Parameter values
Visualizations in the ALL_IMAGES folder include:
- Reconstructed images
- Beam-convolved images
- Comparisons of reconstructed vs. observed visibilities
- Residuals of squared visibilities