PyAutoNervesBoard

Signal. Connect. Understand.

PyAutoArray · autoarray/config/

← all sources · library · 4 files · 136 lines · GitHub

(top level) (2)

general.yaml

28 lines · 28 keys · settings · 20 used · 7 section-read · 1 unused · GitHub

psfinversionnumbastructures
source (28 lines)
1psf:2  use_fft_default: true              # If True, PSFs are convolved using FFTs by default, which is faster and uses less memory in all cases except for very small PSFs, False uses direct convolution.3inversion:4  check_reconstruction: true          # If True, the inversion's reconstruction is checked to ensure the solution of a meshs's mapper is not an invalid solution where the values are all the same.5  use_positive_only_solver: true      # If True, inversion's use a positive-only linear algebra solver by default, which is slower but prevents unphysical negative values in the reconstructed solutuion.6  use_edge_zeroed_pixels : true       # If True, the edge pixels of a pixelization are set to zero, which prevents unphysical values in the reconstructed solution at the edge of the pixelization. NOTE: this is applied ONLY when use_positive_only_solver is True -- with the positive-negative solver it has no effect. That scoping is deliberate, not an oversight.7  no_regularization_add_to_curvature_diag_value : 1.0e-3 # The default value added to the curvature matrix's diagonal when regularization is not applied to a linear object, which prevents inversion's failing due to the matrix being singular.8  use_border_relocator: false          # If True, by default a pixelization's border is used to relocate all pixels outside its border to the border.9  nnls_jacobi_preconditioning: true   # If True (default), the curvature matrix passed to jaxnnls.solve_nnls_primal is Jacobi-preconditioned (D Q D y = D q, x = D y). Fixes NaN backward-pass gradients on ill-conditioned Q and roughly halves forward solve time. Set False to restore the raw unpreconditioned solve.10  nnls_target_kappa: 1.0e-11          # Central-path relaxation parameter passed to jaxnnls.solve_nnls_primal. Larger values smooth the relaxed-KKT backward pass and prevent NaN gradients on ill-conditioned Q; smaller values tighten the primal solve. Verified finite gradients across all MGE/rectangular/delaunay pipelines (imaging + interferometer) with scale invariance over 5 orders of magnitude in noise. jaxnnls's own default (1e-3) is too aggressive for the backward pass. The relaxed solve must start from an iterate whose complementarity s*z is not far above this value; the "raw" no-mapper mode polishes its forward iterate to ensure that (PyAutoArray#573).11  nnls_preconditioning_no_mapper: raw # How the JAX positive-only PDIP solve scales inversions with NO mapper (linear light profiles / MGE only). "raw" (default) runs the forward solve on the un-preconditioned system with a data-scaled KKT tolerance (1e-2 * n * eps * max(1, max|data_vector|)) and keeps the Jacobi-space relaxed-KKT gradient, whose relaxed solve starts from the forward iterate polished by <= 10 tight warm-started PDIP iterations on the Jacobi system (without the polish the loose forward tolerance leaves s*z far above nnls_target_kappa and the relaxed solve diverged to NaN gradients on 4/16 jax_grad/mge.py points, PyAutoArray#573); "jacobi" uses the Jacobi-preconditioned solve. Jacobi scaling of signal-free MGE columns (diagonal = the no-regularization floor) made the PDIP dual diverge on 14/48 SLaM source_lp[1] points (PyAutoArray#571). Inversions with a mapper always use jacobi; the NumPy path is unaffected.12  nnls_warm_start_memo: true         # If True (default), the NumPy/numba positive-only (fnnls) solve warm-starts its active set from the previous likelihood evaluation's passive set, cutting active-set iterations on successive sampler evaluations. The NNLS optimum is unique so the reconstruction is unchanged. On by default as of PyAutoArray#498, measured on the euclid+hst Delaunay-1250 fiducial (9.9x / 4.0x fewer active-set iterations on successive evaluations, reconstruction unchanged). Set false, or AUTOARRAY_NNLS_WARM_START=0, to disable. JAX path unaffected.13  nnls_warm_start_error_tolerance: 1.5 # Relative quality guard on a warm-start memo seed. Each memo entry remembers the error fraction of the most recent dense-sign-started solve for that key; a seeded solve whose own error fraction exceeds this multiple of that reference is dropped, so the next solve restarts from the dense-sign start and refreshes the reference. Default 1.5 sits above the worst seed/dense error-fraction ratio seen in the PyAutoArray#498 32-cell robustness matrix (1.42), so it is protective against unmeasured regimes rather than flapping. Any non-finite or non-positive value (e.g. .inf) disables the guard. NumPy/numba fnnls path only.14  positive_only_solver: pdip          # Which solver the JAX (xp=jnp) positive-only reconstruction uses. "pdip" (default) is the jaxnnls interior-point solve; "certified" is the certified active-set solve (budgeted masked-Cholesky passes that stop once the KKT conditions certify, exact implicit gradient, PDIP fallback), measured 1.2-2.6x faster on source-only inversions (PyAutoArray#566). Applied only to mapper-only JAX inversions (MGE / linear light profiles keep PDIP); the NumPy path always uses fnnls. Opt-in until the batched (vmap) policy is measured.15  certified_pass_budget: 16           # Maximum restricted active-set passes of the "certified" solver. Measured passes to certification: rectangular <= 11, Delaunay <= 7; the loop exits at certification so unused budget is free.16  certified_fallback: pdip            # What an uncertified (budget-exhausted) "certified" solve returns: "pdip" runs the PDIP solve instead (via lax.cond -- under vmap both solvers then run for every lane), "none" returns the last uncertified iterate.17  certified_tau_rel: 1.0e-9           # Relative KKT tolerance of the "certified" solver: primal violation x < -tau*max|x|, dual violation g < -tau*max|q|.18  reconstruction_vmax_factor: 0.5     # Plots of an Inversion's reconstruction use the reconstructed data's bright value multiplied by this factor.19  log_det_method: cholesky            # How the Bayesian-evidence log-determinant terms are computed. "cholesky" (default) is the historical 2*sum(log(diag(cholesky(M)))); "slogdet" uses logabsdet of slogdet(M), which is identical where M is positive-definite but finite (not NaN) where the Cholesky fails, for gradient-based searches (opt-in, non-default; does not change the default evidence). Under "slogdet" the kernel regularization schemes (Matern/Gaussian/Exponential) also compute the regularization log-det analytically from a Cholesky of their covariance instead of factorizing the formed inverse. See PyAutoArray#391.20  regularization_term_method: matmul  # How the Bayesian-evidence regularization term s^T H s is computed. "matmul" (default) is the historical s @ (H @ s) against the explicitly formed regularization matrix; "cho_solve" evaluates coefficient * s^T C^-1 s for the kernel schemes (Matern/Gaussian/Exponential/MaternAdapt) via one Cholesky solve of their covariance C, avoiding the explicit inverse whose round-off is amplified by cond(C) (~1e9 on clustered traced mesh vertices). Opt-in, non-default; does not change the default evidence. Schemes with no such factorization fall back to the formed matrix.21  interferometer_numba_nnz_per_source_max: 60.0 # Geometry gate for the numba `direct_conv` interferometer curvature path, in mean non-zeros per source column (mapper.pix_sizes_for_sub_slim_index.sum() / mapper.params). At or below this the factory routes a NumPy (xp=np) single-mapper interferometer inversion to InversionInterferometerSparseNumba, which is 2-7x faster than the JAX/FFT route while the mapping operator stays sparse; above it the FFT route wins and is used. Measured crossovers are ~60 (Delaunay) and ~77 (rectangular) on the reference CPU (autolens_profiling#226 verdict section 2) -- this is a machine-dependent constant, so re-measure before tuning. Set 0 to disable the numba path entirely.22numba:23  use_numba: true unused24  cache: true25  nopython: true26  parallel: false27structures:28  native_binned_only: false           # If True, data structures are only stored in their native and binned format. This is used to reduce memory usage in autocti.

