Commit f457543c authored by bepinat's avatar bepinat

Correction of a bug when 1D variance spectra are provided rather than a variance datacube

parent f09c56d3
......@@ -318,11 +318,17 @@ def cutcube(cube, hdr, conf):
conf['YMAX'] = cube.shape[1] - 1
if conf['ZMAX'] is None:
conf['ZMAX'] = cube.shape[0] - 1
conf['ZMIN'], conf['YMIN'], conf['XMIN'] = np.max([[conf['ZMIN'], conf['YMIN'], conf['XMIN']], [0, 0, 0]], axis=0)
conf['ZMAX'], conf['YMAX'], conf['XMAX'] = np.min([[conf['ZMAX'], conf['YMAX'], conf['XMAX']], np.array(cube.shape) - 1], axis=0)
conf['ZMIN'], conf['YMIN'], conf['XMIN'] = np.min([[conf['ZMIN'], conf['YMIN'], conf['XMIN']], [conf['ZMAX'], conf['YMAX'], conf['XMAX']]], axis=0)
conf['ZMAX'], conf['YMAX'], conf['XMAX'] = np.max([[conf['ZMAX'], conf['YMAX'], conf['XMAX']], [conf['ZMIN'], conf['YMIN'], conf['XMIN']]], axis=0)
if cube.ndim == 3:
conf['ZMIN'], conf['YMIN'], conf['XMIN'] = np.max([[conf['ZMIN'], conf['YMIN'], conf['XMIN']], [0, 0, 0]], axis=0)
conf['ZMAX'], conf['YMAX'], conf['XMAX'] = np.min([[conf['ZMAX'], conf['YMAX'], conf['XMAX']], np.array(cube.shape) - 1], axis=0)
conf['ZMIN'], conf['YMIN'], conf['XMIN'] = np.min([[conf['ZMIN'], conf['YMIN'], conf['XMIN']], [conf['ZMAX'], conf['YMAX'], conf['XMAX']]], axis=0)
conf['ZMAX'], conf['YMAX'], conf['XMAX'] = np.max([[conf['ZMAX'], conf['YMAX'], conf['XMAX']], [conf['ZMIN'], conf['YMIN'], conf['XMIN']]], axis=0)
if cube.ndim == 1:
conf['ZMIN'] = np.max([conf['ZMIN'], 0], axis=0)
conf['ZMAX'] = np.min([conf['ZMAX'], np.array(cube.shape) - 1], axis=0)
conf['ZMIN'] = np.min([conf['ZMIN'], conf['ZMAX']], axis=0)
conf['ZMAX'] = np.max([conf['ZMAX'], conf['ZMIN']], axis=0)
if cube.ndim == 3:
cubecut = cube[int(conf['ZMIN']):int(conf['ZMAX']) + 1, int(conf['YMIN']):int(conf['YMAX']) + 1, int(conf['XMIN']):int(conf['XMAX']) + 1]
hdr['CRPIX1'] -= conf['XMIN']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment