Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement fitting sequence #35

Merged
merged 29 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ae37076
implement fitting sequence
ahuang314 Feb 2, 2025
7d3e9e9
rename exp_map to exposure_map
ahuang314 Feb 2, 2025
0c73ff4
init file
ahuang314 Feb 2, 2025
0b35daa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2025
190fbcc
change import statement
ahuang314 Feb 2, 2025
f10f71f
Merge branch 'main' of https://github.com/ahuang314/JAXtronomy
ahuang314 Feb 2, 2025
d6fc9d3
add test requirements for fitting sequence
ahuang314 Feb 2, 2025
481ba1a
added emcee test requirement
ahuang314 Feb 2, 2025
332dbfe
fixed tests
ahuang314 Feb 2, 2025
24d68eb
changed tests
ahuang314 Feb 2, 2025
cf366c6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2025
ca4b61a
fixed compatibility issues with non-jax samplers
ahuang314 Feb 2, 2025
eee8c1c
changed tests
ahuang314 Feb 2, 2025
b4c2479
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2025
48fad9c
removed psf_iteration and calibrate_images
ahuang314 Feb 2, 2025
27b4026
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2025
e64d00a
Merge branch 'lenstronomy:main' into main
ahuang314 Feb 2, 2025
bd8175c
changed docstrings
ahuang314 Feb 2, 2025
3802c11
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2025
ef7ccf9
added test
ahuang314 Feb 2, 2025
c95695b
Merge branch 'main' of https://github.com/ahuang314/JAXtronomy
ahuang314 Feb 2, 2025
be20d7e
added test for coverage
ahuang314 Feb 2, 2025
ce00e7e
removed unused function and imports
ahuang314 Feb 2, 2025
ecc4225
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2025
91b49ec
added more tests for coverage
ahuang314 Feb 2, 2025
92da233
Merge branch 'main' of https://github.com/ahuang314/JAXtronomy
ahuang314 Feb 2, 2025
816ceb2
moved some requirements to test_requirements
ahuang314 Feb 2, 2025
ca9d296
removed resume_dyn_run feature in dyPolyChord sampling
ahuang314 Feb 2, 2025
29a406e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2025
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
6 changes: 3 additions & 3 deletions jaxtronomy/Data/image_noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(
)
else:
# make sure no negative exposure values are present no dividing by zero
self.exp_map = jnp.where(
self.exposure_map = jnp.where(
exposure_time <= 10 ** (-10), 10 ** (-10), exposure_time
)

Expand Down Expand Up @@ -88,7 +88,7 @@ def __init__(
self.C_D = covariance_matrix(
self.data,
self.background_rms,
self.exp_map,
self.exposure_map,
)

if gradient_boost_factor is not None:
Expand All @@ -107,7 +107,7 @@ def C_D_model(self, model):
if self._noise_map is not None:
return self._noise_map**2
else:
return covariance_matrix(model, self.background_rms, self.exp_map)
return covariance_matrix(model, self.background_rms, self.exposure_map)


@export
Expand Down
2 changes: 1 addition & 1 deletion jaxtronomy/Data/imaging_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def update_data(self, image_data):
self.C_D = covariance_matrix(
self.data,
self.background_rms,
self.exp_map,
self.exposure_map,
)

def _log_likelihood(self, model, mask, additional_error_map=0):
Expand Down
7 changes: 5 additions & 2 deletions jaxtronomy/Sampling/likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import jax
from jax import jit, lax, numpy as jnp
from functools import partial
import numpy as np

__all__ = ["LikelihoodModule"]

Expand All @@ -32,7 +33,7 @@ def __init__(
kwargs_model,
param_class,
image_likelihood=True,
check_bounds=False,
check_bounds=True,
astrometric_likelihood=False,
image_position_likelihood=False,
source_position_likelihood=False,
Expand Down Expand Up @@ -417,8 +418,10 @@ def effective_num_data_points(self, **kwargs):
num_param, param_names = self.param.num_param()
return self.num_data - num_param

# This function should be used to convert the jax type to a normal float
# Required for samplers e.g. Cobaya which do not work with jax types
def likelihood(self, a):
return self.logL(a)
return np.float64(self.logL(a))

def negativelogL(self, a):
"""For minimizer function, the negative value of the logl value is requested.
Expand Down
Loading