Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
944d957
Merge branch 'feature/github_actions'
May 30, 2025
7b62ea9
Merge branch 'main' of github.com:rhayes777/PyAutoFit
May 30, 2025
c9d01ec
Merge branch 'main' of github.com:rhayes777/PyAutoFit
May 30, 2025
8e68af2
git ch0;10;1cMerge branch 'main' of github.com:rhayes777/PyAutoFit
May 31, 2025
d464d15
switchign use jax to config enables tests to pass
Jun 19, 2025
783a002
simplify use jax import and make jax requirmeent
Jun 20, 2025
b0e3dd9
disable warning when jax is used
Jun 20, 2025
c454b94
simplify factor jax use
Jun 20, 2025
1e12b7f
simplify jacobians
Jun 20, 2025
37e74bc
move more jax imports
Jun 20, 2025
7adc630
fix pool and erfinv imports for cleaner JAX support
Jun 20, 2025
a7bcebc
all unit tests pass due to JAX fixes
Jun 20, 2025
4f793e7
docstring of normal message complete
Jun 20, 2025
bbb00e7
beta.py docstringed
Jun 20, 2025
71e11f7
GaussianPrior updated
Jun 20, 2025
36aa2ed
removed lower_limit and upper_limit from GaussianPrior
Jun 20, 2025
7655911
remove lower_limit from all messages
Jun 20, 2025
304890b
remove limits from test_limits
Jun 20, 2025
5d85b80
remove all use of PriorLimitException
Jun 20, 2025
30d4703
remove assert_within_limits
Jun 20, 2025
0af923c
remove ignore_prior_limits
Jun 20, 2025
4b91631
limits removed rom mapping
Jun 20, 2025
2b392eb
cleaning up some tests
Jun 20, 2025
61c6179
more removal of stuff trying to ix unit tests
Jun 20, 2025
1d736b8
remove limits from more priors
Jun 20, 2025
5abfff9
identifier tests pass
Jun 20, 2025
6b97918
aggregator tests pass
Jun 20, 2025
ce38e33
remove lower limits of gaussians from more unit test sertup
Jun 20, 2025
7a9d7fe
reinstate __database_args__ in UniformPrior and LogUniformPrior
Jun 20, 2025
dd77edf
remove tests on gaussiaPrior limits being copied
Jun 20, 2025
3cc518f
fix random prior test
Jun 20, 2025
858bf83
add dict to UniformPrior and LogUniformPRior fixint tests lost via in…
Jun 20, 2025
9ca1533
all prior tests pass
Jun 20, 2025
3da4c5a
fix non linear test regression by putting assertion skip back in
Jun 23, 2025
8bfa958
readd limits to priors for prior passing
Jun 23, 2025
0a94820
fix mapper model test regression
Jun 23, 2025
6286348
pytest test_autofit/mapper/model/test_model_mapper.py
Jun 23, 2025
b1a4cd4
fix test_autofit/mapper/functionality/test_take_attributes.py
Jun 23, 2025
1894d07
test_autofit/jax/test_pytrees.py
Jun 23, 2025
7e558f6
fix test_autofit/graphical/test_unification.py
Jun 23, 2025
c3d0aef
fix test_autofit/graphical/stochastic/test_regression.py
Jun 23, 2025
354ddb8
test_autofit/graphical/regression/test_identifier.py
Jun 23, 2025
559c141
fixtest_autofit/graphical/global/test_hierarchical.py
Jun 23, 2025
1d0c226
test_autofit/graphical/gaussian/test_other_priors.py
Jun 23, 2025
6673d99
test_autofit/database/identifier/test_identifiers.py
Jun 23, 2025
49e04de
fix pytest test_autofit/aggregator/test_reference.py
Jun 23, 2025
faee773
TruncatedNormal setup
Jun 23, 2025
4281ec8
value for on truncated gaussian
Jun 23, 2025
b17abf4
TruncatedGaussianPrior full implemented, removes assert within limits…
Jun 23, 2025
172b1ff
gaussian liimts -> limits
Jun 23, 2025
5e2fac9
git checkout fea0;10;1cMerge branch 'main' of github.com:rhayes777/Py…
Jun 23, 2025
2b077c6
Merge branch 'main' into feature/truncated_gaussian
Jun 23, 2025
1d0efb0
integration tests pass
Jun 23, 2025
8c0d0cf
model absolute -> model centred absolute
Jun 23, 2025
79892f5
model relative -> model centred relative
Jun 23, 2025
a5043cf
model_bounded -> model_centred_max_lh_bounded
Jun 23, 2025
76110b2
default prior passing now just reuses original prior
Jun 23, 2025
9e51d66
fix test_autofit/non_linear/search/test_abstract_search.py
Jun 23, 2025
2c480c2
fix test_autofit/non_linear/result/test_result.py
Jun 23, 2025
d8f0f85
fix test_autofit/mapper/functionality/test_by_path.py
Jun 23, 2025
1890370
fix
Jun 23, 2025
484e59d
Merge pull request #1151 from rhayes777/feature/model_centered
Jammy2211 Jun 24, 2025
ede358a
clean up some imports
Jun 24, 2025
006e294
reudce import time by going internal
Jun 25, 2025
d0eb12f
Merge pull request #1152 from rhayes777/feature/jax_speed_up_general
Jammy2211 Jul 12, 2025
af26d35
stuff added
Jul 24, 2025
8797993
fix some unit tests and truncated gaussian log prior
Jul 30, 2025
49a3d6e
nautilus now uses batch with JAX
Jul 30, 2025
057f25c
logging
Jul 30, 2025
2adef52
spawn parallel
Aug 1, 2025
46e1f84
haphazard
Aug 7, 2025
ff79e34
PriorVectorize implemented
Aug 7, 2025
a577ce5
added unit test of vectorized with UniformPrior
Aug 7, 2025
348a662
added Gaussian, TruncatedGaussian, LogUniform to Vectorized
Aug 7, 2025
5b006c6
documentation
Aug 7, 2025
adc3445
dask stuff seems to work
Aug 11, 2025
8b24178
change to actors futrues
Aug 11, 2025
ec5f004
backup
Aug 18, 2025
524dcd5
update sampling with jax
Sep 25, 2025
ba9c01c
update nautilus
Oct 1, 2025
3aa935a
cast to float to prevent JAX arrays breaking output
Oct 2, 2025
ee9e284
latent variables now compute in JAX
Oct 2, 2025
16a400d
added samples_drawn_randomly_via_pdf_from
Oct 2, 2025
048e862
fix one latent variable test
Oct 3, 2025
d785b4f
fix all latent tests
Oct 3, 2025
33043af
implementation fully tested
Oct 3, 2025
ca56ea9
fix latent varaible thing
Oct 3, 2025
202b36a
Merge pull request #1154 from rhayes777/feature/jax_latent
Jammy2211 Oct 6, 2025
f1f8dce
fix text util
Oct 6, 2025
3b8ae47
fix test_truncated_gaussian_prior_fields
Oct 6, 2025
f44173c
fix beta message
Oct 6, 2025
50d1bb6
test_truncated_gaussian_prior
Oct 6, 2025
f85ba3c
fix weight
Oct 6, 2025
1958bb2
all unit tests pass
Oct 6, 2025
48384c3
git push
Oct 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ PyAutoFit: Classy Probabilistic Programming
.. |JOSS| image:: https://joss.theoj.org/papers/10.21105/joss.02550/status.svg
:target: https://doi.org/10.21105/joss.02550

