Repository: rhayes777/PyAutoFit (python)

Issue:
Parameter linked floats not displaying in model.info
In the following pipeline:

https://github.com/Jammy2211/autolens_workspace_test/blob/main/slam/integration/source_pix/mass_total/base.py

In the fit `source_pix[2]_light[fixed]_mass[fixed]_source[pix]` the parameter `pixels` is passed as follows (in the following pipeline https://github.com/Jammy2211/autolens_workspace_test/blob/main/slam/source_pix.py):

```
    if setup_adapt.mesh_pixels_fixed is not None:
        if hasattr(model_2.galaxies.source.pixelization.mesh, "pixels"):
            model_2.galaxies.source.pixelization.mesh.pixels = (
                setup_adapt.mesh_pixels_fixed
            )
```

However, the `pixels` float passed via this code does not display in `model.info`:

```
    source
        redshift                                                                1.0
        pixelization
            mesh
                weight_floor                                                    UniformPrior [149], lower_limit = 0.0, upper_limit = 1.0
                weight_power                                                    UniformPrior [150], lower_limit = 0.0, upper_limit = 20.0
            regularization
                inner_coefficient                                               LogUniformPrior [151], lower_limit = 1e-06, upper_limit = 1000000.0
                outer_coefficient                                               LogUniformPrior [152], lower_limit = 1e-06, upper_limit = 1000000.0
                signal_scale                                                    UniformPrior [153], lower_limit = 0.0, upper_limit = 1.0
```

This has caused me some confusion, and indicates that in edge cases certain parameters or fixed values are lost from `model.info` (this has also happened with tuples, which I will post a separate issue about when it crops up again and I'm reminded of it.


Pull request:
ensure integer attributes are displayed in model info
Resolves #818


Patch:
diff --git a/autofit/mapper/prior_model/abstract.py b/autofit/mapper/prior_model/abstract.py
index 6ce076552..c5383aae7 100644
--- a/autofit/mapper/prior_model/abstract.py
+++ b/autofit/mapper/prior_model/abstract.py
@@ -1546,8 +1546,12 @@ class AbstractPriorModel(AbstractModel):
         formatter = TextFormatter(line_length=info_whitespace())
 
         for t in self.path_instance_tuples_for_class(
-            (Prior, float, tuple), ignore_children=True
+            (Prior, float, int, tuple), ignore_children=True
         ):
+            name = t[0][-1]
+            if name in ("id", "item_number"):
+                continue
+
             formatter.add(*t)
 
         return "\n\n".join(


Test patch:
diff --git a/test_autofit/mapper/test_parameterization.py b/test_autofit/mapper/test_parameterization.py
index a7ccfa0d4..e74f2662a 100644
--- a/test_autofit/mapper/test_parameterization.py
+++ b/test_autofit/mapper/test_parameterization.py
@@ -139,3 +139,22 @@ tuple
         assert len(mapper.mock_cls.instance_tuples) == 1
 
         assert len(info.split("\n")) == len(mapper.info.split("\n"))
+
+
+def test_integer_attributes():
+    model = af.Model(af.Gaussian)
+
+    model.centre = 2
+
+    print(model.info)
+
+    assert (
+        model.info
+        == """Total Free Parameters = 2
+
+model                                                                           Gaussian (N=2)
+
+centre                                                                          2
+normalization                                                                   UniformPrior [1], lower_limit = 0.0, upper_limit = 1.0
+sigma                                                                           UniformPrior [2], lower_limit = 0.0, upper_limit = 1.0"""
+    )