pipeline_steps package

Submodules

pipeline_steps.Axial_Profiles module

autoprof.pipeline_steps.Axial_Profiles.Axial_Profiles(IMG, results, options)[source]

Extracts SB profiles perpendicular to the major (or minor) axis.

For some applications, such as examining edge on galaxies, it is beneficial to observe the vertical structure in a disk. This can be achieved with the Axial Profiles method. It will construct a series of lines, each one with a starting point on the major axis of the galaxy and radiating perpendicular from it. The location of these lines are, by default, geometrically spaced so that they can gather more light in the fainter outskirts. Along a given line, and SB profile is extracted, with the distance between points on the profile also increasing geometrically, allowing more light collection. The outputted profile is formatted similar to a regular SB profile, except that there are many SB profiles with each one having a corresponding distance from the center and quadrant of the image. A diagnostic image is generated to aid in identifying where each profile is extracted.

Parameters:
  • ap_axialprof_pa (float, default 0) – user set position angle at which to align the axial profiles relative to the global position angle+90, in degrees. A common choice would be “90” which would then sample along the semi-major axis instead of the semi-minor axis.

  • ap_zeropoint (float, default 22.5) – Photometric zero point

  • ap_samplestyle (string, default 'geometric') – indicate if isophote sampling radii should grow linearly or geometrically. Can also do geometric sampling at the center and linear sampling once geometric step size equals linear. Options are: ‘linear’, ‘geometric’, and ‘geometric-linear’.

  • ap_isoaverage_method (string, default 'median') – Select the method used to compute the averafge flux along an isophote. Choose from ‘mean’, ‘median’, and ‘mode’. In general, median is fast and robust to a few outliers. Mode is slow but robust to more outliers. Mean is fast and accurate in low S/N regimes where fluxes take on near integer values, but not robust to outliers. The mean should be used along with a mask to remove spurious objects such as foreground stars or galaxies, and should always be used with caution.

Notes

References:

  • ‘mask’ (optional)

  • ‘background’

  • ‘psf fwhm’

  • ‘center’

  • ‘prof data’ (optional)

  • ‘init pa’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) – No results provided as this method writes its own profile

    {}
    

pipeline_steps.Background module

autoprof.pipeline_steps.Background.Background_Basic(IMG, results, options)[source]

Compute the mean flux in the border of an image.

Takes all pixels in a 1/5th border of the image and computes the mean. To compute the noise in the background level, we simply take the standard deviation of the flux values. This background estimation method is only for diagnostic purposes and will be considerably biased on real astronomical images.

Parameters:
  • ap_set_background (float, default None) – User provided background value in flux

  • ap_set_background_noise (float, default None) – User provided background noise level in flux

  • ap_background_speedup (int, default 1) – For large images, this can be millions of pixels, which is not really needed to achieve an accurate background level, the user can provide a positive integer factor by which to reduce the number of pixels used in the calculation.

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'background': , # flux value representing the background level (float)
     'background noise': ,# measure of scatter around the background level (float)
     'background uncertainty': ,# optional, uncertainty on background level (float)
     'auxfile background': # optional, message for aux file to record background level (string)
    
    }
    

autoprof.pipeline_steps.Background.Background_DilatedSources(IMG, results, options)[source]

Compute the median flux after removing bright sources.

Compute a global background value for an image. Performed by identifying pixels which are beyond 3 sigma above the average signal and masking them, also further masking a border of 20 pixels around the initial masked pixels. Returns a dictionary of parameters describing the background level.

Parameters:
  • ap_set_background (float, default None) – User provided background value in flux

  • ap_set_background_noise (float, default None) – User provided background noise level in flux

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'background': , # flux value representing the background level (float)
     'background noise': ,# measure of scatter around the background level (float)
     'background uncertainty': ,# optional, uncertainty on background level (float)
     'auxfile background': # optional, message for aux file to record background level (string)
    
    }
    

autoprof.pipeline_steps.Background.Background_Mode(IMG, results, options)[source]

Compute the mode flux in the border of an image.

Takes all pixels in a 1/5th border of the image. Applies a Gaussian smoothing length of log10(sqrt(N)) where N is the number of sampled pixels. The peak of the smoothed distribution is found using Nelder-Mead optimization. To compute the noise in the background level, we take all flux values below the fitted background level and compute the 31.73 - 100 percent range. This corresponds to the lower 1sigma, we do not use the upper 1sigma as it is contaminated by faint sources. In truth the lower 1sigma is contaminated as well, though to a lesser extent.

Parameters:
  • ap_set_background (float, default None) – User provided background value in flux

  • ap_set_background_noise (float, default None) – User provided background noise level in flux

  • ap_background_speedup (int, default 1) – For large images, this can be millions of pixels, which is not really needed to achieve an accurate background level, the user can provide a positive integer factor by which to reduce the number of pixels used in the calculation.

Notes

For best results, use a segmentation mask to remove sources.

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'background': , # flux value representing the background level (float)
     'background noise': ,# measure of scatter around the background level (float)
     'background uncertainty': ,# optional, uncertainty on background level (float)
     'auxfile background': # optional, message for aux file to record background level (string)
    
    }
    

autoprof.pipeline_steps.Background.Background_Unsharp(IMG, results, options)[source]

creates a 2D background level using low order FFT coefficients.

Takes the 2D FFT of an image and sets all coefficients above 3 to zero. This creates a very smooth image which can be used as a variable background level. This can then be subtracted from images to remove large bright sources, such as a nearby BGC or bright star. However, this background estimation method will likely also heavily bias flux value. Thus it can reasonably be used to isolate a galaxy with a large overlapping partner for the sake of fitting isophotes, but the extracted flux profile will be unreliable.

Parameters:

ap_background_unsharp_lowpass (int, default 3) – User provided FFT coefficient cutoff for constructing unsharp image.

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'background': , # flux image representing the variable background level (ndarray)
    }
    

pipeline_steps.Center module

autoprof.pipeline_steps.Center.Center_1DGaussian(IMG, results, options)[source]

Find galaxy center with many 1D gaussian fits to the image..

Compute the pixel location of the galaxy center using a photutils method. Looking at 100 seeing lengths around the center of the image (images should already be mostly centered), finds the galaxy center by fitting several 1d Gaussians.

Parameters:
  • ap_guess_center (dict, default None) –

    user provided starting point for center fitting. Center should be formatted as:

    {'x':float, 'y': float}
    

    , where the floats are the center coordinates in pixels. If not given, Autoprof will default to a guess of the image center.

  • ap_set_center (dict, default None) –

    user provided fixed center for rest of calculations. Center should be formatted as:

    {'x':float, 'y': float}
    

    , where the floats are the center coordinates in pixels. If not given, Autoprof will default to a guess of the image center.

  • ap_centeringring (int, default 50) – Size of ring to use when finding galaxy center, in units of PSF. Larger rings will give the 1D fits more data to work with and allow for the starting position to be further from the true galaxy center. Smaller rings will include fewer spurious objects, and can stop the 1D fits from being distracted by larger nearby objects/galaxies.

Notes

