Skip to content

Commit 1c077f6

Browse files
authored
Revert "Jax to Main!"
1 parent f4d8891 commit 1c077f6

126 files changed

Lines changed: 1143 additions & 3014 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.rst

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,6 @@ PyAutoFit: Classy Probabilistic Programming
1717
.. |JOSS| image:: https://joss.theoj.org/papers/10.21105/joss.02550/status.svg
1818
:target: https://doi.org/10.21105/joss.02550
1919

20-
.. image:: https://www.repostatus.org/badges/latest/active.svg
21-
:target: https://www.repostatus.org/#active
22-
:alt: Project Status: Active
23-
24-
.. image:: https://img.shields.io/pypi/pyversions/autofit
25-
:target: https://pypi.org/project/autofit/
26-
:alt: Python Versions
27-
28-
.. image:: https://img.shields.io/pypi/v/autofit.svg
29-
:target: https://pypi.org/project/autofit/
30-
:alt: PyPI Version
31-
3220
|binder| |Tests| |Build| |RTD| |JOSS|
3321

3422
`Installation Guide <https://pyautofit.readthedocs.io/en/latest/installation/overview.html>`_ |

autofit/__init__.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
from autoconf.dictable import register_parser
2-
from . import conf
3-
4-
conf.instance.register(__file__)
5-
61
import abc
72
import pickle
3+
84
from dill import register
95

6+
from autoconf.dictable import register_parser
7+
from .non_linear.grid.grid_search import GridSearch as SearchGridSearch
8+
from . import conf
109
from . import exc
1110
from . import mock as m
12-
from .non_linear.grid.grid_search import GridSearch as SearchGridSearch
1311
from .aggregator.base import AggBase
1412
from .database.aggregator.aggregator import GridSearchAggregator
1513
from .graphical.expectation_propagation.history import EPHistory
@@ -56,8 +54,6 @@
5654
from .mapper.prior import GaussianPrior
5755
from .mapper.prior import LogGaussianPrior
5856
from .mapper.prior import LogUniformPrior
59-
from .mapper.prior import TruncatedGaussianPrior
60-
from .mapper.prior.vectorized import PriorVectorized
6157
from .mapper.prior.abstract import Prior
6258
from .mapper.prior.tuple_prior import TuplePrior
6359
from .mapper.prior import UniformPrior
@@ -140,6 +136,6 @@ def save_abc(pickler, obj):
140136
pickle._Pickler.save_type(pickler, obj)
141137

142138

143-
139+
conf.instance.register(__file__)
144140

145141
__version__ = "2025.5.10.1"

autofit/aggregator/summary/aggregate_fits.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from enum import Enum
33
from typing import Dict, List, Union
44

5+
from astropy.table import Table
6+
from astropy.io import fits
57
from pathlib import Path
68

79
from autofit.aggregator.search_output import SearchOutput
@@ -51,7 +53,7 @@ def __init__(self, aggregator: Union[Aggregator, List[SearchOutput]]):
5153
def _hdus(
5254
result: SearchOutput,
5355
hdus: List[Enum],
54-
) -> "List[fits.ImageHDU]":
56+
) -> List[fits.ImageHDU]:
5557
"""
5658
Extract the HDUs from a given fits for a given search.
5759
@@ -66,8 +68,6 @@ def _hdus(
6668
-------
6769
The extracted HDUs.
6870
"""
69-
from astropy.io import fits
70-
7171
row = []
7272
for hdu in hdus:
7373
source = result.value(subplot_filename(hdu))
@@ -80,7 +80,7 @@ def _hdus(
8080
)
8181
return row
8282

83-
def extract_fits(self, hdus: List[Enum]) -> "fits.HDUList":
83+
def extract_fits(self, hdus: List[Enum]) -> fits.HDUList:
8484
"""
8585
Extract the HDUs from the fits files for every search in the aggregator.
8686
@@ -95,8 +95,6 @@ def extract_fits(self, hdus: List[Enum]) -> "fits.HDUList":
9595
-------
9696
The extracted HDUs.
9797
"""
98-
from astropy.io import fits
99-
10098
output = [fits.PrimaryHDU()]
10199
for result in self.aggregator:
102100
output.extend(self._hdus(result, hdus))
@@ -119,8 +117,6 @@ def extract_csv(self, filename: str) -> List[Dict]:
119117
-------
120118
The extracted HDUs.
121119
"""
122-
from astropy.table import Table
123-
124120
output = []
125121
for result in self.aggregator:
126122
output.append(Table.read(result.value(filename), format="fits"))
@@ -148,8 +144,6 @@ def output_to_folder(
148144
The name of the fits file. This is the attribute of the search output that is used to name the file.
149145
OR a list of names for each HDU.
150146
"""
151-
from astropy.io import fits
152-
153147
folder.mkdir(parents=True, exist_ok=True)
154148

155149
for i, result in enumerate(self.aggregator):

