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=None)[source]

Bases: pynpoint.core.processing.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, cubes: int = 1)[source]

Bases: pynpoint.core.processing.ProcessingModule

Pipeline module for mean background subtraction. Only applicable on data obtained with dithering.

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
run() → None[source]

Run method of the module. Mean background subtraction which uses either a constant index offset or the NFRAMES attributes. The mean background is calculated from the cubes before and after the science cube.

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: pynpoint.core.processing.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

calc_sky_frame(index_of_science_data)[source]

Method for finding the required sky frame (next, previous, or the mean of next and previous) by comparing the time stamp of the science frame with preceding and following sky frames.

run() → None[source]

Run method of the module. Create list of time stamps, get sky and science images, and subtract the sky images from the science images.

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: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Simple background subtraction with a constant index offset.

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: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Interpolates bad pixels with an iterative spectral deconvolution.

Returns:None
Return type:NoneType
class pynpoint.processing.badpixel.BadPixelMapModule(name_in: str, dark_in_tag: Optional[str], flat_in_tag: Optional[str], bp_map_out_tag: str, dark_threshold: float = 0.2, flat_threshold: float = 0.2)[source]

Bases: pynpoint.core.processing.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, box: int = 9, sigma: float = 5.0, iterate: int = 1)[source]

Bases: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Finds bad pixels with a sigma filter, replaces bad pixels with the mean value of the surrounding pixels, and writes the cleaned images to the database.

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: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Finds bad pixels along a pixel line, replaces the bad pixels with the mean value of the pixels (excluding the bad pixels), and writes the cleaned images to the database.

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: pynpoint.core.processing.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.
  • sigma (tuple(float, float)) – Lower and upper sigma threshold as (lower, upper).
  • 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: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Add the images from the two database tags on a frame-by-frame basis.

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: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Repeats the stack of input images a specified number of times.

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: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Rotates all images by a constant angle.

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: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Subtracts the images from the second database tag from the images of the first database tag, on a frame-by-frame basis.

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, method: str = 'full', radius: float = 0.1, sign: str = 'positive', model: str = 'gaussian', filter_size: float = None, **kwargs)[source]

Bases: pynpoint.core.processing.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) – Tag of the database entry with images that are read as input.
  • fit_out_tag (str) – Tag of the database entry with the best-fit results of the model fit and the 1-sigma errors. Data is 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 (counts), amplitude error (counts), angle (deg), angle error (deg) measured in counterclockwise direction with respect to the upward direction (i.e., East of North), offset (counts), offset error (counts), power index (only for Moffat function), and power index error (only for Moffat function). Not used if set to None.
  • mask_out_tag (str, None) – Tag of the database entry with the masked images that are written as output. The unmasked part of the images is used for the fit. The effect of the smoothing that is applied by setting the fwhm parameter is also visible in the data of the mask_out_tag. Data is not written when set to None.
  • method (str) – Fit and shift all the images individually (‘full’) or only fit the mean of the cube and shift all images to that location (‘mean’). The ‘mean’ method could be used after running the StarAlignmentModule.
  • radius (float) – Radius (arcsec) around the center of the image beyond which pixels are neglected with the fit. The radius is centered on the position specified in guess, which is the center of the image by default.
  • sign (str) – Fit a ‘positive’ or ‘negative’ Gaussian/Moffat. A negative model can be used to center coronagraphic data in which a dark hole is present.
  • model (str) – Type of 2D model used to fit the PSF (‘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)) – 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 (counts), angle (deg), offset (counts), 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) to fit the the individual images or the mean of the stack with a 2D Gaussian or Moffat function, and stores the best fit results. The fitting results contain zeros in case the algorithm could not converge. The fit_out_tag can be directly used as input for the shift_xy argument of the ShiftImagesModule.

Returns:None
Return type:NoneType
class pynpoint.processing.centering.ShiftImagesModule(name_in: str, image_in_tag: str, image_out_tag: str, shift_xy: Union[Tuple[float, float], str], interpolation: str = 'spline')[source]

