Skip to content

Commit

Permalink
Manage merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
e-koch committed Dec 29, 2023
2 parents 0fd4f6d + af2f416 commit 2b1d062
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions spectral_cube/cube_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,6 @@ def combine_headers(header1, header2, spectral_dx_threshold=0,
header['CDELT3'] = new_cdelt3
header['WCSAXES'] = 3
header['BITPIX'] = header1['BITPIX']

return header

def _getdata(cube):
Expand Down Expand Up @@ -1076,10 +1075,21 @@ def log_(x):
if output_array.dtype.kind != 'f':
raise TypeError(f"Output array is not a float, it is {output_array.dtype.kind}, while {dtype} was requested.")

def get_common_beam(beams):
""" HACK """
for epsilon in (5e-4, 1e-3, 1e-4, 5e-3, 1e-2):
for beam_threshold in np.logspace(-6, -2, 5):
try:
commonbeam = beams.common_beam(tolerance=beam_threshold, epsilon=epsilon)
return commonbeam
except (BeamError, ValueError) as ex:
print(f"Encountered beam error '{ex}' with threshold {beam_threshold} and epsilon {epsilon}. Trying again.")
raise BeamError("Failed to find common beam.")

# check that the beams are deconvolvable
if commonbeam is not None:
# assemble beams
beams = [cube.beam if hasattr(cube, 'beam') else cube.beams.common_beam()
beams = [cube.beam if hasattr(cube, 'beam') else get_common_beam(cube.beams)
for cube in cubes]

for beam in beams:
Expand Down

0 comments on commit 2b1d062

Please sign in to comment.