Skip to content

Commit

Permalink
Merge pull request lenstronomy#372 from sibirrer/main
Browse files Browse the repository at this point in the history
minor changes mostly for checking whether tests pass, to merge lenstronomy#371
  • Loading branch information
sibirrer authored Oct 11, 2022
2 parents edd05dc + 6699bfe commit 173d51e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
10 changes: 7 additions & 3 deletions lenstronomy/Plots/chain_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,17 @@ def plot_mcmc_behaviour(ax, samples_mcmc, param_mcmc, dist_mcmc=None, num_averag
def psf_iteration_compare(kwargs_psf, **kwargs):
"""
:param kwargs_psf:
:param kwargs_psf: keyword arguments that initiate a PSF() class
:param kwargs: kwargs to send to matplotlib.pyplot.matshow()
:return:
"""
psf_out = kwargs_psf['kernel_point_source']
psf_in = kwargs_psf['kernel_point_source_init']
psf_error_map = kwargs_psf.get('psf_error_map', None)
# psf_error_map = kwargs_psf.get('psf_error_map', None)
from lenstronomy.Data.psf import PSF
psf = PSF(**kwargs_psf)
# psf_out = psf.kernel_point_source
psf_error_map = psf.psf_error_map
n_kernel = len(psf_in)
delta_x = n_kernel/20.
delta_y = n_kernel/10.
Expand Down Expand Up @@ -156,7 +160,7 @@ def psf_iteration_compare(kwargs_psf, **kwargs):

if psf_error_map is not None:
ax = axes[3]
im = ax.matshow(np.log10(psf_error_map*psf_out**2), origin='lower', **kwargs)
im = ax.matshow(np.log10(psf_error_map*psf.kernel_point_source**2), origin='lower', **kwargs)
divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="5%", pad=0.05)
plt.colorbar(im, cax=cax)
Expand Down
7 changes: 3 additions & 4 deletions lenstronomy/SimulationAPI/data_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ def __init__(self, numpix, kwargs_pixel_grid=None, **kwargs_single_band):
"""
self.numpix = numpix
if kwargs_pixel_grid is not None:
required_keys = ['ra_at_xy_0','dec_at_xy_0','transform_pix2angle']
required_keys = ['ra_at_xy_0', 'dec_at_xy_0', 'transform_pix2angle']
if not all(k in kwargs_pixel_grid for k in required_keys):
raise ValueError('Missing 1 or more required'+
'kwargs_pixel_grid parameters')
raise ValueError('Missing 1 or more required' + 'kwargs_pixel_grid parameters')
self._kwargs_pixel_grid = kwargs_pixel_grid
SingleBand.__init__(self, **kwargs_single_band)

Expand Down Expand Up @@ -65,4 +64,4 @@ def kwargs_data(self):
'transform_pix2angle': transform_pix2angle,
'background_rms': self.background_noise,
'exposure_time': scaled_exposure_time}
return kwargs_data
return kwargs_data
1 change: 1 addition & 0 deletions test/test_Workflow/test_fitting_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ def test_dynesty(self):
np.random.seed(42)
kwargs_params = copy.deepcopy(self.kwargs_params)
kwargs_params['lens_model'][0][0]['theta_E'] += 0.2
kwargs_params['lens_model'][0][0]['gamma'] += 0.1
fittingSequence = FittingSequence(self.kwargs_data_joint, self.kwargs_model, self.kwargs_constraints,
self.kwargs_likelihood, kwargs_params)

Expand Down

0 comments on commit 173d51e

Please sign in to comment.