rhayes777 / PyAutoFit

PyAutoFit: Classy Probabilistic Programming
https://pyautofit.readthedocs.io/
MIT License
59 stars 11 forks source link

naive implementation of physical_centres_from #1034

Closed rhayes777 closed 1 month ago

rhayes777 commented 1 month ago

Pretty sure this does what you want as it uses the model passed to the samples for each grid search run. For any prior which is a grid prior this new function would give you the mean of that prior for each model

rhayes777 commented 1 month ago

Obviously requires more testing and generalisation to support tuple input; I just wanted to check I've understood correctly

Jammy2211 commented 1 month ago

I have tested the implementation by using the following code in the relevent part of the PyAutoLens source code:

    @property
    def y(self) -> List[float]:
        """
        The y coordinates of the physical values of the subhalo grid, where each value is the centre of a grid cell.

        These are the `centre` coordinates of the dark matter subhalo priors.
        """
        return self.physical_centres_lists_from(
            path="galaxies.subhalo.mass.centre.centre_0"
        )

    @property
    def x(self) -> List[float]:
        """
        The x coordinates of the physical values of the subhalo grid, where each value is the centre of a grid cell.

        These are the `centre` coordinates of the dark matter subhalo priors.
        """
        return self.physical_centres_lists_from(
            path="galaxies.subhalo.mass.centre.centre_1"
        )

This PR gives the desired behaviour, in that it recovers the values for y and x correctly and can be used for other quantities in the model.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 80.60%. Comparing base (4e2d1e7) to head (d29e8b2). Report is 76 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1034 +/- ## ========================================== - Coverage 80.77% 80.60% -0.17% ========================================== Files 198 199 +1 Lines 14983 15241 +258 ========================================== + Hits 12102 12285 +183 - Misses 2881 2956 +75 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.