References:

  • ‘background’

  • ‘psf fwhm’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'center': {'x': , # x coordinate of the center (pix)
                'y': }, # y coordinate of the center (pix)
    
     'auxfile center': # optional, message for aux file to record galaxy center (string)
    
    }
    

autoprof.pipeline_steps.Center.Center_2DGaussian(IMG, results, options)[source]

Find galaxy center with a 2D gaussian fit to the image..

Compute the pixel location of the galaxy center by fitting a 2d Gaussian as implimented by the photutils package.

Parameters:
  • ap_guess_center (dict, default None) –

    user provided starting point for center fitting. Center should be formatted as:

    {'x':float, 'y': float}
    

    , where the floats are the center coordinates in pixels. If not given, Autoprof will default to a guess of the image center.

  • ap_set_center (dict, default None) –

    user provided fixed center for rest of calculations. Center should be formatted as:

    {'x':float, 'y': float}
    

    , where the floats are the center coordinates in pixels. If not given, Autoprof will default to a guess of the image center.

  • ap_centeringring (int, default 50) – Size of ring to use when finding galaxy center, in units of PSF. Larger rings will give the 2D fit more data to work with and allow for the starting position to be further from the true galaxy center. Smaller rings will include fewer spurious objects, and can stop the 2D fit from being distracted by larger nearby objects/galaxies.

Notes

References:

  • ‘background’

  • ‘psf fwhm’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'center': {'x': , # x coordinate of the center (pix)
                'y': }, # y coordinate of the center (pix)
    
     'auxfile center': # optional, message for aux file to record galaxy center (string)
    
    }
    

autoprof.pipeline_steps.Center.Center_Forced(IMG, results, options)[source]

Extracts previously fit center coordinates.

Extracts the center coordinates from an aux file for a previous AutoProf fit. Can instead simply be given a set center value, just like other centering methods. A given center will override teh fitted aux file center.

Parameters:
  • ap_guess_center (dict, default None) –

    user provided starting point for center fitting. Center should be formatted as:

    {'x':float, 'y': float}
    

    , where the floats are the center coordinates in pixels. If not given, Autoprof will default to a guess of the image center.

  • ap_set_center (dict, default None) –

    user provided fixed center for rest of calculations. Center should be formatted as:

    {'x':float, 'y': float}
    

    , where the floats are the center coordinates in pixels. If not given, Autoprof will default to a guess of the image center.

  • ap_forcing_profile (string, default None) – (required for forced photometry) file path to .prof file providing forced photometry PA and ellip values to apply to ap_image_file.

Notes

References:

  • ‘background’

  • ‘background noise’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'center': {'x': , # x coordinate of the center (pix)
                'y': }, # y coordinate of the center (pix)
    
     'auxfile center': # optional, message for aux file to record galaxy center (string)
     'auxfile centeral sb': # optional, central surface brightness value (float)
    
    }
    

autoprof.pipeline_steps.Center.Center_HillClimb(IMG, results, options)[source]

Follow locally increasing brightness (robust to PSF size objects) to find peak.

Using 10 circular isophotes out to 10 times the PSF length, the first FFT coefficient phases are averaged to find the direction of increasing flux. Flux values are sampled along this direction and a quadratic fit gives the maximum. This is iteratively repeated until the step size becomes very small.

Parameters:
  • ap_guess_center (dict, default None) –

    user provided starting point for center fitting. Center should be formatted as:

    {'x':float, 'y': float}
    

    , where the floats are the center coordinates in pixels. If not given, Autoprof will default to a guess of the image center.

  • ap_set_center (dict, default None) –

    user provided fixed center for rest of calculations. Center should be formatted as:

    {'x':float, 'y': float}
    

    , where the floats are the center coordinates in pixels. If not given, Autoprof will default to a guess of the image center.

  • ap_centeringring (int, default 10) – Size of ring to use when finding galaxy center, in units of PSF. Larger rings will be robust to features (i.e., foreground stars), while smaller rings may be needed for small galaxies.

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘psf fwhm’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'center': {'x': , # x coordinate of the center (pix)
                'y': }, # y coordinate of the center (pix)
    
     'auxfile center': # optional, message for aux file to record galaxy center (string)
     'auxfile centeral sb': # optional, central surface brightness value (float)
    
    }
    

autoprof.pipeline_steps.Center.Center_HillClimb_mean(IMG, results, options)[source]

Follow locally increasing brightness (robust to PSF size objects) to find peak.

Using 10 circular isophotes out to 10 times the PSF length, the first FFT coefficient phases are averaged to find the direction of increasing flux. Flux values are sampled along this direction and a quadratic fit gives the maximum. This is iteratively repeated until the step size becomes very small. This function is identical to Center_HillClimb() except that all averages/scatters are mean/std based instead of median/iqr based.

Parameters:
  • ap_guess_center (dict, default None) –

    user provided starting point for center fitting. Center should be formatted as:

    {'x':float, 'y': float}
    

    , where the floats are the center coordinates in pixels. If not given, Autoprof will default to a guess of the image center.

  • ap_set_center (dict, default None) –

    user provided fixed center for rest of calculations. Center should be formatted as:

    {'x':float, 'y': float}
    

    , where the floats are the center coordinates in pixels. If not given, Autoprof will default to a guess of the image center.

  • ap_centeringring (int, default 10) – Size of ring to use when finding galaxy center, in units of PSF. Larger rings will be robust to features (i.e., foreground stars), while smaller rings may be needed for small galaxies.

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘psf fwhm’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'center': {'x': , # x coordinate of the center (pix)
                'y': }, # y coordinate of the center (pix)
    
     'auxfile center': # optional, message for aux file to record galaxy center (string)
     'auxfile centeral sb': # optional, central surface brightness value (float)
    
    }
    

autoprof.pipeline_steps.Center.Center_OfMass(IMG, results, options)[source]

Find the light weighted galaxy center.

Iteratively computes the light weighted centroid within a window, moves to the new center and computes the light weighted centroid again. The size of the search area is 10PSF by default. The iterative process will continue until the center is updated by less than 1/10th of the PSF size or when too mny iterations have been reached.

Parameters:
  • ap_guess_center (dict, default None) –

    user provided starting point for center fitting. Center should be formatted as:

    {'x':float, 'y': float}
    

    , where the floats are the center coordinates in pixels. If not given, Autoprof will default to a guess of the image center.

  • ap_set_center (dict, default None) –

    user provided fixed center for rest of calculations. Center should be formatted as:

    {'x':float, 'y': float}
    

    , where the floats are the center coordinates in pixels. If not given, Autoprof will default to a guess of the image center.

  • ap_centeringring (int, default 10) – Size of ring to use when finding galaxy center, in units of PSF. Larger rings will allow for the starting position to be further from the true galaxy center. Smaller rings will include fewer spurious objects, and can stop the centroid from being distracted by larger nearby objects/galaxies.

Notes

References:

  • ‘background’

  • ‘psf fwhm’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'center': {'x': , # x coordinate of the center (pix)
                'y': }, # y coordinate of the center (pix)
    
     'auxfile center': # optional, message for aux file to record galaxy center (string)
     'auxfile centeral sb': # optional, central surface brightness value (float)
    
    }
    

