improving cube_inject_companions
@@ -80,14 +80,13 @@ def cube_inject_companions(array, psf_template, angle_list, flevel, plsc,
if not isinstance(plsc, float):
raise TypeError("`plsc` must be a float")
+ rad_dists = np.asarray(rad_dists).reshape(-1) # forces ndim=1
positions = []
# ADI case
if array.ndim == 3:
ceny, cenx = frame_center(array[0])
- rad_dists = np.asarray(rad_dists).reshape(-1) # forces ndim=1
-
if not rad_dists[-1] < min(ceny, cenx) - 5:
raise ValueError('rad_dists last location is at the border (or '
'outside) of the field')
@@ -132,19 +131,14 @@ def cube_inject_companions(array, psf_template, angle_list, flevel, plsc,
if verbose:
print('\t(X,Y)=({:.2f}, {:.2f}) at {:.2f} arcsec '
- '({:.2f} pxs)'.format(pos_x, pos_y, rad_arcs, rad))
+ '({:.2f} pxs from center)'.format(pos_x, pos_y,
+ rad_arcs, rad))
# ADI+mSDI (IFS) case
if array.ndim == 4 and psf_template.ndim == 3:
ceny, cenx = frame_center(array[0, 0])
- if isinstance(rad_dists, (int, float)):
- check_coor = rad_dists
- rad_dists = np.array([rad_dists])
- elif isinstance(rad_dists, (list, np.ndarray)):
- check_coor = rad_dists[-1]
- rad_dists = np.array(rad_dists)
- if not check_coor < min(ceny, cenx) - 5:
+ if not rad_dists[-1] < min(ceny, cenx) - 5:
raise ValueError('rad_dists last location is at the border (or '
'outside) of the field')
@@ -195,7 +189,8 @@ def cube_inject_companions(array, psf_template, angle_list, flevel, plsc,
if verbose:
print('\t(X,Y)=({:.2f}, {:.2f}) at {:.2f} arcsec '
- '({:.2f} pxs)'.format(pos_x, pos_y, rad_arcs, rad))
+ '({:.2f} pxs from center)'.format(pos_x, pos_y,
+ rad_arcs, rad))
if full_output:
return array_out, positions