logging.yaml

17 lines · 14 keys · settings · 0 used · 14 section-read · 0 unused · GitHub

versiondisable_existing_loggershandlersrootformatters
source (17 lines)
1version: 12disable_existing_loggers: false34handlers:5  console:6    class: logging.StreamHandler7    level: INFO8    stream: ext://sys.stdout9    formatter: formatter1011root:12  level: INFO13  handlers: [ console ]1415formatters:16  formatter:17    format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'

visualize (2)

visualize/general.yaml

56 lines · 56 keys · settings · 22 used · 34 section-read · 0 unused · GitHub

generalinversionzoomunitscolormaptickscontourcolorbarmat_plot
source (56 lines)
1general:2  backend: default                      # The matplotlib backend used for visualization. `default` uses the system default, can specify specific backend (e.g. TKAgg, Qt5Agg, WXAgg).3  dpi: 150                              # Resolution in dots per inch used when saving figures. Lower values reduce file size (e.g. 150 gives ~50% smaller files than 300 with negligible quality loss for diagnostic subplots).4  imshow_origin: upper                  # The `origin` input of `imshow`, determining if pixel values are ascending or descending on the y-axis.5  log10_min_value: 1.0e-4               # If negative values are being plotted on a log10 scale, values below this value are rounded up to it (e.g. to remove negative values).6  log10_max_value: 1.0e99               # If positive values are being plotted on a log10 scale, values above this value are rounded down to it.7  zoom_around_mask: true                # If True, plots of data structures with a mask automatically zoom in the masked region.8  output_format: show                   # Default output format: "show" displays the figure interactively via plt.show(), "png"/"pdf"/etc. saves to file.9inversion:10  reconstruction_vmax_factor: 0.511  total_mappings: 5                     # The maximum number of source clumps drawn by subplot_mappings.12  mappings_threshold: 0.5               # A source pixel joins a clump if its reconstructed value exceeds this fraction of the reconstruction's maximum.13  mappings_min_pixels: 3                # Connected groups of source pixels smaller than this are not drawn as a clump.14zoom:15  plane_percent: 0.0116  inversion_percent: 0.01               # Plots of an Inversion's reconstruction use the reconstructed data's bright value multiplied by this factor.17units:18  use_scaled: true                      # Whether to plot spatial coordinates in scaled units computed via the pixel_scale (e.g. arc-seconds) or pixel units by default.19  cb_unit: $\,\,\mathrm{e^{-}}\,\mathrm{s^{-1}}$ # The string or latex unit label used for the colorbar of the image, for example electrons per second.20  scaled_symbol: '"'                    # The symbol used when plotting spatial coordinates computed via the pixel_scale (e.g. for Astronomy data this is arc-seconds).21  unscaled_symbol: pix                  # The symbol used when plotting spatial coordinates in unscaled pixel units.22colormap: autoarray               # Default colormap for 2D plots. Use any matplotlib name to override (e.g. jet, viridis).23ticks:24  extent_factor_2d: 0.75  # Fraction of half-extent used for 2D tick positions (< 1.0 pulls ticks inward from edges).25  number_of_ticks_2d: 3   # Number of ticks on each spatial axis of 2D plots.26  symbol_over_decimal: false  # If true, place the arcsec double-prime symbol over the decimal point, e.g. 3.″8, instead of after the value, e.g. 3.8".27  minus_in_math: false  # If true, render negative tick labels with the Unicode/math minus sign (U+2212) instead of an ASCII hyphen (U+002D), e.g. −0.″05 instead of -0.″05.28contour:29  total_contours: 10       # Number of contour levels drawn over log10 (and explicit linear) plots.30  include_values: true     # Whether to label each contour line with its value.31colorbar:32  fraction: 0.047          # Fraction of original axes to use for the colorbar.33  pad: 0.01                # Padding between colorbar and axes.34  labelrotation: 90        # Rotation of colorbar tick labels in degrees.35  labelsize: 16            # Font size of colorbar tick labels for single-panel figures.36  labelsize_subplot: 16    # Font size of colorbar tick labels for subplot panels.37mat_plot:38  figure:39    figsize: (7, 7)                     # Default figure size. Override via aplt.Figure(figsize=(...)).40    subplot_shape_to_figsize_factor: (6, 6)  # Per-panel size factor for subplots. figsize = (cols*fx, rows*fy).41  title:42    fontsize: 24                        # Default title font size for single-panel figures.43  title_subplot:44    fontsize: 20                        # Default title font size for subplot panels.45  yticks:46    fontsize: 22                        # Default y-tick font size. Override via aplt.YTicks(fontsize=...).47  yticks_subplot:48    fontsize: 22                        # Default y-tick font size for subplot panels.49  xticks:50    fontsize: 22                        # Default x-tick font size. Override via aplt.XTicks(fontsize=...).51  xticks_subplot:52    fontsize: 22                        # Default x-tick font size for subplot panels.53  ylabel:54    fontsize: 16                        # Default y-label font size. Override via aplt.YLabel(fontsize=...).55  xlabel:56    fontsize: 16                        # Default x-label font size. Override via aplt.XLabel(fontsize=...).

