@@ -816,7 +816,7 @@ def psf_norm_2d(psf, fwhm, threshold, mask_core, full_output, verbose):
816816
817817def cube_planet_free (planet_parameter , cube , angs , psfn , imlib = 'vip-fft' ,
818818 interpolation = 'lanczos4' , transmission = None ,
819- radial_gradient = False ):
819+ radial_gradient = False , weights = None ):
820820 """Return a cube in which we have injected negative fake companion at the\
821821 position/flux given by planet_parameter.
822822
@@ -855,6 +855,10 @@ def cube_planet_free(planet_parameter, cube, angs, psfn, imlib='vip-fft',
855855 at the very edge of a physical mask (e.g. ALC) or the effect on the
856856 light distribution of a marginally extended source near the IWA of the
857857 coronagraph.
858+ weights : 1d array, optional
859+ If provided, the negative fake companion fluxes will be scaled according
860+ to these weights before injection in the cube. Can reflect changes in
861+ the observing conditions throughout the sequence.
858862
859863 Returns
860864 -------
@@ -898,8 +902,12 @@ def cube_planet_free(planet_parameter, cube, angs, psfn, imlib='vip-fft',
898902 transmission = transmission ,
899903 radial_gradient = radial_gradient )
900904 else :
905+ if weights is None :
906+ flevel = - planet_parameter [i , 2 ]
907+ else :
908+ flevel = - planet_parameter [i , 2 ]* weights
901909 cpf = cube_inject_companions (cube_temp , psfn , angs , n_branches = 1 ,
902- flevel = - planet_parameter [ i , 2 ] ,
910+ flevel = flevel ,
903911 rad_dists = [planet_parameter [i , 0 ]],
904912 theta = planet_parameter [i , 1 ],
905913 imlib = imlib , verbose = False ,
0 commit comments