Skip to content

Commit bcffa26

Browse files
committed
pass on reproject kwargs & fix logical error: sign(0)=0
1 parent 20cba44 commit bcffa26

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spectral_cube/cube_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,7 @@ def mosaic_cubes(cubes, spectral_block_size=100, combine_header_kwargs={},
923923
return_footprint=False,
924924
client=None,
925925
extrapolation_tolerance=1e-6,
926+
reproject_kwargs={},
926927
**kwargs):
927928
'''
928929
This function reprojects cubes onto a common grid and combines them to a single field.
@@ -1151,6 +1152,7 @@ def update(self, n=1):
11511152
block_sizes=(None if spectral_block_size is None else
11521153
[(spectral_block_size, cube.shape[1], cube.shape[2])
11531154
for cube in cubes]),
1155+
**reproject_kwargs
11541156
)
11551157
except TypeError as ex:
11561158
# print the exception in case we caught a different TypeError than expected
@@ -1164,6 +1166,7 @@ def update(self, n=1):
11641166
output_footprint=output_footprint,
11651167
reproject_function=reproject_interp,
11661168
#progressbar=tqdm(desc='reproject_and_coadd') if verbose else False,
1169+
**reproject_kwargs
11671170
)
11681171
elif method == 'channel':
11691172
log_("Using Channel method")
@@ -1262,7 +1265,7 @@ def two_closest_channels(cube, channel):
12621265
keep2 = [(cube is not None) and
12631266
all(sh > 1 for sh in cube.shape) and
12641267
((
1265-
(np.sign(channel) == 1) and
1268+
(np.sign(channel) >= 0) and
12661269
(cube.spectral_axis.min() <= channel*(1+extrapolation_tolerance)) and
12671270
(cube.spectral_axis.max() >= channel*(1-extrapolation_tolerance)))
12681271
or (
@@ -1381,6 +1384,7 @@ def two_closest_channels(cube, channel):
13811384
#block_size=[2,-1,-1],
13821385
#progressbar=partial(tqdm, desc=f'coadd ch{ii}') if verbose else False,
13831386
match_background=False,
1387+
**reproject_kwargs
13841388
)
13851389

13861390
if np.all(output_array_[np.isfinite(output_array_)] == 0) or np.all(output_array[ii:ii+1,:,:][np.isfinite(output_array[ii:ii+1,:,:])] == 0):

0 commit comments

Comments
 (0)