.. image:: https://www.repostatus.org/badges/latest/active.svg
:target: https://www.repostatus.org/#active
:alt: Project Status: Active

.. image:: https://img.shields.io/pypi/pyversions/autofit
:target: https://pypi.org/project/autofit/
:alt: Python Versions

.. image:: https://img.shields.io/pypi/v/autofit.svg
:target: https://pypi.org/project/autofit/
:alt: PyPI Version

|binder| |Tests| |Build| |RTD| |JOSS|

`Installation Guide <https://pyautofit.readthedocs.io/en/latest/installation/overview.html>`_ |
Expand Down
14 changes: 9 additions & 5 deletions autofit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from autoconf.dictable import register_parser
from . import conf

conf.instance.register(__file__)

import abc
import pickle

from dill import register

from autoconf.dictable import register_parser
from .non_linear.grid.grid_search import GridSearch as SearchGridSearch
from . import conf
from . import exc
from . import mock as m
from .non_linear.grid.grid_search import GridSearch as SearchGridSearch
from .aggregator.base import AggBase
from .database.aggregator.aggregator import GridSearchAggregator
from .graphical.expectation_propagation.history import EPHistory
Expand Down Expand Up @@ -54,6 +56,8 @@
from .mapper.prior import GaussianPrior
from .mapper.prior import LogGaussianPrior
from .mapper.prior import LogUniformPrior
from .mapper.prior import TruncatedGaussianPrior
from .mapper.prior.vectorized import PriorVectorized
from .mapper.prior.abstract import Prior
from .mapper.prior.tuple_prior import TuplePrior
from .mapper.prior import UniformPrior
Expand Down Expand Up @@ -136,6 +140,6 @@ def save_abc(pickler, obj):
pickle._Pickler.save_type(pickler, obj)


conf.instance.register(__file__)


__version__ = "2025.5.10.1"
14 changes: 10 additions & 4 deletions autofit/aggregator/summary/aggregate_fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
from enum import Enum
from typing import Dict, List, Union

from astropy.table import Table
from astropy.io import fits
from pathlib import Path

