pynpoint.processing package#
Submodules#
pynpoint.processing.background module#
Pipeline modules for subtraction of the background emission.
- class pynpoint.processing.background.LineSubtractionModule(name_in: str, image_in_tag: str, image_out_tag: str, combine: str = 'median', mask: float | None = None)[source]#
Bases:
ProcessingModule
Pipeline module for subtracting the background emission from each pixel by computing the mean or median of all values in the row and column of the pixel. The module can for example be used if no background data is available or to remove a detector bias.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output.
combine (str) – The method by which the column and row pixel values are combined (‘median’ or ‘mean’). Using a mean-combination is computationally faster than a median-combination.
mask (float, None) – The radius of the mask within which pixel values are ignored. No mask is used if set to None.
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Selects the pixel values in the column and row at each pixel position, computes the mean or median value while excluding pixels within the radius of the mask, and subtracts the mean or median value from each pixel separately.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.background.MeanBackgroundSubtractionModule(name_in: str, image_in_tag: str, image_out_tag: str, shift: int | None = None, cubes: int = 1)[source]#
Bases:
ProcessingModule
Pipeline module for mean background subtraction. Only applicable on data obtained with dithering.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output. Should be different from image_in_tag.
shift (int, None) – Image index offset for the background subtraction. Typically equal to the number of frames per dither location. If set to None, the
NFRAMES
attribute will be used to select the background frames automatically. The cubes parameters should be set when shift is set to None.cubes (int) – Number of consecutive cubes per dithering position.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.background.NoddingBackgroundModule(name_in: str, science_in_tag: str, sky_in_tag: str, image_out_tag: str, mode: str = 'both')[source]#
Bases:
ProcessingModule
Pipeline module for background subtraction of data obtained with nodding (e.g., NACO AGPM data). Before using this module, the sky images should be stacked with the StackCubesModule such that each image in the stack of sky images corresponds to the mean combination of a single FITS data cube.
- Parameters:
name_in (str) – Unique name of the module instance.
science_in_tag (str) – Tag of the database entry with science images that are read as input.
sky_in_tag (str) – Tag of the database entry with sky images that are read as input. The
StackCubesModule
should be used on the sky images beforehand.image_out_tag (str) – Tag of the database entry with sky subtracted images that are written as output.
mode (str) – Sky images that are subtracted, relative to the science images. Either the next, previous, or average of the next and previous cubes of sky frames can be used by choosing ‘next’, ‘previous’, or ‘both’, respectively.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.background.SimpleBackgroundSubtractionModule(name_in: str, image_in_tag: str, image_out_tag: str, shift: int)[source]#
Bases:
ProcessingModule
Pipeline module for simple background subtraction. Only applicable on data obtained with dithering.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output.
shift (int) – Frame index offset for the background subtraction. Typically equal to the number of frames per dither location.
- Returns:
None
- Return type:
NoneType
pynpoint.processing.badpixel module#
Pipeline modules for the detection and interpolation of bad pixels.
- class pynpoint.processing.badpixel.BadPixelInterpolationModule(name_in: str, image_in_tag: str, bad_pixel_map_tag: str, image_out_tag: str, iterations: int = 1000)[source]#
Bases:
ProcessingModule
Pipeline module to interpolate bad pixels with spectral deconvolution.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry with the images that are read as input.
bad_pixel_map_tag (str) – Tag of the database entry with the bad pixel map that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output.
iterations (int) – Number of iterations of the spectral deconvolution.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.badpixel.BadPixelMapModule(name_in: str, dark_in_tag: str | None, flat_in_tag: str | None, bp_map_out_tag: str, dark_threshold: float = 0.2, flat_threshold: float = 0.2)[source]#
Bases:
ProcessingModule
Pipeline module to create a bad pixel map from the dark frames and flat fields.
- Parameters:
name_in (str) – Unique name of the module instance.
dark_in_tag (str, None) – Tag of the database entry with the dark frames that are read as input. Not read if set to None.
flat_in_tag (str, None) – Tag of the database entry with the flat fields that are read as input. Not read if set to None.
bp_map_out_tag (str) – Tag of the database entry with the bad pixel map that is written as output.
dark_threshold (float) – Fractional threshold with respect to the maximum pixel value in the dark frame to flag bad pixels. Pixels brighter than the fractional threshold are flagged as bad.
flat_threshold (float) – Fractional threshold with respect to the maximum pixel value in the flat field to flag bad pixels. Pixels fainter than the fractional threshold are flagged as bad.
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Collapses a cube of dark frames and flat fields if needed, flags bad pixels by comparing the pixel values with the threshold times the maximum value, and writes a bad pixel map to the database. For the dark frame, pixel values larger than the threshold will be flagged while for the flat frame pixel values smaller than the threshold will be flagged.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.badpixel.BadPixelSigmaFilterModule(name_in: str, image_in_tag: str, image_out_tag: str, map_out_tag: str | None = None, box: int = 9, sigma: float = 5.0, iterate: int = 1)[source]#
Bases:
ProcessingModule
Pipeline module for finding bad pixels with a sigma filter and replacing them with the mean value of the surrounding pixels.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output.
map_out_tag (str, None) – Tag of the database entry with the bad pixel map that is written as output. No data is written if set to None. This output port can not be used if CPU > 1.
box (int) – Size of the sigma filter. The area of the filter is equal to the squared value of box.
sigma (float) – Sigma threshold.
iterate (int) – Number of iterations.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.badpixel.BadPixelTimeFilterModule(name_in: str, image_in_tag: str, image_out_tag: str, sigma: Tuple[float, float] = (5.0, 5.0))[source]#
Bases:
ProcessingModule
Pipeline module for finding bad pixels with a sigma filter along a pixel line in time. This module is suitable for removing bad pixels that are only present at a position in a small number of images, for example because a dither pattern has been applied. Pixel lines can be processed in parallel by setting the CPU keyword in the configuration file.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output.
sigma (tuple(float, float)) – Lower and upper sigma threshold as (lower, upper).
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.badpixel.ReplaceBadPixelsModule(name_in: str, image_in_tag: str, map_in_tag: str, image_out_tag: str, size: int = 2, replace: str = 'median')[source]#
Bases:
ProcessingModule
Pipeline module for replacing bad pixels with the mean are median value of the surrounding pixels. The bad pixels are selected from the input bad pixel map.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output.
size (int) – Number of pixel lines around the bad pixel that are used to calculate the median or mean replacement value. For example, a 5x5 window is used if
size=2
.replace (str) – Replace the bad pixel with the ‘median’, ‘mean’ or ‘nan’.
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Masks the bad pixels with NaN and replaces the bad pixels with the mean or median value (excluding the bad pixels) within a window centered on the bad pixel. The original value is used if there are only NaNs within the window.
- Returns:
None
- Return type:
NoneType
pynpoint.processing.basic module#
Pipeline modules for basic image operations.
- class pynpoint.processing.basic.AddImagesModule(name_in: str, image_in_tags: Tuple[str, str], image_out_tag: str, scaling: float = 1.0)[source]#
Bases:
ProcessingModule
Pipeline module for adding two sets of images.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tags (tuple(str, str)) – Tuple with two tags of the database entry that are read as input.
image_out_tag (str) – Tag of the database entry with the added images that are written as output.
scaling (float) – Additional scaling factor.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.basic.RepeatImagesModule(name_in: str, image_in_tag: str, image_out_tag: str, repeat: int)[source]#
Bases:
ProcessingModule
Pipeline module for repeating the images from a dataset.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry with the added images that are written as output.
repeat (int) – The number of times the input images get repeated.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.basic.RotateImagesModule(name_in: str, image_in_tag: str, image_out_tag: str, angle: float)[source]#
Bases:
ProcessingModule
Pipeline module for rotating images.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output.
angle (float) – Rotation angle (deg). Rotation is clockwise for positive values.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.basic.SubtractImagesModule(name_in: str, image_in_tags: Tuple[str, str], image_out_tag: str, scaling: float = 1.0)[source]#
Bases:
ProcessingModule
Pipeline module for subtracting two sets of images.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tags (tuple(str, str)) – Tuple with two tags of the database entry that are read as input.
image_out_tag (str) – Tag of the database entry with the subtracted images that are written as output.
scaling (float) – Additional scaling factor.
- Returns:
None
- Return type:
NoneType
pynpoint.processing.centering module#
Pipeline modules for aligning and centering of the star.
- class pynpoint.processing.centering.FitCenterModule(name_in: str, image_in_tag: str, fit_out_tag: str, mask_out_tag: str | None = None, method: str = 'full', mask_radii: Tuple[float | None, float] = (None, 0.1), sign: str = 'positive', model: str = 'gaussian', filter_size: float | None = None, **kwargs: Tuple[float, float, float, float, float, float, float] | Tuple[float, float, float, float, float, float, float, float] | float)[source]#
Bases:
ProcessingModule
Pipeline module for fitting the PSF with a 2D Gaussian or Moffat function.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Database tag of the images that are read as input.
fit_out_tag (str) – Database tag where the best-fit results and 1σ errors will be stored. The data are written in the following format: x offset (pix), x offset error (pix) y offset (pix), y offset error (pix), FWHM major axis (arcsec), FWHM major axis error (arcsec), FWHM minor axis (arcsec), FWHM minor axis error (arcsec), amplitude (ADU), amplitude error (ADU), angle (deg), angle error (deg) measured in counterclockwise direction with respect to the upward direction (i.e. east of north), offset (ADU), offset error (ADU), power index (only for Moffat function), and power index error (only for Moffat function). The
fit_out_tag
can be used as argument ofshift_xy
when running theShiftImagesModule
.mask_out_tag (str, None) – Database tag where the masked images will be stored. The unmasked part of the images is used for the fit. The effect of the smoothing that is applied by setting the
fwhm
argument is also visible in the data of themask_out_tag
. The data are not stored if the argument is set to None. TheOutputPort
ofmask_out_tag
can only be used whenCPU = 1
.method (str) – Fit and shift each image individually (‘full’) or only fit the mean of the cube and shift each image by this constant offset (‘mean’). The ‘mean’ method can be used in case the images are already aligned with
StarAlignmentModule
.mask_radii (tuple(float, float), tuple(None, float)) – Inner and outer radius (arcsec) within and beyond which pixels are neglected during the fit. The radii are centered at the position that specified with the argument of
guess
, which is the center of the image by default. The outer mask (second value ofmask_radii
) is mandatory whereas radius of the inner mask is optional and can be set to None.sign (str) – Fit a ‘positive’ or ‘negative’ Gaussian/Moffat function. A ‘negative’ model can be used to center coronagraphic data in which a dark hole.
model (str) – Type of 2D model that is used for the fit (‘gaussian’ or ‘moffat’). Both models are elliptical in shape.
filter_size (float, None) – Standard deviation (arcsec) of the Gaussian filter that is used to smooth the images before fitting the model. No filter is applied if set to None.
- Keyword Arguments:
guess (tuple(float, float, float, float, float, float, float, float),) – tuple(float, float, float, float, float, float, float, float, float) The initial parameter values for the least squares fit: x offset with respect to center (pix), y offset with respect to center (pix), FWHM x (pix), FWHM y (pix), amplitude (ADU), angle (deg), offset (ADU), and power index (only for Moffat function).
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Uses a non-linear least squares (Levenberg-Marquardt) method to fit the the individual images or the mean of all images with a 2D Gaussian or Moffat function. The best-fit results and errors are stored and contain zeros in case the algorithm could not converge. The
fit_out_tag
can be used as argument ofshift_xy
when running theShiftImagesModule
.- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.centering.ShiftImagesModule(name_in: str, image_in_tag: str, image_out_tag: str, shift_xy: Tuple[float, float] | str, interpolation: str = 'spline')[source]#
Bases:
ProcessingModule
Pipeline module for shifting a stack of images.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output.
shift_xy (tuple(float, float), str) – The shift (pix) in x and y direction as (delta_x, delta_y). Or, a database tag with the fit results from the
FitCenterModule
.interpolation (str) – Interpolation type for shifting of the images (‘spline’, ‘bilinear’, or ‘fft’).
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.centering.StarAlignmentModule(name_in: str, image_in_tag: str, image_out_tag: str, ref_image_in_tag: str | None = None, interpolation: str = 'spline', accuracy: float = 10.0, resize: float | None = None, num_references: int = 10, subframe: float | None = None)[source]#
Bases:
ProcessingModule
Pipeline module to align the images with a cross-correlation in Fourier space.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry with the stack of images that is read as input.
ref_image_in_tag (str, None) – Tag of the database entry with the reference image(s) that are read as input. If it is set to None, a random subsample of num_references elements of image_in_tag is taken as reference images.
image_out_tag (str) – Tag of the database entry with the images that are written as output.
interpolation (str) – Type of interpolation that is used for shifting the images (spline, bilinear, or fft).
accuracy (float) – Upsampling factor for the cross-correlation. Images will be registered to within 1/accuracy of a pixel.
resize (float, None) – Scaling factor for the up/down-sampling before the images are shifted. Not used if set to None.
num_references (int) – Number of reference images for the cross-correlation.
subframe (float, None) – Size (arcsec) of the subframe around the image center that is used for the cross-correlation. The full image is used if set to None.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.centering.WaffleCenteringModule(name_in: str, image_in_tag: str, center_in_tag: str, image_out_tag: str, size: float | None = None, center: Tuple[float, float] | None = None, radius: float = 45.0, pattern: str = None, angle: float = 45.0, sigma: float = 0.06, dither: bool = False)[source]#
Bases:
ProcessingModule
Pipeline module for centering of coronagraphic data for which dedicated center frames with satellite spots are available.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry with science images that are read as input.
center_in_tag (str) – Tag of the database entry with the center frame that is read as input.
image_out_tag (str) – Tag of the database entry with the centered images that are written as output. Should be different from image_in_tag.
size (float, None) – Image size (arcsec) for both dimensions. Original image size is used if set to None.
center (tuple(float, float), None) – Approximate position (x0, y0) of the coronagraph. The center of the image is used if set to None.
radius (float) – Approximate separation (pix) of the satellite spots from the star. For IFS data, the separation of the spots in the image with the shortest wavelength is required.
pattern (str, None) – Waffle pattern that is used (‘x’ or ‘+’). This parameter will be deprecated in a future release. Please use the
angle
parameter instead. The parameter will be ignored if set to None.angle (float) – Angle offset (deg) in clockwise direction of the satellite spots with respect to the ‘+’ orientation (i.e. when the spots are located along the horizontal and vertical axis). The previous use of the ‘+’ pattern corresponds to 0 degrees and ‘x’ pattern corresponds to 45 degrees. SPHERE/IFS data requires an angle of 55.48 degrees.
sigma (float) – Standard deviation (arcsec) of the Gaussian kernel that is used for the unsharp masking.
dither (bool) – Apply dithering correction based on the
DITHER_X
andDITHER_Y
attributes.
- Returns:
None
- Return type:
NoneType
pynpoint.processing.darkflat module#
Pipeline modules for dark frame and flat field calibrations.
- class pynpoint.processing.darkflat.DarkCalibrationModule(name_in: str, image_in_tag: str, dark_in_tag: str, image_out_tag: str)[source]#
Bases:
ProcessingModule
Pipeline module to subtract a master dark from the science data.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry with the science images that are read as input.
dark_in_tag (str) – Tag of the database with the dark frames that are read as input.
image_out_tag (str) – Tag of the database entry that is written as output.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.darkflat.FlatCalibrationModule(name_in: str, image_in_tag: str, flat_in_tag: str, image_out_tag: str)[source]#
Bases:
ProcessingModule
Pipeline module to apply a flat field correction to the science data.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the science database that is read as input.
flat_in_tag (str) – Tag of the flat field database that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output.
- Returns:
None
- Return type:
NoneType
pynpoint.processing.extract module#
Pipeline modules for locating and extracting the position of a star.
- class pynpoint.processing.extract.ExtractBinaryModule(name_in: str, image_in_tag: str, image_out_tag: str, pos_center: Tuple[float, float], pos_binary: Tuple[float, float], image_size: float = 2.0, search_size: float = 0.1, filter_size: float | None = None)[source]#
Bases:
ProcessingModule
Pipeline module to extract a binary star (or another point source) which is rotating across the image stack.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the dataset with the input images.
image_out_tag (str) – Tag of the dataset that is stored as output, containing the extracted images.
pos_center (tuple(float, float)) – Approximate position (x, y) of the center of rotation (pix).
pos_binary (tuple(float, float)) – Approximate position (x, y) of the binary star in the first image (pix).
image_size (float) – Cropped image size (arcsec).
search_size (float) – Window size (arcsec) in which the brightest pixel is selected as position of the binary star. The search window is centered on the position that for each image is calculated from the
pos_center
,pos_binary
, and parallactic angle (PARANG
) of the image.filter_size (float, None) – Full width at half maximum (arcsec) of the Gaussian kernel that is used to smooth the images to lower contributions of bad pixels.
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Locates the position of a binary star (or some other point source) which rotates across the stack of images due to parallactic rotation. The approximate position of the binary star is calculated by taking into account the parallactic angle of each image separately. The brightest pixel is then selected as center around which the image is cropped.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.extract.StarExtractionModule(name_in: str, image_in_tag: str, image_out_tag: str, index_out_tag: str | None = None, image_size: float = 2.0, fwhm_star: float = 0.2, position: Tuple[int, int, float] | Tuple[None, None, float] | None = None)[source]#
Bases:
ProcessingModule
Pipeline module to locate the position of the star in each image and to crop all the images around this position.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the dataset with the input images.
image_out_tag (str) – Tag of the dataset that is stored as output, containing the extracted images.
index_out_tag (str, None) – List with image indices for which the image size is too large to be cropped around the brightest pixel. No data is written if set to None. This tag name can be provided to the
frames`
parameter inRemoveFramesModule
. This argument is ignored ifCPU
is set to a value larger than 1.image_size (float) – Cropped image size (arcsec).
fwhm_star (float) – Full width at half maximum (arcsec) of the Gaussian kernel that is used to smooth the images to lower contributions of bad pixels.
position (tuple(int, int, float), None) – Subframe that is selected to search for the star. The tuple should contain a position (pix) and size (arcsec) as (pos_x, pos_y, size). The full image is used if set to None. The center of the image will be used with
position=(None, None, size)
.
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Locates the position of the star (only pixel precision) by selecting the highest pixel value. A Gaussian kernel with a FWHM similar to the PSF is used to lower the contribution of bad pixels which may have higher values than the peak of the PSF. Images are cropped and written to an output port.
- Returns:
None
- Return type:
NoneType
pynpoint.processing.filter module#
Pipeline modules for spatial filtering of images.
- class pynpoint.processing.filter.GaussianFilterModule(name_in: str, image_in_tag: str, image_out_tag: str, fwhm: float = 1.0)[source]#
Bases:
ProcessingModule
Pipeline module for applying a Gaussian filter.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (tuple(str, str)) – Tuple with two tags of the database entry that are read as input.
image_out_tag (str) – Tag of the database entry with the subtracted images that are written as output.
fwhm (float) – Full width at half maximum (arcsec) of the Gaussian kernel.
- Returns:
None
- Return type:
NoneType
pynpoint.processing.fluxposition module#
Pipeline modules for photometric and astrometric measurements.
- class pynpoint.processing.fluxposition.AperturePhotometryModule(name_in: str, image_in_tag: str, phot_out_tag: str, radius: float = 0.1, position: Tuple[float, float] | None = None)[source]#
Bases:
ProcessingModule
Pipeline module for calculating the counts within a circular area.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
phot_out_tag (str) – Tag of the database entry with the photometry values that are written as output.
radius (float) – Radius (arcsec) of the circular aperture.
position (tuple(float, float), None) – Center position (pix) of the aperture, (x, y), with subpixel precision. The center of the image will be used if set to None. Python indexing starts at zero so the bottom left corner of the image has coordinates (-0.5, -0.5).
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.fluxposition.FakePlanetModule(name_in: str, image_in_tag: str, psf_in_tag: str, image_out_tag: str, position: Tuple[float, float], magnitude: float, psf_scaling: float = 1.0, interpolation: str = 'spline')[source]#
Bases:
ProcessingModule
Pipeline module to inject a positive or negative artificial planet into a stack of images.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry with images that are read as input.
psf_in_tag (str) – Tag of the database entry that contains the reference PSF that is used as fake planet. Can be either a single image (2D) or a cube (3D) with the dimensions equal to
image_in_tag
.image_out_tag (str) – Tag of the database entry with images that are written as output.
position (tuple(float, float)) – Angular separation (arcsec) and position angle (deg) of the fake planet. Angle is measured in counterclockwise direction with respect to the upward direction (i.e., East of North).
magnitude (float) – Magnitude of the fake planet with respect to the star.
psf_scaling (float) – Additional scaling factor of the planet flux (e.g., to correct for a neutral density filter). A negative value will inject a negative planet signal.
interpolation (str) – Type of interpolation that is used for shifting the images (spline, bilinear, or fft).
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.fluxposition.FalsePositiveModule(name_in: str, image_in_tag: str, snr_out_tag: str, position: Tuple[float, float], aperture: float = 0.1, ignore: bool = False, optimize: bool = False, **kwargs: Any)[source]#
Bases:
ProcessingModule
Pipeline module to calculate the signal-to-noise ratio (SNR) and false positive fraction (FPF) at a specified location in an image by using the Student’s t-test (Mawet et al. 2014). Optionally, the SNR can be optimized with the aperture position as free parameter.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry with the images that are read as input. The SNR/FPF is calculated for each image in the dataset.
snr_out_tag (str) – Tag of the database entry that is written as output. The output format is: (x position (pix), y position (pix), separation (arcsec), position angle (deg), SNR, FPF). The position angle is measured in counterclockwise direction with respect to the upward direction (i.e., East of North).
position (tuple(float, float)) – The x and y position (pix) where the SNR and FPF is calculated. Note that the bottom left of the image is defined as (-0.5, -0.5) so there is a -1.0 offset with respect to the DS9 coordinate system. Aperture photometry corrects for the partial inclusion of pixels at the boundary.
aperture (float) – Aperture radius (arcsec).
ignore (bool) – Ignore the two neighboring apertures that may contain self-subtraction from the planet.
optimize (bool) – Optimize the SNR. The aperture position is stored in the snr_out_tag. The size of the aperture is kept fixed.
- Keyword Arguments:
tolerance (float) – The absolute tolerance on the position for the optimization to end. Default is set to 0.01 (pix).
offset (float, None) – Offset (pix) by which the aperture may deviate from
position
whenoptimize=True
(default: None).
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.fluxposition.MCMCsamplingModule(name_in: str, image_in_tag: str, psf_in_tag: str, chain_out_tag: str, param: Tuple[float, float, float], bounds: Tuple[Tuple[float, float], Tuple[float, float], Tuple[float, float]], nwalkers: int = 100, nsteps: int = 200, psf_scaling: float = -1.0, pca_number: int = 20, aperture: float | Tuple[int, int, float] = 0.1, mask: Tuple[float, float] | Tuple[None, float] | Tuple[float, None] | Tuple[None, None] | None = None, extra_rot: float = 0.0, merit: str = 'gaussian', residuals: str = 'median', resume: bool = False, **kwargs: float | Tuple[float, float, float])[source]#
Bases:
ProcessingModule
Pipeline module to measure the separation, position angle, and contrast of a planet with injection of negative artificial planets and sampling of the posterior distribution with
emcee
, an affine invariant Markov chain Monte Carlo (MCMC) ensemble sampler.- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Database tag with the science images.
psf_in_tag (str) – Database tag with the reference PSF that is used as artificial planet. The dataset can be either a single image, or a stack of images with the dimensions equal to
image_in_tag
.chain_out_tag (str) – Database tag were the posterior samples will be stored. The shape of the array is
(nsteps, nwalkers, 3)
. The mean acceptance fraction and the integrated autocorrelation time are stored as attributes.param (tuple(float, float, float)) – The approximate separation (arcsec), angle (deg), and contrast (mag), for example obtained with the
SimplexMinimizationModule
. The angle is measured in counterclockwise direction with respect to the upward direction (i.e., East of North). The separation and angle are also used as (fixed) position for the aperture ifaperture
contains a float (i.e. the radius).bounds (tuple(tuple(float, float), tuple(float, float), tuple(float, float))) – The prior boundaries for the separation (arcsec), angle (deg), and contrast (mag). Each set of boundaries is specified as a tuple.
nwalkers (int) – Number of walkers.
nsteps (int) – Number of steps per walker.
psf_scaling (float) – Additional scaling factor of the planet flux (e.g. to correct for a neutral density filter or difference in exposure time). The value should be negative in order to inject negative fake planets.
pca_number (int) – Number of principal components used for the PSF subtraction.
aperture (float, tuple(int, int, float)) – Either the aperture radius (arcsec) at the position of
param
or tuple with the position and aperture radius (arcsec) as(pos_x, pos_y, radius)
.mask (tuple(float, float), None) – Inner and outer mask radius (arcsec) for the PSF subtraction. Both elements of the tuple can be set to
None
. Masked pixels are excluded from the PCA computation, resulting in a smaller runtime. Masking is done after the artificial planet is injected.extra_rot (float) – Additional rotation angle of the images (deg).
merit (str) – Figure of merit for the minimization (‘hessian’, ‘gaussian’, or ‘poisson’). Either the determinant of the Hessian matrix is minimized (‘hessian’) or the flux of each pixel (‘gaussian’ or ‘poisson’). For the latter case, the estimate noise is assumed to follow a Poisson (see Wertz et al. 2017) or Gaussian distribution (see Wertz et al. 2017 and Stolker et al. 2020).
residuals (str) – Method used for combining the residuals (‘mean’, ‘median’, ‘weighted’, or ‘clipped’).
resume (bool) – Resume from the last state of the chain that was stored by the backend of
emcee
. Set toTrue
for continuing with the samples from a previous run, for example when it was interrupted or to create more steps for the walkers. The backend data ofemcee
is stored with the tag[chain_out_tag]_backend
in the HDF5 database.
- Keyword Arguments:
sigma (tuple(float, float, float)) – The standard deviations that randomly initializes the start positions of the walkers in a small ball around the a priori preferred position. The tuple should contain a value for the separation (arcsec), position angle (deg), and contrast (mag). The default is set to
(1e-5, 1e-3, 1e-3)
.- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. The posterior distributions of the separation, position angle, and flux contrast are sampled with the affine invariant Markov chain Monte Carlo (MCMC) ensemble sampler
emcee
. At each step, a negative copy of the PSF template is injected and the likelihood function is evaluated at the approximate position of the planet.- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.fluxposition.SimplexMinimizationModule(name_in: str, image_in_tag: str, psf_in_tag: str, res_out_tag: str, flux_position_tag: str, position: Tuple[float, float], magnitude: float, psf_scaling: float = -1.0, merit: str = 'gaussian', aperture: float = 0.1, sigma: float = 0.0, tolerance: float = 0.1, pca_number: int | range | List[int] = 10, cent_size: float | None = None, edge_size: float | None = None, extra_rot: float = 0.0, residuals: str = 'median', reference_in_tag: str | None = None, offset: float | None = None)[source]#
Bases:
ProcessingModule
Pipeline module to retrieve the contrast and position of a planet by injecting negative artificial planets and using a downhill simplex method. The module supports both ADI and RDI.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry with the science images that are read as input.
psf_in_tag (str) – Tag of the database entry with the reference PSF that is used as fake planet. Can be either a single image or a stack of images equal in size to
image_in_tag
.res_out_tag (str) – Tag of the database entry with the image residuals that are written as output. The residuals are stored for each step of the minimization. The last image contains the best-fit residuals.
flux_position_tag (str) – Tag of the database entry with the flux and position results that are written as output. Each step of the minimization stores the x position (pixels), y position (pixels), separation (arcsec), angle (deg), contrast (mag), and the chi-square value. The last row contains the best-fit results.
position (tuple(float, float)) – Approximate position of the planet (x, y), provided with subpixel precision (i.e. as floats). The figure of merit is calculated within an aperture of radius
aperture
centered at the rounded (i.e. integers) coordinates ofposition
. When setting,offset=0.
, theposition
is used as fixed position of the planet while only retrieving the contrast.magnitude (float) – Approximate magnitude of the planet relative to the star.
psf_scaling (float) – Additional scaling factor of the planet flux (e.g., to correct for a neutral density filter). Should be a negative value in order to inject negative fake planets.
merit (str) – Figure of merit for the minimization (‘hessian’, ‘gaussian’, or ‘poisson’). Either the determinant of the Hessian matrix is minimized (‘hessian’) or the flux of each pixel (‘gaussian’ or ‘poisson’). For the latter case, the estimated noise is assumed to follow a Poisson (see Wertz et al. 2017) or Gaussian distribution (see Stolker et al. 2020).
aperture (float) – Aperture radius (arcsec) at the position specified at
position
.sigma (float) – Standard deviation (arcsec) of the Gaussian kernel that is used to smooth the images before the figure of merit is calculated (in order to reduce small pixel-to-pixel variations).
tolerance (float) – Absolute error on the input parameters, position (pixels) and contrast (mag), that is used as acceptance level for convergence. Note that only a single value can be specified which is used for both the position and flux so
tolerance=0.1
corresponds to a precision of 0.1 mag and 0.1 pix. The tolerance on the output (i.e., the chi-square value) is set tonp.inf
such that the condition is always met.pca_number (int, range, list(int, )) –
Number of principal components (PCs) used for the PSF subtraction. Can be either a single value, or a range or list of values. In the latter case, the
res_out_tag
and`flux_position_tag`
contain a 3 digit number with thenumber of PCs.
cent_size (float, None) – Radius of the central mask (arcsec). No mask is used when set to
None
. The mask is applied after the artificial planet is injected.edge_size (float, None) – Outer radius (arcsec) beyond which pixels are masked. No outer mask is used when set to
None
. The radius will be set to half the image size if the argument is larger than half the image size. The mask is applied after the artificial planet is injected.extra_rot (float) – Additional rotation angle of the images in clockwise direction (deg).
residuals (str) – Method for combining the residuals (‘mean’, ‘median’, ‘weighted’, or ‘clipped’).
reference_in_tag (str, None) – Tag of the database entry with the reference images that are read as input. The data of the
image_in_tag
itself is used as reference data for the PSF subtraction if set toNone
. Note that the mean is not subtracted from the data ofimage_in_tag
andreference_in_tag
in case thereference_in_tag
is used, to allow for flux and position measurements in the context of RDI.offset (float, None) – Offset (pixels) by which the injected negative PSF may deviate from
position
. The constraint on the position is not applied if set to None. Only the contrast is optimized and the position if fixed toposition
ifoffset=0
.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.fluxposition.SystematicErrorModule(name_in: str, image_in_tag: str, psf_in_tag: str, offset_out_tag: str, position: Tuple[float, float], magnitude: float, angles: Tuple[float, float, int] = (0.0, 359.0, 360), psf_scaling: float = 1.0, merit: str = 'gaussian', aperture: float = 0.1, tolerance: float = 0.01, pca_number: int = 10, mask: Tuple[float, float] | Tuple[None, float] | Tuple[float, None] | Tuple[None, None] | None = None, extra_rot: float = 0.0, residuals: str = 'median', offset: float | None = None)[source]#
Bases:
ProcessingModule
Pipeline module for estimating the systematic error of the flux and position measurement.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry with the science images for which the systematic error is estimated.
psf_in_tag (str) – Tag of the database entry with the PSF template that is used as fake planet. Can be either a single image or a stack of images equal in size to
image_in_tag
.offset_out_tag (str) – Tag of the database entry at which the differences are stored between the injected and and retrieved values of the separation (arcsec), position angle (deg), contrast (mag), x position (pix), and y position (pix).
position (tuple(float, float)) – Separation (arcsec) and position angle (deg) that are used to remove the planet signal. The separation is also used to estimate the systematic error.
magnitude (float) – Magnitude that is used to remove the planet signal and estimate the systematic error.
angles (tuple(float, float, int)) – The start, end, and number of the position angles (linearly sampled) that are used to estimate the systematic errors (default: 0., 359., 360). The endpoint is also included.
psf_scaling (float) – Additional scaling factor of the planet flux (e.g., to correct for a neutral density filter). Should be a positive value.
merit (str) – Figure of merit for the minimization (‘hessian’, ‘gaussian’, or ‘poisson’). Either the determinant of the Hessian matrix is minimized (‘hessian’) or the flux of each pixel (‘gaussian’ or ‘poisson’). For the latter case, the estimate noise is assumed to follow a Poisson (see Wertz et al. 2017) or Gaussian distribution (see Wertz et al. 2017 and Stolker et al. 2020).
aperture (float) – Aperture radius (arcsec) that is used for measuring the figure of merit.
tolerance (float) – Absolute error on the input parameters, position (pix) and contrast (mag), that is used as acceptance level for convergence. Note that only a single value can be specified which is used for both the position and flux so tolerance=0.1 will give a precision of 0.1 mag and 0.1 pix. The tolerance on the output (i.e., the chi-square value) is set to np.inf so the condition is always met.
pca_number (int) – Number of principal components (PCs) used for the PSF subtraction.
mask (tuple(float, float), None) – Inner and outer mask radius (arcsec) which is applied before the PSF subtraction. Both elements of the tuple can be set to None.
extra_rot (float) – Additional rotation angle of the images in clockwise direction (deg).
residuals (str) – Method for combining the residuals (‘mean’, ‘median’, ‘weighted’, or ‘clipped’).
offset (float, None) – Offset (pixels) by which the negative PSF may deviate from the positive injected PSF. No constraint on the position is applied if set to None. Only the contrast is optimized and the position is fixed to the injected value if
offset=0
.
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Removes the planet signal, then artificial planets are injected (one at a time) at equally separated position angles and their position and contrast is determined with the
SimplexMinimizationModule
. The differences between the injected and retrieved separation, position angle, and contrast are then stored as output.- Returns:
None
- Return type:
NoneType
pynpoint.processing.frameselection module#
Pipeline modules for frame selection.
- class pynpoint.processing.frameselection.FrameSelectionModule(name_in: str, image_in_tag: str, selected_out_tag: str, removed_out_tag: str, index_out_tag: str | None = None, method: str = 'median', threshold: float | Tuple[float, float] = 4.0, fwhm: float | None = 0.1, aperture: Tuple[str, float] | Tuple[str, float, float] = ('circular', 0.2), position: Tuple[int, int, float] | Tuple[None, None, float] | Tuple[int, int, None] | None = None)[source]#
Bases:
ProcessingModule
Pipeline module for applying a frame selection.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
selected_out_tag (str) – Tag of the database entry with the selected images that are written as output. Should be different from
image_in_tag
.removed_out_tag (str) – Tag of the database entry with the removed images that are written as output. Should be different from
image_in_tag
.index_out_tag (str, None) – Tag of the database entry with the list of frames indices that are removed with the frames selection. No data is written when set to
None
.method (str) – Method used for the frame selection. Either sigma clipping is applied with respect to the median (
method='median'
) or maximum (method='max'
) aperture flux or fluxes outside a specified range (method='range'
) are removed. In the latter case, thethreshold
argument should be a tuple with the minimum and maximum flux value.threshold (float, tuple(float, float)) – Threshold in units of sigma for the frame selection in case
method='median'
ormethod='max'
. All images that are athreshold
number of sigmas away from the median/maximum aperture flux will be removed. In casemethod='range'
, the argument should be a tuple with the minimum and maximum flux. Aperture fluxes within this range will be selected and stored atselected_out_tag
.fwhm (float, None) – The FWHM (arcsec) of the Gaussian kernel that is used to smooth the images before the brightest pixel is located. Recommended to be similar in size to the FWHM of the stellar PSF. No smoothing is applied if set to
None
.aperture (tuple(str, float), tuple(str, float, float)) – Tuple with the aperture properties for measuring the photometry around the location of the brightest pixel. The first element contains the aperture type (‘circular’, ‘annulus’, or ‘ratio’). For a circular aperture, the second element contains the aperture radius (arcsec). For the other two types, the second and third element are the inner and outer radii (arcsec) of the aperture.
position (tuple(int, int, float), None) – Subframe that is selected to search for the star. The tuple contains the center (pix) and size (arcsec) (pos_x, pos_y, size). Setting
position
to None will use the full image to search for the star. If position=(None, None, size) then the center of the image will be used. Ifposition=(pos_x, pos_y, None)
then a fixed position is used for the aperture.
- Returns:
None
- Return type:
NoneType
- static aperture_phot(image: ndarray, position: ndarray, aperture: Tuple[str, float, float] | Tuple[str, None, float]) float64 [source]#
- Parameters:
image (np.ndarray) – Input image (2D).
position (np.ndarray) – Center position (y, x) of the aperture.
aperture (tuple(str, float, float)) – Tuple with the aperture properties for measuring the photometry around the location of the brightest pixel. The first element contains the aperture type (‘circular’, ‘annulus’, or ‘ratio’). For a circular aperture, the second element is empty and the third element contains the aperture radius (pix). For the other two types, the second and third element are the inner and outer radii (pix) of the aperture.
- Returns:
Photometry value.
- Return type:
np.float64
- run() None [source]#
Run method of the module. Smooths the images with a Gaussian kernel, locates the brightest pixel in each image, measures the integrated flux around the brightest pixel, calculates the median and standard deviation of the photometry, and applies sigma clipping to remove low quality images.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.frameselection.FrameSimilarityModule(name_in: str, image_tag: str, method: str = 'MSE', mask_radius: Tuple[float, float] = (0.0, 5.0), window_size: float = 0.1, temporal_median: str = 'full')[source]#
Bases:
ProcessingModule
Pipeline module for measuring the similarity between frames.
- Parameters:
name_in (str) – Unique name of the module instance.
image_tag (str) – Tag of the database entry that is read as input.
method (str) –
Method for the similarity measure. There are three measures available:
MSE - Mean Squared Error
PCC - Pearson Correlation Coefficient
SSIM - Structural Similarity
These measures compare each image to the temporal median of the image set.
mask_radius (tuple(float, float)) – Inner and outer radius (arcsec) of the mask that is applied to the images. The inner radius is actually not used so can be set to zero.
window_size (float) – Size (arcsec) of the sliding window that is used when the SSIM similarity is calculated.
temporal_median (str) – Option to calculate the temporal median for each position (‘full’) or as a constant value (‘constant’) for the entire set. The latter is computationally less expensive.
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Computes the similarity between frames based on the Mean Squared Error (MSE), the Pearson Correlation Coefficient (PCC), or the Structural Similarity (SSIM). The correlation values are stored as non-static attribute (
MSE
,PCC
, orSSIM
) to the input data. After running this module, theSelectByAttributeModule
can be used to select the images with the highest correlation.- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.frameselection.ImageStatisticsModule(name_in: str, image_in_tag: str, stat_out_tag: str, position: Tuple[int, int, float] | Tuple[None, None, float] | None = None)[source]#
Bases:
ProcessingModule
Pipeline module for calculating image statistics for the full images or a subsection of the images.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry with the images that are read as input.
stat_out_tag (str) – Tag of the database entry with the statistical results that are written as output. The result is stored in the following order: minimum, maximum, sum, mean, median, and standard deviation.
position (tuple(int, int, float)) – Position (x, y) (pix) and radius (arcsec) of the circular area in which the statistics are calculated. The full image is used if set to None.
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Calculates the minimum, maximum, sum, mean, median, and standard deviation of the pixel values of each image separately. NaNs are ignored for each calculation. The values are calculated for either the full images or a circular subsection of the images.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.frameselection.RemoveFramesModule(name_in: str, image_in_tag: str, selected_out_tag: str, removed_out_tag: str, frames: str | range | list | ndarray)[source]#
Bases:
ProcessingModule
Pipeline module for removing images by their index number.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
selected_out_tag (str) – Tag of the database entry with the remaining images after removing the specified images. Should be different from image_in_tag.
removed_out_tag (str) – Tag of the database entry with the images that are removed. Should be different from image_in_tag.
frames (str, list, range, numpy.ndarray) – The frame indices that have to be removed or a database tag pointing to a list of frame indices.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.frameselection.RemoveLastFrameModule(name_in: str, image_in_tag: str, image_out_tag: str)[source]#
Bases:
ProcessingModule
Pipeline module for removing every NDIT+1 image from NACO dataset obtained in cube mode. This frame contains the average pixel values of the cube.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.frameselection.RemoveStartFramesModule(name_in: str, image_in_tag: str, image_out_tag: str, frames: int = 1)[source]#
Bases:
ProcessingModule
Pipeline module for removing a fixed number of images at the beginning of each cube. This can be useful for NACO data in which the background is higher at the beginning of the cube.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output.
frames (int) – Number of frames that are removed at the beginning of each cube.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.frameselection.ResidualSelectionModule(name_in: str, image_in_tag: str, selected_out_tag: str, removed_out_tag: str, percentage: float = 10.0, annulus_radii: Tuple[float, float] = (0.1, 0.2))[source]#
Bases:
ProcessingModule
Pipeline module for applying a frame selection on the residuals of the PSF subtraction.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
selected_out_tag (str) – Tag of the database entry with the selected images that are written as output.
removed_out_tag (str) – Tag of the database entry with the removed images that are written as output.
percentage (float) – The percentage of best frames that is selected.
annulus_radii (tuple(float, float)) – Inner and outer radius of the annulus (arcsec).
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Applies a frame selection on the derotated residuals from the PSF subtraction. The pixels within an annulus (e.g. at the separation of an expected planet) are selected and the standard deviation is calculated. The chosen percentage of images with the lowest standard deviation are stored as output.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.frameselection.SelectByAttributeModule(name_in: str, image_in_tag: str, selected_out_tag: str, removed_out_tag: str, attribute_tag: str, number_frames: int = 100, order: str = 'descending')[source]#
Bases:
ProcessingModule
Pipeline module for selecting frames based on attribute values.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
selected_out_tag (str) – Tag of the database entry to which the selected frames are written.
removed_out_tag (str) – Tag of the database entry to which the removed frames are written.
attribute_tag (str) – Name of the attribute which is used to sort and select the frames.
number_frames (int) – Number of frames that are selected.
order (str) – Order in which the frames are selected. Can be either ‘descending’ (will select the lowest attribute values) or ‘ascending’ (will select the highest attribute values).
- Returns:
None
- Return type:
NoneType
Examples
The example below selects the first 100 frames with an ascending order of the
INDEX
values that are stored to the ‘im_arr’ dataset:SelectByAttributeModule(name_in='frame_selection', image_in_tag='im_arr', attribute_tag='INDEX', selected_frames=100, order='ascending', selected_out_tag='im_arr_selected', removed_out_tag='im_arr_removed'))
The example below selects the 200 frames with the largest
SSIM
values that are stored to the ‘im_arr’ dataset:SelectByAttributeModule(name_in='frame_selection', image_in_tag='im_arr', attribute_tag='SSIM', selected_frames=200, order='descending', selected_out_tag='im_arr_selected', removed_out_tag='im_arr_removed'))
- run() None [source]#
Run method of the module. Selects images according to a specified attribute tag and ordering, e.g. the highest 150
INDEX
frames, or the lowest 50PCC
frames. The order of the selected images is determined by the descending or ascending attribute values. To sort the images again by their original order, theSortParangModule
can be used.- Returns:
None
- Return type:
NoneType
pynpoint.processing.limits module#
Pipeline modules for estimating detection limits.
- class pynpoint.processing.limits.ContrastCurveModule(name_in: str, image_in_tag: str, psf_in_tag: str, contrast_out_tag: str, separation: Tuple[float, float, float] = (0.1, 1.0, 0.01), angle: Tuple[float, float, float] = (0.0, 360.0, 60.0), threshold: Tuple[str, float] = ('sigma', 5.0), psf_scaling: float = 1.0, aperture: float = 0.05, pca_number: int = 20, cent_size: float | None = None, edge_size: float | None = None, extra_rot: float = 0.0, residuals: str = 'mean', snr_inject: float = 100.0, **kwargs: float)[source]#
Bases:
ProcessingModule
Pipeline module to calculate contrast limits for a given sigma level or false positive fraction, with a correction for small sample statistics. Positions are processed in parallel if
CPU
is set to a value larger than 1 in the configuration file.- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that contains the stack with images.
psf_in_tag (str) – Tag of the database entry that contains the reference PSF that is used as fake planet. Can be either a single image or a stack of images equal in size to image_in_tag.
contrast_out_tag (str) – Tag of the database entry that contains the separation, azimuthally averaged contrast limits, the azimuthal variance of the contrast limits, and the threshold of the false positive fraction associated with sigma.
separation (tuple(float, float, float)) – Range of separations (arcsec) where the contrast is calculated. Should be specified as (lower limit, upper limit, step size). Apertures that fall within the mask radius or beyond the image size are removed.
angle (tuple(float, float, float)) – Range of position angles (deg) where the contrast is calculated. Should be specified as (lower limit, upper limit, step size), measured counterclockwise with respect to the vertical image axis, i.e. East of North.
threshold (tuple(str, float)) – Detection threshold for the contrast curve, either in terms of ‘sigma’ or the false positive fraction (FPF). The value is a tuple, for example provided as (‘sigma’, 5.) or (‘fpf’, 1e-6). Note that when sigma is fixed, the false positive fraction will change with separation. Also, sigma only corresponds to the standard deviation of a normal distribution at large separations (i.e., large number of samples).
psf_scaling (float) – Additional scaling factor of the planet flux (e.g., to correct for a neutral density filter). Should have a positive value.
aperture (float) – Aperture radius (arcsec).
pca_number (int) – Number of principal components used for the PSF subtraction.
cent_size (float, None) – Central mask radius (arcsec). No mask is used when set to None.
edge_size (float, None) – Outer edge radius (arcsec) beyond which pixels are masked. No outer mask is used when set to None. If the value is larger than half the image size then it will be set to half the image size.
extra_rot (float) – Additional rotation angle of the images in clockwise direction (deg).
residuals (str) – Method used for combining the residuals (‘mean’, ‘median’, ‘weighted’, or ‘clipped’).
snr_inject (float) – Signal-to-noise ratio of the injected planet signal that is used to measure the amount of self-subtraction.
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. An artificial planet is injected (based on the noise level) at a given separation and position angle. The amount of self-subtraction is then determined and the contrast limit is calculated for a given sigma level or false positive fraction. A correction for small sample statistics is applied for both cases. Note that if the sigma level is fixed, the false positive fraction changes with separation, following the Student’s t-distribution (see Mawet et al. 2014 for details).
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.limits.MassLimitsModule(name_in: str, contrast_in_tag: str, mass_out_tag: str, model_file: str, star_prop: dict, instr_filter: str = "L'")[source]#
Bases:
ProcessingModule
Pipeline module to calculate mass limits from the contrast limits and any isochrones model grid downloaded from https://phoenix.ens-lyon.fr/Grids/.
- Parameters:
name_in (str) – Unique name of the module instance.
contrast_in_tag (str) – Tag of the database entry that contains the contrast curve data, as computed with the
ContrastCurveModule
.mass_out_tag (str) – Tag of the database entry with the output data containing the separation, the mass limits, and the upper and lower one sigma deviation as calculated for the azimuthal variance on the contrast limits.
model_file (str) – Path to the file containing the model data. Must be in the same format as the grids found on https://phoenix.ens-lyon.fr/Grids/. Any of the isochrones files from this website can be used.
star_prop (dict) –
Dictionary containing host star properties. Must have the following keys:
magnitude
- Apparent magnitude, in the same band as the instr_filter.distance
- Distance in parsec.age
- Age of the system in the Myr.
instr_filter (str) – Instrument filter in the same format as listed in the model_file.
- Returns:
None
- Return type:
NoneType
- static interpolate_model(age_eval: ndarray, mag_eval: ndarray, filter_index: int, model_age: List[float], model_data: List[ndarray]) ndarray [source]#
Interpolates the grid based model data.
- Parameters:
age_eval (np.ndarray) – Age at which the system is evaluated. Must be of the same shape as mag_eval.
mag_eval (np.ndarray) – Absolute magnitude for which the system is evaluated. Must be of the same shape as age_eval.
filter_index (int) – Column index where the filter is located.
model_age (list(float)) – List of ages which are given by the model.
model_data (list(np.ndarray)) – List of arrays containing the model data.
- Returns:
griddata – Interpolated values for the given evaluation points (age_eval, mag_eval). Has the same shape as age_eval and mag_eval.
- Return type:
np.ndarray
- static read_model(model_file_path: str) Tuple[List[float], List[ndarray], List[str]] [source]#
Reads the data from the model file and structures it. Returns an array of available model ages and a list of model data for each age.
- Parameters:
model_file (str) – Path to the file containing the model data.
- Returns:
list(float) – List with all the ages from the model grid.
list(np.ndarray) – List with all the isochrone data, so the length is the same as the number of ages.
list(str) – List with all the column names from the model grid.
- run() None [source]#
Run method of the module. Calculates the mass limits from the contrast limits (as calculated with the
ContrastCurveModule
) and the isochrones of an evolutionary model. The age and the absolute magnitude of the isochrones are linearly interpolated such that the mass limits can be calculated for a given contrast limits (which is converted in an absolute magnitude with the apparent magnitude and distance of the central star).- Returns:
None
- Return type:
NoneType
pynpoint.processing.pcabackground module#
Pipeline modules for PCA-based background subtraction.
- class pynpoint.processing.pcabackground.DitheringBackgroundModule(name_in: str, image_in_tag: str, image_out_tag: str, center: List[Tuple[int, int]] | None = None, cubes: int | None = None, size: float = 2.0, gaussian: float = 0.15, subframe: float | None = None, pca_number: int | None = 5, mask_star: float = 0.7, **kwargs)[source]#
Bases:
ProcessingModule
Pipeline module for PCA-based background subtraction of dithering data. This is a wrapper that applies the processing modules for either a mean or the PCA-based background subtraction.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Database tag with input images.
image_out_tag (str) – Database tag to store the background subtracted images.
center (list(tuple(int, int)), None) – Tuple with the centers of the dithering positions, e.g. ((x0, y0), (x1, y1)). The order of the coordinates should correspond to the order in which the star is present. If
center
andcubes
are both set to None then sorting and subtracting of the background frames is based onDITHER_X
andDITHER_Y
. Ifcenter
is specified andcubes
is set to None then theDITHER_X
andDITHER_Y
attributes will be used for sorting and subtracting of the background but not for selecting the dither positions.cubes (int, None) – Number of consecutive cubes per dither position. If
cubes
is set to None then sorting and subtracting of the background frames is based onDITHER_X
andDITHER_Y
.size (float) – Cropped image size (arcsec).
gaussian (float) – Full width at half maximum (arcsec) of the Gaussian kernel that is used to smooth the image before the star is located.
subframe (float, None) – Size (arcsec) of the subframe that is used to search for the star. Cropping of the subframe is done around the center of the dithering position. The full image size (i.e.
size
) will be used if set to None then.pca_number (int, None) – Number of principal components that is used to model the background emission. The PCA background subtraction is skipped if the argument is set to None. In that case, the mean background subtracted images are written toe
image_out_tag
.mask_star (float) – Radius of the central mask (arcsec) that is used to exclude the star when fitting the principal components. The region behind the mask is included when subtracting the PCA background model.
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Cuts out the detector sections at the different dither positions, prepares the PCA background subtraction, locates the star in each image, runs the PCA background subtraction, combines the output from the different dither positions is written to a single database tag.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.pcabackground.PCABackgroundPreparationModule(name_in: str, image_in_tag: str, star_out_tag: str, subtracted_out_tag: str, background_out_tag: str, dither: Tuple[int, int, int] | Tuple[int, None, Tuple[float, float]], combine: str = 'mean')[source]#
Bases:
ProcessingModule
Pipeline module for preparing the images for a PCA-based background subtraction.
- Parameters:
name_in (str) – Unique name of the pipeline module instance.
image_in_tag (str) – Database tag with the images that are read as input.
star_out_tag (str) – Database tag to store the images that contain the star.
subtracted_out_tag (str) – Database tag to store the mean/median background subtracted images with the star.
background_out_tag (str) – Database tag to store the images that contain only background emission.
dither (tuple(int, int, int), tuple(int, None, tuple(float, float))) – Tuple with the parameters for separating the star and background frames. The tuple should contain three values,
(positions, cubes, first)
, withpositions
the number of unique dithering position,cubes
the number of consecutive cubes per dithering position, andfirst
the index value of the first cube which contains the star (Python indexing starts at zero). Sorting is based on theDITHER_X
andDITHER_Y
attributes whencubes
is set to None. In that case, thefirst
value should be a tuple with theDITHER_X
andDITHER_Y
values in which the star appears first.combine (str) – Method for combining the background images (‘mean’ or ‘median’).
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.pcabackground.PCABackgroundSubtractionModule(name_in: str, star_in_tag: str, background_in_tag: str, residuals_out_tag: str, fit_out_tag: str | None = None, mask_out_tag: str | None = None, pca_number: int = 60, mask_star: float = 0.7, subframe: float | None = None, gaussian: float = 0.15, **kwargs)[source]#
Bases:
ProcessingModule
Pipeline module applying a PCA-based background subtraction (see Hunziker et al. 2018).
- Parameters:
name_in (str) – Unique name of the pipeline module instance.
star_in_tag (str) – Database tag with the input images that contain the star.
background_in_tag (str) – Database tag with the input images that contain only background emission.
residuals_out_tag (str) – Database tag to store the background-subtracted images of the star.
fit_out_tag (str, None) – Database tag to store the modeled background images. The data is not stored if the arguments is set to None.
mask_out_tag (str, None) – Database tag to store the mask. The data is not stored if the argument is set to None.
pca_number (int) – Number of principal components that is used to model the background emission.
mask_star (float) – Radius of the central mask (arcsec).
gaussian (float) – Full width at half maximum (arcsec) of the Gaussian kernel that is used to smooth the image before the star is located.
subframe (float, None) – Size (arcsec) of the subframe that is used to find the star. Cropping of the subframe is done around the center of the image. The full images is used if set to None.
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Creates a PCA basis set of the background frames after subtracting the mean background frame from both the star and background frames, masks the PSF of the star, projects the star frames onto the principal components, and stores the residuals of the background subtracted images.
- Returns:
None
- Return type:
NoneType
pynpoint.processing.psfpreparation module#
Pipeline modules to prepare the data for the PSF subtraction.
- class pynpoint.processing.psfpreparation.AngleCalculationModule(name_in: str, data_tag: str, instrument: str = 'NACO')[source]#
Bases:
ProcessingModule
Module for calculating the parallactic angles. The start time of the observation is taken and multiples of the exposure time are added to derive the parallactic angle of each frame inside the cube. Instrument specific overheads are included.
- Parameters:
name_in (str) – Unique name of the module instance.
data_tag (str) – Tag of the database entry for which the parallactic angles are written as attributes.
instrument (str) – Instrument name (‘NACO’, ‘SPHERE/IRDIS’, or ‘SPHERE/IFS’).
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Calculates the parallactic angles from the position of the object on the sky and the telescope location on earth. The start of the observation is used to extrapolate for the observation time of each individual image of a data cube. The values are written as PARANG attributes to data_tag.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.psfpreparation.AngleInterpolationModule(name_in: str, data_tag: str)[source]#
Bases:
ProcessingModule
Module for calculating the parallactic angle values by interpolating between the begin and end value of a data cube.
- Parameters:
name_in (str) – Unique name of the module instance.
data_tag (str) – Tag of the database entry for which the parallactic angles are written as attributes.
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Calculates the parallactic angles of each frame by linearly interpolating between the start and end values of the data cubes. The values are written as attributes to data_tag. A correction of 360 deg is applied when the start and end values of the angles change sign at +/-180 deg.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.psfpreparation.PSFpreparationModule(name_in: str, image_in_tag: str, image_out_tag: str, mask_out_tag: str | None = None, norm: bool = False, resize: float | None = None, cent_size: float | None = None, edge_size: float | None = None)[source]#
Bases:
ProcessingModule
Module to prepare the data for PSF subtraction with PCA. The preparation steps include masking and an optional normalization.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry with images that is written as output.
mask_out_tag (str, None, optional) – Tag of the database entry with the mask that is written as output. If set to None, no mask array is saved.
norm (bool) – Normalize each image by its Frobenius norm. Only supported for 3D datasets (i.e. regular imaging).
resize (float, None) – DEPRECATED. This parameter is currently ignored by the module and will be removed in a future version of PynPoint.
cent_size (float, None, optional) – Radius of the central mask (in arcsec). No mask is used when set to None.
edge_size (float, None, optional) – Outer radius (in arcsec) beyond which pixels are masked. No outer mask is used when set to None. If the value is larger than half the image size then it will be set to half the image size.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.psfpreparation.SDIpreparationModule(name_in: str, image_in_tag: str, image_out_tag: str, wavelength: Tuple[float, float], width: Tuple[float, float])[source]#
Bases:
ProcessingModule
Module for preparing continuum frames for dual-band simultaneous differential imaging.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output. Should be different from image_in_tag.
wavelength (tuple(float, float)) – The central wavelengths of the line and continuum filter, (line, continuum), in arbitrary but identical units.
width (tuple(float, float)) – The equivalent widths of the line and continuum filter, (line, continuum), in arbitrary but identical units.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.psfpreparation.SortParangModule(name_in: str, image_in_tag: str, image_out_tag: str)[source]#
Bases:
ProcessingModule
Module to sort the images and attributes with increasing
INDEX
.- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Database tag with the input data.
image_out_tag (str) – Database tag where the output data will be stored. Should be different from
image_in_tag
.
- Returns:
None
- Return type:
NoneType
pynpoint.processing.psfsubtraction module#
Pipeline modules for PSF subtraction.
- class pynpoint.processing.psfsubtraction.ClassicalADIModule(name_in: str, image_in_tag: str, res_out_tag: str, stack_out_tag: str, threshold: Tuple[float, float, float] | None, nreference: int | None = None, residuals: str = 'median', extra_rot: float = 0.0)[source]#
Bases:
ProcessingModule
Pipeline module for PSF subtraction with classical ADI by subtracting a median-combined reference image. A rotation threshold can be set for a fixed separation to prevent self-subtraction.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry with the science images that are read as input.
res_out_tag (str) – Tag of the database entry with the residuals of the PSF subtraction that are written as output.
stack_out_tag (str) – Tag of the database entry with the stacked residuals that are written as output.
threshold (tuple(float, float, float), None) – Tuple with the separation for which the angle threshold is optimized (arcsec), FWHM of the PSF (arcsec), and the threshold (FWHM) for the selection of the reference images. No threshold is used if set to None.
nreference (int, None) – Number of reference images, closest in line to the science image. All images are used if threshold is None or nreference is None.
residuals (str) – Method used for combining the residuals (‘mean’, ‘median’, ‘weighted’, or ‘clipped’).
extra_rot (float) – Additional rotation angle of the images (deg).
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Selects for each image the reference images closest in line while taking into account a rotation threshold for a fixed separation, median-combines the references images, and subtracts the reference image from each image separately. Alternatively, a single, median-combined reference image can be created and subtracted from all images. All images are used if the rotation condition can not be met. Both the individual residuals (before derotation) and the stacked residuals are stored.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.psfsubtraction.PcaPsfSubtractionModule(name_in: str, images_in_tag: str, reference_in_tag: str, res_mean_tag: str | None = None, res_median_tag: str | None = None, res_weighted_tag: str | None = None, res_rot_mean_clip_tag: str | None = None, res_arr_out_tag: str | None = None, basis_out_tag: str | None = None, pca_numbers: range | List[int] | ndarray | Tuple[range, range] | Tuple[List[int], List[int]] | Tuple[ndarray, ndarray] = range(1, 21), extra_rot: float = 0.0, subtract_mean: bool = True, processing_type: str = 'ADI')[source]#
Bases:
ProcessingModule
Pipeline module for PSF subtraction with principal component analysis (PCA). The module can be used for ADI, RDI (see
subtract_mean
parameter), SDI, and ASDI. The residuals are calculated in parallel for the selected numbers of principal components. This may require a large amount of memory in case the stack of input images is very large. The number of processes can therefore be set with theCPU
keyword in the configuration file.- Parameters:
name_in (str) – Name tag of the pipeline module.
images_in_tag (str) – Database entry with the images from which the PSF model will be subtracted.
reference_in_tag (str) – Database entry with the reference images from which the PSF model is created. Usually
reference_in_tag
is the same asimages_in_tag
, but a different dataset can be used as reference images in case of RDI.res_mean_tag (str, None) – Database entry where the the mean-collapsed residuals will be stored. The residuals are not calculated and stored if set to None.
res_median_tag (str, None) – Database entry where the the median-collapsed residuals will be stored. The residuals are not calculated and stored if set to None.
res_weighted_tag (str, None) – Database entry where the the noise-weighted residuals will be stored (see Bottom et al. 2017). The residuals are not calculated and stored if set to None.
res_rot_mean_clip_tag (str, None) – Tag of the database entry of the clipped mean residuals. Not calculated if set to None.
res_arr_out_tag (str, None) – Database entry where the derotated, but not collapsed, residuals are stored. The number of principal components is was used is appended to the
res_arr_out_tag
. The residuals are not stored if set to None. This parameter is not supported with multiprocessing (i.e.CPU
> 1). For IFS data and if the processing type is either ADI+SDI or SDI+ADI the residuals can only be calculated if exactly 1 principal component for each ADI and SDI is given with the pca_numbers parameter.basis_out_tag (str, None) – Database entry where the principal components are stored. The data is not stored if set to None. Only supported for imaging data with
processing_type='ADI'
.pca_numbers (range, list(int), np.ndarray, tuple(range, range), tuple[list(int),) – list(int)), tuple(np.ndarray, np.ndarray)) Number of principal components that are used for the PSF model. With ADI or SDI, a single list/range/array needs to be provided while for SDI+ADI or ADI+SDI a tuple is required with twice a list/range/array.
extra_rot (float) – Additional rotation angle of the images (deg).
subtract_mean (bool) – The mean of the science and reference images is subtracted from the corresponding stack, before the PCA basis is constructed and fitted. Set the argument to
False
for RDI, that is, in casereference_in_tag
is different fromimages_in_tag
and there is no or limited field rotation. The parameter is only supported withprocessing_type='ADI'
.processing_type (str) –
- Post-processing type:
ADI: Angular differential imaging. Can be used both on imaging and IFS datasets. This argument is also used for RDI, in which case the
PARANG
attribute should contain zeros a derotation angles (e.g. withset_attribute()
orParangWritingModule
). The collapsed residuals are stored as 3D dataset with one image per principal component.SDI: Spectral differential imaging. Can only be applied on IFS datasets. The collapsed residuals are stored as $D dataset with one image per wavelength and principal component.
SDI+ADI: Spectral and angular differential imaging. Can only be applied on IFS datasets. The collapsed residuals are stored as 5D datasets with one image per wavelength and each of the principal components.
ADI+SDI: Angular and spectral differential imaging. Can only be applied on IFS datasets. The collapsed residuals are stored as 5D datasets with one image per wavelength and each of the principal components.
CODI: Perform ADI and SDI simultaniously. Usually requires a lot more PC than the other techniques. The collapsed residuals are stored as 4D datasets with one image per wavelength and each of the principal components.
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Subtracts the mean of the image stack from all images, reshapes the stack of images into a 2D array, uses singular value decomposition to construct the orthogonal basis set, calculates the PCA coefficients for each image, subtracts the PSF model, and writes the residuals as output.
- Returns:
None
- Return type:
NoneType
pynpoint.processing.resizing module#
Pipeline modules for resizing of images.
- class pynpoint.processing.resizing.AddLinesModule(name_in: str, image_in_tag: str, image_out_tag: str, lines: Tuple[int, int, int, int])[source]#
Bases:
ProcessingModule
Module to add lines of pixels to increase the size of an image.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output, including the images with increased size. Should be different from image_in_tag.
lines (tuple(int, int, int, int)) – The number of lines that are added in left, right, bottom, and top direction.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.resizing.CropImagesModule(name_in: str, image_in_tag: str, image_out_tag: str, size: float, center: Tuple[int, int] | None)[source]#
Bases:
ProcessingModule
Pipeline module for cropping of images around a given position.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output. Should be different from image_in_tag.
size (float) – New image size (arcsec). The same size will be used for both image dimensions.
center (tuple(int, int), None) – Tuple (x0, y0) with the new image center. Python indexing starts at 0. The center of the input images will be used when center is set to None. Note that if the image is even-sized, it is not possible to a uniquely define a pixel position in the center of the image. The image center is determined (with pixel precision) with the
center_pixel()
function.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.resizing.RemoveLinesModule(name_in: str, image_in_tag: str, image_out_tag: str, lines: Tuple[int, int, int, int])[source]#
Bases:
ProcessingModule
Module to decrease the dimensions of an image by removing lines of pixels.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output, including the images with decreased size. Should be different from image_in_tag.
lines (tuple(int, int, int, int)) – The number of lines that are removed in left, right, bottom, and top direction.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.resizing.ScaleImagesModule(name_in: str, image_in_tag: str, image_out_tag: str, scaling: Tuple[float, float, float] | Tuple[None, None, float] | Tuple[float, float, None], pixscale: bool = True)[source]#
Bases:
ProcessingModule
Pipeline module for rescaling of an image.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output. Should be different from
image_in_tag
.scaling (tuple(float, float, float)) – Tuple with the scaling factors for the image size and flux, (scaling_x, scaling_y, scaling_flux). Upsampling and downsampling of the image corresponds to
scaling_x/y
> 1 and 0 <scaling_x/y
< 1, respectively.pixscale (bool) – Adjust the pixel scale by the average scaling in x and y direction.
- Returns:
None
- Return type:
NoneType
pynpoint.processing.stacksubset module#
Pipeline modules for stacking and subsampling of images.
- class pynpoint.processing.stacksubset.CombineTagsModule(name_in: str, image_in_tags: List[str], image_out_tag: str, check_attr: bool = True, index_init: bool = False)[source]#
Bases:
ProcessingModule
Pipeline module for combining tags from multiple database entries into a single tag.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tags (list(str, )) – Tags of the database entries that are read as input and combined.
image_out_tag (str) – Tag of the database entry that is written as output. Should not be present in image_in_tags.
check_attr (bool) – Compare non-static attributes between the tags or combine all non-static attributes into the new database tag.
index_init (bool) – Reinitialize the
INDEX
attribute. The frames are indexed in the order of tags names that are provided in image_in_tags.
- Returns:
None
- Return type:
NoneType
- run() None [source]#
Run method of the module. Combines the frames of multiple tags into a single dataset and adds the static and non-static attributes. The values of the attributes are compared between the input tags to make sure that the input tags descent from the same data set.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.stacksubset.DerotateAndStackModule(name_in: str, image_in_tag: str, image_out_tag: str, derotate: bool = True, stack: str | None = None, extra_rot: float = 0.0, dimension: str = 'time')[source]#
Bases:
ProcessingModule
Pipeline module for derotating and/or stacking (i.e., taking the median or average) of the images, either along the time or the wavelengths dimension.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output. The shape of the output data is equal to the data from
image_in_tag
. If the argument ofstack
is not None, then the size of the collapsed dimension is equal to 1.derotate (bool) – Derotate the images with the
PARANG
attribute.stack (str) – Type of stacking applied after optional derotation (‘mean’, ‘median’, or None for no stacking).
extra_rot (float) – Additional rotation angle of the images in clockwise direction (deg).
dimension (str) – Dimension along which the images are stacked. Can either be ‘time’ or ‘wavelength’. If the
image_in_tag
has three dimensions thendimension
is always fixed to ‘time’.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.stacksubset.StackAndSubsetModule(name_in: str, image_in_tag: str, image_out_tag: str, random: int | None = None, stacking: int | None = None, combine: str = 'mean', max_rotation: float | None = None)[source]#
Bases:
ProcessingModule
Pipeline module for stacking subsets of images and/or selecting a random sample of images.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry that is written as output. Should be different from image_in_tag.
random (int, None) – Number of random images. All images are used if set to None.
stacking (int, None) – Number of stacked images per subset. No stacking is applied if set to None.
combine (str) – Method for combining images (‘mean’ or ‘median’). The angles are always mean-combined.
max_rotation (float, None) – Maximum allowed field rotation (deg) throughout each subset of stacked images when stacking is not None. No restriction on the field rotation is applied if set to None.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.stacksubset.StackCubesModule(name_in: str, image_in_tag: str, image_out_tag: str, combine: str = 'mean')[source]#
Bases:
ProcessingModule
Pipeline module for calculating the mean or median of each original data cube associated with a database tag.
- Parameters:
name_in (str) – Unique name of the module instance.
image_in_tag (str) – Tag of the database entry that is read as input.
image_out_tag (str) – Tag of the database entry with the mean or median collapsed images that are written as output. Should be different from image_in_tag.
combine (str) – Method to combine the images (‘mean’ or ‘median’).
- Returns:
None
- Return type:
NoneType
pynpoint.processing.timedenoising module#
Continuous wavelet transform (CWT) and discrete wavelet transform (DWT) denoising for speckle suppression in the time domain. The module can be used as additional preprocessing step. See Bonse et al. (arXiv:1804.05063) more information.
- class pynpoint.processing.timedenoising.CwtWaveletConfiguration(wavelet: str = 'dog', wavelet_order: int = 2, keep_mean: bool = False, resolution: float = 0.5)[source]#
Bases:
object
Configuration capsule for a CWT based time denoising. Standard configuration as in the original paper.
- Parameters:
wavelet (str) – Wavelet.
wavelet_order (int) – Wavelet order.
keep_mean (bool) – Keep mean.
resolution (float) – Resolution.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.timedenoising.DwtWaveletConfiguration(wavelet: str = 'db8')[source]#
Bases:
object
Configuration capsule for a DWT based time denoising. A cheap alternative of the CWT based wavelet denoising. However, the supported wavelets should perform worse compared to the CWT DOG wavelet.
- Parameters:
wavelet (str) – Wavelet.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.timedenoising.TimeNormalizationModule(name_in: str, image_in_tag: str, image_out_tag: str)[source]#
Bases:
ProcessingModule
Pipeline module for normalization of global brightness variations of the detector. See Bonse et al. (arXiv:1804.05063) for details.
- Parameters:
name_in (str) – Unique name for the pipeline module.
image_in_tag (str) – Database tag with the input data.
image_out_tag (str) – Database tag for the output data.
- Returns:
None
- Return type:
NoneType
- class pynpoint.processing.timedenoising.WaveletTimeDenoisingModule(name_in: str, image_in_tag: str, image_out_tag: str, wavelet_configuration: CwtWaveletConfiguration | DwtWaveletConfiguration, padding: str = 'zero', median_filter: bool = False, threshold_function: str = 'soft')[source]#
Bases:
ProcessingModule
Pipeline module for speckle subtraction in the time domain by using CWT or DWT wavelet shrinkage. See Bonse et al. (arXiv:1804.05063) for details.
- Parameters:
name_in (str) – Unique name for the pipeline module.
image_in_tag (str) – Database tag with the input data.
image_out_tag (str) – Database tag for the output data.
wavelet_configuration (pynpoint.processing.timedenoising.CwtWaveletConfiguration or pynpoint.processing.timedenoising.DwtWaveletConfiguration) – Instance of
DwtWaveletConfiguration
orCwtWaveletConfiguration
which contains the parameters for the wavelet transformation.padding (str) – Padding method (
'zero'
,'mirror'
, or'none'
).median_filter (bool) – Apply a median filter in time to remove outliers, for example due to cosmic rays.
threshold_function (str) – Threshold function that is used for wavelet shrinkage in the wavelet space (
'soft'
or'hard'
).
- Returns:
None
- Return type:
NoneType