autoprof.pipeline_steps.Center.Center_Peak(IMG, results, options)[source]

pipeline_steps.Check_Fit module

autoprof.pipeline_steps.Check_Fit.Check_Fit(IMG, results, options)[source]

Check for cases of failed isophote fits.

A variety of check methods are applied to ensure that the fit has converged to a reasonable solution. If a fit passes all of these checks then it is typically an acceptable fit. However if it fails one or more of the checks then the fit likely either failed or the galaxy has strong non-axisymmetric features (and the fit itself may be acceptable).

One check samples the fitted isophotes and looks for cases with high variability of flux values along the isophote. This is done by comparing the interquartile range to the median flux, if the interquartile range is larger then that isophote is flagged. If enough isophotes are flagged then the fit may have failed.

A second check operates similarly, checking the second and fourth FFT coefficient amplitudes relative to the median flux. If many of the isophotes have large FFT coefficients, or if a few of the isophotes have very large FFT coefficients then the fit is flagged as potentially failed.

A third check is similar to the first, except that it compares the interquartile range from the fitted isophotes to those using just the global position angle and ellipticity values.

A fourth check uses the first FFT coefficient to detect if the light is biased to one side of the galaxy. Typically this indicated either a failed center, or the galaxy has been disturbed and is not lopsided.

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘center’

  • ‘init ellip’

  • ‘init pa’

  • ‘fit R’ (optional)

  • ‘fit ellip’ (optional)

  • ‘fit pa’ (optional)

  • ‘prof data’ (optional)

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'checkfit': {'isophote variability': , # True if the test was passed, False if the test failed (bool)
                  'FFT coefficients': , # True if the test was passed, False if the test failed (bool)
                  'initial fit compare': , # True if the test was passed, False if the test failed (bool)
                  'Light symmetry': }, # True if the test was passed, False if the test failed (bool)
    
     'auxfile checkfit isophote variability': ,# optional aux file message for pass/fail of test (string)
     'auxfile checkfit FFT coefficients': ,# optional aux file message for pass/fail of test (string)
     'auxfile checkfit initial fit compare': ,# optional aux file message for pass/fail of test (string)
     'auxfile checkfit Light symmetry': ,# optional aux file message for pass/fail of test (string)
    
    }
    

pipeline_steps.Ellipse_Model module

autoprof.pipeline_steps.Ellipse_Model.EllipseModel(IMG, results, options)[source]

Construct a smooth model image of the galaxy with fixed PA/elliptiicty.

Constructs a 2D model image of the galaxy based on the extracted surface brightness profile and the global ellipticity and position angle values. First the image is transformed by rotating and stretching until the global ellipse fit has been transformed into a circle. The radial distance of every pixel from the galaxy center is then used on an interpolated SB profile to determine the corresponding SB value. The SB values are applied and converted from mag/arcsec^2 to flux units.

Parameters:
  • ap_zeropoint (float, default 22.5) – Photometric zero point

  • ap_ellipsemodel_resolution (float, default 1) – scale factor for the ellipse model resolution. Above 1 increases the precision of the ellipse model (and computation time), between 0 and 1 decreases the resolution (and computation time). Note that the ellipse model resolution is defined logarithmically, so the center will always be more resolved

  • ap_ellipsemodel_replacemaskedpixels (bool, default False) – If True, a new galaxy image will be generated with masked pixels replaced by the ellipse model values.

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'ellipse model': # 2d image with flux values for smooth model of galaxy
    }
    

pipeline_steps.Isophote_Extract module

autoprof.pipeline_steps.Isophote_Extract.Isophote_Extract(IMG, results, options)[source]

General method for extracting SB profiles.

The default SB profile extraction method is highly flexible, allowing users to test a variety of techniques on their data to determine the most robust. The user may specify a variety of sampling arguments for the photometry extraction. For example, a start or end radius in pixels, or whether to sample geometrically or linearly in radius. Geometric sampling is the default as it is faster. Once the sampling profile of semi-major axis values has been chosen, the function interpolates (spline) the position angle and ellipticity profiles at the requested values. For any sampling beyond the outer radius from the Isophotal Fitting step, a constant value is used. Within 1 PSF, a circular isophote is used.

Parameters:
  • ap_zeropoint (float, default 22.5) – Photometric zero point. For converting flux to mag units.

  • ap_fluxunits (str, default "mag") – units for outputted photometry. Can either be “mag” for log units, or “intensity” for linear units.

  • ap_samplegeometricscale (float, default 0.1) – growth scale for isophotes when sampling for the final output profile. Used when sampling geometrically. By default, each isophote is 10% further than the last.

  • ap_samplelinearscale (float, default None) – growth scale (in pixels) for isophotes when sampling for the final output profile. Used when sampling linearly. Default is 1 PSF length.

  • ap_samplestyle (string, default 'geometric') – indicate if isophote sampling radii should grow linearly or geometrically. Can also do geometric sampling at the center and linear sampling once geometric step size equals linear. Options are: ‘linear’, ‘geometric’, ‘geometric-linear’

  • ap_sampleinitR (float, default None) – Starting radius (in pixels) for isophote sampling from the image. Note that a starting radius of zero is not advised. Default is 1 pixel or 1PSF, whichever is smaller.

  • ap_sampleendR (float, default None) – End radius (in pixels) for isophote sampling from the image. Default is 3 times the fit radius, also see ap_extractfull.

  • ap_isoband_start (float, default 2) – The noise level at which to begin sampling a band of pixels to compute SB instead of sampling a line of pixels near the isophote in units of pixel flux noise. Will never initiate band averaging if the band width is less than half a pixel

  • ap_isoband_width (float, default 0.025) – The relative size of the isophote bands to sample. flux values will be sampled at +- ap_isoband_width *R for each radius.

  • ap_isoband_fixed (bool, default False) – Use a fixed width for the size of the isobands, the width is set by ap_isoband_width which now has units of pixels, the default is 0.5 such that the full band has a width of 1 pixel.

  • ap_truncate_evaluation (bool, default False) – Stop evaluating new isophotes once two negative flux isophotes have been recorded, presumed to have reached the end of the profile.

  • ap_extractfull (bool, default False) – Tells AutoProf to extend the isophotal solution to the edge of the image. Will be overridden by ap_truncate_evaluation.

  • ap_iso_interpolate_start (float, default 5) – Use a Lanczos interpolation for isophotes with semi-major axis less than this number times the PSF.

  • ap_iso_interpolate_method (string, default 'lanczos') – Select method for flux interpolation on image, options are ‘lanczos’ and ‘bicubic’. Default is ‘lanczos’ with a window size of 3.

  • ap_iso_interpolate_window (int, default 3) – Window size for Lanczos interpolation, default is 3, meaning 3 pixels on either side of the sample point are used for interpolation.

  • ap_isoaverage_method (string, default 'median') – Select the method used to compute the averafge flux along an isophote. Choose from ‘mean’, ‘median’, and ‘mode’. In general, median is fast and robust to a few outliers. Mode is slow but robust to more outliers. Mean is fast and accurate in low S/N regimes where fluxes take on near integer values, but not robust to outliers. The mean should be used along with a mask to remove spurious objects such as foreground stars or galaxies, and should always be used with caution.

  • ap_isoclip (bool, default False) – Perform sigma clipping along extracted isophotes. Removes flux samples from an isophote that deviate significantly from the median. Several iterations of sigma clipping are performed until convergence or ap_isoclip_iterations iterations are reached. Sigma clipping is a useful substitute for masking objects, though careful masking is better. Also an aggressive sigma clip may bias results.

  • ap_isoclip_iterations (int, default None) – Maximum number of sigma clipping iterations to perform. The default is infinity, so the sigma clipping procedure repeats until convergence

  • ap_isoclip_nsigma (float, default 5) – Number of sigma above median to apply clipping. All values above (median + ap_isoclip_nsigma x sigma) are removed from the isophote.

  • ap_iso_measurecoefs (tuple, default None) – tuple indicating which fourier modes to extract along fitted isophotes. Most common is (4,), which identifies boxy/disky isophotes. Also common is (1,3), which identifies lopsided galaxies. The outputted values are computed as a_i = imag(F_i)/abs(F_0) and b_i = real(F_i)/abs(F_0) where F_i is a fourier coefficient. Not activated by default as it adds to computation time.

  • ap_plot_sbprof_ylim (tuple, default None) – Tuple with axes limits for the y-axis in the SB profile diagnostic plot. Be careful when using intensity units since this will change the ideal axis limits.

  • ap_plot_sbprof_xlim (tuple, default None) – Tuple with axes limits for the x-axis in the SB profile diagnostic plot.

  • ap_plot_sbprof_set_errscale (float, default None) – Float value by which to scale errorbars on the SB profile this makes them more visible in cases where the statistical errors are very small.

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘psf fwhm’

  • ‘center’

  • ‘init ellip’

  • ‘init pa’

  • ‘fit R’

  • ‘fit ellip’

  • ‘fit pa’

  • ‘fit ellip_err’ (optional)

  • ‘fit pa_err’ (optional)

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'prof header': , # List object with strings giving the items in the header of the final SB profile (list)
     'prof units': , # dict object that links header strings to units (given as strings) for each variable (dict)
     'prof data': # dict object linking header strings to list objects containing the rows for a given variable (dict)
    
    }
    

