7. ADI+IFS: PSF subtraction and forward modeling

Author: Valentin Christiaens
Suitable for VIP v1.2.2 onwards (Warning this is a different version requirement than other tutorials)
Last update: 2024/03/25

Table of contents

The purpose of this tutorial is to show:

  • how to inject a planet spectrum in a 4D (IFS+ADI) datacube;

  • how to post-process 4D (IFS+ADI) datacubes;

  • how to retrieve the parameters of a planet present in a 4D (IFS+ADI) datacube (astro- and spectrometry).

Note:

The model spectra (for the star and planet) used in this notebook are provided after resampling for the purpose of highlighting the capabilities of VIP only (i.e. to avoid having to install additional requirements to be able to run this tutorial). If you are interested in a more complete planet spectrum injection procedure, check out this Exoplanet Data Challenge Phase 2 tutorial, which also requires the following external packages: special (for model resampling) and eidc2 (for better flux normalization before spectrum injection).

Let’s first load all packages needed in this tutorial:

import astropy.constants as c
import glob
from hciplot import plot_frames, plot_cubes
from matplotlib import pyplot as plt
import numpy as np
from os.path import join
import pandas as pd
from packaging import version

In the following box we check that your version of VIP passes the requirements to run this notebook:

import vip_hci as vip
vvip = vip.__version__
print("VIP version: ", vvip)
if version.parse(vvip) <= version.parse("1.2.2"):
    msg = "Please upgrade your version of VIP"
    msg+= "It should be above 1.2.2 to run this notebook."
    raise ValueError(msg)
VIP version:  1.6.2

7.1. Loading and visualizing the data

In the ‘datasets’ folder of the VIP_extras repository you can find a toy SPHERE/IFS coronagraphic cube acquired in pupil-stabilized mode on the source HIP39826 (a star with no reported directly imaged companion). The folder also contains the associated non-coronagraphic point spread function (PSF), wavelength vector, parallactic angles, and airmass of the source.

Let’s now load the data. Note that more info on opening and visualizing fits files with VIP in general is available in the first VIP tutorial.

from vip_hci.fits import open_fits
from astropy.utils.data import download_file

url_d = "https://github.com/vortex-exoplanet/VIP_extras/raw/master/datasets"
f1 = download_file("{}/sphere_ifs_HIP39826_cube.fits".format(url_d), cache=True)
f2 = download_file("{}/sphere_ifs_HIP39826_psf.fits".format(url_d), cache=True)
f3 = download_file("{}/sphere_ifs_HIP39826_pa.fits".format(url_d), cache=True)
f4 = download_file("{}/sphere_ifs_HIP39826_wl.fits".format(url_d), cache=True)
f5 = download_file("{}/sphere_ifs_HIP39826_airmass.fits".format(url_d), cache=True)
ftrans = download_file("{}/sphere_ifs_YJ_APLC_CoroTransmission.fits".format(url_d), cache=True)

# alternatively, for local files simply provide their full or relative path. E.g.:
#f1 = '../datasets/sphere_ifs_HIP39826_cube.fits'
#f2 = '../datasets/sphere_ifs_HIP39826_psf.fits'
#f3 = '../datasets/sphere_ifs_HIP39826_pa.fits'
#f4 = '../datasets/sphere_ifs_HIP39826_wl.fits'
#f5 = '../datasets/sphere_ifs_HIP39826_airmass.fits'

cube = open_fits(f1)
psf = open_fits(f2)
derot_angles = -1*open_fits(f3) # note: SPHERE DRH returns parallactic angles, while VIP routines take derotation angles as input
lbda = open_fits(f4)
X_sci = open_fits(f5)
trans = open_fits(ftrans)

nch, nz, ny, nx = cube.shape
FITS HDU-0 data successfully loaded. Data shape: (39, 55, 107, 107)
FITS HDU-0 data successfully loaded. Data shape: (39, 29, 29)
FITS HDU-0 data successfully loaded. Data shape: (55,)
FITS HDU-0 data successfully loaded. Data shape: (39,)
FITS HDU-0 data successfully loaded. Data shape: (55,)
FITS HDU-0 data successfully loaded. Data shape: (40, 23)
Note:

In this example, we take the opposite of the parallactic angles provided in the FITS file, as the convention in VIP is to always consider the derotation angles to be applied to align North up, while the loaded angles are the direct outputs of the SPHERE data center calibration, which trace the parallactic angles.

Each IFS spectral cube consists of 39 monochromatic images spread in wavelengths between the Y and J bands (‘YJ’ mode) or Y and H bands (‘YJH’ mode). Here the IFS+ADI cube contains 55 such spectral cubes combined into a single master cube.

The master spectral cube is already centered, trimmed from bad frames, and mostly corrected from bad pixels (check Tutorial 2 for example uses).

Let’s inspect the first wavelength using hciplot.plot_cubes (feel free to set the backend to ‘bokeh’ to read pixel values interactively):

plot_cubes(cube)#, backend='bokeh')
:Dataset   [x,y,time,lambda]   (flux)
:Cube_shape	[107, 107, 55, 39]

We notice that the flux varies and the PSF size increases, both as a function of wavelength.

Now let’s inspect the PSF cube (one frame per wavelength), which will be used for the actual injection of a fake planet:

plot_cubes(psf)
:Dataset   [x,y,time]   (flux)
:Cube_shape	[29, 29, 39]

As we can see, the flux varies as a function of wavelength. This reflects the intrinsic spectrum of the star but also the instrumental transmission and atmospheric absorption bands (e.g. associated to the water molecule) affecting some wavelengths more than others. The flux will be normalized in the next section, before injection.

Now let’s check the parallactic angle and airmass variations:

%matplotlib inline
fig, axes = plt.subplots(1,2, figsize = (14,5))
ax1, ax2 = axes
ax1.plot(range(1,nz+1), derot_angles)
ax1.set_xlabel("Cube index")
ax1.set_ylabel("Parallactic angle (deg)")
ax2.plot(range(1,nz+1), X_sci)
ax2.set_xlabel("Cube index")
ax2.set_ylabel("Airmass")
plt.show()
../_images/ee241d46691be451e5d6422762bd57880e099337df42fdb752e64b78478ee73c.png

Note the sudden variation in parallactic angle at the end of the sequence is because we trimmed bad frames from the sequence (all were located towards the end of the observation).

Let’s define the pixel scale for IFS - note that this is optional since the planet coordinates will be given in pixels. It will still be useful to have meaningful radial separations expressed in arcsec.

from vip_hci.config import VLT_SPHERE_IFS
plsc = VLT_SPHERE_IFS['plsc']
print(plsc, "arcsec/px")
0.00746 arcsec/px

The coronagraphic radial transmission profile was loaded above and cast into the trans variable. Let’s visualize it.

last_r = 20
plt.figure(figsize=(10,6))
plt.plot(trans[0,:last_r]*1000, trans[1,:last_r], 'b', label='ch 1')
plt.plot(trans[0,:last_r]*1000, trans[10,:last_r], 'c', label='ch 10')
plt.plot(trans[0,:last_r]*1000, trans[20,:last_r], 'y', label='ch 20')
plt.plot(trans[0,:last_r]*1000, trans[30,:last_r], 'm', label='ch 30')
plt.plot(trans[0,:last_r]*1000, trans[-1,:last_r], 'r', label='ch 39')
plt.xlabel("Radius (mas)")
plt.ylabel("Transmission")
plt.legend()
<matplotlib.legend.Legend at 0x7fcbb6625600>
../_images/18d3f9fc345ff9aed18dd78e471146141420a731a6ce51a371a4043ddbe78483.png
Caution:

This is not the most up-to-date SPHERE coronagraphic transmission curve. Please contact relevant SPHERE colleagues or check the ESO website for a newer version. Do not use the above curve for your research.

7.2. Planet parameters and spectra

Now let’s set the ground truth coordinates and average contrast (over all wavelengths) at which two planets will be injected in this cube:

xy_b = (58.6,37.7)
contrast_b = 1e-3

xy_c = (83.8,29.9)
contrast_c = 2e-4

Let’s convert cartesian to polar coordinates:

from vip_hci.var import frame_center, dist

cy, cx = frame_center(cube)
r_b = dist(cy, cx, xy_b[1], xy_b[0])
r_c = dist(cy, cx, xy_c[1], xy_c[0])

theta_b = np.rad2deg(np.arctan2(xy_b[1]-cy, xy_b[0]-cx))
theta_c = np.rad2deg(np.arctan2(xy_c[1]-cy, xy_c[0]-cx))
print(cy, cx)
print(r_b, theta_b)
print(r_c, theta_c)
53 53
16.292636373527763 -69.89671372878468
38.5 -36.86989764584403

Now let’s consider two fiducial model spectra for the injection of the 2 planets: a flat spectrum and a 1000K blackbody model (note that this exercise is purely academic).

def blackbody(lbda, T): 
    fac = 2*c.h.value*(c.c.value**2)/(np.power(lbda*1e-6,5))
    div = (1/(np.exp((c.h.value*c.c.value)/((lbda*1e-6)*c.k_B.value*T))-1))
    # convert from W m-3 Sr-1 to W m-2 mu-1 Sr-1 
    conv = 1e-6
    return fac*div*conv
fluxes_b = np.ones_like(lbda)
fluxes_c = blackbody(lbda, 1000)

spec_b = np.array([lbda, fluxes_b])
spec_c = np.array([lbda, fluxes_c])
plt.plot(lbda, fluxes_b/np.amax(fluxes_b), 'k', label='flat')
plt.plot(lbda, fluxes_c/np.amax(fluxes_c), 'r', label='1000 K BB')
plt.xlabel(r"$\lambda (\mu$m)")
plt.ylabel(r"$ F_{\lambda}$ (arbitrary units)")
plt.legend()
<matplotlib.legend.Legend at 0x7fcbba673c40>
../_images/9b548b08fb8ce4770824ffcf0816541dfdbb8be6a7804068fac021824a653de5.png

7.3. Flux normalization

7.3.1. Non-coronagraphic PSF normalization

Let’s measure the flux and FWHM of the non-coronagraphic PSF and normalize its flux to 1 in a 1-FWHM radius aperture (all at once), in all channels, using VIP’s fm/normalize_psf function. We use the debug option to check that each 2D Gaussian fit worked properly:

from vip_hci.fm import normalize_psf
%matplotlib inline
psfn, flux_st, fwhm = normalize_psf(psf, fwhm='fit', full_output=True, debug=True)
../_images/a5947a299ba786493c94747f86d3d022f86329dbc87e4fc3d014f81322c85480.png
FWHM_y = 6.2499185906038734
FWHM_x = 5.955174570808004 

centroid y = 13.91271280451398
centroid x = 13.89930852239612
centroid y subim = 13.91271280451398
centroid x subim = 13.89930852239612 

amplitude = 636.3209207163183
theta = -40.2032749489346
../_images/d6ffe37dbfe8a69c552c56e3dfac8b3131da308595f9d35cdb61fd1e9b68d156.png
FWHM_y = 6.115031733429569
FWHM_x = 5.839092912200307 

centroid y = 14.027611189747118
centroid x = 13.902123414264741
centroid y subim = 14.027611189747118
centroid x subim = 13.902123414264741 

amplitude = 1054.2949916060757
theta = -37.53607125551687
../_images/497abadd79ceeadea251bc8b0a7bf70e6ed31afe88ee43afea341a553333baff.png
FWHM_y = 6.017536940985172
FWHM_x = 5.754055056932398 

centroid y = 14.064675014829234
centroid x = 13.921899407828272
centroid y subim = 14.064675014829234
centroid x subim = 13.921899407828272 

amplitude = 1404.794695125425
theta = -32.75340696040905
../_images/0a9d18ae2fcc2478d976c2064d1fb38424c53516c529a3aa76f234d1b1b7af77.png
FWHM_y = 5.991878155204902
FWHM_x = 5.682647009421292 

centroid y = 14.065184394206566
centroid x = 13.946038597175642
centroid y subim = 14.065184394206566
centroid x subim = 13.946038597175642 

amplitude = 1705.2716467835362
theta = -37.3838283117331
../_images/0ac6863e914a9473b22670e8eaf208f06df4dfc07b34222ef9d8b2f7710ccf0c.png
FWHM_y = 6.025210456840216
FWHM_x = 5.719302651409165 

centroid y = 14.075784813017492
centroid x = 13.955473078460203
centroid y subim = 14.075784813017492
centroid x subim = 13.955473078460203 

amplitude = 1975.512023781219
theta = -39.2271681016271
../_images/0a0199d922c0aaee2e3d366fc4c10eb15b29e2304104642c4d2a2f75c8d3ab06.png
FWHM_y = 5.985037638845695
FWHM_x = 5.719904342290713 

centroid y = 14.090563585852339
centroid x = 13.954901979145369
centroid y subim = 14.090563585852339
centroid x subim = 13.954901979145369 

amplitude = 2143.9966998784653
theta = -37.89243906967069
../_images/89fe407a812a8f5da77784efff04c4cfb7a1250f919f8c2aff332cf256cacdd5.png
FWHM_y = 6.037449649433551
FWHM_x = 5.7537333670610575 

centroid y = 14.109510955089712
centroid x = 13.980317492176528
centroid y subim = 14.109510955089712
centroid x subim = 13.980317492176528 

amplitude = 2165.8668020759737
theta = -38.98816537803606
../_images/d9cb749028122adf276c229ea7aff19bdc93eb8424e3b8c2ed799085cd51e47f.png
FWHM_y = 6.010425979656497
FWHM_x = 5.749988204486839 

centroid y = 14.09139902516843
centroid x = 13.986593684665714
centroid y subim = 14.09139902516843
centroid x subim = 13.986593684665714 

amplitude = 2237.452674183443
theta = -42.08255560940277
../_images/886c9cc6541026290781865866d856f57e66a70a9b053d0236b80665fff30953.png
FWHM_y = 6.005151597188338
FWHM_x = 5.76618913736032 

centroid y = 14.090254937281216
centroid x = 14.000261828564383
centroid y subim = 14.090254937281216
centroid x subim = 14.000261828564383 

amplitude = 2355.107335363224
theta = -38.12872688402827
../_images/1fa9855ca603621c65cf447ccf8df17da95d9d7cc1f0a6d1bb1accca6b02aac6.png
FWHM_y = 5.968097471114103
FWHM_x = 5.7329897987670995 

centroid y = 14.102026780112466
centroid x = 14.00192256597961
centroid y subim = 14.102026780112466
centroid x subim = 14.00192256597961 

amplitude = 2523.9552216610077
theta = -36.1667187947008
../_images/5ddc0af29ccde4255a81743a3157ce4a3489b811aefd3872a71fef553a2dc375.png
FWHM_y = 6.201045253077615
FWHM_x = 5.952529125955214 

centroid y = 14.095618864845
centroid x = 14.011238141279225
centroid y subim = 14.095618864845
centroid x subim = 14.011238141279225 

amplitude = 2483.2785732032326
theta = -40.014533065813566
../_images/13646193bb9fcbe464c327fc3f5e571369fbeadc045510108362e5cf89d50f26.png
FWHM_y = 6.116743999603686
FWHM_x = 5.8392716209686455 

centroid y = 14.100847253492372
centroid x = 14.00962801008164
centroid y subim = 14.100847253492372
centroid x subim = 14.00962801008164 

amplitude = 2649.287384055851
theta = -42.97211525263866
../_images/b453b50fc62e2329d903d2437455a1b79a4c5e954a0fefa2f7e86443004de29c.png
FWHM_y = 6.037056836634695
FWHM_x = 5.786392745945852 

centroid y = 14.110142788418528
centroid x = 14.004784235107898
centroid y subim = 14.110142788418528
centroid x subim = 14.004784235107898 

amplitude = 2770.024028598639
theta = -39.877002236794056
../_images/261b1cd910d4d28c632e5c8ee47e830a6ad275e0e650091fc25ce032e1d5ff7a.png
FWHM_y = 6.066318706454739
FWHM_x = 5.822724547903064 

centroid y = 14.099317823674594
centroid x = 14.003150239115127
centroid y subim = 14.099317823674594
centroid x subim = 14.003150239115127 

amplitude = 2830.2548549551825
theta = -47.8120183170672
../_images/e89b2e70db05652628a3020a9777de65034a42f231f1f26a14a5c53903efcb3c.png
FWHM_y = 6.0762534866894
FWHM_x = 5.806486874018673 

centroid y = 14.112521461447967
centroid x = 14.034377198494248
centroid y subim = 14.112521461447967
centroid x subim = 14.034377198494248 

amplitude = 2803.4053532338025
theta = -1130.8992713799976
../_images/f0fa2291073940ae91cafe5452fe378efb9101d73de9b25fe58295aa6fd38955.png
FWHM_y = 5.783408275201281
FWHM_x = 6.0947688987153565 

centroid y = 14.151451482312362
centroid x = 14.046235885495356
centroid y subim = 14.151451482312362
centroid x subim = 14.046235885495356 

amplitude = 2553.3202894435076
theta = -1046.1876651444493
../_images/cce89cc115a1f609778e2d52e17541b99a89a9bf91c08cc602267e280891b31e.png
FWHM_y = 6.18160840917673
FWHM_x = 5.819390957373637 

centroid y = 14.20606445385617
centroid x = 14.027564827140305
centroid y subim = 14.20606445385617
centroid x subim = 14.027564827140305 

amplitude = 2063.1990467607516
theta = -591.8971103322749
../_images/5091f5cd8b3fe3079811ba67af72e32154640e2d359cdd3f43593b45ef919c95.png
FWHM_y = 5.751799509227016
FWHM_x = 6.1765754988581305 

centroid y = 14.199498974484168
centroid x = 14.014692740126705
centroid y subim = 14.199498974484168
centroid x subim = 14.014692740126705 

amplitude = 1668.5838006836177
theta = 214.19574589903868
../_images/887094b71e74cac3c376c0fdb0477d6a832bd34f2ab68fd718436cea75890960.png
FWHM_y = 5.797247573087524
FWHM_x = 6.1407206833700165 

centroid y = 14.09188009914479
centroid x = 13.978278484577537
centroid y subim = 14.09188009914479
centroid x subim = 13.978278484577537 

amplitude = 1587.9799968312032
theta = 208.93362670690013
../_images/2c34ec7f7013ecb03550e5505a1bac52d54d5ea8672a30d8f1f8750ac8447bda.png
FWHM_y = 6.173286713166213
FWHM_x = 5.849770266197921 

centroid y = 14.020275158086994
centroid x = 14.002567343397786
centroid y subim = 14.020275158086994
centroid x subim = 14.002567343397786 

amplitude = 1805.5945901482098
theta = 117.55114919185255
../_images/d27ff720bf92b5b271a059859ca22cd33ef3e478ffc6cf51cec9851a88dc0c41.png
FWHM_y = 5.8792339430596385
FWHM_x = 6.127221726103625 

centroid y = 13.989753883492577
centroid x = 14.002807252408369
centroid y subim = 13.989753883492577
centroid x subim = 14.002807252408369 

amplitude = 2198.15726732781
theta = -320.2155668333245
../_images/6e37cbb16e6502c7c810324ef57c74266d7923ca4f7243880ee102ab01d18c3f.png
FWHM_y = 5.887171922875942
FWHM_x = 6.160164896057722 

centroid y = 14.006124941599417
centroid x = 14.009936779590372
centroid y subim = 14.006124941599417
centroid x subim = 14.009936779590372 

amplitude = 2628.450008946031
theta = -321.35901701076017
../_images/60a819f9d41ca707ffbd9d49790255779c65c7516ca4154c1aac6a66288eb38c.png
FWHM_y = 6.09831937562108
FWHM_x = 5.823811534748941 

centroid y = 14.045780781152429
centroid x = 14.014771011818317
centroid y subim = 14.045780781152429
centroid x subim = 14.014771011818317 

amplitude = 2992.2717122916088
theta = -228.95610739084975
../_images/23b7152762d767354feeca2e8844b0906edcdf7ae4c031745d701489807c18b5.png
FWHM_y = 6.0881435225079805
FWHM_x = 5.800320948866406 

centroid y = 14.051247831816042
centroid x = 13.998093842075047
centroid y subim = 14.051247831816042
centroid x subim = 13.998093842075047 

amplitude = 3191.2868185639486
theta = -409.9397195034933
../_images/442931b279bb8f3f5626200d036af9e89740c72a48bd727038a12c5480604d73.png
FWHM_y = 6.131166433598984
FWHM_x = 5.872212732710024 

centroid y = 14.035337815438458
centroid x = 13.998171477355866
centroid y subim = 14.035337815438458
centroid x subim = 13.998171477355866 

amplitude = 3243.165884637672
theta = -50.09403205265119
../_images/3f6a3dd17d9dcd1f94a246c08d6e72c0ddfc9d10773200b5da3d07adb0518689.png
FWHM_y = 6.174942665281358
FWHM_x = 5.993212466027066 

centroid y = 14.039753518531834
centroid x = 13.991921001228043
centroid y subim = 14.039753518531834
centroid x subim = 13.991921001228043 

amplitude = 3307.870326350025
theta = -60.77852495501218
../_images/0158cc016298a101c4250352bb5705263a2ca64dc7bf3cd9ca77716603c1f760.png
FWHM_y = 6.212946741792123
FWHM_x = 6.032862559194067 

centroid y = 14.009742407110084
centroid x = 13.967991908928983
centroid y subim = 14.009742407110084
centroid x subim = 13.967991908928983 

amplitude = 3436.0292572548005
theta = -233.07434375115434
../_images/e23190f1cbe9732fcfd490d710a619d05f9194408c1f724552a056541b5736e0.png
FWHM_y = 6.202834710260402
FWHM_x = 5.991454580720097 

centroid y = 14.020014512644996
centroid x = 13.952064722408837
centroid y subim = 14.020014512644996
centroid x subim = 13.952064722408837 

amplitude = 3546.6560417516
theta = -45.08873954759156
../_images/e6861d1c37d02f45641225c4a2b6b83e2659e4e56ed220268d906d8a0cff96b0.png
FWHM_y = 6.188582125824742
FWHM_x = 5.985402654686102 

centroid y = 14.01288592814225
centroid x = 13.933314914222532
centroid y subim = 14.01288592814225
centroid x subim = 13.933314914222532 