Bases: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Shifts an image with a fifth order spline, bilinear, or a Fourier shift interpolation.

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, interpolation: str = 'spline', accuracy: float = 10.0, resize: float = None, num_references: int = 10, subframe: float = None)[source]

Bases: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Applies a cross-correlation of the input images with respect to a stack of reference images, rescales the image dimensions, and shifts the images to a common center.

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, center: Tuple[float, float] = None, radius: float = 45.0, pattern: str = 'x', sigma: float = 0.06, dither: bool = False)[source]

Bases: pynpoint.core.processing.ProcessingModule

Pipeline module for centering of SPHERE data obtained with a Lyot coronagraph for which 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 waffle spots from the star.
  • pattern (str) – Waffle pattern that is used (‘x’ or ‘+’).
  • 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 and DITHER_Y attributes.
Returns:

None

Return type:

NoneType

run() → None[source]

Run method of the module. Locates the position of the calibration spots in the center frame. From the four spots, the position of the star behind the coronagraph is fitted, and the images are shifted and cropped.

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: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Creates a master dark with the same shape as the science data and subtracts the dark frame from the science data.

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: pynpoint.core.processing.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.
  • dark_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

run() → None[source]

Run method of the module. Creates a master flat with the same shape as the science image and divides the science images by the flat field.

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)[source]

Bases: pynpoint.core.processing.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, image_size: float = 2.0, fwhm_star: float = 0.2, position: Union[Tuple[int, int, float], Tuple[None, None, float]] = None)[source]

Bases: pynpoint.core.processing.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 in RemoveFramesModule. This argument is ignored if CPU 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. The position of the star is attached to the input images (only with CPU == 1) as the non-static attribute STAR_POSITION (y, x).

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)[source]

Bases: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Computes the flux within a circular aperture for each frame and saves the values in the database.

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: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Shifts the PSF template to the location of the fake planet with an additional correction for the parallactic angle and an optional flux scaling. The stack of images with the injected planet signal is stored.

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)[source]

Bases: pynpoint.core.processing.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.
  • 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 written in the history. The size of the aperture is kept fixed.
Keyword Arguments:
 
  • tolerance (float) – The fractional tolerance on the position for the optimization to end. Default is set to 1e-3.
  • bounds (tuple(tuple(float, float), tuple(float, float))) – Boundaries (pix) for the horizontal and vertical offset with respect to the position. The default is set to (-3, 3) for both directions.
Returns:

None

Return type:

NoneType

run() → None[source]

Run method of the module. Calculates the SNR and FPF for a specified position in a post- processed image with the Student’s t-test (Mawet et al. 2014). This approach assumes Gaussian noise but accounts for small sample statistics.

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: Union[float, Tuple[int, int, float]] = 0.1, mask: Union[Tuple[float, float], Tuple[None, float], Tuple[float, None], Tuple[None, None]] = None, extra_rot: float = 0.0, merit: str = 'gaussian', residuals: str = 'median', **kwargs)[source]

Bases: pynpoint.core.processing.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 distributions 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) – Tag of the database entry with 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 (2D) or a cube (3D) with the dimensions equal to image_in_tag.
  • chain_out_tag (str) – Tag of the database entry with the Markov chain that is written as output. The shape of the array is (nsteps, nwalkers, 3). The mean acceptance fraction and the integrated autocorrelation time are stored as attributes to this dataset.
  • 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 specified separation and angle are also used as fixed position for the aperture if aperture contains a float value.
  • bounds (tuple(tuple(float, float), tuple(float, float), tuple(float, float))) – The boundaries of the separation (arcsec), angle (deg), and contrast (mag). Each set of boundaries is specified as a tuple.
  • nwalkers (int) – Number of ensemble members.
  • nsteps (int) – Number of steps to run per walker.
  • psf_scaling (float) – Additional scaling factor of the planet flux (e.g., to correct for a neutral density filter). 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 that is used for the likelihood function (‘gaussian’ or ‘poisson’). Pixels are assumed to be independent measurements which are expected to be equal to zero in case the best-fit negative PSF template is injected. With ‘gaussian’, the variance is estimated from the pixel values within an annulus at the separation of the aperture (but excluding the pixels within the aperture). With ‘poisson’, a Poisson distribution is assumed for the variance of each pixel value (see Wertz et al. 2017).
  • residuals (str) – Method used for combining the residuals (‘mean’, ‘median’, ‘weighted’, or ‘clipped’).
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[int, int], magnitude: float, psf_scaling: float = -1.0, merit: str = 'hessian', aperture: float = 0.1, sigma: float = 0.0, tolerance: float = 0.1, pca_number: Union[int, range, List[int]] = 10, cent_size: float = None, edge_size: float = None, extra_rot: float = 0.0, residuals: str = 'median', reference_in_tag: str = None)[source]

