Closed ChrisDelaX closed 5 years ago
Version 0.9.8 introduced these two lines in get_square
:
https://github.com/vortex-exoplanet/VIP/blob/65d5c23cf0c39e69ab51922a33ac8d4f0ceb6a9b/vip_hci/var/shapes.py#L249-L250
which caused the TypeError
.
The logic did also work correctly in 0.9.7, because get_square
applies int(...)
to all pixel coordinates, so 0.9.7 should be fine to use too (in this case).
@ChrisDelaX I'm glad to hear VIP is working well for you. It seems @r4lv fixed this problem in #348 by calling normalize_psf
with an integer new size (for cropping the template PSF inside the CC computation). Let us know if you find other problems.
@ChrisDelaX Maybe you would like to switch to the development version of VIP, by installing it with
pip install git+https://github.com/vortex-exoplanet/VIP
Fantastic, thank you.
On Mon, Dec 3, 2018 at 2:41 PM RFarkas notifications@github.com wrote:
@ChrisDelaX https://github.com/ChrisDelaX Maybe you would like to switch to the development version of VIP, by installing it with
pip install git+https://github.com/vortex-exoplanet/VIP
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vortex-exoplanet/VIP/issues/347#issuecomment-443713584, or mute the thread https://github.com/notifications/unsubscribe-auth/AMUG7lAHRmSIDReAF3tCvSWQwTRMzCjPks5u1SodgaJpZM4Y-WST .
So, I just installed the dev version following your link, and now I am getting the 'Size must be an integer' TypeError again.
On Mon, Dec 3, 2018 at 3:49 PM Christian Delacroix < christian.delacroix@gmail.com> wrote:
Fantastic, thank you.
On Mon, Dec 3, 2018 at 2:41 PM RFarkas notifications@github.com wrote:
@ChrisDelaX https://github.com/ChrisDelaX Maybe you would like to switch to the development version of VIP, by installing it with
pip install git+https://github.com/vortex-exoplanet/VIP
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vortex-exoplanet/VIP/issues/347#issuecomment-443713584, or mute the thread https://github.com/notifications/unsubscribe-auth/AMUG7lAHRmSIDReAF3tCvSWQwTRMzCjPks5u1SodgaJpZM4Y-WST .
Here is a simple test, the other inputs are similar values to the ones I am using. The images (arrays) have random pixel value, but the same array shapes as in my study. If you want, I can even send you real data.
In [18]: cc_adi = vip_hci.metrics.contrast_curve(np.random.rand(15,489,489),np.random.rand(15),np.random.rand(39,39),4.26, 5e-3, 1e11, vip_hci.medsub.median_sub, nbranch=1, sigma=5, debug=False, plot=False)
--------------------------------------------------------------------------------
Starting time: 2018-12-03 16:13:33
--------------------------------------------------------------------------------
ALGO : median_sub, FWHM = 4.26, # BRANCHES = 1, SIGMA = 5, STARPHOT = 100000000000.0
--------------------------------------------------------------------------------
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-18-21732e4a925b> in <module>()
----> 1 cc_adi = vip_hci.metrics.contrast_curve(np.random.rand(15,489,489),np.random.rand(15),np.random.rand(39,39),4.26, 5e-3, 1e11, vip_hci.medsub.median_sub, nbranch=1, sigma=5, debug=False, plot=False)
~/anaconda3/lib/python3.7/site-packages/vip_hci/metrics/contrcurve.py in contrast_curve(cube, angle_list, psf_template, fwhm, pxscale, starphot, algo, sigma, nbranch, theta, inner_rad, wedge, fc_snr, student, transmission, smooth, interp_order, plot, dpi, imlib, debug, verbose, full_output, save_plot, object_name, frame_size, fix_y_lim, figsize, **algo_dict)
182 wedge=wedge, fc_snr=fc_snr, full_output=True,
183 algo=algo, imlib=imlib, verbose=verbose_thru,
--> 184 **algo_dict)
185 vector_radd = res_throug[2]
186 if res_throug[0].shape[0] > 1:
~/anaconda3/lib/python3.7/site-packages/vip_hci/metrics/contrcurve.py in throughput(cube, angle_list, psf_template, fwhm, pxscale, algo, nbranch, theta, inner_rad, fc_rad_sep, wedge, fc_snr, full_output, imlib, interpolation, verbose, **algo_dict)
552 psf_template = normalize_psf(psf_template, fwhm=fwhm,
553 size=min(new_psf_size,
--> 554 psf_template.shape[1]))
555
556 # Initialize the fake companions
~/anaconda3/lib/python3.7/site-packages/vip_hci/metrics/fakecomp.py in normalize_psf(array, fwhm, size, threshold, mask_core, model, imlib, interpolation, force_odd, full_output, verbose)
415
416 res = psf_norm_2d(array, fwhm, size, threshold, mask_core, full_output,
--> 417 verbose)
418 return res
419
~/anaconda3/lib/python3.7/site-packages/vip_hci/metrics/fakecomp.py in psf_norm_2d(array, fwhm, size, threshold, mask_core, full_output, verbose)
329 if size is not None:
330 if size < array.shape[0]:
--> 331 psfs = frame_crop(array, size, force=True, verbose=False)
332 else:
333 psfs = array.copy()
~/anaconda3/lib/python3.7/site-packages/vip_hci/preproc/cosmetics.py in frame_crop(array, size, cenxy, force, verbose)
119 cenx, ceny = cenxy
120 array_view = get_square(array, size, ceny, cenx, force=force,
--> 121 verbose=verbose)
122
123 if verbose:
~/anaconda3/lib/python3.7/site-packages/vip_hci/var/shapes.py in get_square(array, size, y, x, position, force, verbose)
219 raise TypeError('Input array is not a 2d array.')
220 if not isinstance(size, int):
--> 221 raise TypeError('`Size` must be integer')
222 if size >= size_init: # assuming square frames
223 msg = "`Size` is equal to or bigger than the initial frame size"
TypeError: `Size` must be integer
In [19]: vip_hci.__version__
Out[19]: '0.9.8'
@ChrisDelaX, sorry, I cannot reproduce the Error with the code you provided. I run the code with this binder1 which uses the latest version (commit 1a4293a from 2 hours ago). — I guess your pip used a cached version of VIP, instead of downloading the latest commit from the master branch?
Maybe re-installing VIP helps:
pip install --upgrade --no-deps --force-reinstall git+https://github.com/vortex-exoplanet/VIP
1 In case you are not familiar with jupyter, you could create a new notebook using the new
→ Python 3
and run your code there. The notebook interface is similar to the ipython
which you seem to use 😊
v0.9.7 works great for me. Then, for some reason I upgraded to v0.9.8 and got this error. No big deal for me, I just downgraded back to v0.9.7 for now.
Here is my terminal output:
Works fine. Then I upgrade to v0.9.8 and it's bugged: