Skip to content

Commit

Permalink
Merge pull request #1 from sibirrer/main
Browse files Browse the repository at this point in the history
updating main
  • Loading branch information
williyamshoe authored Jan 4, 2024
2 parents f7656e4 + b331dbc commit e0bc099
Show file tree
Hide file tree
Showing 34 changed files with 1,632 additions and 501 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ci:

repos:
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 23.12.1
hooks:
- id: black
# It is recommended to specify the latest version of Python
Expand All @@ -19,7 +19,7 @@ repos:
# https://pre-commit.com/#top_level-default_language_version
language_version: python3
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 23.12.1
hooks:
- id: black-jupyter
language_version: python3
Expand Down
36 changes: 24 additions & 12 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
# .readthedocs.yml
# Read the Docs configuration file
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py

# Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
formats: all
# formats:
# - pdf
# - epub

# Optionally set the version of Python and requirements required to build your docs
# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
version: 3.6
install:
- requirements: requirements.txt
install:
- requirements: requirements.txt
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ comment: # this is a top-level key
require_changes: false # if true: only post the comment if coverage changes
require_base: false # [true :: must have a base report to post]
require_head: true # [true :: must have a head report to post]
ignore:
- "setup.py"
- "test/*.py"
- "test/**/*.py"
5 changes: 4 additions & 1 deletion hierarc/LensPosterior/base_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def __init__(
num_psf_sampling=100,
num_kin_sampling=1000,
multi_observations=False,
cosmo_fiducial=None,
):
"""
Expand Down Expand Up @@ -59,6 +60,8 @@ def __init__(
routine
:param hernquist_approx: bool, if True, uses the Hernquist approximation for the
light profile
:param cosmo_fiducial: astropy.cosmology instance, if None,
uses astropy's default cosmology
"""
self._z_lens, self._z_source = z_lens, z_source

Expand All @@ -77,7 +80,7 @@ def __init__(
z_lens,
z_source,
kwargs_model,
cosmo_fiducial=None,
cosmo_fiducial=cosmo_fiducial,
lens_model_kinematics_bool=None,
light_model_kinematics_bool=None,
kwargs_seeing=kwargs_seeing,
Expand Down
49 changes: 32 additions & 17 deletions hierarc/LensPosterior/kin_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(
num_psf_sampling=100,
num_kin_sampling=1000,
multi_observations=False,
cosmo_fiducial=None,
):
"""
Expand All @@ -46,24 +47,36 @@ def __init__(
:param gamma_error: 1-sigma uncertainty on power-law slope
:param r_eff: half-light radius of the deflector (arc seconds)
:param r_eff_error: uncertainty on half-light radius
:param sigma_v_measured: numpy array of IFU velocity dispersion of the main deflector in km/s
:param sigma_v_error_independent: numpy array of 1-sigma uncertainty in velocity dispersion of the IFU
:param sigma_v_measured: numpy array of IFU velocity dispersion of the main
deflector in km/s
:param sigma_v_error_independent: numpy array of 1-sigma uncertainty in velocity
dispersion of the IFU
observation independent of each other
:param sigma_v_error_covariant: covariant error in the measured kinematics shared among all IFU measurements
:param sigma_v_error_cov_matrix: error covariance matrix in the sigma_v measurements (km/s)^2
:type sigma_v_error_cov_matrix: nxn matrix with n the length of the sigma_v_measured array
:param kwargs_aperture: spectroscopic aperture keyword arguments, see lenstronomy.Galkin.aperture for options
:param kwargs_seeing: seeing condition of spectroscopic observation, corresponds to kwargs_psf in the GalKin
:param sigma_v_error_covariant: covariant error in the measured kinematics
shared among all IFU measurements
:param sigma_v_error_cov_matrix: error covariance matrix in the sigma_v
measurements (km/s)^2
:type sigma_v_error_cov_matrix: nxn matrix with n the length of the
sigma_v_measured array
:param kwargs_aperture: spectroscopic aperture keyword arguments, see
lenstronomy.Galkin.aperture for options
:param kwargs_seeing: seeing condition of spectroscopic observation, corresponds
to kwargs_psf in the GalKin
module specified in lenstronomy.GalKin.psf
:param kwargs_numerics_galkin: numerical settings for the integrated line-of-sight velocity dispersion
:param anisotropy_model: type of stellar anisotropy model. See details in MamonLokasAnisotropy() class of
lenstronomy.GalKin.anisotropy
:param kwargs_numerics_galkin: numerical settings for the integrated
line-of-sight velocity dispersion
:param anisotropy_model: type of stellar anisotropy model. See details in
MamonLokasAnisotropy() class of lenstronomy.GalKin.anisotropy
:param lens_model_list: keyword argument list of lens model (optional)
:param kwargs_lens_light: keyword argument list of lens light model (optional)
:param kwargs_mge_light: keyword arguments that go into the MGE decomposition routine
:param hernquist_approx: bool, if True, uses the Hernquist approximation for the light profile
:param multi_observations: bool, if True, interprets kwargs_aperture and kwargs_seeing as lists of multiple
observations
:param kwargs_mge_light: keyword arguments that go into the MGE decomposition
routine
:param hernquist_approx: bool, if True, uses the Hernquist approximation for the
light profile
:param multi_observations: bool, if True, interprets kwargs_aperture and
kwargs_seeing as lists of multiple observations
:param cosmo_fiducial: astropy.cosmology instance, if None,
uses astropy's default
"""
self._sigma_v_measured = np.array(sigma_v_measured)
self._sigma_v_error_independent = np.array(sigma_v_error_independent)
Expand Down Expand Up @@ -97,6 +110,7 @@ def __init__(
num_psf_sampling=num_psf_sampling,
num_kin_sampling=num_kin_sampling,
multi_observations=multi_observations,
cosmo_fiducial=cosmo_fiducial,
)

def j_kin_draw(self, kwargs_anisotropy, no_error=False):
Expand Down Expand Up @@ -165,9 +179,10 @@ def hierarchy_configuration(self, num_sample_model=20):
def model_marginalization(self, num_sample_model=20):
"""
:param num_sample_model: number of samples drawn from the lens and light model posterior to compute the
dimensionless kinematic component J()
:return: J() as array for each measurement prediction, covariance matrix in sqrt(J)
:param num_sample_model: number of samples drawn from the lens and light model
posterior to compute the dimensionless kinematic component J()
:return: J() as array for each measurement prediction, covariance matrix in
sqrt(J)
"""
num_data = len(self._sigma_v_measured)
j_kin_matrix = np.zeros(
Expand Down
Loading

0 comments on commit e0bc099

Please sign in to comment.