from autofit.aggregator.search_output import SearchOutput
Expand Down Expand Up @@ -53,7 +51,7 @@ def __init__(self, aggregator: Union[Aggregator, List[SearchOutput]]):
def _hdus(
result: SearchOutput,
hdus: List[Enum],
) -> List[fits.ImageHDU]:
) -> "List[fits.ImageHDU]":
"""
Extract the HDUs from a given fits for a given search.

Expand All @@ -68,6 +66,8 @@ def _hdus(
-------
The extracted HDUs.
"""
from astropy.io import fits

row = []
for hdu in hdus:
source = result.value(subplot_filename(hdu))
Expand All @@ -80,7 +80,7 @@ def _hdus(
)
return row

def extract_fits(self, hdus: List[Enum]) -> fits.HDUList:
def extract_fits(self, hdus: List[Enum]) -> "fits.HDUList":
"""
Extract the HDUs from the fits files for every search in the aggregator.

Expand All @@ -95,6 +95,8 @@ def extract_fits(self, hdus: List[Enum]) -> fits.HDUList:
-------
The extracted HDUs.
"""
from astropy.io import fits

output = [fits.PrimaryHDU()]
for result in self.aggregator:
output.extend(self._hdus(result, hdus))
Expand All @@ -117,6 +119,8 @@ def extract_csv(self, filename: str) -> List[Dict]:
-------
The extracted HDUs.
"""
from astropy.table import Table

output = []
for result in self.aggregator:
output.append(Table.read(result.value(filename), format="fits"))
Expand Down Expand Up @@ -144,6 +148,8 @@ def output_to_folder(
The name of the fits file. This is the attribute of the search output that is used to name the file.
OR a list of names for each HDU.
"""
from astropy.io import fits

folder.mkdir(parents=True, exist_ok=True)

for i, result in enumerate(self.aggregator):
Expand Down
6 changes: 3 additions & 3 deletions autofit/config/general.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
jax:
use_jax: false # If True, PyAutoFit uses JAX internally, whereas False uses normal Numpy.
analysis:
n_cores: 1 # The number of cores a parallelized sum of Analysis classes uses by default.
hpc:
hpc_mode: false # If True, use HPC mode, which disables GUI visualization, logging to screen and other settings which are not suited to running on a super computer.
iterations_per_update: 5000 # The number of iterations between every update (visualization, results output, etc) in HPC mode.
inversion:
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.
reconstruction_vmax_factor: 0.5 # Plots of an Inversion's reconstruction use the reconstructed data's bright value multiplied by this factor.
model:
ignore_prior_limits: false # If ``True`` the limits applied to priors will be ignored, where limits set upper / lower limits. This stops PriorLimitException's from being raised.
reconstruction_vmax_factor: 0.5 # Plots of an Inversion's reconstruction use the reconstructed data's bright value multiplied by this factor.
output:
force_pickle_overwrite: false # If True pickle files output by a search (e.g. samples.pickle) are recreated when a new model-fit is performed.
force_visualize_overwrite: false # If True, visualization images output by a search (e.g. subplots of the fit) are recreated when a new model-fit is performed.
Expand Down
4 changes: 3 additions & 1 deletion autofit/config/output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ start_point: true
# manually after completing a successful model-fit. This will save computational run time by not computing latent
# variables during a any model-fit which is unsuccessful.

latent_during_fit: true # Whether to output the `latent.csv`, `latent.results` and `latent_summary.json` files during the fit when it performs on-the-fly output.
latent_during_fit: false # Whether to output the `latent.csv`, `latent.results` and `latent_summary.json` files during the fit when it performs on-the-fly output.
latent_after_fit: true # If `latent_during_fit` is False, whether to output the `latent.csv`, `latent.results` and `latent_summary.json` files after the fit is complete.
latent_draw_via_pdf : true # Whether to draw latent variable values via the PDF of every sample, which uses fewer samples to estimate latent variable errors. If False, latent variable values are drawn from every sample.
latent_draw_via_pdf_size : 100 # The number of samples drawn to estimate latent variable errors if `latent_draw_via_pdf` is True.
latent_csv: true # Whether to ouptut the `latent.csv` file.
latent_results: true # Whether to output the `latent.results` file.

