Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions irdap/irdap.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
from skimage.registration import phase_cross_correlation
from .version import __version__
from .pca_adi import pca_adi
from photutils.aperture import CircularAperture
from photutils.aperture import aperture_photometry

# to avoid some warning from pandas and matplotlib
from pandas.plotting import register_matplotlib_converters
Expand Down Expand Up @@ -4921,8 +4923,8 @@ def compute_contrast(frame, filter_used, sigma_clip=True):
coord_apertures = np.stack([x, y]).T

# Define the apertures and compute the flux in them
apertures = photutils.CircularAperture(coord_apertures, 0.5*fwhm)
flux = np.array(photutils.aperture_photometry(frame, apertures)['aperture_sum'])
apertures = CircularAperture(coord_apertures, 0.5*fwhm)
flux = np.array(aperture_photometry(frame, apertures)['aperture_sum'])

if sigma_clip:
# Remove outliers from fluxes
Expand Down Expand Up @@ -5117,14 +5119,14 @@ def plot_contrast_point_source(path_table_star_flux, path_flux_left, path_flux_r

# Define same aperture as used for contrast above to extract flux with
coord_aperture = (511.5, 511.5)
aperture = photutils.CircularAperture(coord_aperture, 0.5*fwhm)
aperture = CircularAperture(coord_aperture, 0.5*fwhm)

# Determine star flux in left flux cubes
cube_flux_processed_left = pyfits.getdata(path_flux_left, header=True)[0]

reference_flux_left = 0
for frame, transmission_ratio_sel, dit_ratio_sel in zip(cube_flux_processed_left, transmission_ratio, dit_ratio):
flux = photutils.aperture_photometry(frame, aperture)['aperture_sum'][0]
flux = aperture_photometry(frame, aperture)['aperture_sum'][0]
reference_flux_left += flux * transmission_ratio_sel * dit_ratio_sel

# Divide by the number of frames because we actually need the mean of the different FLUX-files
Expand All @@ -5135,7 +5137,7 @@ def plot_contrast_point_source(path_table_star_flux, path_flux_left, path_flux_r

reference_flux_right = 0
for frame, transmission_ratio_sel, dit_ratio_sel in zip(cube_flux_processed_right, transmission_ratio, dit_ratio):
flux = photutils.aperture_photometry(frame, aperture)['aperture_sum'][0]
flux = aperture_photometry(frame, aperture)['aperture_sum'][0]
reference_flux_right += flux * transmission_ratio_sel * dit_ratio_sel

# Divide by the number of frames because we actually need the mean of the different FLUX-files
Expand Down