autoprof.pipeline_steps.Isophote_Extract.Isophote_Extract_Forced(IMG, results, options)[source]

Method for extracting SB profiles that have been set by forced photometry.

This is nearly identical to the general isophote extraction method, except that it does not choose which radii to sample the profile, instead it takes the radii, PA, and ellipticities as given.

Parameters:
  • ap_zeropoint (float, default 22.5) – Photometric zero point. For converting flux to mag units.

  • ap_fluxunits (str, default "mag") – units for outputted photometry. Can either be “mag” for log units, or “intensity” for linear units.

  • ap_isoband_start (float, default 2) – The noise level at which to begin sampling a band of pixels to compute SB instead of sampling a line of pixels near the isophote in units of pixel flux noise. Will never initiate band averaging if the band width is less than half a pixel

  • ap_isoband_width (float, default 0.025) – The relative size of the isophote bands to sample. flux values will be sampled at +- ap_isoband_width *R for each radius.

  • ap_isoband_fixed (bool, default False) – Use a fixed width for the size of the isobands, the width is set by ap_isoband_width which now has units of pixels, the default is 0.5 such that the full band has a width of 1 pixel.

  • ap_truncate_evaluation (bool, default False) – Stop evaluating new isophotes once two negative flux isophotes have been recorded, presumed to have reached the end of the profile.

  • ap_iso_interpolate_start (float, default 5) – Use a Lanczos interpolation for isophotes with semi-major axis less than this number times the PSF.

  • ap_iso_interpolate_method (string, default 'lanczos') – Select method for flux interpolation on image, options are ‘lanczos’ and ‘bicubic’. Default is ‘lanczos’ with a window size of 3.

  • ap_iso_interpolate_window (int, default 3) – Window size for Lanczos interpolation, default is 3, meaning 3 pixels on either side of the sample point are used for interpolation.

  • ap_isoaverage_method (string, default 'median') – Select the method used to compute the averafge flux along an isophote. Choose from ‘mean’, ‘median’, and ‘mode’. In general, median is fast and robust to a few outliers. Mode is slow but robust to more outliers. Mean is fast and accurate in low S/N regimes where fluxes take on near integer values, but not robust to outliers. The mean should be used along with a mask to remove spurious objects such as foreground stars or galaxies, and should always be used with caution.

  • ap_isoclip (bool, default False) – Perform sigma clipping along extracted isophotes. Removes flux samples from an isophote that deviate significantly from the median. Several iterations of sigma clipping are performed until convergence or ap_isoclip_iterations iterations are reached. Sigma clipping is a useful substitute for masking objects, though careful masking is better. Also an aggressive sigma clip may bias results.

  • ap_isoclip_iterations (int, default None) – Maximum number of sigma clipping iterations to perform. The default is infinity, so the sigma clipping procedure repeats until convergence

  • ap_isoclip_nsigma (float, default 5) – Number of sigma above median to apply clipping. All values above (median + ap_isoclip_nsigma x sigma) are removed from the isophote.

  • ap_iso_measurecoefs (tuple, default None) – tuple indicating which fourier modes to extract along fitted isophotes. Most common is (4,), which identifies boxy/disky isophotes. Also common is (1,3), which identifies lopsided galaxies. The outputted values are computed as a_i = imag(F_i)/abs(F_0) and b_i = real(F_i)/abs(F_0) where F_i is a fourier coefficient. Not activated by default as it adds to computation time.

  • ap_plot_sbprof_ylim (tuple, default None) – Tuple with axes limits for the y-axis in the SB profile diagnostic plot. Be careful when using intensity units since this will change the ideal axis limits.

  • ap_plot_sbprof_xlim (tuple, default None) – Tuple with axes limits for the x-axis in the SB profile diagnostic plot.

  • ap_plot_sbprof_set_errscale (float, default None) – Float value by which to scale errorbars on the SB profile this makes them more visible in cases where the statistical errors are very small.

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘psf fwhm’

  • ‘center’

  • ‘init ellip’

  • ‘init pa’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'prof header': , # List object with strings giving the items in the header of the final SB profile (list)
     'prof units': , # dict object that links header strings to units (given as strings) for each variable (dict)
     'prof data': # dict object linking header strings to list objects containing the rows for a given variable (dict)
    
    }
    

autoprof.pipeline_steps.Isophote_Extract.Isophote_Extract_Photutils(IMG, results, options)[source]

Wrapper of photutils method for extracting SB profiles.

This simply gives users access to the photutils isophote extraction methods. The one exception is that SB values are taken as the median instead of the mean, as recomended in the photutils documentation. See: photutils for more information.