Expand Down
6 changes: 3 additions & 3 deletions autofit/config/priors/Exponential.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
centre:
gaussian_limits:
limits:
lower: -inf
upper: inf
lower_limit: 0.0
Expand All @@ -9,7 +9,7 @@ centre:
type: Absolute
value: 20.0
normalization:
gaussian_limits:
limits:
lower: 0.0
upper: inf
lower_limit: 1.0e-06
Expand All @@ -19,7 +19,7 @@ normalization:
type: Relative
value: 0.5
rate:
gaussian_limits:
limits:
lower: 0.0
upper: inf
lower_limit: 0.0
Expand Down
6 changes: 3 additions & 3 deletions autofit/config/priors/Gaussian.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
centre:
gaussian_limits:
limits:
lower: -inf
upper: inf
lower_limit: 0.0
Expand All @@ -9,7 +9,7 @@ centre:
type: Absolute
value: 20.0
normalization:
gaussian_limits:
limits:
lower: 0.0
upper: inf
lower_limit: 1.0e-06
Expand All @@ -19,7 +19,7 @@ normalization:
type: Relative
value: 0.5
sigma:
gaussian_limits:
limits:
lower: 0.0
upper: inf
lower_limit: 0.0
Expand Down
8 changes: 4 additions & 4 deletions autofit/config/priors/Gaussian2D.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
centre_0:
gaussian_limits:
limits:
lower: -inf
upper: inf
lower_limit: 0.0
Expand All @@ -9,7 +9,7 @@ centre_0:
type: Absolute
value: 20.0
centre_1:
gaussian_limits:
limits:
lower: -inf
upper: inf
lower_limit: 0.0
Expand All @@ -19,7 +19,7 @@ centre_1:
type: Absolute
value: 20.0
normalization:
gaussian_limits:
limits:
lower: 0.0
upper: inf
lower_limit: 1.0e-06
Expand All @@ -29,7 +29,7 @@ normalization:
type: Relative
value: 0.5
sigma:
gaussian_limits:
limits:
lower: 0.0
upper: inf
lower_limit: 0.0
Expand Down
15 changes: 4 additions & 11 deletions autofit/config/priors/GaussianKurtosis.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
GaussianPrior:
lower_limit:
type: Constant
value: -inf
upper_limit:
type: Constant
value: inf
centre:
gaussian_limits:
limits:
lower: -inf
upper: inf
lower_limit: 0.0
Expand All @@ -16,7 +9,7 @@ centre:
type: Absolute
value: 20.0
kurtosis:
gaussian_limits:
limits:
lower: -inf
upper: inf
lower_limit: 0.0
Expand All @@ -26,7 +19,7 @@ kurtosis:
type: Absolute
value: 20.0
normalization:
gaussian_limits:
limits:
lower: 0.0
upper: inf
lower_limit: 1.0e-06
Expand All @@ -36,7 +29,7 @@ normalization:
type: Relative
value: 0.5
sigma:
gaussian_limits:
limits:
lower: 0.0
upper: inf
lower_limit: 0.0
Expand Down
2 changes: 1 addition & 1 deletion autofit/config/priors/MultiLevelGaussians.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
higher_level_centre:
gaussian_limits:
limits:
lower: -inf
upper: inf
lower_limit: 0.0
Expand Down
6 changes: 3 additions & 3 deletions autofit/config/priors/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ They appear as follows:
width_modifier:
type: Absolute
value: 20.0
gaussian_limits:
limits:
lower: -inf
upper: inf

Expand All @@ -28,9 +28,9 @@ The sections of this example config set the following:
When the results of a search are passed to a subsequent search to set up the priors of its non-linear search,
this entry describes how the Prior is passed. For a full description of prior passing, checkout the examples
in 'autolens_workspace/examples/complex/linking'.
gaussian_limits
limits
When the results of a search are passed to a subsequent search, they are passed using a GaussianPrior. The
gaussian_limits set the physical lower and upper limits of this GaussianPrior, such that parameter samples
limits set the physical lower and upper limits of this GaussianPrior, such that parameter samples
can not go beyond these limits.

The files ``template_module.yaml`` and ``TemplateObject.yaml`` give templates one can use to set up prior default
Expand Down
12 changes: 6 additions & 6 deletions autofit/config/priors/model.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Exponential:
centre:
gaussian_limits:
limits:
lower: -inf
upper: inf
lower_limit: 0.0
Expand All @@ -10,7 +10,7 @@ Exponential:
type: Absolute
value: 20.0
normalization:
gaussian_limits:
limits:
lower: 0.0
upper: inf
lower_limit: 1.0e-06
Expand All @@ -20,7 +20,7 @@ Exponential:
type: Relative
value: 0.5
rate:
gaussian_limits:
limits:
lower: 0.0
upper: inf
lower_limit: 0.0
Expand All @@ -31,7 +31,7 @@ Exponential:
value: 0.5
Gaussian:
centre:
gaussian_limits:
limits:
lower: -inf
upper: inf
lower_limit: 0.0
Expand All @@ -41,7 +41,7 @@ Gaussian:
type: Absolute
value: 20.0
normalization:
gaussian_limits:
limits:
lower: 0.0
upper: inf
lower_limit: 1.0e-06
Expand All @@ -51,7 +51,7 @@ Gaussian:
type: Relative
value: 0.5
sigma:
gaussian_limits:
limits:
lower: 0.0
upper: inf
lower_limit: 0.0
Expand Down
Loading
Loading