Skip to content

Commit

Permalink
Added support for galsim_hub (#117)
Browse files Browse the repository at this point in the history
* Added support for galsim_hub

* Moved galaxy sampling to render_minibatch

* Moved generation to whole batch and added possibility to change parameters

* refactor to avoid repeating code

* Better code for handling the extra images

* Added documentation for galsim_hub and new sampling function

* Added a test for galsim_hub

* Completed documentation

* Remove merge comment

* Added tutorial notebook

* Fixed test and moved import

* update lock

* added tensorflow and galsim_hub

* updates

* just updating but still the problem is not resolved

* using python 3.7

* added tensorflow and galsim_hub as optional dependencies

* try install galsim_hub with pip

* small check

* eigency dependency?

* install eigency first

* install galsim first

* try conda

* try again

* some updatest

* a new try :)

* error in action

* weird errro

* another try

* now i get it

* the doc for conda action is misleading

* doesn't activate environment

* old conda

* give up and try source activate

* need to specify bash

* works???!

* lint should work now

* misconfiguration

* need lint

* update docs

* Add missing psf convolution

* no more requirements.txt

* galsim hub no multiprocessing keyword

* update poetry

Co-authored-by: Thomas Sainrat <[email protected]>
Co-authored-by: Ismael Mendoza <[email protected]>
  • Loading branch information
3 people authored Mar 31, 2021
1 parent 46d660f commit ab87076
Show file tree
Hide file tree
Showing 14 changed files with 1,243 additions and 1,178 deletions.
34 changes: 15 additions & 19 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,37 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: [3.7]

steps:
- name: Checkout github repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Install miniconda and environment
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
activate-environment: btk_py37
python-version: ${{ matrix.python-version }}


- name: Install Poetry
run: |
pip install --upgrade pip
pip install poetry
- name: Poetry cache
uses: actions/cache@v2
with:
path: |
~/.cache/pypoetry
key: ${{ runner.os }}-${{ hashFiles('./poetry.lock') }}

- name: Instal FFTW + Eigen
- name: Install conda dependencies
shell: bash -l {0} # setup and activate conda environment.
run: |
sudo apt-get install libfftw3-dev libeigen3-dev
conda install fftw
conda install -c conda-forge eigen
conda install -c conda-forge galsim
conda install tensorflow==1.15
conda install -c conda-forge poetry
- name: Install poetry dependencies
shell: bash -l {0}
run: |
poetry install
poetry install --extras "galsim-hub"
- name: build docs
shell: bash -l {0}
run: |
cd docs
poetry run make html
Expand Down
38 changes: 18 additions & 20 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: [3.7]

steps:
- name: Checkout github repo
Expand All @@ -23,31 +23,29 @@ jobs:
lfs: true
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Install miniconda and environment
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
activate-environment: btk_py37
python-version: ${{ matrix.python-version }}

- name: Install Poetry
- name: Install conda dependencies
shell: bash -l {0} # setup and activate conda environment.
run: |
pip install --upgrade pip
pip install poetry
- name: Poetry cache
uses: actions/cache@v2
with:
path: |
~/.cache/pypoetry
key: ${{ runner.os }}-${{ hashFiles('./poetry.lock') }}

# galsim needs this.
- name: Instal FFTW + Eigen
run: |
sudo apt-get install libfftw3-dev libeigen3-dev
conda install fftw
conda install -c conda-forge eigen
conda install -c conda-forge galsim
conda install tensorflow==1.15
conda install -c conda-forge poetry
- name: Install poetry dependencies
shell: bash -l {0}
run: |
poetry install
poetry install --extras "galsim-hub"
- name: Run pre-commit checks
uses: pre-commit/[email protected]
shell: bash -l {0}
run: |
pre-commit install
pre-commit run --all-files
34 changes: 15 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: [3.7]

steps:
- name: Checkout github repo (+ download lfs dependencies)
Expand All @@ -23,33 +23,29 @@ jobs:
lfs: true
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Install miniconda and environment
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
activate-environment: btk_py37
python-version: ${{ matrix.python-version }}

- name: Install Poetry
- name: Install conda dependencies
shell: bash -l {0} # setup and activate conda environment.
run: |
pip install --upgrade pip
pip install poetry
- name: Poetry cache
uses: actions/cache@v2
with:
path: |
~/.cache/pypoetry
key: ${{ runner.os }}-${{ hashFiles('./poetry.lock') }}

# galsim needs this.
- name: Instal FFTW + Eigen
run: |
sudo apt-get install libfftw3-dev libeigen3-dev
conda install fftw
conda install -c conda-forge eigen
conda install -c conda-forge galsim
conda install tensorflow==1.15
conda install -c conda-forge poetry
- name: Install poetry dependencies
shell: bash -l {0}
run: |
poetry install
poetry install --extras "galsim-hub"
- name: Run Tests
shell: bash -l {0}
run: |
poetry run pytest --cov=./btk --cov-report=xml --durations=0
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ The following sections are only relevant for the maintainer of BTK (currently Is

1. We use [poetry](https://python-poetry.org) as python package manager for BTK. It guarantees all developers are sharing the same python environment, makes it really easy to update dependencies, and publish to [pypi](https://pypi.org). Given some of the complications with installing `galsim` via `poetry`, we follow a hybrid approach of `conda`+`poetry`.

2. It is recommended to create a `conda` virtual environment (using `python3.8`) from scratch and use it to install all required dependencies. After having installed `conda`, please follow the following series of steps:
2. It is recommended to create a `conda` virtual environment (using `python3.7`) from scratch and use it to install all required dependencies. After having installed `conda`, please follow the following series of steps:

```
# enter to the local repo
cd BlendingToolKit
# create virtual environment.
conda create -n btk python=3.8
conda create -n btk python=3.7
conda activate btk
# make sure you can import galsim after this step before moving on.
Expand Down
Loading

0 comments on commit ab87076

Please sign in to comment.