Parameters:
  • ap_zeropoint (float, default 22.5) – Photometric zero point. For converting flux to mag units.

  • ap_fluxunits (str, default "mag") – units for outputted photometry. Can either be “mag” for log units, or “intensity” for linear units.

  • ap_plot_sbprof_ylim (tuple, default None) – Tuple with axes limits for the y-axis in the SB profile diagnostic plot. Be careful when using intensity units since this will change the ideal axis limits.

  • ap_plot_sbprof_xlim (tuple, default None) – Tuple with axes limits for the x-axis in the SB profile diagnostic plot.

  • ap_plot_sbprof_set_errscale (float, default None) – Float value by which to scale errorbars on the SB profile this makes them more visible in cases where the statistical errors are very small.

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘psf fwhm’

  • ‘center’

  • ‘init R’ (optional)

  • ‘init ellip’ (optional)

  • ‘init pa’ (optional)

  • ‘fit R’ (optional)

  • ‘fit ellip’ (optional)

  • ‘fit pa’ (optional)

  • ‘fit photutils isolist’ (optional)

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'prof header': , # List object with strings giving the items in the header of the final SB profile (list)
     'prof units': , # dict object that links header strings to units (given as strings) for each variable (dict)
     'prof data': # dict object linking header strings to list objects containing the rows for a given variable (dict)
    
    }
    

pipeline_steps.Isophote_Fit module

autoprof.pipeline_steps.Isophote_Fit.Isophote_Fit_FFT_Robust(IMG, results, options)[source]

Fit elliptical isophotes to a galaxy image using FFT coefficients and regularization.

The isophotal fitting routine simultaneously optimizes a collection of elliptical isophotes by minimizing the 2nd FFT coefficient power, regularized for robustness. A series of isophotes are constructed which grow geometrically until they begin to reach the background level. Then the algorithm iteratively updates the position angle and ellipticity of each isophote individually for many rounds. Each round updates every isophote in a random order. Each round cycles between three options: optimizing position angle, ellipticity, or both. To optimize the parameters, 5 values (pa, ellip, or both) are randomly sampled and the “loss” is computed. The loss is a combination of the relative amplitude of the second FFT coefficient (compared to the median flux), and a regularization term. The regularization term penalizes adjacent isophotes for having different position angle or ellipticity (using the l1 norm). Thus, all the isophotes are coupled and tend to fit smoothly varying isophotes. When the optimization has completed three rounds without any isophotes updating, the profile is assumed to have converged.

An uncertainty for each ellipticity and position angle value is determined by repeatedly re-optimizing each ellipse with slight adjustments to it’s semi-major axis length (+- 5%). The standard deviation of the PA/ellipticity after repeated fitting gives the uncertainty.

Parameters:
  • ap_scale (float, default 0.2) – growth scale when fitting isophotes, not the same as ap_sample—scale.

  • ap_fit_limit (float, default 2) – noise level out to which to extend the fit in units of pixel background noise level. Default is 2, smaller values will end fitting further out in the galaxy image.

  • ap_regularize_scale (float, default 1) – scale factor to apply to regularization coupling factor between isophotes. Default of 1, larger values make smoother fits, smaller values give more chaotic fits.

  • ap_isofit_robustclip (float, default 0.15) – quantile of flux values at which to clip when extracting values along an isophote. Clipping outlier values (such as very bright stars) while fitting isophotes allows for robust computation of FFT coefficients along an isophote.

  • ap_isofit_losscoefs (tuple, default (2,)) – Tuple of FFT coefficients to use in optimization procedure. AutoProf will attemp to minimize the power in all listed FFT coefficients. Must be a tuple, not a list.

  • ap_isofit_superellipse (bool, default False) – If True, AutoProf will fit superellipses instead of regular ellipses. A superellipse is typically used to represent boxy/disky isophotes. The variable controlling the transition from a rectangle to an ellipse to a four-armed-star like shape is C. A value of C = 2 represents an ellipse and is the starting point of the optimization.

  • ap_isofit_fitcoefs (tuple, default None) – Tuple of FFT coefficients to use in fitting procedure. AutoProf will attemp to fit ellipses with these Fourier mode perturbations. Such perturbations allow for lopsided, boxy, disky, and other types of isophotes beyond straightforward ellipses. Must be a tuple, not a list. Note that AutoProf will first fit ellipses, then turn on the Fourier mode perturbations, thus the fitting time will always be longer.

  • ap_isofit_fitcoefs_FFTinit (bool, default False) – If True, the coefficients for the Fourier modes fitted from ap_isofit_fitcoefs will be initialized using an FFT decomposition along fitted elliptical isophotes. This can improve the fit result, though it is less stable and so users should examine the results after fitting.

  • ap_isofit_perturbscale_ellip (float, default 0.03) – Sampling scale for random adjustments to ellipticity made while optimizing isophotes. Smaller values will converge faster, but get stuck in local minima; larger values will escape local minima, but takes longer to converge.

  • ap_isofit_perturbscale_pa (float, default 0.06) – Sampling scale for random adjustments to position angle made while optimizing isophotes. Smaller values will converge faster, but get stuck in local minima; larger values will escape local minima, but takes longer to converge.

  • ap_isofit_iterlimitmax (int, default 300) – Maximum number of iterations (each iteration adjusts every isophote once) before automatically stopping optimization. For galaxies with lots of structure (ie detailed spiral arms) more iterations may be needed to fully fit the light distribution, but runtime will be longer.

  • ap_isofit_iterlimitmin (int, default 0) – Minimum number of iterations before optimization is allowed to stop.

  • ap_isofit_iterstopnochange (float, default 3) – Number of iterations with no updates to parameters before optimization procedure stops. Lower values will process galaxies faster, but may still be stuck in local minima, higher values are more likely to converge on the global minimum but can take a long time to run. Fractional values are allowed though not recomended.

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘psf fwhm’

  • ‘center’

  • ‘mask’ (optional)

  • ‘init ellip’

  • ‘init pa’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'fit ellip': , # array of ellipticity values (ndarray)
     'fit pa': , # array of PA values (ndarray)
     'fit R': , # array of semi-major axis values (ndarray)
     'fit ellip_err': , # optional, array of ellipticity error values (ndarray)
     'fit pa_err': , # optional, array of PA error values (ndarray)
     'fit C': , # optional, superellipse scale parameter (ndarray)
     'fit Fmodes': , # optional, fitted Fourier mode indices (tuple)
     'fit Fmode A*': , # optional, fitted Fourier mode amplitudes, * for each index (ndarray)
     'fit Fmode Phi*': , # optional, fitted Fourier mode phases, * for each index (ndarray)
     'auxfile fitlimit': # optional, auxfile message (string)
    
    }
    

autoprof.pipeline_steps.Isophote_Fit.Isophote_Fit_FFT_mean(IMG, results, options)[source]

Fit elliptical isophotes to a galaxy image using FFT coefficients and regularization.

Same as the standard isophote fitting routine, except uses less robust mean/std measures. This is only intended for low S/N data where pixels have low integer counts.