Bases: pynpoint.core.processing.ProcessingModule

Pipeline module to measure the flux and position of a planet by injecting negative fake planets and minimizing a figure of merit.

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 (pix), y position (pix), separation (arcsec), angle (deg), contrast (mag), and the chi-square value. The last row contains the best-fit results.
  • position (tuple(int, int)) – Approximate position (x, y) of the planet (pix). This is also the location where the figure of merit is calculated within an aperture of radius aperture.
  • 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 negative in order to inject negative fake planets.
  • merit (str) – Figure of merit for the minimization. Can be ‘hessian’, to minimize the sum of the absolute values of the determinant of the Hessian matrix, or ‘poisson’, to minimize the sum of the absolute pixel values, assuming a Poisson distribution for the noise (Wertz et al. 2017), or ‘gaussian’, to minimize the ratio of the squared pixel values and the variance of the pixels within an annulus but excluding the aperture area.
  • aperture (float) – Aperture radius (arcsec) at the position specified at position.
  • sigma (float) – Standard deviation (arcsec) of the Gaussian kernel which 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 (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, range, list(int, )) – Number of principal components (PCs) used for the PSF subtraction. Can be either a single value or a range/list of values. In the latter case, the res_out_tag and flux_position_tag contain a 3 digit number with the number of PCs.
  • cent_size (float) – Radius of the central mask (arcsec). No mask is used when set to None. Masking is done after the artificial planet is injected.
  • edge_size (float) – 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. Masking is done 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 to None. Note that the mean is not subtracted from the data of image_in_tag and reference_in_tag in case the reference_in_tag is used, to allow for flux and position measurements in the context of RDI.
Returns:

None

Return type:

NoneType

run() → None[source]

Run method of the module. The position and contrast of a planet is measured by injecting negative copies of the PSF template and applying a simplex method (Nelder-Mead) for minimization of a figure of merit at the planet location.

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, method: str = 'median', threshold: float = 4.0, fwhm: float = 0.1, aperture: Union[Tuple[str, float], Tuple[str, float, float]] = ('circular', 0.2), position: Union[Tuple[int, int, float], Tuple[None, None, float], Tuple[int, int, None]] = None)[source]

Bases: pynpoint.core.processing.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) – Perform the sigma clipping with respect to the median or maximum aperture flux by setting the method to ‘median’ or ‘max’.
  • threshold (float) – Threshold in units of sigma for the frame selection. All images that are a threshold number of sigmas away from the median/maximum photometry will be removed.
  • fwhm (float) – 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.
  • 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. If position=(pos_x, pos_y, None) then a fixed position is used for the aperture.
Returns:

None

Return type:

NoneType

static photometry(image: numpy.ndarray, position: numpy.ndarray, aperture: Union[Tuple[str, float, float], Tuple[str, None, float]]) → numpy.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: pynpoint.core.processing.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.
  • 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).

Returns:None
Return type:NoneType
class pynpoint.processing.frameselection.ImageStatisticsModule(name_in: str, image_in_tag: str, stat_out_tag: str, position: Union[Tuple[int, int, float], Tuple[None, None, float]] = None)[source]

Bases: pynpoint.core.processing.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: Union[str, range, list, numpy.ndarray])[source]

Bases: pynpoint.core.processing.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) – A tuple or array with the frame indices that have to be removed or a database tag pointing to a list of frame indices.
Returns:

None

Return type:

NoneType

run() → None[source]