visualize/plots.yaml

35 lines · 30 keys · settings · 1 used · 29 section-read · 0 unused · GitHub

datasetimagingfitfit_imaginginversionfit_interferometer
source (35 lines)
1# The `plots` section customizes every image that is output to hard-disk during a model-fit.23# For example, if `plots: fit: subplot_fit=True``, the ``fit_dataset.png`` subplot file will 4# be plotted every time visualization is performed.56dataset:                                   # Settings for plots of all datasets (e.g. Imaging, Interferometer).7  subplot_dataset: true                    # Plot subplot containing all dataset quantities (e.g. the data, noise-map, etc.)?8imaging:                                   # Settings for plots of imaging datasets (e.g. Imaging)9   psf: false10fit:                                       # Settings for plots of all fits (e.g. FitImaging, FitInterferometer).11  subplot_fit: true                        # Plot subplot of all fit quantities for any dataset (e.g. the model data, residual-map, etc.)?12  subplot_fit_log10: false                  # Plot subplot of all fit quantities for any dataset using log10 color maps (e.g. the model data, residual-map, etc.)?13  data: false                              # Plot individual plots of the data?14  noise_map: false                         # Plot individual plots of the noise-map?15  signal_to_noise_map: false               # Plot individual plots of the signal-to-noise-map?16  model_data: false                        # Plot individual plots of the model-data?17  residual_map: false                      # Plot individual plots of the residual-map?18  normalized_residual_map: false           # Plot individual plots of the normalized-residual-map?19  chi_squared_map: false                   # Plot individual plots of the chi-squared-map?20  residual_flux_fraction: false            # Plot individual plots of the residual_flux_fraction?21fit_imaging: {}                            # Settings for plots of fits to imaging datasets (e.g. FitImaging).22inversion:                                 # Settings for plots of inversions (e.g. Inversion).23  subplot_inversion: true                  # Plot subplot of all quantities in each inversion (e.g. reconstrucuted image, reconstruction)?24  subplot_mappings: false                  # Plot subplot of the image-to-source pixels mappings of each pixelization?25  data_subtracted: false                   # Plot individual plots of the data with the other inversion linear objects subtracted?26  reconstruction_noise_map: false          # Plot image of the noise of every mesh-pixel reconstructed value?27  sub_pixels_per_image_pixels: false       # Plot the number of sub pixels per masked data pixels?28  mesh_pixels_per_image_pixels: false      # Plot the number of image-plane mesh pixels per masked data pixels?29  image_pixels_per_mesh_pixels: false      # Plot the number of image pixels in each pixel of the mesh?30  reconstructed_operated_data: false               # Plot image of the reconstructed data (e.g. in the image-plane)?31  reconstruction: false                    # Plot the reconstructed inversion (e.g. the pixelization's mesh in the source-plane)?32  regularization_weights: false            # Plot the effective regularization weight of every inversion mesh pixel?33fit_interferometer:                        # Settings for plots of fits to interferometer datasets (e.g. FitInterferometer).34  subplot_fit_dirty_images: false          # Plot subplot of the dirty-images of all interferometer datasets?35  subplot_fit_real_space: false            # Plot subplot of the real-space images of all interferometer datasets?