carlos-gg / VIP_extras

Datacubes, Jupyter tutorials and other materials related to VIP (https://github.com/vortex-exoplanet/VIP)
3 stars 6 forks source link

jupyter notebook crash @ SNR map and beyond #8

Open epantin opened 4 years ago

epantin commented 4 years ago

Crash probably because input angles have the wrong shape/type.

I guess that angles shall be reformatted at some point as in "naco_create_hcidataset.ipynb" :

angles have a wrong shape: (61,1) instead of (61,)

dataset.angles = dataset.angles.reshape(-1)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


TypeError Traceback (most recent call last)

in () ----> 1 vip.metrics.snr(vip.pca.pca(cube, angs, ncomp=20, verbose=False), 2 source_xy=(62,62), fwhm=fwhm_naco, plot=True) ~/Softs/Python/anaconda3/lib/python3.6/site-packages/vip_hci/pca/pca_fullfr.py in pca(cube, angle_list, cube_ref, scale_list, ncomp, svd_mode, scaling, mask_center_px, source_xy, delta_rot, fwhm, adimsdi, crop_ifs, imlib, interpolation, collapse, check_memory, batch, nproc, full_output, verbose) 303 res_pca = _adi_pca(cube, angle_list, ncomp, batch, source_xy, delta_rot, 304 fwhm, scaling, mask_center_px, svd_mode, imlib, --> 305 interpolation, collapse, verbose, start_time, True) 306 307 if batch is None: ~/Softs/Python/anaconda3/lib/python3.6/site-packages/vip_hci/pca/pca_fullfr.py in _adi_pca(cube, angle_list, ncomp, batch, source_xy, delta_rot, fwhm, scaling, mask_center_px, svd_mode, imlib, interpolation, collapse, verbose, start_time, full_output) 491 residuals_cube_ = cube_derotate(residuals_cube, angle_list, 492 imlib=imlib, --> 493 interpolation=interpolation) 494 frame = cube_collapse(residuals_cube_, mode=collapse) 495 if verbose: ~/Softs/Python/anaconda3/lib/python3.6/site-packages/vip_hci/preproc/derotation.py in cube_derotate(array, angle_list, imlib, interpolation, cxy, nproc, border_mode) 199 array_der[i] = frame_rotate(array[i], -angle_list[i], imlib=imlib, 200 interpolation=interpolation, cxy=cxy, --> 201 border_mode=border_mode) 202 elif nproc > 1: 203 global data_array ~/Softs/Python/anaconda3/lib/python3.6/site-packages/vip_hci/preproc/derotation.py in frame_rotate(array, angle, imlib, interpolation, cxy, border_mode) 142 raise ValueError('Opencv `border_mode` not recognized.') 143 --> 144 M = cv2.getRotationMatrix2D((cx,cy), angle, 1) 145 array_out = cv2.warpAffine(array.astype(np.float32), M, (x, y), 146 flags=intp, borderMode=bormo) TypeError: Argument 'angle' can not be treated as a double
agallenne commented 3 years ago

I had a similar problem from the tutorial. I have the vip version 0.9.11. First, the vip.HCIDataset module does not exist anymore, I had to use vip.Dataset. Then I also had the dimension problem with the angles vector, so what I did was just to flatten it: betapic = vip.Dataset(cube=cube, angles=angles.flatten(), psf=psf). At least it loads, before having another issue :-/