Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
198 changes: 99 additions & 99 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,99 +1,99 @@
name: Tests

on: [push, pull_request]

jobs:
unittest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, '3.10', '3.11', '3.12']
steps:
- name: Checkout PyAutoConf
uses: actions/checkout@v2
with:
repository: rhayes777/PyAutoConf
path: PyAutoConf
- name: Checkout PyAutoFit
uses: actions/checkout@v2
with:
repository: rhayes777/PyAutoFit
path: PyAutoFit
- name: Checkout PyAutoArray
uses: actions/checkout@v2
with:
repository: Jammy2211/PyAutoArray
path: PyAutoArray
- name: Checkout PyAutoGalaxy
uses: actions/checkout@v2
with:
repository: Jammy2211/PyAutoGalaxy
path: PyAutoGalaxy
- name: Checkout PyAutoLens
uses: actions/checkout@v2
with:
path: PyAutoLens
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Extract branch name
shell: bash
run: |
cd PyAutoLens
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Change to same branch if exists in deps
shell: bash
run: |
export PACKAGES=("PyAutoConf" "PyAutoArray" "PyAutoFit" "PyAutoGalaxy")
export BRANCH="${{ steps.extract_branch.outputs.branch }}"
for PACKAGE in ${PACKAGES[@]}; do
pushd $PACKAGE
export existed_in_remote=$(git ls-remote --heads origin ${BRANCH})

