pyklip.instruments.P1640_support package
Submodules
pyklip.instruments.P1640_support.P1640_cube_checker module
pyklip.instruments.P1640_support.P1640_cube_checker_interactive module
pyklip.instruments.P1640_support.P1640_spot_checker module
pyklip.instruments.P1640_support.P1640contrast module
pyklip.instruments.P1640_support.P1640cores module
pyklip.instruments.P1640_support.P1640spots module
pyklip.instruments.P1640_support.P1640utils module
- pyklip.instruments.P1640_support.P1640utils.centroid_image(orig_img)[source]
Centroid an image - weighted sum of pixels Input:
orig_img: 2D array
- Returns:
[y,x] floating-point coordinates of the centroid
- pyklip.instruments.P1640_support.P1640utils.clean_bad_pixels(img, boxrad=2, thresh=3)[source]
Clean the image of outlier pixels using a median filter. Input:
img: 2-d array boxrad: 1/2 the fitler size (2*boxrad+1) thresh: threshold (in stdev) for deciding a hot pixel
- Returns:
2_d array where hot pixels have been replaced by median values
- Return type:
cleaned_img
- pyklip.instruments.P1640_support.P1640utils.clean_bad_pixels_cube(cube, boxrad=2, thresh=10)[source]
Clean the image of outlier pixels using a median filter. Input:
cube: 3-D data cube boxrad: 1/2 the fitler size (2*boxrad+1) thresh: threshold (in stdev) for deciding a hot pixel
- pyklip.instruments.P1640_support.P1640utils.find_bad_pix(img, median_img, std_img, thresh=3)[source]
Find the bad pixels
- pyklip.instruments.P1640_support.P1640utils.get_PSF_center(cube, refchan=26, fine=False)[source]
Return the PSF center at the pixel level (default) or subpixel level (fine=True) Input:
cube: Nlambda x Npix x Npix datacube refchan(=26): Reference channel for the initial center estimate fine_centering(=False): After getting a rough estimate of the center, centroid the image
- Returns:
Nlamdba x 2 array of pixel indices for the PSF center
- pyklip.instruments.P1640_support.P1640utils.get_cube_xsection(orig_cube, center, width)[source]
Select the cross-section of a cube centered in center with 1/2-width width Input:
orig_cube: Nlambda x Npix x Npix datacube center: [row, col] index width: 1/2-width of cross-section
- Returns:
Nlambda x (2*width+1) x (2*width+1) cube cross-section
- Return type:
cube_cutout
- pyklip.instruments.P1640_support.P1640utils.get_encircled_energy_cube(cube, frac=0.5, refchan=26)[source]
Get the fractional encircled energy of a PSF in each channel of a datacube. Basically a wrapper for get_encircled_energy_image Input:
core_cube: unocculted core cube Nlambda x Npix x Npix frac: encircled energy cutoff
- Returns:
[starx, stary, radius, flux]
- Return type:
Pandas Dataframe with Nlambda columns
- pyklip.instruments.P1640_support.P1640utils.get_encircled_energy_image(im, center, frac=0.5)[source]
Given an image, find the fraction of encircled energy around the center. Input:
im: unocculted core cube Npix x Npix frac: encircled energy cutoff
- Returns:
[starx, stary, radius, flux, bgnd_mean, bgnd_std, bgnd_npix]
- Return type:
Pandas Series with the following indices
- pyklip.instruments.P1640_support.P1640utils.get_spot_files(fitsfile, spot_file_dir)[source]
Search in spot_file_dir for the spot files associated with fitsfile Return spot files if they are found, otherwise return an empty list
- pyklip.instruments.P1640_support.P1640utils.set_zeros_to_nan(data)[source]
PyKLIP expects values outside the detector to be set to nan. P1640 sets these (and also saturated pixels) to identically 0. Find all the zeros and convert them to nans Input:
data: N x Npix x Npix datacube or appended set of datacubes
- Returns:
data with nans instead of zeros
- Return type:
nandata
- pyklip.instruments.P1640_support.P1640utils.table_to_TableHDU(table, kwargs={})[source]
Accept a table with a .colnames element and return it as an astropy fits.TableHDU object. Only works with floating-point data atm. Input:
table: astropy.table.Table object kwargs: dict of keywords and arguments to pass to the HDU
- Returns:
fits TableHDU with an empty header
- Return type:
TableHDU