amplitude = 3607.1363107135307
theta = -45.5425527870248
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
Cell In[15], line 3
      1 from vip_hci.fm import normalize_psf
      2 get_ipython().run_line_magic('matplotlib', 'inline')
----> 3 psfn, flux_st, fwhm = normalize_psf(psf, fwhm='fit', full_output=True, debug=True)

File ~/checkouts/readthedocs.org/user_builds/vip/envs/latest/lib/python3.10/site-packages/vip_hci/fm/fakecomp.py:755, in normalize_psf(array, fwhm, size, threshold, mask_core, model, imlib, interpolation, force_odd, correct_outliers, full_output, verbose, debug)
    753     fwhm = [fwhm] * array.shape[0]
    754 else:
--> 755     fits_vect = [fit_2d(array[i],
    756                         full_output=True,
    757                         debug=debug) for i in range(n)]
    758     if model == 'gauss':
    759         fwhmx = [fits_vect[i]['fwhm_x'] for i in range(n)]

File ~/checkouts/readthedocs.org/user_builds/vip/envs/latest/lib/python3.10/site-packages/vip_hci/fm/fakecomp.py:755, in <listcomp>(.0)
    753     fwhm = [fwhm] * array.shape[0]
    754 else:
--> 755     fits_vect = [fit_2d(array[i],
    756                         full_output=True,
    757                         debug=debug) for i in range(n)]
    758     if model == 'gauss':
    759         fwhmx = [fits_vect[i]['fwhm_x'] for i in range(n)]

File ~/checkouts/readthedocs.org/user_builds/vip/envs/latest/lib/python3.10/site-packages/vip_hci/var/fit_2d.py:281, in fit_2dgaussian(array, crop, cent, cropsize, fwhmx, fwhmy, theta, threshold, sigfactor, bpm, full_output, debug)
    279 else:
    280     label = ('Subimage', 'Model', 'Residuals')
--> 281 plot_frames((psf_subimage, fit(x, y), psf_subimage-fit(x, y)),
    282             grid=True, grid_spacing=1, label=label)
    283 print('FWHM_y =', fwhm_y)
    284 print('FWHM_x =', fwhm_x, '\n')

File ~/checkouts/readthedocs.org/user_builds/vip/envs/latest/lib/python3.10/site-packages/hciplot/hciplot.py:827, in plot_frames(data, backend, mode, rows, vmax, vmin, circle, circle_alpha, circle_color, circle_linestyle, circle_radius, circle_label, circle_label_color, ellipse, ellipse_alpha, ellipse_color, ellipse_linestyle, ellipse_a, ellipse_b, ellipse_angle, ellipse_label, ellipse_label_color, arrow, arrow_alpha, arrow_length, arrow_shiftx, arrow_label, arrow_color, arrow_head_width, arrow_head_length, arrow_width, label, label_pad, label_size, label_color, grid, grid_alpha, grid_color, grid_spacing, cross, cross_alpha, lab_fontsize, cross_color, ang_scale, ang_ticksep, ang_ticksep_minor, tick_direction, tick_color, ndec, pxscale, auscale, ang_legend, au_legend, axis, show_center, cmap, log, colorbar, top_colorbar, colorbar_ticks, colorbar_ticksize, colorbar_label, colorbar_label_size, patch, dpi, size_factor, horsp, versp, width, height, title, tit_size, sampling, save, return_fig_ax, transparent)
    825 if ang_ticksep_minor is None:
    826     minor_ticks = np.arange(0, data[i].shape[0], gridspa)
--> 827     ax.set_xticks(minor_ticks, minor=True)
    828     ax.set_yticks(minor_ticks, minor=True)
    829 ax.grid(True, which='minor', color=grid_color[i], linewidth=0.5,
    830         alpha=grid_alpha[i], linestyle='dashed')

File ~/checkouts/readthedocs.org/user_builds/vip/envs/latest/lib/python3.10/site-packages/matplotlib/axes/_base.py:74, in _axis_method_wrapper.__set_name__.<locals>.wrapper(self, *args, **kwargs)
     73 def wrapper(self, *args, **kwargs):
---> 74     return get_method(self)(*args, **kwargs)

File ~/checkouts/readthedocs.org/user_builds/vip/envs/latest/lib/python3.10/site-packages/matplotlib/axis.py:2183, in Axis.set_ticks(self, ticks, labels, minor, **kwargs)
   2178     first_key = next(iter(kwargs))
   2179     raise ValueError(
   2180         f"Incorrect use of keyword argument {first_key!r}. Keyword arguments "
   2181         "other than 'minor' modify the text labels and can only be used if "
   2182         "'labels' are passed as well.")
-> 2183 result = self._set_tick_locations(ticks, minor=minor)
   2184 if labels is not None:
   2185     self.set_ticklabels(labels, minor=minor, **kwargs)

File ~/checkouts/readthedocs.org/user_builds/vip/envs/latest/lib/python3.10/site-packages/matplotlib/axis.py:2132, in Axis._set_tick_locations(self, ticks, minor)
   2130 if minor:
   2131     self.set_minor_locator(locator)
-> 2132     return self.get_minor_ticks(len(ticks))
   2133 else:
   2134     self.set_major_locator(locator)

File ~/checkouts/readthedocs.org/user_builds/vip/envs/latest/lib/python3.10/site-packages/matplotlib/axis.py:1698, in Axis.get_minor_ticks(self, numticks)
   1696     tick = self._get_tick(major=False)
   1697     self.minorTicks.append(tick)
-> 1698     self._copy_tick_props(self.minorTicks[0], tick)
   1700 return self.minorTicks[:numticks]

File ~/checkouts/readthedocs.org/user_builds/vip/envs/latest/lib/python3.10/site-packages/matplotlib/axis.py:1618, in Axis._copy_tick_props(self, src, dest)
   1616 dest.label1.update_from(src.label1)
   1617 dest.label2.update_from(src.label2)
-> 1618 dest.tick1line.update_from(src.tick1line)
   1619 dest.tick2line.update_from(src.tick2line)
   1620 dest.gridline.update_from(src.gridline)

File ~/checkouts/readthedocs.org/user_builds/vip/envs/latest/lib/python3.10/site-packages/matplotlib/lines.py:1357, in Line2D.update_from(self, other)
   1354 self._solidjoinstyle = other._solidjoinstyle
   1356 self._linestyle = other._linestyle
-> 1357 self._marker = MarkerStyle(marker=other._marker)
   1358 self._drawstyle = other._drawstyle

File ~/checkouts/readthedocs.org/user_builds/vip/envs/latest/lib/python3.10/site-packages/matplotlib/markers.py:248, in MarkerStyle.__init__(self, marker, fillstyle, transform, capstyle, joinstyle)
    246 self._user_joinstyle = JoinStyle(joinstyle) if joinstyle is not None else None
    247 self._set_fillstyle(fillstyle)
--> 248 self._set_marker(marker)

File ~/checkouts/readthedocs.org/user_builds/vip/envs/latest/lib/python3.10/site-packages/matplotlib/markers.py:323, in MarkerStyle._set_marker(self, marker)
    321     self._marker_function = self._set_tuple_marker
    322 elif isinstance(marker, MarkerStyle):
--> 323     self.__dict__ = copy.deepcopy(marker.__dict__)
    324 else:
    325     try:

File ~/.asdf/installs/python/3.10.14/lib/python3.10/copy.py:146, in deepcopy(x, memo, _nil)
    144 copier = _deepcopy_dispatch.get(cls)
    145 if copier is not None:
--> 146     y = copier(x, memo)
    147 else:
    148     if issubclass(cls, type):

File ~/.asdf/installs/python/3.10.14/lib/python3.10/copy.py:231, in _deepcopy_dict(x, memo, deepcopy)
    229 memo[id(x)] = y
    230 for key, value in x.items():
--> 231     y[deepcopy(key, memo)] = deepcopy(value, memo)
    232 return y

File ~/.asdf/installs/python/3.10.14/lib/python3.10/copy.py:153, in deepcopy(x, memo, _nil)
    151 copier = getattr(x, "__deepcopy__", None)
    152 if copier is not None:
--> 153     y = copier(memo)
    154 else:
    155     reductor = dispatch_table.get(cls)

File ~/checkouts/readthedocs.org/user_builds/vip/envs/latest/lib/python3.10/site-packages/matplotlib/path.py:285, in Path.__deepcopy__(self, memo)
    280 """
    281 Return a deepcopy of the `Path`.  The `Path` will not be
    282 readonly, even if the source `Path` is.
    283 """
    284 # Deepcopying arrays (vertices, codes) strips the writeable=False flag.
--> 285 p = copy.deepcopy(super(), memo)
    286 p._readonly = False
    287 return p

File ~/.asdf/installs/python/3.10.14/lib/python3.10/copy.py:172, in deepcopy(x, memo, _nil)
    170                 y = x
    171             else:
--> 172                 y = _reconstruct(x, memo, *rv)
    174 # If is its own copy, don't memoize.
    175 if y is not x:

File ~/.asdf/installs/python/3.10.14/lib/python3.10/copy.py:271, in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
    269 if state is not None:
    270     if deep:
--> 271         state = deepcopy(state, memo)
    272     if hasattr(y, '__setstate__'):
    273         y.__setstate__(state)

File ~/.asdf/installs/python/3.10.14/lib/python3.10/copy.py:146, in deepcopy(x, memo, _nil)
    144 copier = _deepcopy_dispatch.get(cls)
    145 if copier is not None:
--> 146     y = copier(x, memo)
    147 else:
    148     if issubclass(cls, type):

File ~/.asdf/installs/python/3.10.14/lib/python3.10/copy.py:231, in _deepcopy_dict(x, memo, deepcopy)
    229 memo[id(x)] = y
    230 for key, value in x.items():
--> 231     y[deepcopy(key, memo)] = deepcopy(value, memo)
    232 return y

KeyboardInterrupt: 

Now let’s plot the measured FWHM and stellar flux:

fig, axes = plt.subplots(1,2, figsize = (14,5))
ax1, ax2 = axes
ax1.plot(lbda, fwhm, 'bo')
ax1.set_xlabel(r"Wavelength ($\mu$m)")
ax1.set_ylabel("FWHM")
ax2.plot(lbda, flux_st, 'ro')
ax2.set_xlabel(r"Wavelength ($\mu$m)")
ax2.set_ylabel("Stellar flux (ADUs)")
plt.show()
../_images/06240dc142ef36036149ba88645e7ac83fae8608b5835de5992caf66250942c1.png

Fig. 3.1: Measured FWHM and stellar flux in the non-coronagraphic PSF cube.

plot_cubes(psfn, grid=True)
:Dataset   [x,y,time]   (flux)
:Cube_shape	[29, 29, 39]

Now let’s save the measured spectrum of the star in the format we will need for the injection function:

spec_star = np.array([lbda, flux_st])

7.3.2. Stellar SED model

The spectral type of the star (HIP39826) is K7V. For the purpose of this tutorial, we simply load a BT-NextGen SED model that has already be resampled considering the spectral resolution and sampling of SPHERE-IFS:

spec_star_mod = open_fits("../datasets/sphere_ifs_HIP39826_SED_model.fits")

plt.plot(spec_star_mod[0], spec_star_mod[0]*spec_star_mod[1], 'k', label='Model SED for the star')
plt.ylabel(r"$\lambda F_{\lambda}$ (arbitrary units)")
plt.legend()
FITS HDU-0 data successfully loaded. Data shape: (2, 39)
<matplotlib.legend.Legend at 0x1570c4070>

7.3.3. Airmass

Airmass variation can also be taken into consideration during the injection of the planet spectra (more specifically we consider the ratio between individual airmass values and the median airmass over the observation):

med_X = np.median(X_sci)
X_fac = np.exp(-(X_sci-med_X))

Let’s plot the factors to be applied to correct for airmass (w.r.t median airmass):

%matplotlib inline
plt.plot(range(1,nz+1), X_fac, 'k')
plt.xlabel("Cube index")
plt.ylabel("X factor")
Text(25.097222222222214, 0.5, 'X factor')

7.3.4. Final fluxes

Let’s now calculate the fluxes at which the normalized PSF will actually be injected in each frame of each spectral cube.

Considering the effect of instrumental and atmospheric transmission, we have:

flux_b_trans = fluxes_b*(flux_st/spec_star_mod[1])
flux_c_trans = fluxes_c*(flux_st/spec_star_mod[1])                     

Considering the actual mean contrast we want the planet to be injected, with respect to the star, we have:

flux_b_scal = flux_b_trans*contrast_b*np.mean(flux_st)/np.mean(flux_b_trans)
flux_c_scal = flux_c_trans*contrast_c*np.mean(flux_st)/np.mean(flux_c_trans) 

Finally let’s consider the airmass:

final_fluxes_b = np.outer(flux_b_scal, X_fac)
final_fluxes_c = np.outer(flux_c_scal, X_fac)
Note:

The effect of coronagraphic transmission is taken at the moment of injection, within the planet injection function (next section), as it depends on the radial separation from the star.

7.4. Injection

The actual injection can be simply performed with the cube_inject_companions function, which can handle 4D input cubes. Let’s inject the first planet first:

from vip_hci.fm import cube_inject_companions
cube_fc = cube_inject_companions(cube, psfn, derot_angles, flevel=final_fluxes_b, 
                                 plsc=plsc, rad_dists=[r_b], n_branches=1, 
                                 theta=theta_b, transmission=trans, verbose=True)
*** Processing spectral channel 1/39 ***
*** Processing spectral channel 2/39 ***
*** Processing spectral channel 3/39 ***
*** Processing spectral channel 4/39 ***
*** Processing spectral channel 5/39 ***
*** Processing spectral channel 6/39 ***
*** Processing spectral channel 7/39 ***
*** Processing spectral channel 8/39 ***
*** Processing spectral channel 9/39 ***
*** Processing spectral channel 10/39 ***
*** Processing spectral channel 11/39 ***
*** Processing spectral channel 12/39 ***
*** Processing spectral channel 13/39 ***
*** Processing spectral channel 14/39 ***
*** Processing spectral channel 15/39 ***
*** Processing spectral channel 16/39 ***
*** Processing spectral channel 17/39 ***
*** Processing spectral channel 18/39 ***
*** Processing spectral channel 19/39 ***
*** Processing spectral channel 20/39 ***
*** Processing spectral channel 21/39 ***
*** Processing spectral channel 22/39 ***
*** Processing spectral channel 23/39 ***
*** Processing spectral channel 24/39 ***
*** Processing spectral channel 25/39 ***
*** Processing spectral channel 26/39 ***
*** Processing spectral channel 27/39 ***
*** Processing spectral channel 28/39 ***
*** Processing spectral channel 29/39 ***
*** Processing spectral channel 30/39 ***
*** Processing spectral channel 31/39 ***
*** Processing spectral channel 32/39 ***
*** Processing spectral channel 33/39 ***
*** Processing spectral channel 34/39 ***
*** Processing spectral channel 35/39 ***
*** Processing spectral channel 36/39 ***
*** Processing spectral channel 37/39 ***
*** Processing spectral channel 38/39 ***
*** Processing spectral channel 39/39 ***

Let’s now inject the second planet in the same cube:

cube_fc = cube_inject_companions(cube_fc, psfn, derot_angles, flevel=final_fluxes_c, 
                                 plsc=plsc, rad_dists=[r_c], n_branches=1, 
                                 theta=theta_c, transmission=trans, verbose=False)

Let’s inspect the cube with the inject companions:

plot_cubes(cube_fc)
:Dataset   [x,y,time,lambda]   (flux)
:Cube_shape	[107, 107, 55, 39]

7.5. Post-processing of IFS data

Let’s now try to recover the 2 injected companions using different post-processing algorithms.

7.5.1. Optimal scaling factors

In order to leverage the radial expansion of the stellar PSF with wavelength through spectral differential imaging, let’s first compute the optimal scaling factors between the spectral channels. For a perfect AO correction, flat stellar spectrum and uniform atmospheric transmission, one would expect the scaling factors to be (exactly) inversely proportional to the wavelength. Although reality deviates a bit from these assumptions, these still make for a good first guess:

th_scal = lbda[-1]/lbda
th_scal
array([1.3877398, 1.375682 , 1.3635113, 1.3512615, 1.3389585, 1.3266245,
       1.3142908, 1.3019674, 1.2896852, 1.2774729, 1.2653329, 1.2532798,
       1.2413497, 1.2295421, 1.217879 , 1.2063586, 1.1950108, 1.1838219,
       1.1728301, 1.1620203, 1.151418 , 1.1410172, 1.1308315, 1.1208638,
       1.1111166, 1.1016016, 1.092311 , 1.0832641, 1.0744526, 1.0658859,
       1.0575558, 1.0494791, 1.0416555, 1.0340765, 1.0267497, 1.0196825,
       1.0128585, 1.0063006, 1.       ], dtype=float32)

Let’s use preproc.find_scal_vector to refine this estimate. This function will find the optimal scaling factors (both in terms of geometric scaling and flux scaling) between each spectral channel and the last one such that their subtraction yields minimal residuals. For coronagraphic observations, it is recommended to provide a binary mask, corresponding to the location where the residuals will be calculated, which avoids the area encompassed by the coronagraphic mask, in order to achieve the best estimate. Here we use the mean of the 4D cube along the temporal direction to find the factors:

from vip_hci.var import mask_circle
from vip_hci.preproc import find_scal_vector

mask = np.ones_like(cube[0,0])
mask = mask_circle(mask, int(0.16/plsc))

opt_scal_mean, opt_flux = find_scal_vector(np.mean(cube,axis=1), lbda, flux_st, 
                                           mask=mask, nfp=2, fm="stddev")

Although much slower, another approach would be to calculate the scaling factors for each individual spectral cube, and use the median values. To display the progress let’s use a Progressbar:

from vip_hci.config import Progressbar 
opt_scals = np.zeros([cube.shape[1],cube.shape[0]])
opt_fluxes = np.zeros([cube.shape[1],cube.shape[0]])
for i in Progressbar(range(cube.shape[1]), verbose=True):
    opt_scals[i], opt_fluxes[i] = find_scal_vector(cube[:,i], lbda, flux_st, mask=mask, nfp=2, fm="stddev")
