Skip to content

Commit 981e15e

Browse files
Jammy2211Jammy2211claude
authored
docs: convert remaining prose .rst to MyST .md (pass 2) (#1249)
Continues the rst→md migration started in #1245. Converts: - README.rst (rewritten as plain CommonMark with inline badge links so it renders correctly on GitHub and PyPI as well as inside Sphinx; rst-to-myst's MyST-with-substitutions output renders as literal text on GitHub and PyPI) - CITATIONS.rst - 4× autofit/config/.../README.rst - test_autofit/config/non_linear/README.rst Plus infra: - pyproject.toml: readme content-type → text/markdown - MANIFEST.in: include README.md / CITATIONS.md The workspace prose references in docs/general/{configs,workspace}.md intentionally still say "README.rst" — they point at the autofit_workspace README which is not being converted in this pass. Co-authored-by: Jammy2211 <JNightingale2211@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5b3b8fd commit 981e15e

16 files changed

Lines changed: 235 additions & 268 deletions

File tree

CITATIONS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Citations & References
2+
3+
The bibtex entries for **PyAutoFit** and its affiliated software packages can be found
4+
[here](https://github.com/rhayes777/PyAutoFit/blob/main/files/citations.bib), with example text for citing **PyAutoFit**
5+
in [.tex format here](https://github.com/rhayes777/PyAutoFit/blob/main/files/citation.tex) format here and
6+
[.md format here](https://github.com/rhayes777/PyAutoFit/blob/main/files/citations.md). As shown in the examples, we
7+
would greatly appreciate it if you mention **PyAutoFit** by name and include a link to our GitHub page!
8+
9+
**PyAutoFit** is published in the [Journal of Open Source Software](https://joss.theoj.org/papers/10.21105/joss.02550#) and its
10+
entry in the above .bib file is under the key `pyautofit`.

CITATIONS.rst

Lines changed: 0 additions & 13 deletions
This file was deleted.

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# MANIFEST.in
22
exclude .gitignore
3-
include README.rst
3+
include README.md
44
include setup.cfg
5-
include CITATIONS.rst
5+
include CITATIONS.md
66
include LICENSE
77
include requirements.txt
88
include optional_requirements.txt

README.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# PyAutoFit: Classy Probabilistic Programming
2+
3+
[![Project Status: Active](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
4+
[![Python Versions](https://img.shields.io/pypi/pyversions/autofit)](https://pypi.org/project/autofit/)
5+
[![PyPI Version](https://img.shields.io/pypi/v/autofit.svg)](https://pypi.org/project/autofit/)
6+
[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PyAutoLabs/autofit_workspace/blob/2026.5.1.4/start_here.ipynb)
7+
[![Tests](https://github.com/rhayes777/PyAutoFit/actions/workflows/main.yml/badge.svg)](https://github.com/rhayes777/PyAutoFit/actions)
8+
[![Build](https://github.com/rhayes777/PyAutoBuild/actions/workflows/release.yml/badge.svg)](https://github.com/rhayes777/PyAutoBuild/actions)
9+
[![Documentation Status](https://readthedocs.org/projects/pyautofit/badge/?version=latest)](https://pyautofit.readthedocs.io/en/latest/?badge=latest)
10+
[![JOSS](https://joss.theoj.org/papers/10.21105/joss.02550/status.svg)](https://doi.org/10.21105/joss.02550)
11+
12+
[Installation Guide](https://pyautofit.readthedocs.io/en/latest/installation/overview.html) |
13+
[readthedocs](https://pyautofit.readthedocs.io/en/latest/index.html) |
14+
[Introduction on Colab](https://colab.research.google.com/github/PyAutoLabs/autofit_workspace/blob/2026.5.1.4/notebooks/overview/overview_1_the_basics.ipynb) |
15+
[HowToFit](https://github.com/PyAutoLabs/HowToFit)
16+
17+
**PyAutoFit** is a Python based probabilistic programming language for model fitting and Bayesian inference
18+
of large datasets.
19+
20+
The basic **PyAutoFit** API allows us a user to quickly compose a probabilistic model and fit it to data via a
21+
log likelihood function, using a range of non-linear search algorithms (e.g. MCMC, nested sampling).
22+
23+
Users can then set up **PyAutoFit** scientific workflow, which enables streamlined modeling of small
24+
datasets with tools to scale up to large datasets.
25+
26+
**PyAutoFit** supports advanced statistical methods, most
27+
notably [a big data framework for Bayesian hierarchical analysis](https://pyautofit.readthedocs.io/en/latest/features/graphical.html).
28+
29+
## Getting Started
30+
31+
The following links are useful for new starters:
32+
33+
- [The PyAutoFit readthedocs](https://pyautofit.readthedocs.io/en/latest), which includes an [installation guide](https://pyautofit.readthedocs.io/en/latest/installation/overview.html) and an overview of **PyAutoFit**'s core features.
34+
- [The introduction Jupyter Notebook on Colab](https://colab.research.google.com/github/PyAutoLabs/autofit_workspace/blob/2026.5.1.4/notebooks/overview/overview_1_the_basics.ipynb), where you can try **PyAutoFit** in a web browser (without installation).
35+
- [The autofit_workspace GitHub repository](https://github.com/Jammy2211/autofit_workspace), which includes example scripts demonstrating **PyAutoFit**'s features.
36+
- [The standalone HowToFit repository](https://github.com/PyAutoLabs/HowToFit), a series of Jupyter notebook lectures which give new users a step-by-step introduction to **PyAutoFit**.
37+
38+
## Support
39+
40+
Support for installation issues, help with Fit modeling and using **PyAutoFit** is available by
41+
[raising an issue on the GitHub issues page](https://github.com/rhayes777/PyAutoFit/issues).
42+
43+
We also offer support on the **PyAutoFit** [Slack channel](https://pyautoFit.slack.com/), where we also provide the
44+
latest updates on **PyAutoFit**. Slack is invitation-only, so if you'd like to join send
45+
an [email](https://github.com/Jammy2211) requesting an invite.
46+
47+
## HowToFit
48+
49+
For users less familiar with Bayesian inference and scientific analysis you may wish to read through
50+
the **HowToFits** lectures. These teach you the basic principles of Bayesian inference, with the
51+
content pitched at undergraduate level and above.
52+
53+
The lectures are available in the [standalone HowToFit repository](https://github.com/PyAutoLabs/HowToFit).
54+
55+
## API Overview
56+
57+
To illustrate the **PyAutoFit** API, we use an illustrative toy model of fitting a one-dimensional Gaussian to
58+
noisy 1D data. Here's the `data` (black) and the model (red) we'll fit:
59+
60+
<img src="https://raw.githubusercontent.com/rhayes777/PyAutoFit/main/files/toy_model_fit.png" width="400" />
61+
62+
We define our model, a 1D Gaussian by writing a Python class using the format below:
63+
64+
```python
65+
class Gaussian:
66+
67+
def __init__(
68+
self,
69+
centre=0.0, # <- PyAutoFit recognises these
70+
normalization=0.1, # <- constructor arguments are
71+
sigma=0.01, # <- the Gaussian's parameters.
72+
):
73+
self.centre = centre
74+
self.normalization = normalization
75+
self.sigma = sigma
76+
77+
"""
78+
An instance of the Gaussian class will be available during model fitting.
79+
80+
This method will be used to fit the model to data and compute a likelihood.
81+
"""
82+
83+
def model_data_from(self, xvalues):
84+
85+
transformed_xvalues = xvalues - self.centre
86+
87+
return (self.normalization / (self.sigma * (2.0 * np.pi) ** 0.5)) * \
88+
np.exp(-0.5 * (transformed_xvalues / self.sigma) ** 2.0)
89+
```
90+
91+
**PyAutoFit** recognises that this Gaussian may be treated as a model component whose parameters can be fitted for via
92+
a non-linear search like [emcee](https://github.com/dfm/emcee).
93+
94+
To fit this Gaussian to the `data` we create an Analysis object, which gives **PyAutoFit** the `data` and a
95+
`log_likelihood_function` describing how to fit the `data` with the model:
96+
97+
```python
98+
class Analysis(af.Analysis):
99+
100+
def __init__(self, data, noise_map):
101+
102+
self.data = data
103+
self.noise_map = noise_map
104+
105+
def log_likelihood_function(self, instance):
106+
107+
"""
108+
The 'instance' that comes into this method is an instance of the Gaussian class
109+
above, with the parameters set to values chosen by the non-linear search.
110+
"""
111+
112+
print("Gaussian Instance:")
113+
print("Centre = ", instance.centre)
114+
print("normalization = ", instance.normalization)
115+
print("Sigma = ", instance.sigma)
116+
117+
"""
118+
We fit the ``data`` with the Gaussian instance, using its
119+
"model_data_from" function to create the model data.
120+
"""
121+
122+
xvalues = np.arange(self.data.shape[0])
123+
124+
model_data = instance.model_data_from(xvalues=xvalues)
125+
residual_map = self.data - model_data
126+
chi_squared_map = (residual_map / self.noise_map) ** 2.0
127+
log_likelihood = -0.5 * sum(chi_squared_map)
128+
129+
return log_likelihood
130+
```
131+
132+
We can now fit our model to the `data` using a non-linear search:
133+
134+
```python
135+
model = af.Model(Gaussian)
136+
137+
analysis = Analysis(data=data, noise_map=noise_map)
138+
139+
emcee = af.Emcee(nwalkers=50, nsteps=2000)
140+
141+
result = emcee.fit(model=model, analysis=analysis)
142+
```
143+
144+
The `result` contains information on the model-fit, for example the parameter samples, maximum log likelihood
145+
model and marginalized probability density functions.

README.rst

Lines changed: 0 additions & 175 deletions
This file was deleted.

autofit/config/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
The `config` folder contains configuration files which customize default **PyAutoLens**.
2+
3+
# Folders
4+
5+
- `priors`: Configs defining default priors assumed on every lens model component and set of parameters.
6+
- `visualize`: Configs defining what images are output by a lens model fit.
7+
8+
# Files
9+
10+
- `general.yaml`: Customizes general **PyAutoLens** settings.
11+
- `non-linear.yaml`: Configs for default non-linear search (e.g. MCMC, nested sampling) settings.
12+
- `logging.yaml`: Customizes the logging behaviour of **PyAutoLens**.
13+
- `notation.yaml`: Configs defining labels and formatting of model parameters when used for visualization.

autofit/config/README.rst

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
The `non_linear` folder contains configuration files which customize the default behaviour of non-linear searches in
2+
**PyAutoLens**.
3+
4+
# Files
5+
6+
- `mcmc.yaml`: Settings default behaviour of MCMC non-linear searches (e.g. Emcee).
7+
- `nest.yaml`: Settings default behaviour of nested sampler non-linear searches (e.g. Dynesty).
8+
- `mle.yaml`: Settings default behaviour of maximum likelihood estimator (mle) searches (e.g. BFGS).

0 commit comments

Comments
 (0)