autofit/config/general.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
jax:
2-
use_jax: false # If True, PyAutoFit uses JAX internally, whereas False uses normal Numpy.
31
analysis:
42
n_cores: 1 # The number of cores a parallelized sum of Analysis classes uses by default.
53
hpc:
64
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.
75
iterations_per_update: 5000 # The number of iterations between every update (visualization, results output, etc) in HPC mode.
86
inversion:
97
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.
10-
reconstruction_vmax_factor: 0.5 # Plots of an Inversion's reconstruction use the reconstructed data's bright value multiplied by this factor.
8+
reconstruction_vmax_factor: 0.5 # Plots of an Inversion's reconstruction use the reconstructed data's bright value multiplied by this factor.
9+
model:
10+
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.
1111
output:
1212
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.
1313
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.

autofit/config/output.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,8 @@ start_point: true
8686
# manually after completing a successful model-fit. This will save computational run time by not computing latent
8787
# variables during a any model-fit which is unsuccessful.
8888

89-
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.
89+
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.
9090
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.
91-
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.
92-
latent_draw_via_pdf_size : 100 # The number of samples drawn to estimate latent variable errors if `latent_draw_via_pdf` is True.
9391
latent_csv: true # Whether to ouptut the `latent.csv` file.
9492
latent_results: true # Whether to output the `latent.results` file.
9593

autofit/config/priors/Exponential.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
centre:
2-
limits:
2+
gaussian_limits:
33
lower: -inf
44
upper: inf
55
lower_limit: 0.0
@@ -9,7 +9,7 @@ centre:
99
type: Absolute
1010
value: 20.0
1111
normalization:
12-
limits:
12+
gaussian_limits:
1313
lower: 0.0
1414
upper: inf
1515
lower_limit: 1.0e-06
@@ -19,7 +19,7 @@ normalization:
1919
type: Relative
2020
value: 0.5
2121
rate:
22-
limits:
22+
gaussian_limits:
2323
lower: 0.0
2424
upper: inf
2525
lower_limit: 0.0

autofit/config/priors/Gaussian.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
centre:
2-
limits:
2+
gaussian_limits:
33
lower: -inf
44
upper: inf
55
lower_limit: 0.0
@@ -9,7 +9,7 @@ centre:
99
type: Absolute
1010
value: 20.0
1111
normalization:
12-
limits:
12+
gaussian_limits:
1313
lower: 0.0
1414
upper: inf
1515
lower_limit: 1.0e-06
@@ -19,7 +19,7 @@ normalization:
1919
type: Relative
2020
value: 0.5
2121
sigma:
22-
limits:
22+
gaussian_limits:
2323
lower: 0.0
2424
upper: inf
2525
lower_limit: 0.0

autofit/config/priors/Gaussian2D.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
centre_0:
2-
limits:
2+
gaussian_limits:
33
lower: -inf
44
upper: inf
55
lower_limit: 0.0
@@ -9,7 +9,7 @@ centre_0:
99
type: Absolute
1010
value: 20.0
1111
centre_1:
12-
limits:
12+
gaussian_limits:
1313
lower: -inf
1414
upper: inf
1515
lower_limit: 0.0
@@ -19,7 +19,7 @@ centre_1:
1919
type: Absolute
2020
value: 20.0
2121
normalization:
22-
limits:
22+
gaussian_limits:
2323
lower: 0.0
2424
upper: inf
2525
lower_limit: 1.0e-06
@@ -29,7 +29,7 @@ normalization:
2929
type: Relative
3030
value: 0.5
3131
sigma:
32-
limits:
32+
gaussian_limits:
3333
lower: 0.0
3434
upper: inf
3535
lower_limit: 0.0

autofit/config/priors/GaussianKurtosis.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
GaussianPrior:
2+
lower_limit:
3+
type: Constant
4+
value: -inf
5+
upper_limit:
6+
type: Constant
7+
value: inf
18
centre:
2-
limits:
9+
gaussian_limits:
310
lower: -inf
411
upper: inf
512
lower_limit: 0.0
@@ -9,7 +16,7 @@ centre:
916
type: Absolute
1017
value: 20.0
1118
kurtosis:
12-
limits:
19+
gaussian_limits:
1320
lower: -inf
1421
upper: inf
1522
lower_limit: 0.0
@@ -19,7 +26,7 @@ kurtosis:
1926
type: Absolute
2027
value: 20.0
2128
normalization:
22-
limits:
29+
gaussian_limits:
2330
lower: 0.0
2431
upper: inf
2532
lower_limit: 1.0e-06
@@ -29,7 +36,7 @@ normalization:
2936
type: Relative
3037
value: 0.5
3138
sigma:
32-
limits:
39+
gaussian_limits:
3340
lower: 0.0
3441
upper: inf
3542
lower_limit: 0.0

autofit/config/priors/MultiLevelGaussians.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
higher_level_centre:
2-
limits:
2+
gaussian_limits:
33
lower: -inf
44
upper: inf
55
lower_limit: 0.0

0 commit comments

Comments
 (0)