Skip to content

Commit 6543589

Browse files
Jammy2211Jammy2211
authored andcommitted
simplify transformer tests
1 parent ef25716 commit 6543589

File tree

13 files changed

+119
-270
lines changed

13 files changed

+119
-270
lines changed

autoarray/dataset/imaging/simulator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(
3333
The simulation of an `Imaging` dataset uses the following steps:
3434
3535
1) Receive as input a raw image of what the data looks like before any simulaiton process is applied.
36-
2) Include dirrection due to the telescope optics by convolve the image with an input Point Spread
36+
2) Include direction due to the telescope optics by convolve the image with an input Point Spread
3737
Function (PSF).
3838
3) Use input values of the background sky level in every pixel of the image to add the background sky to
3939
the PSF convolved image.

autoarray/inversion/pixelization/mappers/abstract.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ def extent_from(
397397
zoom_to_brightest: bool = True,
398398
zoom_percent: Optional[float] = None,
399399
) -> Tuple[float, float, float, float]:
400+
401+
from autoarray.geometry import geometry_util
402+
400403
if zoom_to_brightest and values is not None:
401404
if zoom_percent is None:
402405
zoom_percent = conf.instance["visualize"]["general"]["zoom"][
@@ -408,8 +411,6 @@ def extent_from(
408411
true_indices = np.argwhere(fractional_bool)
409412
true_grid = self.source_plane_mesh_grid[true_indices]
410413

411-
from autoarray.geometry import geometry_util
412-
413414
try:
414415
return geometry_util.extent_symmetric_from(
415416
extent=(
@@ -420,9 +421,13 @@ def extent_from(
420421
)
421422
)
422423
except ValueError:
423-
return self.source_plane_mesh_grid.geometry.extent
424+
return geometry_util.extent_symmetric_from(
425+
extent=self.source_plane_mesh_grid.geometry.extent
426+
)
424427

425-
return self.source_plane_mesh_grid.geometry.extent
428+
return geometry_util.extent_symmetric_from(
429+
extent=self.source_plane_mesh_grid.geometry.extent
430+
)
426431

427432
def interpolated_array_from(
428433
self,

autoarray/operators/transformer_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def visibilities_jit(image_1d, grid_radians, uv_wavelengths):
115115
return visibilities
116116

117117

118-
@numba_util.jit()
118+
# @numba_util.jit()
119119
def image_via_jit_from(n_pixels, grid_radians, uv_wavelengths, visibilities):
120120
image_1d = np.zeros(n_pixels)
121121

autoarray/plot/mat_plot/abstract.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ def __init__(
108108
self.yticks = yticks or wb.YTicks(is_default=True)
109109
self.xticks = xticks or wb.XTicks(is_default=True)
110110

111-
self.title = title or wb.Title(is_default=True)
111+
if title is not False:
112+
self.title = title or wb.Title(is_default=True)
113+
else:
114+
self.title = False
112115
self.ylabel = ylabel or wb.YLabel(is_default=True)
113116
self.xlabel = xlabel or wb.XLabel(is_default=True)
114117

autoarray/plot/mat_plot/two_d.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,9 @@ def plot_array(
333333
else:
334334
title = auto_labels.title
335335

336-
self.title.set(auto_title=title, use_log10=self.use_log10)
336+
if self.title is not False:
337+
self.title.set(auto_title=title, use_log10=self.use_log10)
338+
337339
self.ylabel.set()
338340
self.xlabel.set()
339341

@@ -439,7 +441,8 @@ def plot_grid(
439441
if colorbar is not None and self.colorbar_tickparams is not None:
440442
self.colorbar_tickparams.set(cb=colorbar)
441443

442-
self.title.set(auto_title=auto_labels.title)
444+
if self.title is not False:
445+
self.title.set(auto_title=auto_labels.title)
443446
self.ylabel.set()
444447
self.xlabel.set()
445448

@@ -583,7 +586,8 @@ def _plot_rectangular_mapper(
583586
shape_native=mapper.shape_native,
584587
)
585588

586-
self.title.set(auto_title=auto_labels.title)
589+
if self.title is not False:
590+
self.title.set(auto_title=auto_labels.title)
587591
self.tickparams.set()
588592
self.ylabel.set()
589593
self.xlabel.set()
@@ -668,7 +672,8 @@ def _plot_delaunay_mapper(
668672
use_log10=self.use_log10,
669673
)
670674

671-
self.title.set(auto_title=auto_labels.title)
675+
if self.title is not False:
676+
self.title.set(auto_title=auto_labels.title)
672677
self.ylabel.set()
673678
self.xlabel.set()
674679

@@ -751,7 +756,8 @@ def _plot_voronoi_mapper(
751756
use_log10=self.use_log10,
752757
)
753758

754-
self.title.set(auto_title=auto_labels.title)
759+
if self.title is not False:
760+
self.title.set(auto_title=auto_labels.title)
755761
self.ylabel.set()
756762
self.xlabel.set()
757763

autoarray/plot/wrap/base/units.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(
1515
ticks_label: Optional[str] = None,
1616
colorbar_convert_factor: Optional[float] = None,
1717
colorbar_label: Optional[str] = None,
18-
**kwargs
18+
**kwargs,
1919
):
2020
"""
2121
This object controls the units of a plotted figure, and performs multiple tasks when making the plot:

autoarray/plot/wrap/one_d/yx_plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def plot_y_vs_x(
7272
# marker="o",
7373
fmt="o",
7474
# ls=ls_errorbar,
75-
**self.config_dict
75+
**self.config_dict,
7676
)
7777
if plot_axis_type == "errorbar_logy":
7878
plt.yscale("log")

autoarray/plot/wrap/two_d/delaunay_drawer.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,18 @@ def draw_delaunay_pixels(
8787
cmap = plt.get_cmap(cmap.cmap)
8888

8989
if colorbar is not None:
90-
cb = colorbar.set_with_color_values(
91-
units=units,
92-
norm=norm,
93-
cmap=cmap,
94-
color_values=color_values,
95-
ax=ax,
96-
use_log10=use_log10,
97-
)
98-
99-
if cb is not None and colorbar_tickparams is not None:
100-
colorbar_tickparams.set(cb=cb)
90+
if colorbar is not False:
91+
cb = colorbar.set_with_color_values(
92+
units=units,
93+
norm=norm,
94+
cmap=cmap,
95+
color_values=color_values,
96+
ax=ax,
97+
use_log10=use_log10,
98+
)
99+
100+
if cb is not None and colorbar_tickparams is not None:
101+
colorbar_tickparams.set(cb=cb)
101102

102103
else:
103104

@@ -115,5 +116,5 @@ def draw_delaunay_pixels(
115116
cmap=cmap,
116117
vmin=vmin,
117118
vmax=vmax,
118-
**self.config_dict
119+
**self.config_dict,
119120
)

autoarray/structures/arrays/kernel_2d.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(
2626
normalize: bool = False,
2727
store_native: bool = False,
2828
*args,
29-
**kwargs
29+
**kwargs,
3030
):
3131
"""
3232
An array of values, which are paired to a uniform 2D mask of pixels. Each entry
@@ -91,7 +91,9 @@ def no_mask(
9191
pixel_scales=pixel_scales,
9292
origin=origin,
9393
)
94-
return Kernel2D(values=values, mask=values.mask, header=header, normalize=normalize)
94+
return Kernel2D(
95+
values=values, mask=values.mask, header=header, normalize=normalize
96+
)
9597

9698
@classmethod
9799
def full(

autoarray/structures/plot/structure_plotters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,5 +210,5 @@ def figure_1d(self):
210210
should_plot_grid=self.should_plot_grid,
211211
should_plot_zero=self.should_plot_zero,
212212
plot_axis_type_override=self.plot_axis_type,
213-
**self.plot_yx_dict
213+
**self.plot_yx_dict,
214214
)

0 commit comments

Comments
 (0)