Run method of the module. Removes the frames and corresponding attributes, updates the NFRAMES attribute, and saves the data and attributes.

Returns:None
Return type:NoneType
class pynpoint.processing.frameselection.RemoveLastFrameModule(name_in: str, image_in_tag: str, image_out_tag: str)[source]

Bases: pynpoint.core.processing.ProcessingModule

Pipeline module for removing every NDIT+1 frame from NACO data 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. Should be different from image_in_tag.
Returns:

None

Return type:

NoneType

run() → None[source]

Run method of the module. Removes every NDIT+1 frame and saves the data and attributes.

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: pynpoint.core.processing.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 significantly higher in the first several frames of a data 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. Should be different from image_in_tag.
  • frames (int) – Number of frames that are removed at the beginning of each cube.
Returns:

None

Return type:

NoneType

run() → None[source]

Run method of the module. Removes a constant number of images at the beginning of each cube and saves the data and attributes.

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: pynpoint.core.processing.ProcessingModule

Pipeline module for selecting frames based on attribute values.

Parameters:
  • name_in (str) – Unique name of the module instance.
  • image_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 50 PCC frames.

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, edge_size: float = None, extra_rot: float = 0.0, residuals: str = 'median', snr_inject: float = 100.0, **kwargs)[source]

Bases: pynpoint.core.processing.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: pynpoint.core.processing.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: numpy.ndarray, mag_eval: numpy.ndarray, filter_index: int, model_age: List[float], model_data: List[numpy.ndarray]) → numpy.ndarray[source]

Interpolates the grid based model data.