Parameters:
  • ap_scale (float, default 0.2) – growth scale when fitting isophotes, not the same as ap_sample—scale.

  • ap_fit_limit (float, default 2) – noise level out to which to extend the fit in units of pixel background noise level. Default is 2, smaller values will end fitting further out in the galaxy image.

  • ap_regularize_scale (float, default 1) – scale factor to apply to regularization coupling factor between isophotes. Default of 1, larger values make smoother fits, smaller values give more chaotic fits.

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘center’

  • ‘psf fwhm’

  • ‘init ellip’

  • ‘init pa’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'fit ellip': , # array of ellipticity values (ndarray)
     'fit pa': , # array of PA values (ndarray)
     'fit R': , # array of semi-major axis values (ndarray)
     'fit ellip_err': , # optional, array of ellipticity error values (ndarray)
     'fit pa_err': , # optional, array of PA error values (ndarray)
     'auxfile fitlimit': # optional, auxfile message (string)
    
    }
    

autoprof.pipeline_steps.Isophote_Fit.Isophote_Fit_FixedPhase(IMG, results, options)[source]

Simply applies fixed position angle and ellipticity at the initialization values.

Parameters:
  • ap_scale (float, default 0.2) – growth scale when fitting isophotes, not the same as ap_sample—scale.

  • ap_fit_limit (float, default 2) – noise level out to which to extend the fit in units of pixel background noise level. Default is 2, smaller values will end fitting further out in the galaxy image.

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘psf fwhm’

  • ‘center’

  • ‘mask’ (optional)

  • ‘init ellip’

  • ‘init pa’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'fit ellip': , # array of ellipticity values (ndarray)
     'fit pa': , # array of PA values (ndarray)
     'fit R': , # array of semi-major axis values (ndarray)
     'fit ellip_err': , # optional, array of ellipticity error values (ndarray)
     'fit pa_err': , # optional, array of PA error values (ndarray)
     'auxfile fitlimit': # optional, auxfile message (string)
    
    }
    

autoprof.pipeline_steps.Isophote_Fit.Isophote_Fit_Forced(IMG, results, options)[source]

Read previously fit PA/ellipticity profile.

Reads a .prof file and extracts the corresponding PA/ellipticity profile. The profile is extracted generically, so any csv file with columns for ‘R’, ‘pa’, ‘ellip’, and optionally ‘pa_e’ and ‘ellip_e’ will be able to create a forced fit. This can be used for testing purposes, such as selecting a specific isophote to extract or comparing AutoProf SB extraction methods with other softwares.

Parameters:

ap_forcing_profile (string, default None) – File path to .prof file providing forced photometry PA and ellip values to apply to ap_image_file (required for forced photometry)

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘center’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'fit ellip': , # array of ellipticity values (ndarray)
     'fit pa': , # array of PA values (ndarray)
     'fit R': , # array of semi-major axis values (ndarray)
     'fit ellip_err': , # optional, array of ellipticity error values (ndarray)
     'fit pa_err': , # optional, array of PA error values (ndarray)
    
    }
    

autoprof.pipeline_steps.Isophote_Fit.Photutils_Fit(IMG, results, options)[source]

Photutils elliptical isophote wrapper.

This simply gives users access to the photutils isophote fitting method. See: photutils for more information.

Notes

References:

  • ‘background’

  • ‘center’

  • ‘init R’

  • ‘init ellip’

  • ‘init pa’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'fit ellip': , # array of ellipticity values (ndarray)
     'fit pa': , # array of PA values (ndarray)
     'fit R': , # array of semi-major axis values (ndarray)
     'fit ellip_err': , # optional, array of ellipticity error values (ndarray)
     'fit pa_err': , # optional, array of PA error values (ndarray)
     'auxfile fitlimit': # optional, auxfile message (string)
    
    }
    

pipeline_steps.Isophote_Initialize module

autoprof.pipeline_steps.Isophote_Initialize.Isophote_Init_Forced(IMG, results, options)[source]

Read global elliptical isophote to a galaxy from an aux file.

Extracts global ellipse parameters from the corresponding aux file for a given .prof file.

Parameters:

ap_forcing_profile (string, default None) – File path to .prof file providing forced photometry PA and ellip values to apply to ap_image_file (required for forced photometry)

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘psf fwhm’

  • ‘center’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'init ellip': , # Ellipticity of the global fit (float)
     'init pa': ,# Position angle of the global fit (float)
     'init R': ,# Semi-major axis length of global fit (float)
     'auxfile initialize': # optional, message for aux file to record the global ellipticity and postition angle (string)
    
    }
    

autoprof.pipeline_steps.Isophote_Initialize.Isophote_Initialize(IMG, results, options)[source]

Fit global elliptical isophote to a galaxy image using FFT coefficients.

A global position angle and ellipticity are fit in a two step process. First, a series of circular isophotes are geometrically sampled until they approach the background level of the image. An FFT is taken for the flux values around each isophote and the phase of the second coefficient is used to determine a direction. The average direction for the outer isophotes is taken as the position angle of the galaxy. Second, with fixed position angle the ellipticity is optimized to minimize the amplitude of the second FFT coefficient relative to the median flux in an isophote.

To compute the error on position angle we use the standard deviation of the outer values from step one. For ellipticity the error is computed by optimizing the ellipticity for multiple isophotes within 1 PSF length of each other.

Parameters:
  • ap_fit_limit (float, default 2) – noise level out to which to extend the fit in units of pixel background noise level. Default is 2, smaller values will end fitting further out in the galaxy image.

  • ap_isoinit_pa_set (float, default None) – User set initial position angle in degrees, will override the calculation.

  • ap_isoinit_ellip_set (float, default None) – User set initial ellipticity (1 - b/a), will override the calculation.

  • ap_isoinit_R_set (float, default None) – User set initial semi-major axis length, will override the calculation.

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘psf fwhm’

  • ‘center’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'init ellip': , # Ellipticity of the global fit (float)
     'init pa': ,# Position angle of the global fit (float)
     'init R': ,# Semi-major axis length of global fit (float)
     'auxfile initialize': # optional, message for aux file to record the global ellipticity and postition angle (string)
    
    }
    

autoprof.pipeline_steps.Isophote_Initialize.Isophote_Initialize_mean(IMG, results, options)[source]

Fit global elliptical isophote to a galaxy image using FFT coefficients.

Same as the default isophote initialization routine, except uses mean/std measures for low S/N applications.

Parameters:

ap_fit_limit (float, default 2) – noise level out to which to extend the fit in units of pixel background noise level. Default is 2, smaller values will end fitting further out in the galaxy image.

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘psf fwhm’

  • ‘center’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'init ellip': , # Ellipticity of the global fit (float)
     'init pa': ,# Position angle of the global fit (float)
     'init R': ,# Semi-major axis length of global fit (float)
     'auxfile initialize': # optional, message for aux file to record the global ellipticity and postition angle (string)
    
    }
    

pipeline_steps.Mask module

autoprof.pipeline_steps.Mask.Bad_Pixel_Mask(IMG, results, options)[source]

Simple masking routine to clip pixels based on thresholds.

Creates a mask image using user provided limits on highest/lowest pixels values allowed. Also users can reject pixels with a specific value. This can be used on its own, or in combination with other masking routines. Multiple Mask calls with perform boolean-or operation.