0% [##############################] 100% | ETA: 00:00:00
Total time elapsed: 00:09:53
opt_scal_med = np.median(opt_scals,axis=0)
opt_flux_med = np.median(opt_fluxes,axis=0)

Let’s plot the theoretical and empirical scaling factors:

%matplotlib inline
plt.figure(figsize=(8,6))
for i in range(cube.shape[1]):
    if not i%10:
        label = 'cube #{}'.format(i)
    else:
        label = None
    plt.plot(lbda, opt_scals[i], alpha=0.3, label=label)
plt.plot(lbda, th_scal, 'k:', lw=2, label='Theoretical')
plt.plot(lbda, opt_scal_mean, 'k--', lw=2, label='Optimal (mean cube)')
plt.plot(lbda, np.median(opt_scals,axis=0), 'k-', lw=2, label='Optimal (median of indiv. curves)')
plt.xlabel(r"Wavelength ($\mu$m)")
plt.ylabel("Scaling factor")
plt.legend()
<matplotlib.legend.Legend at 0x16b16f310>
../_images/b3e8eaa4c73081615d9d5fa6f300de9b678973fe7c5531efe02adc37febb1d55.png

Let’s visualize the actual residuals in the first spectral cube (using the frame_rescaling routine to apply the optimal scaling factor):

from vip_hci.preproc import frame_rescaling
res_cube_test_opt = np.zeros([cube.shape[0],cube.shape[-2],cube.shape[-1]])
for i in range(cube.shape[0]):
    res_cube_test_opt[i] = opt_fluxes[0,i]*frame_rescaling(cube[i,0], scale=opt_scal_med[i])-cube[-1,0]
plot_cubes(res_cube_test_opt, vmin=-5)
:Dataset   [x,y,time]   (flux)
:Cube_shape	[107, 107, 39]

Apart from the residual starlight at the edge of the coronagraphic mask (which does not expand radially), we see that the stellar halo is very well subtracted.

7.5.2. median-SDI

The most basic way to leverage the radial diversity present in IFS data is to perform median-SDI (i.e. the radial equivalent to median-ADI). For that just use the psfsub.median_sub function, with the sdi_only option on:

from vip_hci.psfsub import median_sub

mask_px = int(0.09/plsc)
med_SDI = median_sub(cube_fc, derot_angles, scale_list=opt_scal_med, sdi_only=True,
                     radius_int=mask_px, interp_zeros=True, mask_val=0)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:40:39
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
39 spectral channels per IFS frame
First median subtraction exploiting spectral variability
Running time:  0:00:17.345312
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
55 ADI frames
Median subtraction in the ADI fashion
Done derotating and combining
Running time:  0:00:19.408581
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

For better results, it is recommended to use both the geometrical and flux scaling factors found in the previous section:

med_SDI_opt = median_sub(cube_fc, derot_angles, scale_list=opt_scal_med, flux_sc_list=opt_flux_med, sdi_only=True,
                         radius_int=mask_px, interp_zeros=True, mask_val=0)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:40:58
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
39 spectral channels per IFS frame
First median subtraction exploiting spectral variability
Running time:  0:00:17.220773
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
55 ADI frames
Median subtraction in the ADI fashion
Done derotating and combining
Running time:  0:00:19.133822
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Let’s compare both reductions, showing circles at the ground truth locations where we injected the fake companions.

%matplotlib inline
plot_frames((med_SDI, med_SDI_opt), circle=(xy_b,xy_c), vmin=-0.2, vmax=0.6)
../_images/437def10efdacac1e1879312532ea9cc4122fdafc8da3a6b30b60d2917b0f625.png

In the first image, we notice the limitation of SDI at short angular separation. Since the stellar residuals at the edge of the coronagraphic mask do not expand radially as the rest of the stellar halo, we are left with a bright spurious ring, preventing the re-detection of fake planet b.

We see that the median-SDI reduction with scaled fluxes performs slightly better at subtracting stellar residuals near the edge of the coronagraphic mask, although fake planet b is still not recovered.

Fake planet c is redetected. Let’s compare its signal-to-noise ratio in both images:

from vip_hci.metrics import snr
snr_c = snr(med_SDI, xy_c, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
snr_c_sc = snr(med_SDI_opt, xy_c, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
print(snr_c, snr_c_sc)
19.81792937838819 23.22640649203268

Overall, we can conclude that the scaled flux version of median-SDI performs better than the non-flux scaled version.

7.5.3. PCA-SDI

Let’s now run a PCA-SDI reduction. Note that this approach may be useful in datasets with azimuthally extended disc features (since ADI can filter such signals).

For PCA reductions, flux scaling factors are not necessary. This is because: i) the basis is orthonormal and an internal scaling is performed anyway when the principal components are projected onto each images; ii) flux scaling will typically increase the noise contribution before calculation of the principal components, which can bias their values. Our tests suggest indeed that better results are obtained (i.e. higher SNR for injected fake planets) when no flux scaling factor is considered before PCA.

7.5.3.1. Full-frame PCA

To trigger SDI alone with the psfsub.pca function, you need to set:

  • adimsdi='double' to separate the PCA-SDI and PCA-ADI

  • ncomp to a tuple of 2 values, the first of which being the number of principal components for PCA-SDI, and the second to be set to None - to prevent PCA-ADI (i.e. simply derotate and stack the SDI residual images);

Let’s use the mask_center_px argument to set a numerical mask of 0.1’’ radius in order not to include the coronagraphic mask.

Let’s also set imlib and interpolation to non-default values for faster rescaling and (de-)rotations:

imlib = 'skimage'           # If you have it installed, feel free to set to 'opencv'
interpolation = 'biquintic'   # If you have opencv installed, feel free to set to 'lanczos4'
from vip_hci.psfsub import pca

ncomp_sdi = 1
mask_px = int(0.09/plsc)

pca_sdi = pca(cube_fc, derot_angles, scale_list=opt_scal_med, ncomp=(ncomp_sdi,None), 
              adimsdi='double', crop_ifs=False, imlib=imlib, interpolation=interpolation, 
              interp_zeros=True, mask_val=0, mask_center_px=mask_px)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:41:18
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
System total memory = 17.180 GB
System available memory = 3.290 GB
39 spectral channels in IFS cube
First PCA stage exploiting spectral variability
Running time:  0:00:15.340817
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
55 ADI frames
De-rotating and combining frames (skipping PCA)
Running time:  0:00:15.504656
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Let’s show the final image with and without the application of a large (0.15’’ radius) numerical mask, and with circles at the ground truth location where we injected the fake companions.

%matplotlib inline
plot_frames((pca_sdi, mask_circle(pca_sdi,20)),
            circle=(xy_b,xy_c))
../_images/e06bb111aa850424af9e86bdea4da90d2053013b5788c305f2476d821182babf.png

In the first image, we notice the same effect as with median-SDI: significant stellar residuals at the edge of the coronagraphic mask.

On the other hand, fake planet c is easily re-detected. Notice the negative side lobe, that is reminiscent of ADI side lobes, but this time radially.

Question 7.1: Why is the negative side lobe only radially inward of the planet in our final SDI image?

This time the images obtained without and with flux-scaling applied to the cube before PCA appears to yield similar results. We note that flux scaling may actually have been slightly counter-productive, based on the raw fluxes at the location of the companion (peak value closer to ~0.4 without flux scaling, while closer to ~0.3 with flux scaling). Let’s confirm that by measuring the SNR of c:

from vip_hci.metrics import snr
snr_c = snr(pca_sdi, xy_c, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
print(snr_c)
12.781841904984528

7.5.3.2. Annular PCA

PCA-SDI can also be performed in concentric annuli using psfsub.pca_annular. Again let’s demonstrate whether flux scaling is useful or not:

from vip_hci.psfsub import pca_annular

ncomp_sdi = 1
mask_px = int(0.09/plsc)
fwhm_m = np.mean(fwhm)

pca_sdi_ann = pca_annular(cube_fc, derot_angles, scale_list=opt_scal_med, 
                          ncomp=(ncomp_sdi,None), radius_int=mask_px, fwhm=fwhm_m, asize=fwhm_m,
                          delta_sep=(0.3, 1), delta_rot=(0.5, 1),
                          mask_val=0, interp_zeros=True)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:41:33
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
First PCA subtraction exploiting the spectral variability
39 spectral channels per IFS frame
N annuli = 6, mean FWHM = 6.000
Running time:  0:00:17.167127
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
55 ADI frames
Skipping the second PCA subtraction

As before we show the image before and after masking the central part of the image, dominated by residual stellar light, to better show injected planet c:

plot_frames((pca_sdi_ann, mask_circle(pca_sdi_ann, int(0.18/plsc))), circle=(xy_b,xy_c))
../_images/64664c72504d54de07fa483a9d6fc1f68571ed872ef8edcc751f062d2198a356.png
snr_c = snr(pca_sdi_ann, xy_c, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
print(snr_c)
16.555897988329143

Despite both reductions yielding relatively similar final images, we note that flux-scaling is slightly counter-productive (SNR slightly lower), similarly to the full-frame PCA reduction.

7.5.4. median-ASDI

Let’s now combine both SDI and ADI, which should yield a better subtraction of the stellar residuals. Again, let’s start with the most basic way to combine both strategies: median-ASDI.

This simply involves the same calls to median_sub as in Sec. 7.5.2., but removing sdi_only=True:

mask_px = int(0.09/plsc)

med_ASDI = median_sub(cube_fc, derot_angles, scale_list=opt_scal_med, flux_sc_list=opt_flux_med,
                      radius_int=mask_px, interp_zeros=True, mask_val=0)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:41:53
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
39 spectral channels per IFS frame
First median subtraction exploiting spectral variability
Running time:  0:00:18.364268
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
55 ADI frames
Median subtraction in the ADI fashion
Done derotating and combining
Running time:  0:00:20.449512
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Let’s check the ASDI image:

%matplotlib inline
plot_frames(med_ASDI, circle=(xy_b,xy_c))
../_images/6f5f2f7683453713f42338fa96d975d1b96c68b320413261b19fa02a527a971c.png

This time we find signal at the location of fake planet b - although it does appear significantly filtered.

Fake planet c is easily redetected. Let’s measure the signal-to-noise ratio for both fake planets:

snr_b = snr(med_SDI, xy_b, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
print(snr_b)

snr_c = snr(med_SDI, xy_c, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
print(snr_c)
0.9097275791820104
19.81792937838819

7.5.5. PCA-ASDI

7.5.5.1. Full-frame PCA-ASDI (single step)

The psfsub.pca function in VIP offers the possibility to do this in either a single or 2 consecutive steps.

In the first case, a master PCA library is created with all images acquired at different parallactic angles and at different wavelengths (i.e. containing both angular and radial diversity). This is done by setting:

  • adimsdi='single' (default);

  • ncomp to either a scalar value (integer to use that number of principal components, or float between 0 and 1 to indicate the desired cumulative explained variance ratio), or a list (of integer values to be tested).

Let’s try with a list of a few ncomp values:

ncomp = [1,5,10,20]
pca_asdi = pca(cube_fc, derot_angles, scale_list=opt_scal_med, ncomp=ncomp, 
               adimsdi='single', crop_ifs=False, mask_center_px=mask_px,
               imlib=imlib, interpolation=interpolation)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:42:13
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
System total memory = 17.180 GB
System available memory = 3.224 GB
Rescaling the spectral channels to align the speckles
0% [##############################] 100% | ETA: 00:00:00
Total time elapsed: 00:00:07
Running time:  0:00:07.898087
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
2145 total frames
Performing single-pass PCA
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:28.111506
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Descaling the spectral channels and obtaining a final frame
Descaling the spectral channels and obtaining a final frame
Descaling the spectral channels and obtaining a final frame
Descaling the spectral channels and obtaining a final frame
Computed residual frames for PCs interval: [1, 5, 10, 20]
Number of steps 4
Running time:  0:01:00.889786
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Let’s visualize the resulting image, including circles at the ground truth locations of the injected planets:

labels = tuple(['PCA-ASDI (npc={:.0f})'.format(npc) for npc in ncomp])
plot_frames(pca_asdi, label=labels,
            dpi=100, colorbar=True, circle=(xy_b,xy_c))
../_images/5177382879e1dd52c17f01560a8e0054dd6fb006b64b6e0c00ddf48c22a47c1a.png

Let’s estimate the signal-to-noise ratio of both detections:

snr_b = [snr(pca_asdi[i], xy_b, fwhm=np.mean(fwhm), exclude_negative_lobes=True) for i in range(len(ncomp))]
print(snr_b)

snr_c = [snr(pca_asdi[i], xy_c, fwhm=np.mean(fwhm), exclude_negative_lobes=True) for i in range(len(ncomp))]
print(snr_c)
[1.6473287851234246, 5.174644502161828, 9.193702125591468, 5.456633290533542]
[11.09562890427494, 22.160314653515435, 30.91657020627059, 32.0115277132438]

7.5.5.2. Full-frame PCA-ASDI (double step)

The second option consists in performing PCA-SDI first, and then PCA-ADI on the cube consisting of residual SDI frames obtained for each individual spectral cube. This mode can be activated by setting adimsdi='double' (instead of the default ‘single’ value).

Given the high correlation in the spectral dimension, let’s just try with 1pc for each step:

ncomp = (1,1)
pca_asdi_2s = pca(cube_fc, derot_angles, scale_list=opt_scal_med, ncomp=ncomp, 
                  adimsdi='double', crop_ifs=False, mask_center_px=mask_px,
                  interp_zeros=True, mask_val=0,
                  imlib=imlib, interpolation=interpolation)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:43:14
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
System total memory = 17.180 GB
System available memory = 4.711 GB
39 spectral channels in IFS cube
First PCA stage exploiting spectral variability
Running time:  0:00:15.814789
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
55 ADI frames
Second PCA stage exploiting rotational variability
De-rotating and combining residuals
Running time:  0:00:16.004056
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
plot_frames(pca_asdi_2s,
            label='PCA-ASDI 2s., npc=({:.0f},{})'.format(ncomp[0],ncomp[1]),
            dpi=100, colorbar=True, circle=(xy_b,xy_c))
../_images/1eb2f35705d97e86e2eec3774f7a8de7de86f37ab4d545f1998099463ef646c1.png

Let’s estimate the signal-to-noise ratio of both detections:

snr_b = snr(pca_asdi_2s, xy_b, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
print(snr_b)

snr_c = snr(pca_asdi_2s, xy_c, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
print(snr_c)
4.917762300669619
51.4835450246924

We see that with only 1 spectral PC followed by 1 angular PC, parts of the final images can be much cleaner of residual starlight, as also testified by the SNR~50 for injected planet c.

7.5.5.3. Annular PCA-ASDI (double step)

Similarly, ASDI can be done in concentric annuli with the pca_annular function:

ncomp = (1,1)
pca_ann = pca_annular(cube_fc, derot_angles, scale_list=opt_scal_med, ncomp=ncomp, 
                      radius_int=mask_px, fwhm=np.mean(fwhm), asize=np.mean(fwhm), 
                      mask_val=0, interp_zeros=True)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:43:30
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
First PCA subtraction exploiting the spectral variability
39 spectral channels per IFS frame
N annuli = 6, mean FWHM = 6.000
Running time:  0:00:19.117560
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
55 ADI frames
Second PCA subtraction exploiting angular variability
N annuli = 6, FWHM = 6.000
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  2.29    Ann center:  15    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:19.162806
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  4.57    Ann center:  21    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:19.194432
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  5.84    Ann center:  27    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:19.227298
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 4    PA thresh:  6.64    Ann center:  33    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:19.258054
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 5    PA thresh:  7.19    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:19.292301
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 6    PA thresh:  7.77    Ann center:  44    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:19.324715
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:21.375637
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
plot_frames(pca_ann, label='PCA-ASDI ann. (npc={:.0f},{:.0f})'.format(ncomp[0], ncomp[1]),
            dpi=100, colorbar=True, circle=(xy_b,xy_c))
../_images/0d4f042a252543f89db1be5da0c6c8debd70ab097331e3b56081090f46c97192.png

Let’s estimate the signal-to-noise ratio and signifance of both detections:

snr_b = snr(pca_ann, xy_b, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
print(snr_b)

snr_c = snr(pca_ann, xy_c, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
print(snr_c)
10.256502247434709
38.183397286765874
from vip_hci.metrics import significance

sig_b = significance(snr_b, r_b, np.mean(fwhm))
print(sig_b)

sig_c = significance(snr_c, r_c, np.mean(fwhm))
print(sig_c)
At a separation of 16.3 px (2.7 FWHM), S/N = 10.3 corresponds to a 5.5-sigma detection in terms of Gaussian false alarm probability.
5.507620264057997
Warning high S/N! cdf>0.9999999999999999 is rounded to 1
Returning 8.2 sigma, but quote significance > 8.2 sigma.
8.2

7.5.6. PCA-ADI for all spectral channels

If you provide a 4d input cube without scale_list to the pca or pca_annular functions, their default behaviour will be to perform PCA-ADI on each spectral channel and then combine the final ADI images from each spectral channel into a single one.

mask_px = int(0.08/plsc)

Let’s try different flavours of PCA. First let’s run it in full frames:

ncomp_ff = 6
pca_adi_mean = pca(cube_fc, derot_angles, ncomp=ncomp_ff, mask_center_px=mask_px,
                   interp_zeros=True, mask_val=0, imlib=imlib, interpolation=interpolation)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:43:52
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
System total memory = 17.180 GB
System available memory = 3.870 GB
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.028750
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:00.203303
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.227674
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:00.397865
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.427711
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:00.611567
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.639825
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:00.810637
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.836738
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:01.015707
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:01.041536
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:01.216683
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:01.241943
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:01.411526
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:01.437085
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:01.602834
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:01.629340
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:01.791391
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:01.816342
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:01.979210
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:02.003822
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:02.168433
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:02.193940
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:02.369082
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:02.394425
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:02.560748
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:02.585237
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:02.748396
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:02.773848
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:02.951331
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:02.976848
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:03.147034
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:03.172102
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:03.332570
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:03.356871
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:03.520219
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:03.544292
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:03.704573
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:03.728349
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:03.893034
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:03.917403
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:04.079691
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:04.104437
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:04.264729
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:04.289515
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:04.454387
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:04.479643
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:04.649373
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:04.674816
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:04.846926
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:04.872582
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:05.044137
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:05.070643
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:05.249134
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:05.274159
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:05.444941
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:05.470711
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:05.644912
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:05.671243
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:05.835711
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:05.860125
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:06.020940
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:06.045240
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:06.205498
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:06.230004
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:06.393030
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:06.416739
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:06.581540
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:06.605346
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:06.767350
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:06.791093
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:06.950467
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:06.974378
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:07.135107
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:07.159253
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:07.326951
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done vectorizing the frames. Matrix shape: (55, 11449)
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:07.351703
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done de-rotating and combining
Running time:  0:00:07.513036
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Now in concentric annuli, with a PA threshold (set by delta_rot):

ncomp_ann = 4
pca_adi_ann_mean = pca_annular(cube_fc, derot_angles, ncomp=ncomp_ann, radius_int=mask_px, 
                               fwhm=np.mean(fwhm), asize=2*np.mean(fwhm), delta_rot=(0.2,1),
                               mask_val=0, interp_zeros=True, imlib=imlib, interpolation=interpolation)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:43:59
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:00.062115
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:00.112310
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:00.163639
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:00.332096
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:00.393302
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:00.451325
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:00.506595
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:00.669622
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:00.725280
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:00.781150
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:00.834997
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:00.999233
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:01.059205
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:01.115646
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:01.167120
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:01.334684
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:01.389742
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:01.443162
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:01.498265
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:01.665933
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:01.720154
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:01.772510
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:01.821638
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:01.985256
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:02.040718
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:02.091407
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:02.144059
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:02.308169
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:02.363215
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:02.413109
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:02.466963
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:02.633510
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:02.688289
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:02.736523
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:02.786658
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:02.952381
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:03.009127
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:03.060315
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:03.114047
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:03.277525
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:03.329793
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:03.381195
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:03.435584
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:03.600732
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:03.654207
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:03.701729
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:03.750271
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:03.911251
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:03.963908
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:04.011126
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:04.059274
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:04.219229
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:04.272620
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:04.324460
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:04.374561
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:04.535110
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:04.588986
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:04.637640
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:04.687610
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:04.850560
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:04.902642
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:04.951610
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:05.001251
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:05.164212
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:05.217376
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:05.265870
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:05.319449
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:05.482487
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:05.535325
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:05.583754
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:05.633792
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:05.794397
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:05.847257
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:05.895478
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:05.944944
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:06.111199
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:06.164910
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:06.213625
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:06.263788
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:06.424915
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:06.477161
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:06.525713
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:06.576615
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:06.742488
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:06.794675
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:06.842512
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:06.891873
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:07.053635
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:07.106205
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:07.154266
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:07.202569
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:07.364649
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:07.417380
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:07.465040
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:07.513776
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:07.674940
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:07.727037
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:07.773565
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:07.822598
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:07.983946
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:08.037126
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:08.085613
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:08.135023
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:08.296295
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:08.348773
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:08.396634
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:08.446058
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:08.607816
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:08.659843
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:08.707215
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:08.757416
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:08.921074
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:08.974365
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:09.020629
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:09.066846
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:09.227865
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:09.281156
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:09.328838
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:09.376719
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:09.538046
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:09.590436
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:09.638365
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:09.686301
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:09.846576
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:09.899779
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:09.948183
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:09.997254
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:10.157988
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:10.209990
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:10.256473
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:10.304802
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:10.465381
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:10.517383
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:10.565106
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:10.613851
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:10.773830
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:10.826308
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:10.873896
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:10.921054
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:11.081840
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:11.134634
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:11.182628
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:11.231346
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:11.392780
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:11.444926
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:11.490966
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:11.539556
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:11.701568
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:11.754820
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:11.802607
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:11.848954
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:12.009076
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:12.061432
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:12.108121
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with lapack for current annulus
Running time:  0:00:12.155261
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:00:12.315511
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done PCA with SvdMode.LAPACK for current annulus
Running time:  0:02:25.052289
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:02:27.416946
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
N annuli = 3, FWHM = 6.031
PCA per annulus (or annular sectors):
Ann 1    PA thresh:  4.31    Ann center:  16    N segments: 1 
Done PCA with SvdMode.LAPACK for current annulus
Running time:  0:02:28.011655
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 2    PA thresh:  7.37    Ann center:  28    N segments: 1 
Done PCA with SvdMode.LAPACK for current annulus
Running time:  0:02:28.470096
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Ann 3    PA thresh:  8.81    Ann center:  39    N segments: 1 
Done PCA with SvdMode.LAPACK for current annulus
Running time:  0:02:28.911330
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done derotating and combining.
Running time:  0:02:31.288946
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Finally, let’s also run it as a single wide annulus including both injected planets:

from vip_hci.psfsub import pca_annulus
ncomp_a = 3
pca_adi_a_mean = pca_annulus(cube_fc, derot_angles, ncomp=ncomp_a, r_guess=(r_b+r_c)/2, 
                             annulus_width=r_c, mask_val=0, interp_zeros=True,
                             imlib=imlib, interpolation=interpolation)

Let’s compare the results:

plot_frames((pca_adi_mean, pca_adi_ann_mean, pca_adi_a_mean),
            label=('PCA-ADI (npc={:.0f})'.format(ncomp_ff),
                   'PCA-ADI annular (npc={:.0f})'.format(ncomp_ann),
                   'PCA-ADI annulus (npc={:.0f})'.format(ncomp_a)),
            dpi=100, colorbar=True, circle=(xy_b,xy_c))
../_images/69b67ead77cfb1b647dcd68c00603bdb3aa116c107a4d06c80e7fe4e3305e58e.png

Let’s estimate the signal-to-noise ratio and signifance of both detections:

snr_b_ff = snr(pca_adi_mean, xy_b, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
snr_b_ann = snr(pca_adi_ann_mean, xy_b, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
snr_b_a = snr(pca_adi_a_mean, xy_b, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
print(snr_b_ff, snr_b_ann, snr_b_a)
snr_b = max(snr_b_ff, snr_b_ann, snr_b_a)

snr_c_ff = snr(pca_adi_mean, xy_c, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
snr_c_ann = snr(pca_adi_ann_mean, xy_c, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
snr_c_a = snr(pca_adi_a_mean, xy_c, fwhm=np.mean(fwhm), exclude_negative_lobes=True)
print(snr_c_ff, snr_c_ann, snr_c_a)
snr_c = max(snr_c_ff, snr_c_ann, snr_c_a)
9.964575355731181 6.194275666961779 4.668026246564868
31.688689438349595 11.400841177824212 24.621333311752664
sig_b = significance(snr_b, r_b, np.mean(fwhm))
print(sig_b)

sig_c = significance(snr_c, r_c, np.mean(fwhm))
print(sig_c)
At a separation of 16.3 px (2.7 FWHM), S/N = 10.0 corresponds to a 5.4-sigma detection in terms of Gaussian false alarm probability.
5.440259378094337
Warning high S/N! cdf>0.9999999999999999 is rounded to 1
Returning 8.2 sigma, but quote significance > 8.2 sigma.
8.2

In this case, we see that ADI alone recovers better the innermost planet. This is because of the bright stellar residuals at the edge of the coronagraphic mask, preventing SDI to do a good job at that separation.

Answer 7.1: The scaling factors are such that all spectral channels are upscaled, for the stellar halo to match the last spectral channel, i.e. all factors are >= 1 (exactly 1 for the last spectral channel). The PSF model and subtraction with PCA is then made with these upscaled images, where the planet is now present at different radial separations. However since we injected a very red spectrum for planet c (blackbody of 1100 K), it is the brightest in the last spectral channels. This means the strongest positive (resp. negative) imprint will be in the long (resp. short) wavelength channels, where the planet was not moved (resp. moved radially outward), i.e. the positive (resp. negative) imprint is unchanged (resp. radially inward) with respect to its position in the upscaled cube. After final downscaling, the negative imprint stays thus radially inward from the location of the fake planet. You can test this explanation by injecting a blue spectrum for planet c (e.g. 1/blackbody).

7.6. Astrometry retrieval

The firstguess function can accept a 4D input cube to infer a first guess on the position (a single one for all channels) and fluxes (one per channel). Since it would be very slow to run it on all 39 spectral channels, let’s just focus on the 8 channels (~20% of all channels) with the maximum S/N ratio. Let’s find these channels for planet c.

As the rest of this tutorial is CPU-intensive, we will only focus on planet c - although the same procedure can be applied to planet b.

7.6.1. Spectral channels with maximum SNR

from vip_hci.psfsub import pca_grid

all_frs = []
all_snrs = []
all_pcs = []
for i in range(nch):
    print("**Channel {}**".format(i+1))
    res_ann_opt = pca_grid(cube_fc[i], derot_angles, fwhm=fwhm[i], range_pcs=(1,11,1), 
                           source_xy=xy_c, mode='annular', annulus_width=int(4*fwhm[i]), 
                           imlib=imlib, interpolation=interpolation, full_output=True,
                           plot=True, exclude_negative_lobes=True)
    _, final_ann_opt, df, opt_npc_ann = res_ann_opt
    all_frs.append(final_ann_opt)
    pcs = df['PCs']
    snrs = df['S/Ns']
    opt_snr = snrs[df.index[pcs==opt_npc_ann]]
    print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
    all_snrs.append(float(opt_snr))
    all_pcs.append(opt_npc_ann)
**Channel 1**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:19
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.012564
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Number of steps 11
Optimal number of PCs = 1, for S/N=1.406
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 0.223
Central pixel S/N = 1.169
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 1.403
Max S/N (shifting the aperture center) = 2.257
stddev S/N (shifting the aperture center) = 0.568

Opt SNR: 1.406315822640483, for npc=1
**Channel 2**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:21
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011747
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=3.560
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 1.131
Central pixel S/N = 4.489
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 3.574
Max S/N (shifting the aperture center) = 4.695
stddev S/N (shifting the aperture center) = 0.771

Opt SNR: 3.560228545229816, for npc=1
**Channel 3**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:23
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.012508
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=3.363
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 1.365
Central pixel S/N = 3.768
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 3.360
Max S/N (shifting the aperture center) = 4.876
stddev S/N (shifting the aperture center) = 0.682

Opt SNR: 3.3626991555800974, for npc=1
**Channel 4**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:25
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011827
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=3.550
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 1.724
Central pixel S/N = 4.389
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 3.563
Max S/N (shifting the aperture center) = 4.322
stddev S/N (shifting the aperture center) = 0.507

Opt SNR: 3.550228902599102, for npc=1
**Channel 5**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:28
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011690
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=3.470
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 1.982
Central pixel S/N = 4.377
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 3.471
Max S/N (shifting the aperture center) = 4.256
stddev S/N (shifting the aperture center) = 0.499

Opt SNR: 3.4698553173521773, for npc=1
**Channel 6**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:30
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.012223
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=3.916
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 2.235
Central pixel S/N = 4.827
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 3.908
Max S/N (shifting the aperture center) = 4.797
stddev S/N (shifting the aperture center) = 0.590

Opt SNR: 3.9162354555822882, for npc=1
**Channel 7**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:32
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.012341
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=3.614
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 2.048
Central pixel S/N = 4.412
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 3.581
Max S/N (shifting the aperture center) = 4.569
stddev S/N (shifting the aperture center) = 0.571

Opt SNR: 3.6135618037373716, for npc=1
**Channel 8**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:34
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011346
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=4.132
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 2.449
Central pixel S/N = 5.372
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 4.137
Max S/N (shifting the aperture center) = 5.290
stddev S/N (shifting the aperture center) = 0.670

Opt SNR: 4.131686920746008, for npc=1
**Channel 9**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:36
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011836
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=4.444
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 2.665
Central pixel S/N = 5.831
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 4.430
Max S/N (shifting the aperture center) = 5.878
stddev S/N (shifting the aperture center) = 0.874

Opt SNR: 4.443944112734254, for npc=1
**Channel 10**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:38
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011299
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=4.104
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 2.562
Central pixel S/N = 5.136
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 4.033
Max S/N (shifting the aperture center) = 5.448
stddev S/N (shifting the aperture center) = 0.842

Opt SNR: 4.104050624135878, for npc=1
**Channel 11**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:40
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011955
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=4.275
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 3.083
Central pixel S/N = 5.335
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 4.247
Max S/N (shifting the aperture center) = 5.563
stddev S/N (shifting the aperture center) = 0.938

Opt SNR: 4.274623331158116, for npc=1
**Channel 12**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:43
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011829
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 5, for S/N=4.568
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 0.937
Central pixel S/N = 6.006
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 4.385
Max S/N (shifting the aperture center) = 6.781
stddev S/N (shifting the aperture center) = 1.192

Opt SNR: 4.567621084931069, for npc=5
**Channel 13**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:45
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011936
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 5, for S/N=5.285
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 0.977
Central pixel S/N = 6.535
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 4.804
Max S/N (shifting the aperture center) = 7.018
stddev S/N (shifting the aperture center) = 1.416

Opt SNR: 5.285349465825721, for npc=5
**Channel 14**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:47
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011793
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 4, for S/N=6.249
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 1.265
Central pixel S/N = 7.268
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 5.373
Max S/N (shifting the aperture center) = 7.461
stddev S/N (shifting the aperture center) = 1.470

Opt SNR: 6.248796814948493, for npc=4
**Channel 15**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:49
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011034
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 6, for S/N=6.068
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 1.061
Central pixel S/N = 7.042
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 5.016
Max S/N (shifting the aperture center) = 7.526
stddev S/N (shifting the aperture center) = 1.624

Opt SNR: 6.068032431052506, for npc=6
**Channel 16**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:51
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.010943
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 7, for S/N=7.357
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 1.238
Central pixel S/N = 8.839
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 6.367
Max S/N (shifting the aperture center) = 9.763
stddev S/N (shifting the aperture center) = 2.016

Opt SNR: 7.357126409737286, for npc=7
**Channel 17**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:53
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011678
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=5.498
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 2.937
Central pixel S/N = 6.952
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 5.478
Max S/N (shifting the aperture center) = 8.157
stddev S/N (shifting the aperture center) = 1.455

Opt SNR: 5.497769065327149, for npc=1
**Channel 18**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:55
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011750
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=4.958
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 2.309
Central pixel S/N = 5.803
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 5.023
Max S/N (shifting the aperture center) = 7.694
stddev S/N (shifting the aperture center) = 1.342

Opt SNR: 4.958351756255778, for npc=1
**Channel 19**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:57
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011421
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=4.867
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 2.237
Central pixel S/N = 6.065
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 4.887
Max S/N (shifting the aperture center) = 7.327
stddev S/N (shifting the aperture center) = 1.337

Opt SNR: 4.8671778914611314, for npc=1
**Channel 20**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:44:59
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011646
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 3, for S/N=6.235
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 1.397
Central pixel S/N = 7.616
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 5.559
Max S/N (shifting the aperture center) = 8.355
stddev S/N (shifting the aperture center) = 1.775

Opt SNR: 6.235377957943322, for npc=3
**Channel 21**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:02
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.012479
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 3, for S/N=7.010
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 1.939
Central pixel S/N = 8.242
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 6.619
Max S/N (shifting the aperture center) = 9.557
stddev S/N (shifting the aperture center) = 1.671

Opt SNR: 7.009732024726299, for npc=3
**Channel 22**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:04
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011781
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/Users/valentin/GitHub/VIP/vip_hci/psfsub/utils_pca.py:381: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`). Consider using `matplotlib.pyplot.close()`.
  plt.figure(figsize=vip_figsize, dpi=vip_figdpi)
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 3, for S/N=8.449
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 2.581
Central pixel S/N = 9.729
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 7.798
Max S/N (shifting the aperture center) = 12.240
stddev S/N (shifting the aperture center) = 2.354

Opt SNR: 8.449449009570616, for npc=3
**Channel 23**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:06
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011800
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 4, for S/N=10.653
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 2.166
Central pixel S/N = 12.208
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 8.903
Max S/N (shifting the aperture center) = 12.388
stddev S/N (shifting the aperture center) = 2.410

Opt SNR: 10.652709378844564, for npc=4
**Channel 24**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:08
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011317
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 4, for S/N=10.948
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 2.436
Central pixel S/N = 12.679
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 8.807
Max S/N (shifting the aperture center) = 12.635
stddev S/N (shifting the aperture center) = 2.461

Opt SNR: 10.948329926561087, for npc=4
**Channel 25**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:10
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011547
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 4, for S/N=13.553
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 2.981
Central pixel S/N = 13.963
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 10.520
Max S/N (shifting the aperture center) = 14.787
stddev S/N (shifting the aperture center) = 2.766

Opt SNR: 13.553054584302888, for npc=4
**Channel 26**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:12
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.015208
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 5, for S/N=11.518
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 2.691
Central pixel S/N = 13.452
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 8.950
Max S/N (shifting the aperture center) = 14.002
stddev S/N (shifting the aperture center) = 3.179

Opt SNR: 11.5179708785798, for npc=5
**Channel 27**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:15
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011635
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 5, for S/N=12.303
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 2.905
Central pixel S/N = 14.044
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 9.448
Max S/N (shifting the aperture center) = 14.375
stddev S/N (shifting the aperture center) = 3.292

Opt SNR: 12.302576009150227, for npc=5
**Channel 28**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:17
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.014834
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 5, for S/N=14.285
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 3.259
Central pixel S/N = 14.322
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 10.231
Max S/N (shifting the aperture center) = 16.153
stddev S/N (shifting the aperture center) = 3.339

Opt SNR: 14.2852448151926, for npc=5
**Channel 29**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:19
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011709
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 5, for S/N=16.080
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 3.390
Central pixel S/N = 13.661
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 10.084
Max S/N (shifting the aperture center) = 14.893
stddev S/N (shifting the aperture center) = 3.317

Opt SNR: 16.080014328608577, for npc=5
**Channel 30**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:21
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.012095
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 5, for S/N=17.060
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 3.735
Central pixel S/N = 13.771
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 10.397
Max S/N (shifting the aperture center) = 15.881
stddev S/N (shifting the aperture center) = 3.451

Opt SNR: 17.059942544708445, for npc=5
**Channel 31**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:23
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.012268
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 5, for S/N=18.046
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 3.651
Central pixel S/N = 13.531
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 10.727
Max S/N (shifting the aperture center) = 16.195
stddev S/N (shifting the aperture center) = 3.772

Opt SNR: 18.045760468153613, for npc=5
**Channel 32**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:25
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011810
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 4, for S/N=17.494
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 4.455
Central pixel S/N = 17.641
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 11.917
Max S/N (shifting the aperture center) = 18.422
stddev S/N (shifting the aperture center) = 3.596

Opt SNR: 17.494045453004787, for npc=4
**Channel 33**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:27
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011798
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 3, for S/N=18.575
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 7.238
Central pixel S/N = 18.353
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 12.649
Max S/N (shifting the aperture center) = 18.763
stddev S/N (shifting the aperture center) = 3.816

Opt SNR: 18.57466350557792, for npc=3
**Channel 34**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:29
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011656
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 3, for S/N=19.378
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 7.632
Central pixel S/N = 16.965
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 11.769
Max S/N (shifting the aperture center) = 18.142
stddev S/N (shifting the aperture center) = 3.565

Opt SNR: 19.37834079637245, for npc=3
**Channel 35**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:32
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011720
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 4, for S/N=21.623
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 5.144
Central pixel S/N = 18.531
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 13.619
Max S/N (shifting the aperture center) = 22.455
stddev S/N (shifting the aperture center) = 4.724

Opt SNR: 21.6226239255198, for npc=4
**Channel 36**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:34
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.012530
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 3, for S/N=20.234
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 7.507
Central pixel S/N = 16.550
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 11.979
Max S/N (shifting the aperture center) = 18.420
stddev S/N (shifting the aperture center) = 3.866

Opt SNR: 20.234224573895204, for npc=3
**Channel 37**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:36
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.012314
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=19.646
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 16.880
Central pixel S/N = 21.843
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 16.372
Max S/N (shifting the aperture center) = 22.743
stddev S/N (shifting the aperture center) = 4.135

Opt SNR: 19.646382108154057, for npc=1
**Channel 38**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:38
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011906
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 1, for S/N=20.957
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 15.671
Central pixel S/N = 24.066
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 17.039
Max S/N (shifting the aperture center) = 24.544
stddev S/N (shifting the aperture center) = 4.638

Opt SNR: 20.957140197893363, for npc=1
**Channel 39**
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:40
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.011859
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
Number of steps 11
Optimal number of PCs = 2, for S/N=23.472
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 29.9
Flux in a centered 1xFWHM circular aperture = 7.541
Central pixel S/N = 14.163
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 14.472
Max S/N (shifting the aperture center) = 19.366
stddev S/N (shifting the aperture center) = 3.306

Opt SNR: 23.47182015357593, for npc=2
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:17: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  print("Opt SNR: {}, for npc={}".format(float(opt_snr), opt_npc_ann))
/var/folders/c8/p96qsd5x0bzcl1g1w145r9z40000gn/T/ipykernel_56271/3656633532.py:18: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  all_snrs.append(float(opt_snr))
../_images/9b597eb032ead4e641dc4e1557e73b97137f25bd22c40249fcfb5ca2c4ff5f42.png ../_images/6a92b8290f48bab9c169cbecd01f2ca8cadc622fe0a902ae6845b52ed13ba8a1.png ../_images/22590d37efd049b8d73a48fe2c9e96bdb91abaaf643c68b4ce3fd78cec9c7d66.png ../_images/ef15df406f0518094375e3d0b85183482b3d9069d4801f07eb714de2888c7675.png ../_images/913832c988e2882c05cf389e9d98a6740cc5e6325ccd01352f64d0a4eef57078.png ../_images/b86cb7c0c40f079a5065b7e2970c170d1919f30f7f9b8aab39abfa7c154ac302.png ../_images/1ffd39ed333517f82e1ca2e5444aacb0629ae7dc1b0c5895cf71019235142623.png ../_images/b2e9a14dca2de02002e7e678cbfd50dc05e18ebe387b71edc1376b314aeb6e2a.png ../_images/00b06bbb68437ea22c6499c3d78ab003911cf560e3fe506ebebe147642f825a2.png ../_images/472c5511d81bc34ba27bc2b92fb67786f7f54e436e3685815fab97fe0b085f4a.png ../_images/3611730e8ee9d49547e7d41a173e3602441d384c4ae9d43f404cafd5f732715f.png ../_images/063b4a493afc85a3f6a78643287743d8f090dc4e6398cc187d3d3643ece735e5.png ../_images/bc0938e3752f597117184871b70e1d64199b54a1a3fbf0e83b0c4a329f979922.png ../_images/c539a0568e0045a640ab2491a37bb6f584d7d6ee6317428ea99674ac7d2954fa.png ../_images/c6f0300385b2e16eb3af59b157bc3a135490b7915800f7cca812b04b1f3488bf.png ../_images/0fad667e721676cd39b37eb853e83013ce9891d7881bb7d31eb0793aa9eb518f.png ../_images/c87aaca940b4b2afad643789707c22479f63eb6777a8dd4e9eae507b66a88841.png ../_images/ff7ea465279670dd42a3a8b1f8e8ea98c910d7b7277ad8c34e01cb0923dea8bc.png ../_images/4d478370ba07d22119330c1bf9d45d4d7f2f4d8ee2f8ce619151b4cfaa03dd9a.png ../_images/eaaf2d56500ed49ebc1cf802772bae08e5ec1cd916a66fd1b20dac3db6d9b6d3.png ../_images/390e530973caf721d505894a161436c2a27b367cdac6842070a77f43c7b7ab8f.png ../_images/ab8c9fab9d74eea3268e8a23b1bbf737adb20fe4f997e35dca5fe832abe5ce48.png ../_images/b58b995135eebc6acee7ca3de919f65a3fb36f8613ce8da0b12bb768df899767.png ../_images/9433ed31d702e1d4f39579ae827911e1bc8f6b304cef9460cbda381256855baa.png ../_images/d1ebdd1395c79dcdeee6877c097df0bddc00abd7e66f280764334d7b4e943de8.png ../_images/9785d6e7ad849328ed3642390cd47f68d4a215abbfce5465bf56fa62d14f7f10.png ../_images/6166011aa9b624e0903ffcbfcd2de1bf0e39be430059f1dcdfc07a2e661c0fde.png ../_images/fe49a4c0131119ee8a8a578f625c1e29857d7d47ccee473a47b20386766245ff.png ../_images/c2c06d55fe482ae746d56a8a3c99ab7332a714ad882486261308fc925244bb50.png ../_images/5d918d87e6cb2f6f8647b1cbbdb604957949dac1c0bb5a125c3f4576f553b68a.png ../_images/846517752a3f86298196605830e9becce58486355f26ce8d443fea62124c65d1.png ../_images/0d7c1d35e5943ab42517b7e7487336d89c10599d72cb87e11a515b1ada477204.png ../_images/f1eae93daa5d38f12a97d2bba84abc56dd37cbb40ba76dc91c6b22323678ea68.png ../_images/9eb7157e20eab776118c1e9f0e0282c61cb43cdbb5d10013efb06c72b25855aa.png ../_images/707d2cb22e2e9d4ce592a2effff8c92b1ef537cc0a174558ff9c9338de4959ba.png ../_images/c7fe1b86327b485cfe0ae4b5aa948a8576d55c2e4e43f8a9e08b01d20682d37f.png ../_images/2a9745eb256bff87744b389d954a2586a84d1120c226d8292201aa86a8c1bce4.png ../_images/5760673a44df5140acbb41809e01c0f93dce075a8a5cd2fa529cd0025cc2abc9.png ../_images/b6d412205fa4500a5660bc32ebd9bdba7e5ba09cc3581c9397e0d205dbe5d036.png

Let’s plot the results:

plt.figure(figsize=(6,4))
plt.plot(lbda, all_snrs)
plt.xlabel(r"Wavelength ($\mu$m)")
plt.ylabel("SNR of c")
Text(0, 0.5, 'SNR of c')
../_images/42da7d6ef9c97816663646910ffa7621e815322e1d91eb4d7f2302e1449f6489.png

Let’s (reverse) sort to only keep the best 8 channels:

order_snr = np.flip(np.argsort(all_snrs))
sorted_npc = np.array(all_pcs)[order_snr]
sorted_ch = np.arange(nch)[order_snr]
sorted_frs = np.array(all_frs)[order_snr]
sorted_snr = np.array(all_snrs)[order_snr]

Let’s finally show these 8 channels with optimal SNR:

cutoff = 8
final_frs_c = tuple(sorted_frs[:cutoff])
final_chs_c = sorted_ch[:cutoff]
final_npcs_c = sorted_npc[:cutoff]

labels = ['ch.{}, npc={}, SNR={:.1f}'.format(final_chs_c[i], final_npcs_c[i], sorted_snr[i]) for i in range(cutoff)]
labels = tuple(labels)

plot_frames(final_frs_c, label=labels, rows=2)
../_images/7cfa720f4dce809f3c71b4d6673a2f24709120fcc1a8814df0e28824bfbcd9d8.png

7.6.2. NEGFC+PCA-ADI (simplex)

Let’s now find the optimal position of planet c by running the firstguess function on the 8 best spectral channels (corresponding to the highest SNR, as determined above):

crop_cube_c = cube_fc[final_chs_c]
crop_cube_c.shape
(8, 55, 107, 107)
psfn_crop_c = psfn[final_chs_c]
trans_crop_c = [trans[0]]
for i in final_chs_c:
    trans_crop_c.append(trans[i])
trans_crop_c = np.array(trans_crop_c)
from vip_hci.fm import firstguess
res = firstguess(crop_cube_c, derot_angles, psfn_crop_c, ncomp=list(final_npcs_c),
                 planets_xy_coord=[xy_c], fwhm=np.mean(fwhm), annulus_width=int(4*np.mean(fwhm)),
                 aperture_radius=2, imlib=imlib, interpolation=interpolation, transmission=trans_crop_c, mu_sigma=True, 
                 force_rPA=False, simplex=True, plot=True, verbose=True)
r0c = res[0]
theta0c = res[1]
fluxes0c = res[2]
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 14:45:48
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
             Planet 0           
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Planet 0: flux estimation at the position [83.8,29.9], running ...
Processing spectral channel 0...
... optimal grid flux: 25.929 ($\chi^2_r$ = 1.4)
Processing spectral channel 1...
... optimal grid flux: 25.929 ($\chi^2_r$ = 1.5)
Processing spectral channel 2...
... optimal grid flux: 25.929 ($\chi^2_r$ = 1.2)
Processing spectral channel 3...
... optimal grid flux: 38.566 ($\chi^2_r$ = 1.4)
Processing spectral channel 4...
... optimal grid flux: 25.929 ($\chi^2_r$ = 1.2)
Processing spectral channel 5...
... optimal grid flux: 25.929 ($\chi^2_r$ = 1.4)
Processing spectral channel 6...
... optimal grid flux: 25.929 ($\chi^2_r$ = 1.4)
Processing spectral channel 7...
... optimal grid flux: 17.433 ($\chi^2_r$ = 1.6)
../_images/d8fc875832920210a7a2721216fe927712ba8c96d5dfbae1e61b76224a25757b.png
Planet 0: preliminary position guess: (r, theta)=(38.5, 323.1)
Planet 0: preliminary flux guess: 25.9, 25.9, 25.9, 38.6, 25.9, 25.9, 25.9, 17.4
Planet 0: Simplex Nelder-Mead minimization, running ...
Planet 0: Success: True, nit: 599, nfev: 981, chi2r: 0.08273690102140464
message: Optimization terminated successfully.
Planet 0 simplex result: (r, theta, f0, f1, f2, f3, f4, f5, f6, f7)=(25.818, 30.198, 29.524, 32.601, 31.230, 29.441, 27.446, 20.260) at 
          (X,Y)=(83.76, 29.96)

 ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― 
DONE !
 ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Running time:  1:11:19.599622
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
res
(array([38.43053665]),
 array([323.17227216]),
 array([[25.81842079, 30.19799045, 29.52422292, 32.60082118, 31.23004471,
         29.44067354, 27.44591763, 20.25968548]]))

Let’s compare the estimates to their respective ground truth values:

print("r (gt): {:.2f} VS. r (estimated): {:.2f}".format(r_c, r0c[0]))
print("theta (gt): {:.2f} VS. r (estimated): {:.2f}".format(theta_c%360, theta0c[0]))
for i, ch in enumerate(final_chs_c):
    print("flux ch.{} (gt): {:.2f} VS. r (estimated): {:.2f}".format(ch, flux_c_scal[ch], fluxes0c[0,i]))
r (gt): 38.50 VS. r (estimated): 38.43
theta (gt): 323.13 VS. r (estimated): 323.17
flux ch.38 (gt): 24.66 VS. r (estimated): 25.82
flux ch.34 (gt): 29.42 VS. r (estimated): 30.20
flux ch.37 (gt): 28.25 VS. r (estimated): 29.52
flux ch.35 (gt): 30.51 VS. r (estimated): 32.60
flux ch.36 (gt): 30.09 VS. r (estimated): 31.23
flux ch.33 (gt): 27.34 VS. r (estimated): 29.44
flux ch.32 (gt): 25.13 VS. r (estimated): 27.45
flux ch.30 (gt): 22.10 VS. r (estimated): 20.26

7.6.3. NEGFC+PCA-ADI (MCMC)

A better, albeit slower way, to infer the astrometry of each planet with uncertainties is to use an MCMC approach. Our specific case can be solved with the mcmc_negfc_sampling, which can, since VIP v1.2.3, also deal with 4D cubes. We refer to Tutorial 5A for more details on how to set up the parameters for the MCMC algorithm.

import pickle

lab='c'
ann_width = 4*np.mean(fwhm)
aperture_radius=2
nwalkers, itermin, itermax = (100, 200, 500)
conv_test, ac_c, ac_count_thr, check_maxgap = ('ac', 50, 1, 50)

algo_params = {'algo': pca_annulus,
               'annulus_width': ann_width,
               'svd_mode': 'lapack',
               'imlib': imlib, 
               'interpolation': interpolation}
conv_params = {'conv_test': conv_test,
               'ac_c': ac_c,
               'ac_count_thr': ac_count_thr,
               'check_maxgap': check_maxgap}
mcmc_params = {'nwalkers': nwalkers,
               'niteration_min': itermin,
               'niteration_limit': itermax,
               'bounds': None,
               'sigma':'spe', 
               'nproc': 2}
negfc_params = {'mu_sigma': True,
                'aperture_radius': aperture_radius}
obs_params = {}
Note:

When the flux variation is known throughout the observation (e.g. through a background star or satellite spots) or if you wish to take into account the effect of airmass, it is possible to provide a weights parameter for the injection of the mean flux to be scaled at the moment of injection in each image to follow in (this is a new addition since Christiaens et al. 2021).

weights=X_fac
# input to MCMC
init = [r0c[0], theta0c[0]]
for i in range(cutoff):
    init.append(fluxes0c[0,i])
initial_state = np.array(init)
obs_params['psfn']= psfn[final_chs_c]
obs_params['fwhm']= np.mean(fwhm[final_chs_c])
obs_params['transmission']= trans_crop_c
algo_params['ncomp'] = list(final_npcs_c)
Warning:

The following box is very computer intensive. It can be skipped if needed (results loaded in the subsequent one).

from vip_hci.fm import mcmc_negfc_sampling
chain = mcmc_negfc_sampling(cube_fc[final_chs_c], derot_angles, **obs_params, **algo_params, **negfc_params, 
                            initial_state=initial_state, **mcmc_params, **conv_params, weights=weights,
                            display=True, verbosity=2, save=False, output_dir='./')
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-08 15:57:08
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
        MCMC sampler for the NEGFC technique       
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
The mean and stddev in the annulus at the radius of the companion (excluding the PA area directly adjacent to it) are -0.00 and 0.08 respectively.
Beginning emcee Ensemble sampler...
emcee Ensemble sampler successful

Start of the MCMC run ...
Step  |  Duration/step (sec)  |  Remaining Estimated Time (sec)
0		81.68936			40762.99264
1		83.24805			41457.52940
2		83.43421			41466.80088
3		87.95120			43623.79371
4		87.83650			43479.06898
5		83.79669			41395.56437
6		84.11321			41467.81154
7		85.93990			42282.43031
8		84.86983			41671.08555
9		83.30998			40821.89069
10		83.31553			40741.29319
11		84.16042			41070.28252
12		83.27096			40552.95606
13		83.74174			40698.48710
14		83.46243			40479.27758
15		83.25598			40295.89287
16		83.41263			40288.30077
17		82.76278			39891.66237
18		81.89873			39393.28913
19		83.74382			40197.03168
20		82.92500			39721.07308
21		82.01236			39201.90904
22		82.62069			39410.06818
23		83.09659			39553.97827
24		81.83670			38872.43298
25		81.76536			38756.78064
26		82.29557			38925.80508
27		82.50129			38940.60794
28		81.99986			38621.93359
29		82.42443			38739.48257
30		82.00413			38459.93463
31		81.63117			38203.38616
32		81.93483			38263.56748
33		82.32236			38362.21836
34		82.27969			38260.05353
35		83.15343			38583.19106
36		83.71995			38762.33546
37		105.51843			48749.51605
38		105.29174			48539.49306
39		105.48060			48521.07784
40		105.52828			48437.48236
41		106.63249			48837.67905
42		176.38720			80608.95177
43		107.86379			49185.88824
44		106.62904			48516.21092
45		106.52472			48362.22152
46		107.42355			48662.86770
47		107.06789			48394.68492
48		106.43992			48004.40347
49		106.61238			47975.57010
50		109.86931			49331.32064

 ac convergence test in progress...
51		107.60120			48205.33670
52		106.76028			47721.84695
53		107.32942			47868.92221
54		107.23052			47717.57962
55		106.93905			47480.94042
56		107.31880			47542.22707
57		273.47794			120877.24815
58		12673.97241			5589221.83105
59		111.18266			48920.36864
60		109.14117			47912.97495
61		107.03788			46882.59056
62		106.64145			46602.31540
63		106.73005			46534.30267
64		106.76377			46442.23821
65		104.76075			45466.16507
66		106.54283			46133.04755
67		106.89899			46180.36238
68		104.14060			44884.59645
69		105.92179			45546.37056
70		105.98755			45468.65981
71		106.21297			45459.15244
72		106.86333			45630.64362
73		106.01915			45164.16003
74		105.88789			45002.35283
75		105.90551			44903.93836
76		105.75859			44735.88399
77		105.92897			44702.02365
78		106.25399			44732.93147
79		106.04723			44539.83492
80		104.48466			43779.07296
81		104.18917			43551.07181
82		1550.44152			646534.11509
83		94.37091			39258.29814
84		84.75734			35174.29444
85		84.04961			34796.53813
86		82.30649			33992.58243
87		81.08715			33407.90580
88		80.39966			33044.25862
89		83.90673			34401.76012
90		83.32324			34079.20598
91		83.04677			33883.08298
92		83.54103			34001.20084
93		83.15094			33759.28002
94		83.45729			33800.20204
95		81.99558			33126.21311
96		82.09399			33083.87716
97		82.21375			33049.92710
98		83.54873			33503.03872
99		83.96338			33585.35280
100		83.58042			33348.58838

 ac convergence test in progress...
101		82.66181			32899.39879
102		81.04544			32175.03889
103		83.02784			32879.02622
104		81.94930			32369.97192
105		82.23514			32400.64477
106		83.17321			32687.07350
107		84.14698			32985.61498
108		84.08134			32875.80355
109		83.10538			32411.09664
110		83.15452			32347.10634
111		83.48427			32391.89715
112		84.00501			32509.93732
113		83.31292			32158.78596
114		83.04063			31970.64063
115		83.63183			32114.62272
116		83.19644			31864.23499
117		83.79500			32009.68924
118		83.79381			31925.44123
119		84.02127			31928.08336
120		81.46226			30874.19806
121		81.05232			30637.77620
122		81.86045			30861.39003
123		81.01535			30461.77310
124		81.65300			30619.87313
125		83.27478			31144.76847
126		85.27786			31808.64066
127		87.95275			32718.42412
128		84.14372			31217.31864
129		83.48850			30890.74611
130		84.19711			31068.73433
131		83.74352			30817.61536
132		82.83978			30402.19853
133		80.60833			29502.65061
134		82.56366			30135.73517
135		84.20848			30651.88526
136		83.45095			30292.69449
137		82.89800			30009.07781
138		84.05810			30344.97518
139		82.87964			29836.67076
140		83.52543			29985.62793
141		84.24989			30161.45955
142		85.64572			30575.52240
143		85.45559			30422.19111
144		84.32443			29935.17265
145		82.06816			29052.13006
146		84.43652			29806.09015
147		84.05939			29588.90563
148		85.08463			29864.70513
149		83.88536			29359.87670
150		82.46869			28781.57281

 ac convergence test in progress...
151		85.73458			29835.63280
152		85.25802			29584.53294
153		84.88954			29371.78084
154		82.13820			28337.67969
155		84.14474			28945.78987
156		85.14951			29206.28296
157		84.26898			28819.98979
158		86.32510			29436.85774
159		82.74590			28133.60532
160		83.68068			28367.74916
161		82.18636			27778.99103
162		85.21747			28718.28705
163		83.15907			27941.44651
164		84.65147			28358.24245
165		85.42956			28533.47170
166		84.53891			28151.45603
167		84.34114			28001.25914
168		86.17986			28525.53234
169		82.92511			27365.28498
170		81.54082			26826.92912
171		82.33777			27006.78725
172		83.17896			27199.52025
173		81.78549			26662.06974
174		80.91318			26296.78415
175		81.13946			26289.18439
176		83.68236			27029.40163
177		82.63495			26608.45519
178		84.93765			27264.98469
179		82.59966			26431.89184
180		82.00488			26159.55544
181		84.00575			26713.82723
182		84.25140			26707.69221
183		84.94395			26842.28820
184		81.42477			25648.80318
185		83.70001			26281.80157
186		84.53735			26460.19024
187		84.33458			26312.38958
188		84.72993			26351.00823
189		82.52892			25583.96551
190		83.09873			25677.50695
191		84.28553			25959.94262
192		85.09599			26124.47016
193		82.98671			25393.93295
194		85.78614			26164.77118
195		86.48739			26292.16534
196		89.58831			27145.25914
197		90.43139			27310.27978
198		92.39931			27812.19111
199		88.72828			26618.48280
200		90.80236			27149.90474

 ac convergence test in progress...
Auto-corr tau/N = [0.0864627  0.09171085 0.08497292 0.08682651 0.08337941 0.0815108
 0.08175324 0.08142712 0.08336117 0.09078609]
tau/N <= 0.02 = [False False False False False False False False False False] 

201		91.72792			27334.92046
202		89.13097			26471.89809
203		86.05353			25471.84399
204		85.62998			25260.84263
205		85.87204			25246.37917
206		87.08987			25517.33250
207		85.20438			24879.67925
208		82.63895			24047.93532
209		88.61725			25699.00308
210		89.61761			25899.48813
211		87.21768			25118.69098
212		88.81005			25488.48464
213		88.59508			25338.19202
214		90.54394			25805.02176
215		85.47815			24275.79488
216		84.36403			23875.02162
217		87.70309			24732.26997
218		87.20997			24506.00157
219		87.67232			24548.25044
220		84.11851			23469.06429
221		80.31305			22327.02901
222		80.73276			22362.97507
223		80.10759			22109.69401
224		81.95399			22537.34615
225		79.15664			21688.92073
226		81.47540			22242.78447
227		82.10866			22333.55661
228		81.93647			22204.78310
229		81.39604			21976.93026
230		81.93763			22041.22328
231		80.29460			21518.95334
232		77.58801			20716.00000
233		80.57757			21433.63442
234		81.76221			21666.98459
235		80.61052			21281.17807
236		81.94949			21552.71666
237		80.64769			21129.69609
238		82.43513			21515.56867
239		82.56863			21467.84406
240		83.94501			21741.75655
241		82.01848			21160.76758
242		82.87409			21298.64036
243		80.61248			20636.79539
244		83.00464			21166.18397
245		84.47772			21457.34190
246		84.75519			21443.06231
247		81.02550			20418.42499
248		81.12560			20362.52660
249		83.80815			20952.03775
250		83.33294			20749.90181

 ac convergence test in progress...
Auto-corr tau/N = [0.08629976 0.08799655 0.08005138 0.07981482 0.08133855 0.08031523
 0.07938774 0.0797585  0.08151866 0.08302602]
tau/N <= 0.02 = [False False False False False False False False False False] 

251		81.97529			20329.87142
252		82.92933			20483.54426
253		81.21382			19978.60095
254		84.41310			20681.20926
255		85.10057			20764.53810
256		84.51384			20536.86215
257		82.91104			20064.47095
258		82.33154			19841.90114
259		83.73185			20095.64448
260		82.35239			19682.22049
261		80.89727			19253.55121
262		82.70422			19600.90132
263		82.94613			19575.28597
264		81.93816			19255.46807
265		87.52970			20481.94863
266		84.19657			19617.80104
267		82.18292			19066.43767
268		83.31786			19246.42612
269		81.24990			18687.47723
270		80.57255			18451.11487
271		82.49897			18809.76607
272		80.22874			18211.92421
273		80.53048			18199.88893
274		80.18310			18041.19840
275		80.06877			17935.40403
276		79.55450			17740.65328
277		79.04376			17547.71428
278		83.28582			18406.16666
279		81.72454			17979.39880
280		81.87902			17931.50472
281		82.58003			18002.44545
282		82.11119			17818.12845
283		82.52945			17826.36142
284		84.22294			18107.93188
285		80.47048			17220.68208
286		80.46203			17138.41282
287		83.64424			17732.57824
288		80.53513			16992.91201
289		81.44175			17102.76666
290		83.85293			17525.26279
291		82.58919			17178.55152
292		81.58996			16889.12172
293		82.92355			17082.25151
294		82.97669			17010.22166
295		81.79864			16686.92154
296		83.45821			16942.01764
297		82.58496			16682.16152
298		81.12570			16306.26671
299		81.88840			16377.67900
300		82.51552			16420.58788

 ac convergence test in progress...
Auto-corr tau/N = [0.08596317 0.08396508 0.07312605 0.07778693 0.07976221 0.07500365
 0.07667643 0.07528922 0.07891291 0.07799338]
tau/N <= 0.02 = [False False False False False False False False False False] 

301		83.44301			16521.71677
302		83.68995			16486.91936
303		83.41463			16349.26670
304		82.49394			16086.31752
305		82.15831			15938.71253
306		82.00645			15827.24504
307		83.58263			16047.86554
308		82.90612			15835.06968
309		82.15668			15609.76844
310		83.32312			15748.06968
311		82.77285			15561.29655
312		82.24288			15379.41856
313		83.41662			15515.49188
314		82.58623			15278.45199
315		81.74722			15041.48830
316		83.02677			15193.89946
317		83.06551			15117.92264
318		82.34128			14903.77168
319		83.45199			15021.35766
320		82.55332			14777.04428
321		82.14638			14622.05493
322		83.00648			14692.14696
323		83.00792			14609.39322
324		82.41563			14422.73612
325		80.82060			14062.78370
326		81.83227			14156.98288
327		83.61436			14381.67026
328		82.72250			14145.54818
329		82.00821			13941.39519
330		83.18827			14058.81695
331		82.98741			13941.88454
332		81.81480			13663.07193
333		82.98017			13774.70839
334		82.94050			13685.18234
335		81.79266			13413.99558
336		83.41025			13595.87010
337		82.96206			13439.85453
338		82.07375			13213.87423
339		80.75269			12920.43056
340		81.85364			13014.72892
341		81.74111			12915.09570
342		80.93470			12706.74790
343		84.20000			13135.19984
344		78.02162			12093.35110
345		81.03566			12479.49102
346		83.72641			12810.14134
347		82.02259			12467.43307
348		80.52931			12159.92596
349		82.41629			12362.44320
350		81.95614			12211.46501

 ac convergence test in progress...
Auto-corr tau/N = [0.0820121  0.08124959 0.06676178 0.07194576 0.07759089 0.0707499
 0.07602957 0.07427978 0.07576743 0.07422574]
tau/N <= 0.02 = [False False False False False False False False False False] 

351		82.29673			12179.91574
352		81.92898			12043.55977
353		82.33660			12021.14331
354		80.24207			11635.09957
355		80.24690			11555.55302
356		80.13592			11459.43599
357		81.64434			11593.49671
358		81.55289			11498.95721
359		81.51722			11412.41136
360		81.46963			11324.27926
361		81.54532			11253.25375
362		81.66800			11188.51614
363		81.68151			11108.68577
364		78.87927			10648.70078
365		81.50079			10921.10559
366		81.67284			10862.48719
367		81.50753			10758.99356
368		81.68703			10701.00041
369		81.60439			10608.57031
370		81.59355			10525.56782
371		81.61518			10446.74342
372		81.56023			10358.14959
373		81.53241			10273.08328
374		81.53862			10192.32788
375		81.55298			10112.56927
376		81.56795			10032.85822
377		81.62677			9958.46582
378		81.65924			9880.76865
379		81.57578			9789.09408
380		81.63161			9714.16195
381		81.67052			9637.12101
382		81.48729			9534.01305
383		80.13757			9295.95870
384		78.89773			9073.23918
385		81.82424			9327.96325
386		80.49892			9096.37773
387		80.48217			9014.00326
388		80.29155			8912.36216
389		77.57910			8533.70111
390		81.75882			8911.71182
391		81.71311			8825.01577
392		82.02876			8777.07689
393		81.90718			8682.16076
394		81.79530			8588.50629
395		80.38226			8359.75494
396		80.36031			8277.11152
397		81.73803			8337.27896
398		81.55743			8237.30063
399		81.58913			8158.91350
400		80.18708			7938.52112

 ac convergence test in progress...
Auto-corr tau/N = [0.08030479 0.07901209 0.06542088 0.0691828  0.07866088 0.07158633
 0.07465741 0.07498889 0.07341384 0.06950794]
tau/N <= 0.02 = [False False False False False False False False False False] 

401		80.62048			7900.80675
402		80.07639			7767.40935
403		80.12596			7692.09206
404		80.33062			7631.40919
405		81.61088			7671.42253
406		80.05179			7444.81638
407		80.11322			7370.41615
408		80.18768			7297.07924
409		80.19952			7217.95716
410		78.66149			7000.87261
411		81.59424			7180.29330
412		78.68407			6845.51400
413		78.71399			6769.40340
414		80.10203			6808.67230
415		80.20863			6737.52517
416		81.58055			6771.18565
417		79.07036			6483.76911
418		81.55702			6606.11822
419		81.59169			6527.33496
420		80.04313			6323.40688
421		80.01916			6241.49479
422		80.30367			6183.38274
423		81.53973			6197.01963
424		80.21537			6016.15245
425		80.13739			5930.16716
426		78.91136			5760.52943
427		80.28024			5780.17699
428		78.72634			5589.56986
429		80.23400			5616.37979
430		81.84562			5647.34750
431		81.60924			5549.42805
432		81.51347			5461.40229
433		80.01356			5280.89503
434		78.84186			5124.72064
435		80.04860			5123.11066
436		78.93192			4972.71102
437		79.05557			4901.44515
438		81.50160			4971.59736
439		80.03829			4802.29716
440		81.51352			4809.29762
441		81.59880			4732.73034
442		80.27432			4575.63618
443		81.41435			4559.20349
444		78.69122			4328.01721
445		80.15574			4328.41007
446		80.31873			4256.89243
447		80.13528			4167.03440
448		78.72697			4015.07567
449		80.11407			4005.70370
450		79.97707			3918.87638

 ac convergence test in progress...
Auto-corr tau/N = [0.07847232 0.07695    0.06621235 0.06603675 0.07632031 0.07118351
 0.07456467 0.07479184 0.07287346 0.06717837]
tau/N <= 0.02 = [False False False False False False False False False False] 

451		81.07575			3891.63586
452		81.45645			3828.45315
453		81.64784			3755.80041
454		81.60243			3672.10926
455		80.53723			3543.63816
456		81.60395			3508.96989
457		80.18156			3367.62531
458		80.18294			3287.50050
459		81.58331			3263.33236
460		80.18578			3127.24542
461		81.52151			3097.81719
462		80.09628			2963.56240
463		78.66187			2831.82721
464		78.76287			2756.70062
465		78.61234			2672.81939
466		78.70793			2597.36156
467		78.86177			2523.57654
468		80.08506			2482.63692
469		80.21484			2406.44523
470		81.70360			2369.40434
471		81.58092			2284.26587
472		80.14990			2164.04716
473		81.60715			2121.78595
474		81.58011			2039.50278
475		81.83624			1964.06966
476		78.65630			1809.09495
477		81.48474			1792.66435
478		80.29732			1686.24374
479		80.24035			1604.80690
480		81.59848			1550.37116
481		80.38473			1446.92516
482		80.19565			1363.32607
483		77.62854			1242.05666
484		79.99637			1199.94554
485		80.41593			1125.82308
486		80.16833			1042.18832
487		80.15545			961.86545
488		78.60141			864.61550
489		81.40510			814.05096
490		81.56365			734.07289
491		80.10064			640.80510
492		80.22048			561.54337
493		80.19707			481.18244
494		81.68306			408.41530
495		81.53146			326.12583
496		81.64929			244.94787
497		81.63194			163.26387
498		81.75156			81.75156
499		81.54709			0.00000
We have reached the limit # of steps without convergence
Running time:  15:44:20.188583
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
../_images/e2a5a9c61cc6abbb16635d41efe1c54ade51f99289915e689791114204eaa157.png ../_images/520fb226f238e60a77729470657f417e020da1c751afe8fd3c920925969a47dd.png ../_images/7a94fa31390ee23a89e35c4825d8e4f083090207343f1a7bf4d57f9cb7d45f2d.png ../_images/70d65fd8adf61baf79a0e6fb7dc953d3934302b14d379084abc65938672a1187.png ../_images/bd66fe2a604aa8b9d5963458d9b7c09498742e9e47807c3b502c03f7a0cb8d8e.png ../_images/1eb624fc16a33ae07173413a59db6f6d7f4a9fc95c135c838324799395bafc14.png ../_images/6c6ba4c5d8a2d306ad4c4373cde5c345af23e3a51c69b6390bd7f3162290e791.png ../_images/ad05329894d8f6bf7f01dbf1eabd5138372edad01a7823c4d06856192165d5bc.png ../_images/5ce745affd93e7d1ebd3ffb53c6ddc4fe481d8f83602bd02e5828f4eed119470.png

If you ran the previous box and wish to write your results, set write=True in the next box. This will pickle the MCMC chain.

write=False

if write:
    output = {'chain':chain}
    with open('../datasets/MCMC_results_pl{}_top{}ch'.format(lab, cutoff), 'wb') as fileSave:
        pickle.dump(output, fileSave)
with open('../datasets/MCMC_results_pl{}_top{}ch'.format(lab, cutoff), 'rb') as fi:
    myPickler = pickle.Unpickler(fi)
    mcmc_result = myPickler.load()

chain = mcmc_result['chain']

Let’s visualize the chain after setting labels for each parameter:

labels = [r"$r$", r"$\theta$"]
for i, ch in enumerate(final_chs_c):
    labels.append(r"$f$ (ch.{:.0f})".format(ch))
from vip_hci.fm import show_walk_plot
show_walk_plot(chain, labels=labels)
../_images/a191ef99f1cb41e8118daab657ec38042513061db3c39c6f710fed4044c4e4f1.png

Let’s visualize the corner plot after burning the first 30% of the chain:

from vip_hci.fm import show_corner_plot
burnin = 0.3
show_corner_plot(chain, burnin=burnin, labels=labels)
../_images/c28aac19822cb592c9a35811d4bab32c95604f3b32e2a2e38e745ae0275d8c01.png

To calculate 1-sigma (68%) confidence intervals on each parameter, let’s first flatten the chain:

npar = len(initial_state)
isamples_flat = chain[:, int(chain.shape[1]//(1/burnin)):, :].reshape((-1,npar))

Then use the confidence function.

Below, the first set of plots show the estimate, ground truth value and 68% confidence interval (in shaded area).

By setting ‘gaussian_fit’ to True, a second set of plots is also shown, where a Gaussian function is fit to each posterior distribution in order to infer mean and standard deviation for each parameter.

Note that the function can accept a ground truth value gt, which will be shown in the plots if provided.

from vip_hci.fm import confidence

gt = [r_c, theta_c%360]
for i, ch in enumerate(final_chs_c):
    gt.append(flux_c_scal[ch])

mu, sigma = confidence(isamples_flat, cfd=68, gaussian_fit=True, verbose=False, 
                       gt=gt, save=False, title=True, labels=labels)
../_images/d757ebcdfab2a5e3f7f54ae00859c9571c41f8b7cc45d0992d221a23af3d7009.png

Overall we see that the estimated parameters are consistent with the ground truth values (shown with dashed blue lines), within uncertainties.

from vip_hci.var import frame_center
r_est = mu[0]
theta_est = mu[1]

xc, yc = frame_center(cube_fc)
x_est = xc + r_est*np.cos(np.deg2rad(theta_est))
y_est = yc + r_est*np.sin(np.deg2rad(theta_est))

xy_est = (x_est, y_est)

7.7. Spectrum retrieval

7.7.1. NEGFC+PCA-ADI (simplex)

Let’s use the negative fake companion technique (combined with PCA-ADI) to estimate the flux of the companion in each spectral channel. In this section, we will just use the firstguess function in VIP which finds a first estimate on a grid of flux values followed by a simplex. The difference with Sec. 7.6 is that here we set force_rPA=True to pin the position during the NEGFC procedure (i.e. only allowing the fluxes at different wavelengths as free parameters) - this will be faster and provide more reliable flux estimates in channels where the companion is faint.

est_fluxes_c = np.zeros(nch)
for i in range(nch):
    trans_i = np.array([trans[0],trans[i]])
    res = firstguess(cube_fc[i], derot_angles, psfn[i], ncomp=4, planets_xy_coord=[xy_est], 
                     fwhm=fwhm[i], annulus_width=int(4*fwhm[i]), aperture_radius=2, imlib=imlib, interpolation=interpolation,
                     f_range=None, transmission=trans_i, mu_sigma=True, force_rPA=True, weights=X_fac,
                     simplex=True, plot=False, verbose=False)
    _, _, est_fluxes_c[i] = res
Note:

Here we arbitrarily assigned the number of principal components to 4 for the PCA-ADI algorithm used by NEGFC to measure the flux of the outer fake planet. A more rigorous approach would consist in finding the optimal number of principal components for each spectral channel first, as done in Tutorial 5A (Sec. 5.2) or in the next section.

Let’s now compare the retrieved fluxes with and without weights to the ground truth values used for injection:

%matplotlib inline
fig, axes = plt.subplots(1,2, figsize = (14,5))
ax1, ax2 = axes
ax1.plot(lbda, est_fluxes_c, 'bo', label='Planet c: estimated spectrum')
ax1.plot(lbda, flux_c_scal, 'k', label='Planet c: injected spectrum')
ax1.set_xlabel("Wavelength")
ax1.set_ylabel("Flux (ADU/s)")
ax1.legend()

ax2.plot(lbda, est_fluxes_c-flux_c_scal, 'bo', label='Planet b: estimated - injected spectrum')
ax2.plot(lbda, [0]*len(lbda), 'k--')
ax2.plot(lbda, [np.mean(est_fluxes_c-flux_c_scal)]*len(lbda), 'b-', label='Mean residuals')
ax2.set_xlabel("Wavelength")
ax2.set_ylabel("Flux (ADU/s)")
ax2.legend()
plt.show()
../_images/dba9d1032d607caa0be8d91372660673b01385c3bb0da64bf873a6d9523c8f9d.png

This approach does not yield uncertainties. For the latter, it is recommended to run the mcmc_negfc_sampling function.

7.7.2. NEGFC+PCA-ADI (MCMC)

One can use the MCMC approach to have both estimates and uncertainties on the flux of directly imaged companions. Given that this approach is computationally expensive, we will only apply it to 3 spectral channels. Again, we set force_rPA=True to pin the position during the NEGFC procedure as found from the spectral channels where the companions showed the highest SNR.

We refer to Tutorial 5 (Sec. 5.3.3.) for more details on setting the MCMC parameters.

ann_width = 4*np.mean(fwhm)
aperture_radius=2
nwalkers, itermin, itermax = (100, 200, 500)
conv_test, ac_c, ac_count_thr, check_maxgap = ('ac', 50, 1, 50)

algo_params = {'algo': pca_annulus,
               'annulus_width': ann_width,
               'svd_mode': 'lapack',
               'imlib': imlib, 
               'interpolation': interpolation}
conv_params = {'conv_test': conv_test,
               'ac_c': ac_c,
               'ac_count_thr': ac_count_thr,
               'check_maxgap': check_maxgap}
mcmc_params = {'nwalkers': nwalkers,
               'niteration_min': itermin,
               'niteration_limit': itermax,
               'bounds': None,
               'sigma':'spe', 
               'nproc': None}
negfc_params = {'mu_sigma': True,
                'aperture_radius': aperture_radius}
obs_params = {}
Note:

The pixel intensities in calibrated SPHERE cubes coming out from the DRH pipeline (as this one) are normalized by their integration time. In absence of knowledge of this original integration time, it is not possible to scale the cube back to original ADU values, and it is therefore not possible to include photon noise uncertainty among the different sources of uncertainty (in this specific case, the estimated photon noise uncertainty will be so large that the MCMC will not work properly). To alleviate this issue, we set sigma to ‘spe’, instead of ‘spe+pho’ (default) - although this may slightly underestimate the final uncertainties.

import pickle

lab='c'
test_ch = [20,29,38]
Warning:

The next box is very computer-intensive. The results from that box have been saved in the ‘datasets’ folder, such that it can be skipped.

for i, ch in enumerate(test_ch):
    # find optimal npc
    res_ann_opt = pca_grid(cube_fc[ch], derot_angles, fwhm=fwhm[ch], range_pcs=(1,11,1), 
                           source_xy=xy_est, mode='annular',
                           annulus_width=ann_width, imlib=imlib, 
                           interpolation=interpolation, 
                           full_output=True, plot=True, exclude_negative_lobes=True)
    _, final_ann_opt, _, opt_npc_ann = res_ann_opt
    plot_frames(final_ann_opt, label='PCA-ADI annulus (ch={}, opt. npc={:.0f})'.format(ch, opt_npc_ann),
                dpi=100, colorbar=True, circle=xy_est)
    # first guess
    trans_i = np.array([trans[0],trans[ch]])
    r_0, theta_0, f_0 = firstguess(cube_fc[ch], derot_angles, psfn[ch], ncomp=opt_npc_ann,
                                   planets_xy_coord=[xy_est], fwhm=fwhm[ch], weights=X_fac,
                                   f_range=None, annulus_width=ann_width, aperture_radius=aperture_radius,
                                   imlib=imlib, interpolation=interpolation, simplex=True, force_rPA=True,
                                   transmission=trans_i, plot=True, verbose=True)
    initial_state = np.array([r_0[0], theta_0[0], f_0[0]])
    # MCMC
    obs_params['psfn']= psfn[ch]
    obs_params['fwhm']= fwhm[ch]
    obs_params['transmission']= trans_i
    algo_params['ncomp'] = opt_npc_ann
    chain = mcmc_negfc_sampling(cube_fc[ch], derot_angles, **obs_params, **algo_params, **negfc_params, 
                                initial_state=initial_state, **mcmc_params, **conv_params, weights=X_fac,
                                force_rPA=True, display=True, verbosity=2, save=False, output_dir='./')
    output = {'chain':chain}
    with open('../datasets/MCMC_results_pl{}_ch{}'.format(lab, ch), 'wb') as fileSave:
        pickle.dump(output, fileSave)           
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-09 07:49:50
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.014893
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Number of steps 11
Optimal number of PCs = 3, for S/N=6.977
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 30.0
Flux in a centered 1xFWHM circular aperture = 1.942
Central pixel S/N = 8.017
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 6.579
Max S/N (shifting the aperture center) = 9.557
stddev S/N (shifting the aperture center) = 1.654
../_images/f76d8603ba6a934a99053ceca0ed35a33198536b3cf68550ba4b350209d88621.png ../_images/d00b30db5007910f5128d1e4eab0e2811005a9c07f4f654ad643563e2fe7a8e8.png
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-09 07:49:52
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
             Planet 0           
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Planet 0: flux estimation at the position [83.75877533353938,29.974810067878558], running ...
Step | flux    | chi2r
1/30   0.100   0.076
2/30   0.149   0.076
3/30   0.221   0.074
4/30   0.329   0.073
5/30   0.489   0.070
6/30   0.728   0.067
7/30   1.083   0.062
8/30   1.610   0.056
9/30   2.395   0.047
10/30   3.562   0.037
11/30   5.298   0.029
12/30   7.880   0.033
13/30   11.721   0.067
14/30   17.433   0.203
../_images/6a9981dd9e60a613bb463d374c4049aa89bba709b93b386152a187930dd0d4f9.png
Planet 0: preliminary position guess: (r, theta)=(38.4, 323.2)
Planet 0: preliminary flux guess: 5.3
Planet 0: Simplex Nelder-Mead minimization, running ...
Planet 0: Success: True, nit: 21, nfev: 48, chi2r: 0.02870798428148494
message: Optimization terminated successfully.
Planet 0 simplex result: (r, theta, f)=(38.422, 323.182, 5.920) at 
          (X,Y)=(83.76, 29.97)

 ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― 
DONE !
 ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Running time:  0:00:12.043463
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-09 07:50:04
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
        MCMC sampler for the NEGFC technique       
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
The mean and stddev in the annulus at the radius of the companion (excluding the PA area directly adjacent to it) are -0.00 and 0.10 respectively.
Beginning emcee Ensemble sampler...
emcee Ensemble sampler successful

Start of the MCMC run ...
Step  |  Duration/step (sec)  |  Remaining Estimated Time (sec)
0		5.79291			2890.66134
1		4.79625			2388.53101
2		4.72407			2347.86329
3		4.77572			2368.75613
4		4.72416			2338.46019
5		4.78810			2365.31942
6		4.76206			2347.69459
7		4.72130			2322.88157
8		4.72586			2320.39775
9		4.79611			2350.09292
10		4.72218			2309.14406
11		4.72268			2304.66882
12		4.72078			2299.01889
13		4.71015			2289.13387
14		4.72533			2291.78553
15		4.72170			2285.30135
16		4.71177			2275.78588
17		4.54851			2192.38086
18		4.80911			2313.18239
19		4.71064			2261.10720
20		4.73128			2266.28073
21		4.54571			2172.84842
22		4.76526			2273.02759
23		4.74136			2256.88498
24		4.71906			2241.55445
25		4.65713			2207.48057
26		4.70192			2224.00816
27		4.76352			2248.37955
28		4.74965			2237.08750
29		4.70176			2209.82861
30		4.57804			2147.10217
31		4.79186			2242.59282
32		4.74471			2215.78097
33		4.71384			2196.65084
34		4.75405			2210.63511
35		4.72874			2194.13350
36		4.73742			2193.42500
37		4.56081			2107.09561
38		4.71113			2171.83001
39		4.71321			2168.07660
40		4.70453			2159.38065
41		4.75900			2179.62063
42		4.74020			2166.27049
43		4.69830			2142.42480
44		4.81369			2190.22713
45		4.72704			2146.07798
46		4.73965			2147.06009
47		4.72816			2137.12606
48		4.73140			2133.86230
49		4.72764			2127.43935
50		4.55894			2046.96406

 ac convergence test in progress...
51		4.74955			2127.79974
52		4.72770			2113.28369
53		4.78266			2133.06859
54		4.74339			2110.80944
55		4.70378			2088.47876
56		4.77703			2116.22651
57		4.77873			2112.19910
58		4.55828			2010.20368
59		4.70568			2070.49788
60		4.79769			2106.18459
61		4.72739			2070.59507
62		4.52789			1978.68662
63		4.57991			1996.83902
64		4.39320			1911.04244
65		4.69483			2037.55752
66		4.69351			2032.28853
67		4.71060			2034.97877
68		4.74474			2044.98251
69		4.79975			2063.89207
70		4.75406			2039.49388
71		4.70386			2013.25294
72		4.70415			2008.67162
73		4.75919			2027.41494
74		4.71134			2002.32035
75		4.72398			2002.96964
76		4.70677			1990.96540
77		4.53415			1913.41003
78		4.53479			1909.14785
79		4.80114			2016.47670
80		4.68069			1961.21037
81		4.73903			1980.91412
82		4.77351			1990.55367
83		4.39854			1829.79139
84		4.70793			1953.79095
85		4.80555			1989.49646
86		4.71583			1947.63696
87		4.73818			1952.12810
88		4.71640			1938.44163
89		4.69934			1926.72858
90		4.69434			1919.98465
91		4.72366			1927.25532
92		4.72016			1921.10471
93		4.71638			1914.85069
94		4.54638			1841.28349
95		4.79800			1938.39160
96		4.77291			1923.48273
97		4.71030			1893.53980
98		4.77211			1913.61571
99		4.72519			1890.07520
100		4.70731			1878.21749

 ac convergence test in progress...
101		4.73964			1886.37592
102		4.72243			1874.80511
103		4.73428			1874.77488
104		4.44299			1754.97947
105		4.75964			1875.29974
106		4.68295			1840.39974
107		4.78198			1874.53694
108		4.77078			1865.37381
109		4.70279			1834.08732
110		4.70007			1828.32723
111		4.60053			1785.00370
112		4.71201			1823.54826
113		4.74129			1830.13640
114		4.72306			1818.37810
115		4.73222			1817.17440
116		4.70488			1801.96751
117		4.66667			1782.66870
118		4.71747			1797.35493
119		4.55106			1729.40432
120		4.65617			1764.68919
121		4.58760			1734.11242
122		4.70768			1774.79498
123		4.60304			1730.74229
124		4.73611			1776.04050
125		4.71587			1763.73650
126		4.70316			1754.27905
127		4.74598			1765.50382
128		4.72879			1754.38072
129		4.74531			1755.76285
130		4.82346			1779.85637
131		4.72800			1739.90437
132		4.71363			1729.90148
133		4.79468			1754.85288
134		4.74401			1731.56255
135		4.77472			1737.99881
136		4.58706			1665.10097
137		4.52514			1638.09959
138		4.56280			1647.17188
139		4.76220			1714.39092
140		4.73660			1700.43976
141		4.59255			1644.13218
142		4.71478			1683.17682
143		4.75783			1693.78712
144		4.55730			1617.84008
145		4.72286			1671.89244
146		4.81015			1697.98119
147		4.75252			1672.88739
148		4.70668			1652.04398
149		4.74159			1659.55790
150		4.72720			1649.79175

 ac convergence test in progress...
151		4.75555			1654.93001
152		4.53134			1572.37671
153		4.72445			1634.66108
154		4.71515			1626.72641
155		4.69448			1614.89974
156		4.62741			1587.20094
157		4.56400			1560.88663
158		4.73719			1615.38281
159		4.81631			1637.54676
160		4.72691			1602.42181
161		4.73973			1602.02975
162		4.73456			1595.54504
163		4.74359			1593.84624
164		4.58421			1535.71169
165		4.73027			1579.90884
166		4.72546			1573.57785
167		4.71441			1565.18279
168		4.74551			1570.76513
169		4.57833			1510.84758
170		4.75343			1563.88011
171		4.78472			1569.38816
172		4.75825			1555.94873
173		4.70458			1533.69210
174		4.76542			1548.76247
175		4.77877			1548.32018
176		4.72895			1527.45182
177		4.71670			1518.77643
178		4.55506			1462.17298
179		4.68986			1500.75424
180		4.74267			1512.91173
181		4.77485			1518.40071
182		4.73061			1499.60242
183		4.73273			1495.54205
184		4.62353			1456.41289
185		4.73196			1485.83513
186		4.62061			1446.25249
187		4.76651			1487.15143
188		4.70928			1464.58732
189		4.38792			1360.25489
190		4.72738			1460.76104
191		4.72221			1454.44130
192		4.58301			1406.98499
193		4.54532			1390.86761
194		4.73261			1443.44696
195		4.72247			1435.62966
196		4.71281			1427.98294
197		4.63467			1399.67034
198		4.74842			1429.27322
199		4.73742			1421.22690
200		4.75017			1420.30173

 ac convergence test in progress...
Auto-corr tau/N = [0.05325131]
tau/N <= 0.02 = [False] 

201		4.72952			1409.39577
202		4.55971			1354.23536
203		4.72556			1398.76517
204		4.71942			1392.22772
205		4.73658			1392.55570
206		4.55338			1334.14093
207		4.80867			1404.13281
208		4.73335			1377.40485
209		4.60077			1334.22272
210		4.81789			1392.36963
211		4.52137			1302.15514
212		4.74080			1360.60960
213		4.59832			1315.11866
214		4.69352			1337.65348
215		4.71160			1338.09326
216		4.70523			1331.57896
217		4.95512			1397.34356
218		4.76213			1338.15937
219		4.75665			1331.86144
220		4.72284			1317.67124
221		4.57162			1270.91092
222		4.76423			1319.69282
223		4.79962			1324.69595
224		4.70683			1294.37797
225		4.71481			1291.85657
226		4.78219			1305.53896
227		4.70234			1279.03675
228		4.77349			1293.61633
229		4.72912			1276.86132
230		4.70735			1266.27688
231		4.70061			1259.76455
232		4.79447			1280.12402
233		4.74678			1262.64295
234		4.71079			1248.35988
235		4.86649			1284.75468
236		4.75089			1249.48381
237		4.52541			1185.65637
238		4.77044			1245.08614
239		4.73589			1231.33166
240		4.75642			1231.91200
241		4.84659			1250.42074
242		4.70963			1210.37465
243		4.71606			1207.31238
244		4.71226			1201.62528
245		4.72502			1200.15432
246		4.71133			1191.96750
247		4.70305			1185.16986
248		4.77871			1199.45596
249		4.75271			1188.17700
250		4.70982			1172.74468

 ac convergence test in progress...
Auto-corr tau/N = [0.05005028]
tau/N <= 0.02 = [False] 

251		4.76353			1181.35544
252		4.68616			1157.48152
253		4.72939			1163.42945
254		4.56387			1118.14766
255		4.69606			1145.83986
256		4.70999			1144.52708
257		4.70986			1139.78636
258		4.71424			1136.13088
259		4.77162			1145.18832
260		4.74825			1134.83103
261		4.76118			1133.16108
262		4.51797			1070.75842
263		4.72122			1114.20839
264		4.76311			1119.33202
265		4.72745			1106.22260
266		4.73151			1102.44253
267		4.51367			1047.17167
268		4.75067			1097.40477
269		4.70254			1081.58443
270		4.73504			1084.32485
271		4.68160			1067.40548
272		4.72003			1071.44658
273		4.79184			1082.95516
274		4.70168			1057.87800
275		4.54470			1018.01325
276		4.68462			1044.67071
277		4.72441			1048.81880
278		4.73580			1046.61246
279		4.71168			1036.56982
280		4.55898			998.41771
281		4.72615			1030.30048
282		4.70024			1019.95186
283		4.75640			1027.38305
284		4.75709			1022.77456
285		4.71150			1008.26207
286		4.80417			1023.28778
287		4.73516			1003.85456
288		4.72978			997.98316
289		4.75134			997.78056
290		4.72304			987.11452
291		4.73941			985.79749
292		4.68595			969.99124
293		4.70901			970.05627
294		4.73981			971.66166
295		4.56595			931.45278
296		4.74362			962.95547
297		4.54084			917.24887
298		4.67530			939.73510
299		4.81152			962.30380
300		4.75148			945.54412

 ac convergence test in progress...
Auto-corr tau/N = [0.04719123]
tau/N <= 0.02 = [False] 

301		4.56519			903.90742
302		4.62910			911.93290
303		4.71291			923.73016
304		4.56568			890.30721
305		4.63760			899.69459
306		4.72893			912.68445
307		4.74674			911.37370
308		4.74396			906.09655
309		4.73187			899.05568
310		4.61640			872.49979
311		4.77116			896.97808
312		4.80228			898.02655
313		4.78352			889.73491
314		4.55667			842.98469
315		4.78704			880.81444
316		4.70729			861.43370
317		4.75759			865.88174
318		4.75242			860.18892
319		4.71522			848.73906
320		4.73352			847.30080
321		4.71568			839.39086
322		4.71084			833.81868
323		4.72910			832.32125
324		4.80022			840.03797
325		4.72959			822.94831
326		4.72546			817.50527
327		4.50990			775.70297
328		4.56273			780.22683
329		4.72090			802.55283
330		4.73707			800.56517
331		4.67126			784.77084
332		4.73651			790.99684
333		4.73548			786.09034
334		4.72142			779.03430
335		4.70068			770.91119
336		4.78082			779.27431
337		4.77582			773.68316
338		4.74997			764.74533
339		4.74790			759.66464
340		4.79877			763.00491
341		4.79919			758.27202
342		4.94447			776.28226
343		4.63817			723.55468
344		4.77369			739.92226
345		4.76729			734.16281
346		4.83196			739.29003
347		4.73703			720.02841
348		4.69961			709.64141
349		4.71142			706.71345
350		4.90359			730.63491

 ac convergence test in progress...
Auto-corr tau/N = [0.04500563]
tau/N <= 0.02 = [False] 

351		4.47529			662.34262
352		4.45280			654.56233
353		4.84240			706.99025
354		4.81286			697.86441
355		4.64518			668.90534
356		4.78631			684.44176
357		4.61201			654.90485
358		4.83702			682.01982
359		5.04201			705.88154
360		4.81473			669.24719
361		4.84219			668.22167
362		4.93746			676.43161
363		4.90083			666.51342
364		4.79060			646.73140
365		4.85118			650.05839
366		4.55749			606.14644
367		4.75401			627.52958
368		4.73189			619.87694
369		4.69967			610.95658
370		4.57432			590.08741
371		4.72319			604.56781
372		4.72790			600.44330
373		4.69431			591.48331
374		4.72723			590.90375
375		4.81033			596.48042
376		4.70573			578.80430
377		4.73205			577.31047
378		4.59066			555.47010
379		4.70404			564.48420
380		4.72162			561.87302
381		4.75117			560.63853
382		4.72579			552.91708
383		4.73162			548.86746
384		4.69423			539.83703
385		4.71246			537.22101
386		4.72586			534.02229
387		4.74356			531.27894
388		4.80654			533.52583
389		4.70233			517.25641
390		4.68314			510.46280
391		4.73406			511.27837
392		4.70432			503.36192
393		4.55892			483.24573
394		4.69700			493.18479
395		4.69797			488.58930
396		4.71448			485.59154
397		4.73764			483.23908
398		4.73867			478.60617
399		4.75044			475.04400
400		4.75100			470.34920

 ac convergence test in progress...
Auto-corr tau/N = [0.04139613]
tau/N <= 0.02 = [False] 

401		4.71500			462.06980
402		4.76349			462.05843
403		4.69225			450.45638
404		4.58551			435.62373
405		4.70816			442.56723
406		4.70476			437.54259
407		4.69715			432.13771
408		4.75435			432.64621
409		4.73679			426.31083
410		4.71250			419.41223
411		4.75339			418.29823
412		4.78253			416.08002
413		4.80243			413.00864
414		4.69233			398.84822
415		4.75871			399.73181
416		4.75812			394.92404
417		4.73807			388.52207
418		4.67330			378.53698
419		4.73561			378.84872
420		4.72054			372.92274
421		4.72212			368.32528
422		4.56132			351.22195
423		4.81568			365.99160
424		4.97590			373.19272
425		4.61568			341.56054
426		4.77068			348.25942
427		4.73935			341.23327
428		4.74533			336.91850
429		4.82641			337.84877
430		4.72924			326.31749
431		4.72818			321.51604
432		4.75879			318.83906
433		4.75334			313.72057
434		4.98329			323.91411
435		4.56923			292.43066
436		4.76239			300.03070
437		4.72852			293.16805
438		4.68463			285.76225
439		4.78238			286.94256
440		4.58097			270.27711
441		4.56339			264.67656
442		4.61304			262.94334
443		4.52028			253.13590
444		5.09837			280.41018
445		4.76912			257.53232
446		4.74714			251.59847
447		4.75950			247.49400
448		4.73532			241.50147
449		4.72775			236.38730
450		4.72837			231.69028

 ac convergence test in progress...
Auto-corr tau/N = [0.03770091]
tau/N <= 0.02 = [False] 

451		4.88501			234.48038
452		4.73987			222.77412
453		4.74138			218.10334
454		4.74504			213.52689
455		4.72972			208.10755
456		4.70471			202.30253
457		4.73678			198.94480
458		4.71246			193.21106
459		4.72107			188.84288
460		4.69764			183.20776
461		4.72743			179.64230
462		4.74741			175.65421
463		4.59985			165.59449
464		4.80069			168.02418
465		4.68483			159.28436
466		4.80489			158.56134
467		4.84233			154.95459
468		4.74000			146.94012
469		4.72555			141.76644
470		4.50971			130.78173
471		4.72498			132.29952
472		4.72150			127.48058
473		4.71996			122.71901
474		4.67479			116.86983
475		4.70094			112.82266
476		4.51302			103.79944
477		4.77691			105.09209
478		4.53289			95.19063
479		4.53716			90.74310
480		4.75530			90.35070
481		4.71091			84.79638
482		4.52076			76.85290
483		4.72997			75.67949
484		4.73991			71.09860
485		4.71732			66.04247
486		4.76425			61.93529
487		4.72053			56.64638
488		4.71253			51.83785
489		4.83979			48.39787
490		4.68860			42.19737
491		4.70316			37.62528
492		4.70884			32.96190
493		4.76123			28.56736
494		4.78300			23.91501
495		4.59451			18.37805
496		4.71973			14.15919
497		4.71002			9.42003
498		4.74011			4.74011
499		4.55241			0.00000
We have reached the limit # of steps without convergence
Running time:  0:39:24.243736
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-09 08:29:28
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.012556
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Number of steps 11
Optimal number of PCs = 5, for S/N=17.106
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 30.0
Flux in a centered 1xFWHM circular aperture = 3.729
Central pixel S/N = 13.727
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 10.417
Max S/N (shifting the aperture center) = 15.881
stddev S/N (shifting the aperture center) = 3.412
../_images/b05baa7a0a1f6ef108a2c4073d4cbc89d5895549c8a5fd04b91318f009af4ab5.png ../_images/34bd257820d4d04cac64cc5b55351cee71f6fee255e11bcfdda73253ff1f93bd.png ../_images/c148e74cd03cbe1937339093e3fd5fc10f32f9e9c525be698a34f67b32c227f8.png ../_images/960790fcf6a6996ff1e2d039efaaf768518fa3fd4898c32e026633338c9ec4b3.png ../_images/f332d94a037725a80aed25692a662634ec5d3a3b122a930c3982fbc390a38f69.png ../_images/e18b6fba34cea5776c985f55742d84d8271f28172da66a7fe3d7611b65b3c38c.png ../_images/6f35ac71131c5f365774529c6cb063a0e86a4c220b1fd45fb6e86b7c87a6ae8b.png ../_images/557048ff9af62535d1571ffa335d846063967f5d688814b1082ff2ce28e34235.png ../_images/9453f7bdf55b399eb00fb43043538fe6fe2c7d78e4e6f4c44e2ac90700d98c60.png ../_images/372b35b16076df146bb66c71b734a799cbe25a483f9b41969b4103e01bd6e2e6.png ../_images/eb887c19f771ef1fa10194b7555fbdb9787cfca05ac4d3ae3260cbf4eae01b85.png
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-09 08:29:31
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
             Planet 0           
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Planet 0: flux estimation at the position [83.75877533353938,29.974810067878558], running ...
Step | flux    | chi2r
1/30   0.100   0.248
2/30   0.149   0.248
3/30   0.221   0.247
4/30   0.329   0.245
5/30   0.489   0.242
6/30   0.728   0.238
7/30   1.083   0.231
8/30   1.610   0.221
9/30   2.395   0.205
10/30   3.562   0.186
11/30   5.298   0.158
12/30   7.880   0.121
13/30   11.721   0.076
14/30   17.433   0.037
15/30   25.929   0.051
16/30   38.566   0.213
17/30   57.362   0.492
../_images/3f0daa81805ae301e0dbaf423adefc77b9a18316ad9a2f7674e22a448838440a.png
Planet 0: preliminary position guess: (r, theta)=(38.4, 323.2)
Planet 0: preliminary flux guess: 17.4
Planet 0: Simplex Nelder-Mead minimization, running ...
Planet 0: Success: True, nit: 23, nfev: 51, chi2r: 0.031945210353584046
message: Optimization terminated successfully.
Planet 0 simplex result: (r, theta, f)=(38.422, 323.182, 20.157) at 
          (X,Y)=(83.76, 29.97)

 ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― 
DONE !
 ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Running time:  0:00:13.390550
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-09 08:29:45
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
        MCMC sampler for the NEGFC technique       
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
The mean and stddev in the annulus at the radius of the companion (excluding the PA area directly adjacent to it) are -0.00 and 0.10 respectively.
Beginning emcee Ensemble sampler...
emcee Ensemble sampler successful

Start of the MCMC run ...
Step  |  Duration/step (sec)  |  Remaining Estimated Time (sec)
0		5.40492			2697.05558
1		4.69484			2338.02982
2		4.75181			2361.64907
3		4.75406			2358.01326
4		4.71624			2334.54029
5		4.70132			2322.45109
6		4.72088			2327.39433
7		4.74514			2334.61134
8		4.75643			2335.40860
9		4.72440			2314.95845
10		4.85806			2375.59379
11		4.79191			2338.45403
12		4.72777			2302.42302
13		4.85410			2359.09454
14		4.70046			2279.72358
15		4.78530			2316.08617
16		4.73557			2287.27790
17		4.50974			2173.69613
18		4.71004			2265.53116
19		4.78141			2295.07776
20		4.72539			2263.46037
21		4.73902			2265.25204
22		4.80468			2291.83093
23		4.78607			2278.17075
24		4.71776			2240.93410
25		4.70826			2231.71429
26		4.78263			2262.18446
27		4.73466			2234.76094
28		4.74051			2232.77880
29		4.78247			2247.76043
30		4.77647			2240.16537
31		4.71114			2204.81165
32		4.77124			2228.16815
33		4.68844			2184.81351
34		4.74382			2205.87676
35		4.90896			2277.75698
36		4.74651			2197.63552
37		4.78065			2208.66076
38		4.78025			2203.69525
39		4.72746			2174.63160
40		4.74318			2177.11870
41		4.74271			2172.15981
42		4.73737			2164.97626
43		4.74380			2163.17462
44		4.73229			2153.19195
45		4.86964			2210.81520
46		4.92811			2232.43474
47		4.77428			2157.97275
48		5.06165			2282.80280
49		5.01476			2256.64020
50		4.96649			2229.95446

 ac convergence test in progress...
51		5.09063			2280.60000
52		4.86789			2175.94683
53		4.85582			2165.69572
54		4.83634			2152.17085
55		5.30332			2354.67275
56		5.02837			2227.56702
57		4.89426			2163.26425
58		4.90585			2163.47941
59		4.95030			2178.13024
60		5.09020			2234.59956
61		4.96927			2176.54201
62		4.83767			2114.06266
63		4.91387			2142.44776
64		4.88126			2123.34984
65		4.81197			2088.39585
66		4.83676			2094.31838
67		4.77632			2063.36808
68		4.78427			2062.02209
69		4.79654			2062.51392
70		4.68283			2008.93450
71		4.65670			1993.06760
72		4.71551			2013.52277
73		4.62824			1971.62811
74		4.65990			1980.45580
75		4.74685			2012.66313
76		4.73178			2001.54336
77		4.76737			2011.83056
78		4.88916			2058.33636
79		4.64782			1952.08608
80		4.78755			2005.98471
81		4.63807			1938.71201
82		4.65484			1941.06828
83		4.63452			1927.95990
84		4.64928			1929.45037
85		4.68102			1937.94269
86		4.76613			1968.41128
87		4.68389			1929.76392
88		4.71501			1937.86747
89		4.77142			1956.28302
90		4.75766			1945.88130
91		4.71704			1924.55314
92		4.72616			1923.54590
93		4.65911			1891.59704
94		4.72884			1915.17980
95		4.85126			1959.90864
96		4.85439			1956.31998
97		4.86617			1956.19873
98		4.92557			1975.15277
99		4.72781			1891.12240
100		4.68711			1870.15689

 ac convergence test in progress...
101		4.84195			1927.09491
102		4.67439			1855.73204
103		4.93417			1953.93053
104		4.70288			1857.63641
105		4.72990			1863.58178
106		4.74873			1866.24971
107		4.79648			1880.21820
108		4.64659			1816.81786
109		4.66027			1817.50452
110		4.79469			1865.13480
111		4.85593			1884.10084
112		4.73456			1832.27665
113		4.78204			1845.86705
114		4.65743			1793.11016
115		4.73976			1820.06861
116		4.76143			1823.62577
117		4.74845			1813.90752
118		4.69562			1789.03274
119		4.92190			1870.32200
120		4.85015			1838.20533
121		4.90051			1852.39391
122		4.89934			1847.05156
123		4.84461			1821.57223
124		4.73699			1776.37200
125		4.68288			1751.39637
126		4.72858			1763.75885
127		4.63997			1726.06735
128		4.69275			1741.00877
129		4.68579			1733.74230
130		4.68083			1727.22738
131		4.76519			1753.59102
132		4.68963			1721.09494
133		4.62020			1690.99320
134		4.71183			1719.81831
135		4.83432			1759.69357
136		4.69936			1705.86623
137		4.71269			1705.99233
138		4.68345			1690.72653
139		4.71327			1696.77828
140		4.64734			1668.39398
141		4.75377			1701.84966
142		4.62010			1649.37463
143		4.73335			1685.07331
144		4.68989			1664.91237
145		4.67993			1656.69451
146		4.66716			1647.50748
147		4.83197			1700.85520
148		4.80328			1685.95198
149		4.79925			1679.73610
150		4.78480			1669.89380

 ac convergence test in progress...
151		4.69853			1635.08879
152		4.60589			1598.24279
153		4.61261			1595.96237
154		4.66443			1609.22973
155		4.70506			1618.54064
156		4.74900			1628.90700
157		4.64191			1587.53151
158		4.63051			1579.00289
159		4.55615			1549.09134
160		4.57937			1552.40474
161		4.67061			1578.66517
162		4.73775			1596.62343
163		4.72574			1587.84730
164		4.77085			1598.23442
165		4.74170			1583.72880
166		4.73385			1576.37172
167		4.87440			1618.30014
168		4.76144			1576.03565
169		4.68097			1544.71911
170		4.70033			1546.40824
171		4.81956			1580.81601
172		4.76624			1558.56113
173		4.77545			1556.79540
174		4.68454			1522.47615
175		4.68860			1519.10802
176		4.61177			1489.60236
177		4.75786			1532.03156
178		4.70514			1510.34994
179		4.77710			1528.67264
180		4.72014			1505.72370
181		4.65237			1479.45302
182		4.61022			1461.44006
183		4.66386			1473.78071
184		4.73708			1492.18052
185		4.61328			1448.56866
186		4.66628			1460.54533
187		4.65237			1451.53975
188		4.72346			1468.99513
189		4.79181			1485.46110
190		4.73597			1463.41349
191		4.70725			1449.83392
192		4.70854			1445.52270
193		4.65945			1425.79262
194		4.83562			1474.86440
195		4.71073			1432.06192
196		4.80444			1455.74411
197		4.77414			1441.79088
198		4.70004			1414.71084
199		4.79601			1438.80210
200		4.64959			1390.22801

 ac convergence test in progress...
Auto-corr tau/N = [0.06116205]
tau/N <= 0.02 = [False] 

201		4.79583			1429.15853
202		4.68846			1392.47381
203		4.63567			1372.15832
204		4.58739			1353.28093
205		4.63321			1362.16433
206		4.57943			1341.77328
207		4.61824			1348.52520
208		4.61619			1343.31158
209		4.63410			1343.88900
210		4.59480			1327.89662
211		4.62692			1332.55325
212		4.60609			1321.94840
213		4.67279			1336.41708
214		4.75444			1355.01654
215		4.69801			1334.23569
216		4.61011			1304.66000
217		4.57482			1290.09924
218		4.60855			1295.00255
219		4.58345			1283.36628
220		4.61428			1287.38328
221		4.58448			1274.48516
222		4.60881			1276.64120
223		4.58043			1264.19840
224		4.56782			1256.15105
225		4.60576			1261.97797
226		4.60799			1257.97991
227		4.64167			1262.53478
228		4.66558			1264.37272
229		4.60824			1244.22534
230		4.60626			1239.08340
231		4.63296			1241.63274
232		4.59628			1227.20729
233		4.61938			1228.75588
234		4.58500			1215.02421
235		4.64249			1225.61630
236		4.61432			1213.56485
237		4.62737			1212.37094
238		4.66065			1216.43017
239		4.62793			1203.26180
240		4.64794			1203.81750
241		4.70110			1212.88303
242		4.63097			1190.16032
243		4.61438			1181.28179
244		4.62501			1179.37653
245		4.59608			1167.40483
246		4.61444			1167.45357
247		4.58885			1156.38894
248		4.65392			1168.13317
249		4.62619			1156.54850
250		4.60850			1147.51675

 ac convergence test in progress...
Auto-corr tau/N = [0.05827143]
tau/N <= 0.02 = [False] 

251		4.71870			1170.23686
252		4.63211			1144.13240
253		4.62713			1138.27496
254		4.66990			1144.12623
255		4.63512			1130.96855
256		4.63653			1126.67655
257		4.61023			1115.67469
258		4.62815			1115.38415
259		4.64477			1114.74480
260		4.62308			1104.91564
261		4.66554			1110.39733
262		4.64324			1100.44693
263		4.58683			1082.49235
264		4.60703			1082.65323
265		4.63217			1083.92848
266		4.64259			1081.72440
267		4.68437			1086.77407
268		4.61143			1065.24079
269		4.61805			1062.15035
270		4.60862			1055.37352
271		4.62817			1055.22390
272		4.61522			1047.65607
273		4.60417			1040.54129
274		4.60979			1037.20342
275		4.63214			1037.59891
276		4.63608			1033.84539
277		4.66539			1035.71591
278		4.60998			1018.80602
279		4.62053			1016.51594
280		4.64349			1016.92387
281		4.77818			1041.64389
282		4.61100			1000.58635
283		4.61919			997.74418
284		4.60352			989.75659
285		4.60298			985.03858
286		4.73164			1007.84017
287		5.23339			1109.47868
288		4.97318			1049.34077
289		4.65825			978.23313
290		4.86872			1017.56269
291		4.74589			987.14512
292		4.94530			1023.67793
293		4.69825			967.84053
294		4.69588			962.65458
295		4.60441			939.30005
296		4.69358			952.79735
297		4.58202			925.56723
298		4.58083			920.74763
299		4.59010			918.01980
300		4.61395			918.17545

 ac convergence test in progress...
Auto-corr tau/N = [0.05091726]
tau/N <= 0.02 = [False] 

301		4.71760			934.08421
302		4.66762			919.52153
303		4.57276			896.26076
304		4.62366			901.61468
305		4.58697			889.87315
306		4.66055			899.48654
307		4.60067			883.32960
308		4.83139			922.79644
309		4.66927			887.16035
310		4.61859			872.91370
311		4.62847			870.15255
312		4.98913			932.96656
313		4.77195			887.58326
314		4.71274			871.85672
315		4.70412			865.55734
316		5.08042			929.71686
317		4.90746			893.15790
318		4.94945			895.85027
319		4.58732			825.71814
320		4.71626			844.21126
321		4.97801			886.08649
322		4.70829			833.36680
323		4.62500			813.99930
324		4.71337			824.83993
325		4.66077			810.97433
326		4.62827			800.69106
327		4.63129			796.58274
328		4.97579			850.85958
329		4.77758			812.18894
330		4.75869			804.21929
331		4.69551			788.84534
332		4.68315			782.08622
333		5.09885			846.40844
334		4.86243			802.30078
335		4.76661			781.72355
336		4.63424			755.38128
337		4.65688			754.41505
338		4.66561			751.16257
339		4.74889			759.82304
340		4.84564			770.45628
341		4.67205			738.18327
342		4.66194			731.92458
343		4.81083			750.48917
344		4.66745			723.45444
345		4.69730			723.38482
346		4.65373			712.02008
347		4.66145			708.54010
348		4.68727			707.77852
349		4.71592			707.38830
350		4.64236			691.71149

 ac convergence test in progress...
Auto-corr tau/N = [0.04621867]
tau/N <= 0.02 = [False] 

351		4.67951			692.56792
352		4.66065			685.11496
353		4.70841			687.42815
354		4.66288			676.11789
355		4.70724			677.84256
356		4.69812			671.83130
357		4.66864			662.94645
358		4.62820			652.57564
359		4.71107			659.55008
360		4.64672			645.89339
361		4.68220			646.14360
362		4.67223			640.09524
363		4.69155			638.05107
364		4.65964			629.05127
365		4.65937			624.35518
366		4.68619			623.26314
367		4.94387			652.59044
368		4.73770			620.63909
369		4.82349			627.05318
370		4.65523			600.52428
371		4.67589			598.51392
372		4.71262			598.50299
373		4.60562			580.30850
374		4.61241			576.55150
375		4.65489			577.20611
376		4.62655			569.06553
377		4.60515			561.82867
378		4.61341			558.22261
379		4.65633			558.76008
380		4.59144			546.38112
381		4.60387			543.25690
382		4.68524			548.17285
383		4.60749			534.46838
384		4.60733			529.84272
385		4.64804			529.87599
386		4.61425			521.40969
387		4.58301			513.29723
388		4.61780			512.57558
389		4.68556			515.41149
390		4.67124			509.16571
391		4.78629			516.91954
392		4.77437			510.85716
393		4.68558			496.67137
394		4.72415			496.03627
395		4.68285			487.01630
396		4.80434			494.84681
397		4.61885			471.12290
398		4.81845			486.66335
399		4.73296			473.29560
400		4.80899			476.09031

 ac convergence test in progress...
Auto-corr tau/N = [0.04231593]
tau/N <= 0.02 = [False] 

401		4.76428			466.89924
402		4.66650			452.65079
403		4.58796			440.44426
404		5.16284			490.46970
405		4.86742			457.53729
406		4.74245			441.04785
407		4.73287			435.42413
408		4.62548			420.91868
409		5.05806			455.22549
410		4.80803			427.91458
411		4.87184			428.72174
412		5.04273			438.71751
413		4.71055			405.10704
414		4.83497			410.97262
415		4.68394			393.45121
416		4.66524			387.21525
417		4.62355			379.13094
418		4.57048			370.20912
419		4.66981			373.58496
420		5.04884			398.85852
421		4.65893			363.39638
422		4.83675			372.42983
423		4.63191			352.02501
424		4.64286			348.21465
425		4.61512			341.51903
426		4.87855			356.13444
427		4.63904			334.01066
428		4.62551			328.41086
429		4.68841			328.18835
430		4.71842			325.57105
431		4.70728			320.09518
432		4.88032			326.98111
433		4.68448			309.17581
434		4.73690			307.89830
435		4.88553			312.67405
436		4.81270			303.19985
437		4.94403			306.52961
438		4.62202			281.94334
439		4.72054			283.23240
440		4.86515			287.04367
441		4.74155			275.01019
442		4.94112			281.64390
443		4.83934			271.00293
444		4.66437			256.54052
445		4.61674			249.30407
446		4.68433			248.26949
447		4.62696			240.60213
448		4.63677			236.47512
449		4.61081			230.54050
450		4.60077			225.43773

 ac convergence test in progress...
Auto-corr tau/N = [0.03912493]
tau/N <= 0.02 = [False] 

451		4.65304			223.34616
452		4.63518			217.85323
453		4.57528			210.46279
454		4.57463			205.85822
455		4.62933			203.69043
456		4.60195			197.88385
457		4.59489			192.98551
458		4.65391			190.81031
459		4.66900			186.76016
460		4.63392			180.72296
461		4.67188			177.53163
462		4.65447			172.21520
463		4.62765			166.59526
464		4.58372			160.43020
465		4.64052			157.77775
466		4.70789			155.36027
467		4.74597			151.87104
468		4.65090			144.17775
469		4.63174			138.95208
470		4.60353			133.50225
471		4.64287			130.00042
472		4.65713			125.74243
473		4.70514			122.33356
474		4.61523			115.38070
475		5.11074			122.65769
476		4.81221			110.68076
477		4.75359			104.57889
478		4.72965			99.32271
479		4.82857			96.57136
480		4.82937			91.75809
481		4.83834			87.09007
482		4.64749			79.00730
483		4.61063			73.77010
484		4.69576			70.43632
485		4.73614			66.30602
486		4.67994			60.83927
487		4.75959			57.11504
488		4.61737			50.79104
489		4.62868			46.28680
490		4.70870			42.37832
491		4.78252			38.26019
492		4.70276			32.91933
493		4.60442			27.62654
494		4.68946			23.44731
495		4.62070			18.48279
496		4.62915			13.88744
497		4.64048			9.28095
498		4.62145			4.62145
499		4.59869			0.00000
We have reached the limit # of steps without convergence
Running time:  0:39:24.645910
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-09 09:09:09
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Done SVD/PCA with numpy SVD (LAPACK)
Running time:  0:00:00.012196
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Number of steps 11
Optimal number of PCs = 2, for S/N=23.088
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Coords of chosen px (X,Y) = 83.8, 30.0
Flux in a centered 1xFWHM circular aperture = 7.536
Central pixel S/N = 17.969
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Inside a centered 1xFWHM circular aperture:
Mean S/N (shifting the aperture center) = 14.389
Max S/N (shifting the aperture center) = 19.366
stddev S/N (shifting the aperture center) = 3.283
../_images/1aa7854d96f7af974e44a48ed44086ed934b731e45b5225053e14a4fb9941f1b.png ../_images/d5ee22e57095fb65c7b6faf42b00e5a2f65f2f3cd98f4865145d33e7fc320425.png ../_images/85d700a00348a8425531a588214ed3c96d142b6c9a45c27bd8273e72d039bf74.png ../_images/77984f1c5207e939bcf6693b1d172243a21c4785ed29e00d6d86999a075b0966.png ../_images/3bdf1a9bd2076bb0e96e3537d17724f72fd33920fd8db39ca7a20537797bb4b5.png ../_images/9fb361fb54e34de208f2806de7ee79caecb39a4b58a7423b23caad9f9b3f6f7c.png ../_images/a147cae9bc494cb57344846a458c2a7a13386eec57807b8bab8442ca5ea3e694.png ../_images/55d26e36fa40a25f122e07f8471d6fe9ff6dfe0fd15699529d51292b9c3e8b03.png ../_images/ca4dd8bb38e042808e9ec0b66b8831c5017219c90b805c7e35740d77ef92a922.png ../_images/c73370ca7fe7ea9d1c3866e65c498f548050a1e3a690f53597035f336702a349.png ../_images/3341e5932ca62fb5658899d787c8ac15c854091fc1da00e61797af7df364c43b.png
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-09 09:09:12
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
             Planet 0           
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Planet 0: flux estimation at the position [83.75877533353938,29.974810067878558], running ...
Step | flux    | chi2r
1/30   0.100   0.631
2/30   0.149   0.629
3/30   0.221   0.626
4/30   0.329   0.621
5/30   0.489   0.615
6/30   0.728   0.605
7/30   1.083   0.591
8/30   1.610   0.570
9/30   2.395   0.540
10/30   3.562   0.496
11/30   5.298   0.433
12/30   7.880   0.350
13/30   11.721   0.230
14/30   17.433   0.108
15/30   25.929   0.032
16/30   38.566   0.205
17/30   57.362   0.906
18/30   85.317   2.640
../_images/987b5bd0534fbf4342227e39de801f1c34f7e74af9c1ff86730cd4bb006782af.png
Planet 0: preliminary position guess: (r, theta)=(38.4, 323.2)
Planet 0: preliminary flux guess: 25.9
Planet 0: Simplex Nelder-Mead minimization, running ...
Planet 0: Success: True, nit: 22, nfev: 49, chi2r: 0.03141176700592041
message: Optimization terminated successfully.
Planet 0 simplex result: (r, theta, f)=(38.422, 323.182, 25.959) at 
          (X,Y)=(83.76, 29.97)

 ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― 
DONE !
 ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Running time:  0:00:13.366227
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-07-09 09:09:26
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
        MCMC sampler for the NEGFC technique       
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
The mean and stddev in the annulus at the radius of the companion (excluding the PA area directly adjacent to it) are -0.00 and 0.10 respectively.
Beginning emcee Ensemble sampler...
emcee Ensemble sampler successful

Start of the MCMC run ...
Step  |  Duration/step (sec)  |  Remaining Estimated Time (sec)
0		5.47454			2731.79396
1		4.80140			2391.09820
2		4.74648			2359.00205
3		4.72840			2345.28838
4		4.76207			2357.22366
5		4.88931			2415.31766
6		4.99918			2464.59574
7		5.01529			2467.52170
8		5.00300			2456.47398
9		4.87649			2389.48010
10		4.91454			2403.20908
11		4.79145			2338.22955
12		4.88031			2376.71048
13		4.99119			2425.71931
14		4.79842			2327.23370
15		4.81680			2331.33120
16		4.81030			2323.37635
17		4.79930			2313.26356
18		4.89692			2355.41804
19		4.88471			2344.66128
20		4.98646			2388.51434
21		4.78234			2285.96043
22		4.78695			2283.37324
23		4.79150			2280.75352
24		4.86941			2312.97023
25		4.83667			2292.57968
26		4.92789			2330.89292
27		4.83087			2280.17017
28		4.77727			2250.09370
29		4.81460			2262.86012
30		4.78328			2243.35926
31		4.99767			2338.90816
32		4.94767			2310.56236
33		4.94376			2303.79356
34		5.02590			2337.04397
35		4.86794			2258.72277
36		4.86370			2251.89495
37		4.74713			2193.17221
38		4.82542			2224.51816
39		4.95233			2278.07180
40		4.88863			2243.88071
41		4.91861			2252.72521
42		4.86003			2221.03599
43		4.85608			2214.37385
44		4.99345			2272.01838
45		4.83581			2195.45683
46		5.03079			2278.94832
47		4.75626			2149.82816
48		4.90843			2213.70238
49		5.03126			2264.06745
50		5.03681			2261.52904

 ac convergence test in progress...
51		4.91608			2202.40205
52		4.81779			2153.55347
53		4.65103			2074.35938
54		4.65886			2073.19403
55		4.66169			2069.79258
56		4.67749			2072.12896
57		4.73370			2092.29496
58		4.93276			2175.34672
59		4.69416			2065.43260
60		4.72614			2074.77546
61		4.86336			2130.15212
62		4.73201			2067.88793
63		4.72812			2061.45988
64		4.74990			2066.20650
65		4.75684			2064.46726
66		4.70282			2036.32236
67		4.69801			2029.54248
68		4.92898			2124.39124
69		4.74850			2041.85328
70		4.57528			1962.79641
71		4.63757			1984.87953
72		4.70701			2009.89242
73		4.67658			1992.22351
74		4.63808			1971.18272
75		4.60829			1953.91369
76		4.76764			2016.71172
77		4.64018			1958.15638
78		4.64055			1953.67197
79		4.68425			1967.38626
80		4.63754			1943.13094
81		4.62801			1934.50985
82		4.67077			1947.71276
83		4.60845			1917.11562
84		4.62699			1920.19960
85		4.65068			1925.38235
86		4.62233			1909.02353
87		4.60500			1897.26165
88		4.66057			1915.49550
89		4.63047			1898.49106
90		4.60500			1883.44377
91		4.60152			1877.41975
92		4.65566			1894.85321
93		4.62280			1876.85680
94		4.66892			1890.91301
95		4.60928			1862.14831
96		4.62324			1863.16612
97		4.58767			1844.24294
98		4.64174			1861.33654
99		4.60274			1841.09800
100		4.64514			1853.41046

 ac convergence test in progress...
101		4.66533			1856.80015
102		4.62824			1837.41049
103		4.60628			1824.08886
104		4.62983			1828.78325
105		4.67446			1841.73724
106		4.59670			1806.50192
107		4.67620			1833.07158
108		4.64659			1816.81786
109		4.58037			1786.34274
110		4.58223			1782.48630
111		4.77656			1853.30489
112		4.63626			1794.23339
113		4.60633			1778.04531
114		4.62614			1781.06390
115		4.61484			1772.09779
116		4.60168			1762.44344
117		4.61667			1763.56641
118		4.64706			1770.52986
119		4.61120			1752.25714
120		4.69296			1778.63260
121		4.57861			1730.71382
122		4.60805			1737.23410
123		4.64359			1745.98946
124		4.62264			1733.48925
125		4.62027			1727.98210
126		4.58842			1711.48252
127		4.59664			1709.95194
128		4.63349			1719.02331
129		4.60415			1703.53661
130		4.59127			1694.17789
131		4.67926			1721.96805
132		4.61443			1693.49508
133		4.61490			1689.05194
134		4.62959			1689.80035
135		4.60577			1676.49919
136		4.59067			1666.41321
137		4.60760			1667.95120
138		4.59189			1657.67049
139		4.62161			1663.78104
140		4.64038			1665.89534
141		4.62846			1656.98761
142		4.58789			1637.87637
143		4.62631			1646.96743
144		4.66511			1656.11334
145		4.59374			1626.18431
146		4.70057			1659.30227
147		4.65657			1639.11158
148		4.65063			1632.37113
149		4.61069			1613.73975
150		4.61717			1611.39093

 ac convergence test in progress...
151		4.62678			1610.11979
152		4.63071			1606.85672
153		4.67414			1617.25244
154		4.59194			1584.22068
155		4.58533			1577.35249
156		4.59899			1577.45254
157		4.64764			1589.49288
158		4.59909			1568.28901
159		4.61766			1570.00440
160		4.60784			1562.05844
161		4.61690			1560.51321
162		4.61931			1556.70713
163		4.64817			1561.78613
164		4.63448			1552.54980
165		4.59452			1534.56901
166		4.62527			1540.21591
167		4.59530			1525.63927
168		4.59138			1519.74843
169		4.63372			1529.12892
170		4.67315			1537.46767
171		4.59627			1507.57623
172		4.70675			1539.10627
173		4.59748			1498.77718
174		4.60094			1495.30680
175		4.56858			1480.22089
176		4.61793			1491.59268
177		4.65885			1500.14938
178		4.63711			1488.51295
179		4.60182			1472.58208
180		4.63872			1479.75009
181		4.58706			1458.68540
182		4.58533			1453.55056
183		4.67866			1478.45688
184		4.58680			1444.84294
185		4.60954			1447.39556
186		4.60814			1442.34782
187		4.60522			1436.82770
188		4.61510			1435.29610
189		4.60798			1428.47504
190		4.61526			1426.11441
191		4.60460			1418.21711
192		4.65721			1429.76408
193		4.59780			1406.92680
194		4.57995			1396.88444
195		4.62435			1405.80179
196		4.63278			1403.73173
197		4.57699			1382.25189
198		4.70058			1414.87518
199		4.62188			1386.56310
200		4.58960			1372.29189

 ac convergence test in progress...
Auto-corr tau/N = [0.05255235]
tau/N <= 0.02 = [False] 

201		4.70103			1400.90634
202		4.62360			1373.20861
203		4.58609			1357.48175
204		4.61197			1360.53174
205		4.61066			1355.53345
206		4.61446			1352.03561
207		4.58123			1337.71858
208		4.60284			1339.42528
209		4.63489			1344.11839
210		4.63683			1340.04474
211		4.60321			1325.72563
212		4.59280			1318.13274
213		4.61683			1320.41452
214		4.60033			1311.09519
215		4.57549			1299.43859
216		4.63156			1310.73120
217		4.60955			1299.89282
218		4.62386			1299.30410
219		4.62249			1294.29636
220		4.58133			1278.19163
221		4.60898			1281.29616
222		4.64426			1286.46085
223		4.58759			1266.17484
224		4.61429			1268.93058
225		4.66483			1278.16232
226		4.61401			1259.62582
227		4.60610			1252.85974
228		4.66397			1263.93614
229		4.58327			1237.48290
230		4.59976			1237.33652
231		4.59300			1230.92400
232		4.62041			1233.65027
233		4.60763			1225.63038
234		4.60529			1220.40185
235		4.68271			1236.23597
236		4.62559			1216.53122
237		4.61188			1208.31125
238		4.58387			1196.39059
239		4.62595			1202.74674
240		4.59685			1190.58363
241		4.65252			1200.35042
242		4.71348			1211.36462
243		4.57524			1171.26118
244		4.70838			1200.63792
245		4.61303			1171.70886
246		4.62354			1169.75562
247		4.59939			1159.04653
248		4.68442			1175.78942
249		4.61032			1152.58100
250		4.59837			1144.99338

 ac convergence test in progress...
Auto-corr tau/N = [0.04815493]
tau/N <= 0.02 = [False] 

251		4.68502			1161.88595
252		4.59347			1134.58586
253		4.66002			1146.36467
254		4.63147			1134.71015
255		4.61240			1125.42438
256		4.60633			1119.33770
257		4.61685			1117.27746
258		4.59500			1107.39452
259		4.59208			1102.10040
260		4.60703			1101.08017
261		4.69232			1116.77264
262		4.59587			1089.22024
263		4.60993			1087.94301
264		4.58608			1077.72786
265		4.61217			1079.24801
266		4.60153			1072.15719
267		4.62614			1073.26378
268		4.58346			1058.77880
269		4.60966			1060.22226
270		4.62645			1059.45751
271		4.61398			1051.98812
272		4.60525			1045.39062
273		4.60949			1041.74406
274		4.68246			1053.55282
275		4.59807			1029.96790
276		4.59976			1025.74648
277		4.62791			1027.39558
278		4.62380			1021.85980
279		4.59108			1010.03804
280		4.64187			1016.57019
281		4.59317			1001.31062
282		4.61916			1002.35815
283		4.64451			1003.21351
284		4.67292			1004.67845
285		4.59174			982.63236
286		4.58893			977.44145
287		4.67555			991.21660
288		4.61372			973.49576
289		4.61340			968.81484
290		4.60760			962.98798
291		4.57252			951.08374
292		4.61642			955.59811
293		4.65908			959.76966
294		4.57950			938.79770
295		4.59589			937.56176
296		4.63095			940.08326
297		4.65249			939.80318
298		4.60558			925.72238
299		4.58702			917.40340
300		4.66434			928.20406

 ac convergence test in progress...
Auto-corr tau/N = [0.04599749]
tau/N <= 0.02 = [False] 

301		4.59488			909.78624
302		4.61421			908.99898
303		4.64833			911.07268
304		4.61034			899.01630
305		4.62125			896.52328
306		4.67333			901.95308
307		4.61505			886.08960
308		4.60044			878.68385
309		4.64348			882.26158
310		4.60983			871.25787
311		4.62323			869.16743
312		4.58348			857.11076
313		4.62143			859.58524
314		4.60348			851.64288
315		4.60542			847.39691
316		4.63485			848.17664
317		4.60732			838.53188
318		4.59746			832.14080
319		4.61841			831.31380
320		4.60441			824.18957
321		4.58221			815.63249
322		4.60686			815.41440
323		4.59285			808.34195
324		4.61405			807.45857
325		4.60161			800.67979
326		4.65388			805.12038
327		4.61336			793.49809
328		4.61618			789.36712
329		4.63282			787.57906
330		4.60018			777.43025
331		4.60095			772.95960
332		4.62478			772.33893
333		4.59679			763.06714
334		4.64532			766.47747
335		4.62064			757.78529
336		4.60137			750.02315
337		4.61378			747.43285
338		4.61881			743.62777
339		4.67649			748.23872
340		4.59895			731.23289
341		4.59809			726.49885
342		4.60677			723.26258
343		4.63721			723.40429
344		4.61938			716.00375
345		4.60138			708.61329
346		4.65061			711.54394
347		4.59536			698.49502
348		4.64651			701.62316
349		4.61715			692.57250
350		4.59355			684.43850

 ac convergence test in progress...
Auto-corr tau/N = [0.04281248]
tau/N <= 0.02 = [False] 

351		4.97297			735.99912
352		4.66175			685.27754
353		4.60636			672.52798
354		4.59070			665.65179
355		4.62490			665.98589
356		4.63027			662.12804
357		4.62568			656.84713
358		4.62371			651.94381
359		4.59149			642.80916
360		4.58733			637.63831
361		4.63752			639.97748
362		4.58710			628.43284
363		4.59109			624.38770
364		4.61130			622.52536
365		4.63255			620.76237
366		4.58751			610.13950
367		4.58734			605.52835
368		4.62096			605.34537
369		4.58300			595.78935
370		4.62873			597.10617
371		4.60891			589.94010
372		4.59448			583.49858
373		4.61431			581.40256
374		4.76328			595.41012
375		4.65423			577.12489
376		4.67016			574.43017
377		4.66724			569.40304
378		4.62703			559.87027
379		4.63843			556.61208
380		4.66924			555.63944
381		4.59483			542.19029
382		4.68920			548.63687
383		4.63938			538.16762
384		4.59440			528.35554
385		4.65055			530.16247
386		4.60879			520.79383
387		4.60998			516.31776
388		4.63765			514.77937
389		4.61496			507.64615
390		4.65952			507.88735
391		4.62183			499.15818
392		4.60327			492.54989
393		4.63387			491.19022
394		4.59909			482.90424
395		4.62958			481.47611
396		4.63866			477.78167
397		4.61473			470.70256
398		4.59826			464.42386
399		4.57762			457.76240
400		4.66123			461.46217

 ac convergence test in progress...
Auto-corr tau/N = [0.04048601]
tau/N <= 0.02 = [False] 

401		4.62057			452.81615
402		4.61423			447.58079
403		4.62533			444.03187
404		4.64248			441.03598
405		4.57934			430.45777
406		4.62157			429.80573
407		4.64825			427.63900
408		4.65884			423.95426
409		4.59410			413.46918
410		4.65206			414.03307
411		4.63373			407.76842
412		4.57655			398.16011
413		4.67226			401.81445
414		4.61693			392.43905
415		4.58548			385.18049
416		4.67632			388.13439
417		4.59000			376.38025
418		4.66691			378.01939
419		4.62183			369.74672
420		4.60435			363.74341
421		4.62573			360.80655
422		4.60637			354.69018
423		4.61908			351.04993
424		4.64125			348.09360
425		4.63507			342.99518
426		4.67007			340.91474
427		4.61786			332.48614
428		4.64897			330.07694
429		4.58838			321.18639
430		4.66743			322.05267
431		4.58339			311.67038
432		4.58355			307.09765
433		4.63095			305.64250
434		4.67757			304.04231
435		4.61481			295.34803
436		4.69518			295.79615
437		4.63276			287.23137
438		4.61034			281.23086
439		4.63736			278.24190
440		4.64796			274.22982
441		4.60881			267.31115
442		4.65699			265.44826
443		4.61331			258.34530
444		4.60603			253.33143
445		4.63047			250.04511
446		4.64157			246.00321
447		4.59251			238.81031
448		4.59392			234.29017
449		4.62707			231.35370
450		4.59178			224.99722

 ac convergence test in progress...
Auto-corr tau/N = [0.03635645]
tau/N <= 0.02 = [False] 

451		4.61642			221.58811
452		4.66924			219.45419
453		4.60850			211.99082
454		4.65945			209.67539
455		4.64685			204.46131
456		4.61151			198.29484
457		4.61280			193.73743
458		4.58758			188.09070
459		4.92987			197.19488
460		4.68485			182.70899
461		4.63668			176.19380
462		4.63913			171.64785
463		4.63558			166.88088
464		4.61739			161.60872
465		4.67983			159.11408
466		4.61254			152.21369
467		4.61449			147.66384
468		4.66488			144.61128
469		4.59281			137.78436
470		4.61127			133.72674
471		4.62675			129.54906
472		4.63607			125.17403
473		4.58725			119.26858
474		4.58972			114.74297
475		4.61721			110.81299
476		4.57421			105.20683
477		4.60663			101.34586
478		4.60266			96.65584
479		4.64842			92.96838
480		4.65146			88.37778
481		4.64714			83.64852
482		4.59658			78.14181
483		4.62488			73.99803
484		4.61333			69.20000
485		4.63405			64.87667
486		4.67880			60.82446
487		4.62398			55.48777
488		4.65134			51.16470
489		4.61546			46.15457
490		4.61162			41.50462
491		4.67387			37.39098
492		4.59347			32.15428
493		4.58153			27.48921
494		4.66894			23.34469
495		4.61422			18.45690
496		4.58544			13.75632
497		4.59280			9.18560
498		4.60779			4.60779
499		4.61109			0.00000
We have reached the limit # of steps without convergence
Running time:  0:38:54.316042
――――――――――――――――――――――