Parameters:
  • age_eval (numpy.ndarray) – Age at which the system is evaluated. Must be of the same shape as mag_eval.
  • mag_eval (numpy.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(numpy.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:

numpy.ndarray

static read_model(model_file_path: str) → Tuple[List[float], List[numpy.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(numpy.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: tuple = None, cubes: int = None, size: float = 2.0, gaussian: float = 0.15, subframe: float = None, pca_number: int = 60, mask_star: float = 0.7, subtract_mean: bool = False, **kwargs)[source]

Bases: pynpoint.core.processing.ProcessingModule

Pipeline module for PCA-based background subtraction of data with dithering. This is a wrapper that applies the processing modules required for the PCA background 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.
  • image_out_tag (str) – Tag of the database entry that is written as output. Not written if set to None.
  • center (tuple(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 and cubes are both set to None then sorting and subtracting of the background frames is based on DITHER_X and DITHER_Y. If center is specified and cubes is set to None then the DITHER_X and DITHER_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 on DITHER_X and DITHER_Y.
  • size (float) – Image size (arsec) that is cropped at the specified dither positions.
  • 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. If set to None then the full frame size (size) will be used.
  • pca_number (int) – Number of principal components.
  • mask_star (float) – Radius of the central mask (arcsec).
  • subtract_mean (bool) – The mean of the background images is subtracted from both the star and background images before the PCA basis is constructed.
Keyword Arguments:
 
  • crop (bool) – Skip the step of selecting and cropping of the dithering positions if set to False.
  • prepare (bool) – Skip the step of preparing the PCA background subtraction if set to False.
  • pca_background (bool) – Skip the step of the PCA background subtraction if set to False.
  • combine (str) – Combine the mean background subtracted (‘mean’) or PCA background subtracted (‘pca’) frames. This step is ignored if set to None.
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: Union[Tuple[int, int, int], Tuple[int, None, Tuple[float, float]]], combine: str = 'mean', **kwargs)[source]

Bases: pynpoint.core.processing.ProcessingModule

Pipeline module for preparing the PCA background subtraction.

Parameters:
  • name_in (str) – Unique name of the pipeline module instance.
  • image_in_tag (str) – Tag of the database entry that is read as input.
  • star_out_tag (str) – Output tag with the images containing the star.
  • subtracted_out_tag (str) – Output tag with the mean/median background subtracted images with the star.
  • background_out_tag (str) – Output tag with the images containing 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) with positions the number of unique dithering position, cubes the number of consecutive cubes per dithering position, and first the index value of the first cube which contains the star (Python indexing starts at zero). Sorting is based on the DITHER_X and DITHER_Y attributes when cubes is set to None. In that case, the first value should be a tuple with the DITHER_X and DITHER_Y values in which the star appears first.
  • combine (str) – Method to combine the background images (‘mean’ or ‘median’).
Returns:

None

Return type:

NoneType

run() → None[source]

Run method of the module. Separates the star and background frames, subtracts the mean or median background from both the star and background frames, and writes the star and background frames separately.

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, mask_out_tag: str = None, pca_number: int = 60, mask_star: float = 0.7, subtract_mean: bool = False, subframe: float = None, gaussian: float = 0.15, **kwargs)[source]

Bases: pynpoint.core.processing.ProcessingModule

Pipeline module for PCA based background subtraction. See Hunziker et al. 2018 for details.

Parameters:
  • name_in (str) – Tag of the database entry with the star images.
  • star_in_tag (str) – Tag of the database entry with the star images.
  • background_in_tag (str) – Tag of the database entry with the background images.
  • residuals_out_tag (str) – Tag of the database entry with the residuals of the star images after the background subtraction.
  • fit_out_tag (str, None) – Tag of the database entry with the fitted background. No data is written when set to None.
  • mask_out_tag (str, None) – Tag of the database entry with the mask. No data is written when set to None.
  • pca_number (int) – Number of principal components.
  • mask_star (float) – Radius of the central mask (arcsec).
  • subtract_mean (bool) – The mean of the background images is subtracted from both the star and background images before the PCA basis is constructed.
  • 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, masks the PSF in the star frames and optionally an off-axis point source, fits the star frames with a linear combination of the principal components, and writes 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: pynpoint.core.processing.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: pynpoint.core.processing.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, norm: bool = False, resize: float = None, cent_size: float = None, edge_size: float = None)[source]

Bases: pynpoint.core.processing.ProcessingModule

Module to prepare the data for PSF subtraction with PCA. The preparation steps include masking and image 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.
  • 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

run() → None[source]

Run method of the module. Masks and normalizes the images.

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: pynpoint.core.processing.ProcessingModule

Module for preparing continuum frames for SDI 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.
  • 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

run() → None[source]

Run method of the module. Normalizes the images for the different filter widths, upscales the images, and crops the images to the initial image shape in order to align the PSF patterns.

Returns:None
Return type:NoneType
class pynpoint.processing.psfpreparation.SortParangModule(name_in: str, image_in_tag: str, image_out_tag: str)[source]

Bases: pynpoint.core.processing.ProcessingModule

Module to sort the images and non-static attributes with increasing INDEX.

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. Should be different from image_in_tag.
Returns:

None

Return type:

NoneType

run() → None[source]

Run method of the module. Sorts the images and relevant non-static attributes.

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: Optional[Tuple[float, float, float]], nreference: int = None, residuals: str = 'median', extra_rot: float = 0.0)[source]

Bases: pynpoint.core.processing.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, res_median_tag: str = None, res_weighted_tag: str = None, res_rot_mean_clip_tag: str = None, res_arr_out_tag: str = None, basis_out_tag: str = None, pca_numbers: Union[range, List[int], numpy.ndarray] = range(1, 21), extra_rot: float = 0.0, subtract_mean: bool = True)[source]

Bases: pynpoint.core.processing.ProcessingModule

Pipeline module for PSF subtraction with principal component analysis (PCA). 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 be set with the CPU keyword in the configuration file.

Parameters:
  • name_in (str) – Unique name of the module instance.
  • images_in_tag (str) – Tag of the database entry with the science images that are read as input
  • reference_in_tag (str) – Tag of the database entry with the reference images that are read as input.
  • res_mean_tag (str, None) – Tag of the database entry with the mean collapsed residuals. Not calculated if set to None.
  • res_median_tag (str, None) – Tag of the database entry with the median collapsed residuals. Not calculated if set to None.
  • res_weighted_tag (str, None) – Tag of the database entry with the noise-weighted residuals (see Bottom et al. 2017). Not calculated 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) – Tag of the database entry with the image residuals from the PSF subtraction. If a list of PCs is provided in pca_numbers then multiple tags will be created in the central database. Not calculated if set to None. Not supported with multiprocessing.
  • basis_out_tag (str, None) – Tag of the database entry with the basis set. Not stored if set to None.
  • pca_numbers (range, list(int, ), numpy.ndarray) – Number of principal components used for the PSF model. Can be a single value or a tuple with integers.
  • 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.
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: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Adds lines of zero-value pixels to increase the size of an image.