Parameters:
  • ap_badpixel_high (float, default None) – flux value that corresponds to a saturated pixel or bad pixel flag, all values above ap_badpixel_high will be masked if using the Bad_Pixel_Mask pipeline method.

  • ap_badpixel_low (float, default None) – flux value that corresponds to a bad pixel flag, all values below ap_badpixel_low will be masked if using the Bad_Pixel_Mask pipeline method.

  • ap_badpixel_exact (float, default None) – flux value that corresponds to a precise bad pixel flag, all values equal to ap_badpixel_exact will be masked if using the Bad_Pixel_Mask pipeline method.

See also

ap_savemask

bool, default False indicates if the mask should be saved after fitting

Notes

References:

  • ‘mask’ (optional)

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'mask':  # 2d mask image with boolean datatype (ndarray)
    }
    

autoprof.pipeline_steps.Mask.Mask_Segmentation_Map(IMG, results, options)[source]

Reads the results from other masking routines into AutoProf.

Creates a mask from a supplied segmentation map. Such maps typically number each source with an integer. In such a case, AutoProf will check to see if the object center lands on one of these segments, if so it will zero out that source-id before converting the segmentation map into a mask. If the supplied image is just a 0, 1 mask then AutoProf will take it as is.

Parameters:

ap_mask_file (string, default None) – path to fits file which is a mask for the image. Must have the same dimensions as the main image.

See also

ap_savemask

bool, default False indicates if the mask should be saved after fitting

Notes

References:

  • ‘background’ (optional)

  • ‘background noise’ (optional)

  • ‘center’ (optional)

  • ‘mask’ (optional)

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'mask':  # 2d mask image with boolean datatype (ndarray)
    }
    

autoprof.pipeline_steps.Mask.Star_Mask(IMG, results, options)[source]

Masking routine which identifies stars and masks a region around them.

Using an edge detecting convolutional filter, sources are identified that are of similar scale as the PSF. These sources are masked with a region roughly 2 times the FWHM of the source.

See also

ap_savemask

bool, default False indicates if the mask should be saved after fitting

starfind

autoprofutils.SharedFunctions.StarFind()

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘psf fwhm’

  • ‘center’

  • ‘mask’ (optional)

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'mask':  # 2d mask image with boolean datatype (ndarray)
    }
    

autoprof.pipeline_steps.Mask.Star_Mask_IRAF(IMG, results, options)[source]

Masking routine which identifies stars and masks a region around them.

An IRAF star finder wrapper (from photutils) is applied to the image and then the identified sources are masked form the image. The size of the mask depends on the flux in the source roughly as sqrt(log(f)), thus an inverse of a Gaussian.

See also

ap_savemask

bool, default False indicates if the mask should be saved after fitting

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘psf fwhm’

  • ‘center’

  • ‘mask’ (optional)

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'mask':  # 2d mask image with boolean datatype (ndarray)
    }
    

pipeline_steps.PSF module

autoprof.pipeline_steps.PSF.PSF_Assumed(IMG, results, options)[source]

Most astronomical data is assumed to be nyquist sampled, thus we assume a PSF scale of 4.0 pix to speed things up. Note that AutoProf just uses the PSF FWHM to initialize some length scales on the image, accuracy is not very important for the PSF.

autoprof.pipeline_steps.PSF.PSF_IRAF(IMG, results, options)[source]

PSF routine which identifies stars and averages the FWHM.

Uses the photutil IRAF wrapper to identify stars in the image and computes the average FWHM.

Parameters:
  • ap_guess_psf (float, default None) – Initialization value for the PSF calculation in pixels. If not given, AutoProf will default with a guess of 1/ap_pixscale

  • ap_set_psf (float, default None) – force AutoProf to use this PSF value (in pixels) instead of calculating its own.

Notes

References:

  • ‘background’ (float)

  • ‘background noise’ (float)

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'psf fwhm':  # FWHM of the average PSF for the image
    }
    

autoprof.pipeline_steps.PSF.PSF_Image(IMG, results, options)[source]

PSF routine which identifies stars and averages the FWHM.

Constructs an averaged PSF image. Extracts a window of pixels around each identified star (+-10 PSF) and normalizes the flux total to 1. All extraced normalized stars are median stacked. The final PSF is saved as “<name>_psf.fits” and added to the results dictionary. Also calculates the PSF FWHM and adds it to the results dictionary. This method is currently very slow.

Parameters:
  • ap_guess_psf (float, default None) – Initialization value for the PSF calculation in pixels. If not given, AutoProf will default with a guess of 1/ap_pixscale

  • ap_set_psf (float, default None) – force AutoProf to use this PSF value (in pixels) instead of calculating its own.

Notes

References:

  • ‘background’

  • ‘background noise’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'psf fwhm':  # FWHM of the average PSF for the image
     'auxfile psf': # aux file message giving the PSF
     'psf img':   # image of the PSF as numpy array
    }
    

autoprof.pipeline_steps.PSF.PSF_StarFind(IMG, results, options)[source]

PSF routine which identifies stars and averages the FWHM.

The PSF method uses an edge finding convolution filter to identify candidate star pixels, then averages their FWHM. Randomly iterates through the pixels and searches for a local maximum. An FFT is used to identify non-circular star candidate (artifacts or galaxies) which may have been picked up by the edge finder. Circular apertures are placed around the star until half the central flux value is reached, This is recorded as the FWHM for that star. A collection of 50 stars are identified and the most circular (by FFT coefficients) half are kept, a median is taken as the image PSF.

Parameters:
  • ap_guess_psf (float, default None) – Initialization value for the PSF calculation in pixels. If not given, AutoProf will default with a guess of 1/ap_pixscale

  • ap_set_psf (float, default None) – force AutoProf to use this PSF value (in pixels) instead of calculating its own.

Notes

References:

  • ‘background’

  • ‘background noise’

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {'psf fwhm':  # FWHM of the average PSF for the image
    }
    

autoprof.pipeline_steps.PSF.PSF_deconvolve(IMG, results, options)[source]

routine which deconvolves the PSF from the primary image.

Performs Richardson-Lucy deconvolution on the primary galaxy image using the sci-kit image implementation (the user must have skimage in their python installation). This deconvolution procedure is more stable than standard FFT deconvolution. This method is currently very slow. If the user provides an image via ‘ap_psf_file’ then that will be taken as the psf and deconvolved from the image. If there is no file given, but ‘psf img’ exists in the results dictionary (ie from the ‘psf img’ pipeline step) then that will be used. If no other option is available, the ‘psf fwhm’ will be taken from the results dictionary and a PSF image will be constructed using a Gaussian of the given PSF out to 20 times the PSF size.

Parameters:
  • ap_psf_file (string, default None) – Optional argument. Path to PSF fits file. For best results the image should have an odd number of pixels with the PSF centered in the image.

  • ap_psf_deconvolution_iterations (int, default 50) – number of itterations of the Richardson-Lucy deconvolution algorithm to perform.

Notes

References:

  • ‘psf img’ (optional)

  • ‘psf fwhm’ (optional)

Returns:

  • IMG (ndarray) – deconvolved galaxy image

  • results (dict) –

    {}
    

pipeline_steps.Plotting_Steps module

autoprof.pipeline_steps.Plotting_Steps.Plot_Galaxy_Image(IMG, results, options)[source]

Generate a plain image of the galaxy

