diff --git a/vip_hci/metrics/detection.py b/vip_hci/metrics/detection.py index dc2813b7..4796578d 100644 --- a/vip_hci/metrics/detection.py +++ b/vip_hci/metrics/detection.py @@ -322,6 +322,7 @@ def print_abort(): yy_out = [] xx_out = [] snr_list = [] + snr_final = [] if mode in ('lpeaks', 'log', 'dog'): xx -= pad @@ -342,6 +343,7 @@ def print_abort(): _ = frame_report(array, fwhm, (x, y), verbose=verbose) yy_final.append(y) xx_final.append(x) + snr_final.append(snr_value) else: yy_out.append(y) xx_out.append(x) @@ -353,17 +355,18 @@ def print_abort(): if verbose: print(sep) - if debug or full_output: + if debug: table_full = pn.DataFrame({'y': yy.tolist(), 'x': xx.tolist(), 'px_snr': snr_list}) table_full.sort_values('px_snr') + print(table_full) yy_final = np.array(yy_final) xx_final = np.array(xx_final) yy_out = np.array(yy_out) xx_out = np.array(xx_out) - table = pn.DataFrame({'y': yy_final.tolist(), 'x': xx_final.tolist()}) + table = pn.DataFrame({'y': yy_final.tolist(), 'x': xx_final.tolist(), 'px_snr': snr_final}) if plot: coords = tuple(zip(xx_out.tolist() + xx_final.tolist(), @@ -373,9 +376,6 @@ def print_abort(): plot_frames(array, dpi=120, circle=coords, circle_alpha=circlealpha, circle_label=True, circle_radius=fwhm, **kwargs) - if debug: - print(table_full) - if full_output: return table else: diff --git a/vip_hci/preproc/badframes.py b/vip_hci/preproc/badframes.py index c54285ac..8df78c09 100644 --- a/vip_hci/preproc/badframes.py +++ b/vip_hci/preproc/badframes.py @@ -63,9 +63,14 @@ def cube_detect_badfr_pxstats(array, mode='annulus', in_radius=10, width=10, """ check_array(array, 3, msg='array') - if in_radius+width > array[0].shape[0]/2: - msgve = 'Inner radius and annulus size are too big (out of boundaries)' - raise ValueError(msgve) + if mode == 'annulus': + if in_radius + width > array[0].shape[0] / 2: + msgve = 'Inner radius and annulus size are too big (out of boundaries)' + raise ValueError(msgve) + elif mode == 'circle': + if in_radius > array[0].shape[0] / 2: + msgve = 'Radius size is too big (out of boundaries)' + raise ValueError(msgve) if verbose: start_time = time_ini() diff --git a/vip_hci/preproc/recentering.py b/vip_hci/preproc/recentering.py index 25da3466..559f6f20 100644 --- a/vip_hci/preproc/recentering.py +++ b/vip_hci/preproc/recentering.py @@ -1476,7 +1476,8 @@ def cube_recenter_2dfit(array, xy=None, fwhm=4, subi_size=5, model='gauss', if nproc == 1: res = [] - print('2d {}-fitting'.format(model)) + if verbose: + print('2d {}-fitting'.format(model)) for i in Progressbar(range(n_frames), desc="frames", verbose=verbose): if model == "2gauss": args = [array, i, subi_size, pos_y, pos_x, debug, fwhm[i], diff --git a/vip_hci/stats/clip_sigma.py b/vip_hci/stats/clip_sigma.py index b9744f9f..59f2dd9a 100644 --- a/vip_hci/stats/clip_sigma.py +++ b/vip_hci/stats/clip_sigma.py @@ -287,7 +287,7 @@ def _clip_array(array, lower_sigma, upper_sigma, bpm_mask_ori, if bpm_mask_ori is None: gpm_ori = np.ones(array.shape) else: - gpm_ori = np.ones(array.shape)-bpm_mask_ori + gpm_ori = np.ones(array.shape) - bpm_mask_ori ny, nx = array.shape bpm = np.ones(array.shape) @@ -331,7 +331,11 @@ def _clip_array(array, lower_sigma, upper_sigma, bpm_mask_ori, x-hbox_l:x+hbox_r+1] gp_arr = gpm_ori[y-hbox_b:y+hbox_t+1, x-hbox_l:x+hbox_r+1] - neighbours = sub_arr[np.where(gp_arr)].flatten() + gp_idx = np.nonzero(gp_arr) + neighbours = [] + for n, (i, j) in enumerate(zip(gp_idx[0], gp_idx[1])): + neighbours.append(sub_arr[i, j]) + neighbours = np.array(neighbours) neigh_list = [] remove_itself = True for i in range(neighbours.shape[0]):