Returns:None
Return type:NoneType
class pynpoint.processing.resizing.CropImagesModule(name_in: str, image_in_tag: str, image_out_tag: str, size: float, center: Optional[Tuple[int, int]])[source]

Bases: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Decreases the image size by cropping around an given position. The module always returns odd-sized images.

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: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Removes the lines given by lines from each frame.

Returns:None
Return type:NoneType
class pynpoint.processing.resizing.ScaleImagesModule(name_in: str, image_in_tag: str, image_out_tag: str, scaling: Union[Tuple[float, float, float], Tuple[None, None, float], Tuple[float, float, None]], pixscale: bool = False)[source]

Bases: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Rescales an image with a fifth order spline interpolation and a reflecting boundary condition.

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: pynpoint.core.processing.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, extra_rot: float = 0.0)[source]

Bases: pynpoint.core.processing.ProcessingModule

Pipeline module for derotating and/or stacking (i.e., taking the median or average) of the 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. The output is either 2D (stack=False) or 3D (stack=True).
  • 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).
Returns:

None

Return type:

NoneType

run() → None[source]

Run method of the module. Uses the PARANG attributes to derotate the images (if derotate is set to True) and applies an optional mean or median stacking afterwards.

Returns:None
Return type:NoneType
class pynpoint.processing.stacksubset.StackAndSubsetModule(name_in: str, image_in_tag: str, image_out_tag: str, random: int = None, stacking: int = None, combine: str = 'mean')[source]

Bases: pynpoint.core.processing.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) – Number of random images. All images are used if set to None.
  • stacking (int) – 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.
Returns:

None

Return type:

NoneType

run() → None[source]

Run method of the module. Stacks subsets of images and/or selects a random subset. Also the parallactic angles are mean-combined if images are stacked.

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: pynpoint.core.processing.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

run() → None[source]

Run method of the module. Uses the NFRAMES attribute to select the images of each cube, calculates the mean or median of each cube, and saves the data and attributes.

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. 2018 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: pynpoint.core.processing.ProcessingModule

Pipeline module for normalization of global brightness variations of the detector (see Bonse et al. 2018).

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

run() → None[source]

Run method of the module.

Returns:None
Return type:NoneType
class pynpoint.processing.timedenoising.WaveletTimeDenoisingModule(name_in: str, image_in_tag: str, image_out_tag: str, wavelet_configuration: Union[pynpoint.processing.timedenoising.CwtWaveletConfiguration, pynpoint.processing.timedenoising.DwtWaveletConfiguration], padding: str = 'zero', median_filter: bool = False, threshold_function: str = 'soft')[source]

Bases: pynpoint.core.processing.ProcessingModule

Pipeline module for speckle subtraction in the time domain by using CWT or DWT wavelet shrinkage (see Bonse et al. 2018).

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.
  • wavelet_configuration (pynpoint.processing.timedenoising.CwtWaveletConfiguration or pynpoint.processing.timedenoising.DwtWaveletConfiguration) – Instance of DwtWaveletConfiguration or CwtWaveletConfiguration which gives the parameters of the wavelet transformation to be used.
  • padding (str) – Padding method (‘zero’, ‘mirror’, or ‘none’).
  • median_filter (bool) – If true a median filter in time is applied which removes outliers in time like cosmic rays.
  • threshold_function (str) – Threshold function used for wavelet shrinkage in the wavelet space (‘soft’ or ‘hard’).
Returns:

None

Return type:

NoneType

run() → None[source]

Run method of the module. Applies the time denoising for the lines in time in parallel.

Returns:None
Return type:NoneType

Module contents