if [[ -z ${existed_in_remote} ]]; then
echo "Branch $BRANCH did not exist in $PACKAGE"
else
echo "Branch $BRANCH did exist in $PACKAGE"
git fetch
git checkout $BRANCH
fi
popd
done
- name: Install dependencies
run: |
pip3 install --upgrade pip
pip3 install setuptools
pip3 install wheel
pip3 install pytest coverage pytest-cov
pip3 install -r PyAutoConf/requirements.txt
pip3 install -r PyAutoFit/requirements.txt
pip3 install -r PyAutoArray/requirements.txt
pip3 install -r PyAutoArray/optional_requirements.txt
pip3 install -r PyAutoGalaxy/requirements.txt
pip3 install -r PyAutoGalaxy/optional_requirements.txt
pip3 install -r PyAutoLens/requirements.txt
pip3 install -r PyAutoLens/optional_requirements.txt
- name: Run tests
run: |
export ROOT_DIR=`pwd`
export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoConf
export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoFit
export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoArray
export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoGalaxy
export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoLens
pushd PyAutoLens
pytest --cov autolens --cov-report xml:coverage.xml
- name: Slack send
if: ${{ failure() }}
id: slack
uses: slackapi/slack-github-action@v1.21.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
channel-id: C03S98FEDK2
payload: |
{
"text": "${{ github.repository }}/${{ github.ref_name }} (Python ${{ matrix.python-version }}) build result: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
name: Tests
on: [push, pull_request]
jobs:
unittest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, '3.10', '3.11', '3.12']
steps:
- name: Checkout PyAutoConf
uses: actions/checkout@v2
with:
repository: rhayes777/PyAutoConf
path: PyAutoConf
- name: Checkout PyAutoFit
uses: actions/checkout@v2
with:
repository: rhayes777/PyAutoFit
path: PyAutoFit
- name: Checkout PyAutoArray
uses: actions/checkout@v2
with:
repository: Jammy2211/PyAutoArray
path: PyAutoArray
- name: Checkout PyAutoGalaxy
uses: actions/checkout@v2
with:
repository: Jammy2211/PyAutoGalaxy
path: PyAutoGalaxy
- name: Checkout PyAutoLens
uses: actions/checkout@v2
with:
path: PyAutoLens
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Extract branch name
shell: bash
run: |
cd PyAutoLens
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Change to same branch if exists in deps
shell: bash
run: |
export PACKAGES=("PyAutoConf" "PyAutoArray" "PyAutoFit" "PyAutoGalaxy")
export BRANCH="${{ steps.extract_branch.outputs.branch }}"
for PACKAGE in ${PACKAGES[@]}; do
pushd $PACKAGE
export existed_in_remote=$(git ls-remote --heads origin ${BRANCH})
if [[ -z ${existed_in_remote} ]]; then
echo "Branch $BRANCH did not exist in $PACKAGE"
else
echo "Branch $BRANCH did exist in $PACKAGE"
git fetch
git checkout $BRANCH
fi
popd
done
- name: Install dependencies
run: |
pip3 install --upgrade pip
pip3 install setuptools
pip3 install wheel
pip3 install pytest coverage pytest-cov
pip3 install -r PyAutoConf/requirements.txt
pip3 install -r PyAutoFit/requirements.txt
pip3 install -r PyAutoArray/requirements.txt
pip3 install -r PyAutoArray/optional_requirements.txt
pip3 install -r PyAutoGalaxy/requirements.txt
pip3 install -r PyAutoGalaxy/optional_requirements.txt
pip3 install -r PyAutoLens/requirements.txt
pip3 install -r PyAutoLens/optional_requirements.txt
- name: Run tests
run: |
export ROOT_DIR=`pwd`
export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoConf
export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoFit
export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoArray
export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoGalaxy
export PYTHONPATH=$PYTHONPATH:$ROOT_DIR/PyAutoLens
pushd PyAutoLens
pytest --cov autolens --cov-report xml:coverage.xml
- name: Slack send
if: ${{ failure() }}
id: slack
uses: slackapi/slack-github-action@v1.21.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
channel-id: C03S98FEDK2
payload: |
{
"text": "${{ github.repository }}/${{ github.ref_name }} (Python ${{ matrix.python-version }}) build result: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
1 change: 0 additions & 1 deletion autolens/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
from .lens.to_inversion import TracerToInversion
from .analysis.positions import PositionsLHResample
from .analysis.positions import PositionsLHPenalty
from .analysis.preloads import Preloads
from .imaging.simulator import SimulatorImaging
from .imaging.fit_imaging import FitImaging
from .imaging.model.analysis import AnalysisImaging
Expand Down
23 changes: 1 addition & 22 deletions autolens/aggregator/fit_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import autoarray as aa

from autolens.imaging.fit_imaging import FitImaging
from autolens.analysis.preloads import Preloads

from autogalaxy.aggregator.imaging.imaging import _imaging_from
from autogalaxy.aggregator.dataset_model import _dataset_model_from
Expand All @@ -17,7 +16,6 @@ def _fit_imaging_from(
fit: af.Fit,
instance: Optional[af.ModelInstance] = None,
settings_inversion: aa.SettingsInversion = None,
use_preloaded_grid: bool = True,
) -> List[FitImaging]:
"""
Returns a list of `FitImaging` object from a `PyAutoFit` sqlite database `Fit` object.
Expand Down Expand Up @@ -49,10 +47,6 @@ def _fit_imaging_from(
randomly from the PDF).
settings_inversion
Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit.
use_preloaded_grid
Certain pixelization's construct their mesh in the source-plane from a stochastic KMeans algorithm. This grid
may be output to hard-disk after the model-fit and loaded via the database to ensure the same grid is used
as the fit.
"""

dataset_list = _imaging_from(fit=fit)
Expand All @@ -65,25 +59,14 @@ def _fit_imaging_from(

settings_inversion = settings_inversion or fit.value(name="settings_inversion")

mesh_grids_of_planes_list = agg_util.mesh_grids_of_planes_list_from(
fit=fit, total_fits=len(dataset_list), use_preloaded_grid=use_preloaded_grid
)

fit_dataset_list = []

for dataset, tracer, dataset_model, adapt_images, mesh_grids_of_planes in zip(
for dataset, tracer, dataset_model, adapt_images in zip(
dataset_list,
tracer_list,
dataset_model_list,
adapt_images_list,
mesh_grids_of_planes_list,
):
preloads = agg_util.preloads_from(
preloads_cls=Preloads,
use_preloaded_grid=use_preloaded_grid,
mesh_grids_of_planes=mesh_grids_of_planes,
use_w_tilde=False,
)

fit_dataset_list.append(
FitImaging(
Expand All @@ -92,7 +75,6 @@ def _fit_imaging_from(
dataset_model=dataset_model,
adapt_images=adapt_images,
settings_inversion=settings_inversion,
preloads=preloads,
)
)

Expand All @@ -104,7 +86,6 @@ def __init__(
self,
aggregator: af.Aggregator,
settings_inversion: Optional[aa.SettingsInversion] = None,
use_preloaded_grid: bool = True,
):
"""
Interfaces with an `PyAutoFit` aggregator object to create instances of `FitImaging` objects from the results
Expand Down Expand Up @@ -146,7 +127,6 @@ def __init__(
super().__init__(aggregator=aggregator)

self.settings_inversion = settings_inversion
self.use_preloaded_grid = use_preloaded_grid

def object_via_gen_from(
self, fit, instance: Optional[af.ModelInstance] = None
Expand All @@ -168,5 +148,4 @@ def object_via_gen_from(
fit=fit,
instance=instance,
settings_inversion=self.settings_inversion,
use_preloaded_grid=self.use_preloaded_grid,
)
23 changes: 1 addition & 22 deletions autolens/aggregator/fit_interferometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from autogalaxy.aggregator.dataset_model import _dataset_model_from

from autolens.interferometer.fit_interferometer import FitInterferometer
from autolens.analysis.preloads import Preloads

from autogalaxy.aggregator import agg_util
from autolens.aggregator.tracer import _tracer_from
Expand All @@ -18,7 +17,6 @@ def _fit_interferometer_from(
instance: Optional[af.ModelInstance] = None,
real_space_mask: Optional[aa.Mask2D] = None,
settings_inversion: aa.SettingsInversion = None,
use_preloaded_grid: bool = True,
) -> List[FitInterferometer]:
"""
Returns a list of `FitInterferometer` objects from a `PyAutoFit` sqlite database `Fit` object.
Expand Down Expand Up @@ -51,10 +49,6 @@ def _fit_interferometer_from(
randomly from the PDF).
settings_inversion
Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit.
use_preloaded_grid
Certain pixelization's construct their mesh in the source-plane from a stochastic KMeans algorithm. This grid
may be output to hard-disk after the model-fit and loaded via the database to ensure the same grid is used
as the fit.
"""
dataset_list = _interferometer_from(
fit=fit,
Expand All @@ -67,25 +61,14 @@ def _fit_interferometer_from(

settings_inversion = settings_inversion or fit.value(name="settings_inversion")

mesh_grids_of_planes_list = agg_util.mesh_grids_of_planes_list_from(
fit=fit, total_fits=len(dataset_list), use_preloaded_grid=use_preloaded_grid
)

fit_dataset_list = []

for dataset, tracer, dataset_model, adapt_images, mesh_grids_of_planes in zip(
for dataset, tracer, dataset_model, adapt_images in zip(
dataset_list,
tracer_list,
dataset_model_list,
adapt_images_list,
mesh_grids_of_planes_list,
):
preloads = agg_util.preloads_from(
preloads_cls=Preloads,
use_preloaded_grid=use_preloaded_grid,
mesh_grids_of_planes=mesh_grids_of_planes,
use_w_tilde=False,
)

fit_dataset_list.append(
FitInterferometer(
Expand All @@ -94,7 +77,6 @@ def _fit_interferometer_from(
dataset_model=dataset_model,
adapt_images=adapt_images,
settings_inversion=settings_inversion,
preloads=preloads,
)
)

Expand All @@ -106,7 +88,6 @@ def __init__(
self,
aggregator: af.Aggregator,
settings_inversion: Optional[aa.SettingsInversion] = None,
use_preloaded_grid: bool = True,
real_space_mask: Optional[aa.Mask2D] = None,
):
"""
Expand Down Expand Up @@ -145,7 +126,6 @@ def __init__(
super().__init__(aggregator=aggregator)

self.settings_inversion = settings_inversion
self.use_preloaded_grid = use_preloaded_grid
self.real_space_mask = real_space_mask

def object_via_gen_from(
Expand All @@ -168,5 +148,4 @@ def object_via_gen_from(
fit=fit,
instance=instance,
settings_inversion=self.settings_inversion,
use_preloaded_grid=self.use_preloaded_grid,
)
2 changes: 0 additions & 2 deletions autolens/aggregator/subhalo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def __init__(
self,
aggregator_grid_search: af.GridSearchAggregator,
settings_inversion: Optional[aa.SettingsInversion] = None,
use_preloaded_grid: bool = True,
):
"""
Wraps a PyAutoFit aggregator in order to create generators of fits to imaging data, corresponding to the
Expand All @@ -20,7 +19,6 @@ def __init__(

self.aggregator_grid_search = aggregator_grid_search
self.settings_inversion = settings_inversion
self.use_preloaded_grid = use_preloaded_grid

if len(aggregator_grid_search) == 0:
raise exc.AggregatorException(
Expand Down
Loading
Loading