Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorStoneAstro committed Oct 20, 2023
2 parents 31d76cb + 801b59f commit 6a47dd0
Show file tree
Hide file tree
Showing 56 changed files with 1,969 additions and 279 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,20 @@ jobs:
echo github.event_name is: ${{ github.event_name }}
echo github workspace: ${{ github.workspace }}
pip --version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov torch
pip install pytest pytest-cov torch wheel
# Install deps
cd $GITHUB_WORKSPACE
pip install -r requirements.txt
shell: bash

- name: Install Caustic
run: |
cd $GITHUB_WORKSPACE
pip install -e .
pip install -e .[dev]
pip show caustic
shell: bash
- name: Test with pytest
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Docs
on:
push:
branches:
- main
workflow_dispatch:

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- run: |
pip install torch wheel
pip install -r requirements.txt
- name: Install dependencies
run: |
pip install sphinx sphinx_rtd_theme
- name: Install Caustic
run: |
cd $GITHUB_WORKSPACE
pip install -e .[dev]
pip show caustic
shell: bash
- name: Sphinx build
run: |
sphinx-apidoc -f -o docs/ caustic/
sphinx-build docs _build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/
force_orphan: true
4 changes: 2 additions & 2 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov torch
pip install pytest pytest-cov torch wheel
# Install deps
cd $GITHUB_WORKSPACE
pip install -r requirements.txt
Expand All @@ -52,7 +52,7 @@ jobs:
- name: Install Caustic
run: |
cd $GITHUB_WORKSPACE
pip install -e .
pip install -e .[dev]
pip show caustic
shell: bash

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ __pycache__/
# Distribution / packaging
.Python
build/
_build/
develop-eggs/
dist/
downloads/
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Simply install caustic from PyPI:
pip install caustic
```

## Documentation

Please see our [documentation page](Ciela-Institute.github.io/caustic/) for more detailed information.

## Contributing

Please reach out to one of us if you're interested in contributing!
Expand Down
3 changes: 2 additions & 1 deletion caustic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
__version__ = '0.4.1'
__version__ = '0.4.10'
__author__ = "Ciela"

from .constants import *
from .lenses import *
Expand Down
7 changes: 6 additions & 1 deletion caustic/cosmology.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def critical_surface_density(
d_l = self.angular_diameter_distance(z_l, params)
d_s = self.angular_diameter_distance(z_s, params)
d_ls = self.angular_diameter_distance_z1z2(z_l, z_s, params)
return d_s / d_l / d_ls / (4 * pi * G_over_c2)
return d_s / (4 * pi * G_over_c2 * d_l * d_ls)


class FlatLambdaCDM(Cosmology):
Expand Down Expand Up @@ -210,6 +210,11 @@ def __init__(
self._comoving_distance_helper_y_grid = _comoving_distance_helper_y_grid.to(
dtype=torch.float32
)

def to(self, device: Optional[torch.device] = None, dtype: Optional[torch.dtype] = None):
super().to(device, dtype)
self._comoving_distance_helper_y_grid = self._comoving_distance_helper_y_grid.to(device, dtype)
self._comoving_distance_helper_x_grid = self._comoving_distance_helper_x_grid.to(device, dtype)

def hubble_distance(self, h0):
"""
Expand Down
2 changes: 1 addition & 1 deletion caustic/forward_raytrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def forward_raytrace(
thetaxy_max = torch.tensor((thetax_range[1], thetay_range[1]))
fov = thetaxy_max - thetaxy_min

while True:
for _ in range(10):
thetaxy_0s = fov[None, :] * torch.rand(n_guesses, 2) + thetaxy_min[None, :]
thetaxys = minimize_levmarq(
thetaxy_0s,
Expand Down
3 changes: 3 additions & 0 deletions caustic/lenses/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
from .sie import *
from .sis import *
from .utils import *
from .singleplane import *
from .mass_sheet import *
from .tnfw import *
Loading

0 comments on commit 6a47dd0

Please sign in to comment.