Plots an LSB image of the object without anything else drawn above it. Useful for inspecting images for spurious features. This step can be run at any point in the pipeline. It will take advantage of whatever information has been determined so far. So if it is the first pipeline step, it has little to work from and will simply plot the whole image, if it is run after the isophote initialization step then the plotted image will be cropped to focus on the galaxy.

Parameters:
  • ap_guess_center (dict, default None) –

    user provided starting point for center fitting. Center should be formatted as:

    {'x':float, 'y': float}
    

    , where the floats are the center coordinates in pixels. If not given, Autoprof will default to a guess of the image center.

  • ap_set_center (dict, default None) –

    user provided fixed center for rest of calculations. Center should be formatted as:

    {'x':float, 'y': float}
    

    , where the floats are the center coordinates in pixels. If not given, Autoprof will default to a guess of the image center.

Notes

References:

  • ‘background’

  • ‘background noise’

  • ‘center’ (optional)

  • ‘init R’ (optional)

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {}
    

pipeline_steps.Radial_Profiles module

autoprof.pipeline_steps.Radial_Profiles.Radial_Profiles(IMG, results, options)[source]

Extracts SB profiles along lines radiating from the galaxy center.

For some applications, such as examining edge on galaxies, it is beneficial to observe the structure in a disk as well as (or instead of) the average isophotal profile. This can done with radial profiles which sample along lines radiating form the galaxy center. These lines are by default placed on the 4 semi-axes of the galaxy. The lines are actually wedges with increasing width as a function of radius. This helps keep roughly constant S/N in the bins, allowing the profile to extend far into the outskirts of a galaxy. The user may increase the number of wedgest to extract more stucture from the galaxy, however at some point the wedges will begin to cross each other. AutoProf will warn the user when this happens, but will carry on anyway.

Parameters:
  • ap_radialprofiles_nwedges (int, default 4) – number of radial wedges to sample. Recommended choosing a power of 2.

  • ap_radialprofiles_width (float, default 15) – User set width of radial sampling wedges in degrees.

  • ap_radialprofiles_pa (float, default 0) – user set position angle at which to measure radial wedges relative to the global position angle, in degrees.

  • ap_radialprofiles_expwidth (bool, default False) – Tell AutoProf to use exponentially increasing widths for radial samples. In this case ap_radialprofiles_width corresponds to the final width of the radial sampling.

  • ap_radialprofiles_variable_pa (bool, default False) – Tell AutoProf to rotate radial sampling wedges with the position angle profile of the galaxy.

Notes

References:

  • ‘prof header’ (optional)

  • ‘prof units’ (optional)

  • ‘prof data’ (optional)

  • ‘mask’ (optional)

  • ‘background’

  • ‘center’

  • ‘init pa’ (optional)

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) – No results provided as this method writes its own profile

    {'prof header': , # Previously extracted SB profile, with extra columns appended for radial profiles (list)
     'prof units': , # Previously extracted SB profile, with extra units appended for radial profiles (dict)
     'prof data': # Previously extracted SB profile, with extra columns appended for radial profiles (dict)
    
    }
    

pipeline_steps.Slice_Profiles module

autoprof.pipeline_steps.Slice_Profiles.Slice_Profile(IMG, results, options)[source]

Extract a very basic SB profile along a line.

A line of pixels can be identified by the user in image coordinates to extract an SB profile. Primarily intended for diagnostic purposes, this allows users to see very specific pixels. While this tool can be used for examining the disk structure (such as for edge on galaxies), users will likely prefer the more powerful Axial_Profiles() and Radial_Profiles() methods for such analysis.

Parameters:
  • ap_slice_anchor (dict, default None) – Coordinates for the starting point of the slice as a dictionary formatted “{‘x’: x-coord, ‘y’: y-coord}” in pixel units.

  • ap_slice_pa (float, default None) – Position angle of the slice in degrees, counter-clockwise relative to the x-axis.

  • ap_slice_length (float, default None) – Length of the slice from anchor point in pixel units. By default, use init ellipse semi-major axis length

  • ap_slice_width (float, default 10) – Width of the slice in pixel units.

  • ap_slice_step (float, default None) – Distance between samples for the profile along the slice. By default use the PSF.

  • ap_isoaverage_method (string, default 'median') – Select the method used to compute the averafge flux along an isophote. Choose from ‘mean’, ‘median’, and ‘mode’. In general, median is fast and robust to a few outliers. Mode is slow but robust to more outliers. Mean is fast and accurate in low S/N regimes where fluxes take on near integer values, but not robust to outliers. The mean should be used along with a mask to remove spurious objects such as foreground stars or galaxies, and should always be used with caution.

  • ap_saveto (string, default None) – Directory in which to save profile

  • ap_name (string, default None) – Name of the current galaxy, used for making filenames.

  • ap_zeropoint (float, default 22.5) – Photometric zero point. For converting flux to mag units.

Notes

References:

  • ‘background’ (optional)

  • ‘background noise’ (optional)

  • ‘center’ (optional)

  • ‘init R’ (optional)

  • ‘init pa’ (optional)

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {}
    

pipeline_steps.Write_Fi module

autoprof.pipeline_steps.Write_Fi.WriteFi(IMG, results, options)[source]

Writes the galaxy image to disk.

pipeline_steps.Write_Prof module

autoprof.pipeline_steps.Write_Prof.WriteProf(IMG, results, options)[source]

Basic method to write SB profile to disk.

This step writes the results of the AutoProf pipeline analysis to a file. There are two files written, a .prof file containing the surface brightness profile and acompanying measurements, and a .aux file containing global results, messages, and setting used for the pipeline. The .prof file looks for specific keywords in the results dictionary: prof header, prof units, prof data, and prof format. There are the results from the isophotal fitting step. prof header gives the column names for the profile, prof units is a dictionary which gives the corresponding units for each column header key, prof data is a dictionary containing a list of values for each header key, and prof format is a dictionary which gives the python string format for values under each header key (for example ‘%.4f’ gives a number to 4 decimal places). The profile is written with comma (or a user specified delimiter) separation for each value, where each row corresponds to a given isophote at increasing semi-major axis values.

The .aux file has a less strict format than the .prof file. The first line records the date and time that the file was written, the second line gives the name of the object as specified by the user or the filename. The next lines are taken from the results dictionary, any result key with auxfile in the name is taken as a message for the .aux file and written (in alphabetical order by key) to the file. See the pipeline step output formats for the messages that are included in the .aux file. Finally, a record of the user specified options is included for reference.

Parameters:
  • ap_saveto (string, default None) – Directory in which to save profile

  • ap_name (string, default None) – Name of the current galaxy, used for making filenames.

  • ap_delimiter (string, default ',') – Delimiter to use between entries in the profile.

  • ap_profile_format (string, default 'csv') – Type of file format to use for profile. Can choose from [‘csv’, ‘fits’]

  • ap_savemask (bool, default False) – Save object mask fits file. This can create large files, depending on the size of the original image.

Notes

References:

  • ‘prof header’

  • ‘prof units’

  • ‘prof data’

  • ‘mask’ (optional)

Returns:

  • IMG (ndarray) – Unaltered galaxy image

  • results (dict) –

    {}
    

Module contents