Skip to content

Commit

Permalink
update dataset plots with log10 and fix contour log10
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed Jan 17, 2024
1 parent d803a32 commit 08352cc
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
10 changes: 7 additions & 3 deletions autoarray/dataset/plot/imaging_plotters.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import copy
from typing import Callable, Optional

from autoarray.plot.visuals.two_d import Visuals2D
Expand Down Expand Up @@ -161,9 +162,13 @@ def subplot_dataset(self):

self.figures_2d(data=True)

contour_original = copy.copy(self.mat_plot_2d.contour)

self.mat_plot_2d.use_log10 = True
self.mat_plot_2d.contour = False
self.figures_2d(data=True)
self.mat_plot_2d.use_log10 = False
self.mat_plot_2d.contour = contour_original

self.figures_2d(noise_map=True)

Expand All @@ -175,13 +180,12 @@ def subplot_dataset(self):

self.figures_2d(signal_to_noise_map=True)

self.mat_plot_2d.output.subplot_to_figure(
auto_filename="subplot_dataset"
)
self.mat_plot_2d.output.subplot_to_figure(auto_filename="subplot_dataset")
self.close_subplot_figure()

self.mat_plot_2d.use_log10 = use_log10_original


class ImagingPlotter(Plotter):
def __init__(
self,
Expand Down
6 changes: 4 additions & 2 deletions autoarray/plot/mat_plot/two_d.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ def plot_array(
)
self.colorbar_tickparams.set(cb=cb)

self.contour.set(array=array, extent=extent, use_log10=self.use_log10)
if self.contour is not False:
self.contour.set(array=array, extent=extent, use_log10=self.use_log10)

grid_indexes = None

Expand Down Expand Up @@ -452,7 +453,8 @@ def plot_grid(
self.yticks.set(min_value=extent[2], max_value=extent[3], units=self.units)
self.xticks.set(min_value=extent[0], max_value=extent[1], units=self.units)

self.contour.set(array=color_array, extent=extent, use_log10=self.use_log10)
if self.contour is not False:
self.contour.set(array=color_array, extent=extent, use_log10=self.use_log10)

visuals_2d.plot_via_plotter(plotter=self, grid_indexes=grid)

Expand Down
2 changes: 1 addition & 1 deletion autoarray/plot/wrap/base/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ def config_category(self):

@property
def log10_min_value(self):
return conf.instance["visualize"]["general"]["general"]["log10_min_value"]
return conf.instance["visualize"]["general"]["general"]["log10_min_value"]
1 change: 0 additions & 1 deletion autoarray/plot/wrap/base/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def tick_values_from(self, norm=None, use_log10: bool = False):
max_value = norm.vmax

if use_log10:

if min_value < self.log10_min_value:
min_value = self.log10_min_value

Expand Down
6 changes: 5 additions & 1 deletion autoarray/plot/wrap/two_d/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ def levels_from(
"""
if self.manual_levels is None:
if self.use_log10:
min_value = np.min(array)
if min_value < self.log10_min_value:
min_value = self.log10_min_value

return np.logspace(
np.log10(np.min(array)),
np.log10(min_value),
np.log10(np.max(array)),
self.total_contours,
)
Expand Down

0 comments on commit 08352cc

Please sign in to comment.