Calculation Utilities - leahghartman/GaussBean GitHub Wiki

This section covers all functions in the calculation utilities module (so, all of the code contained in calc_utils.py).

Often when writing the functions throughout this package, I allowed for users to input either image arrays OR image paths. Therefore, in some of the explanations below, you might see the word OPTIONAL next to the inputs "imgar" and "imgpath", but you HAVE to put in one or the other, you can't just put in nothing.

Note: I wouldn't necessarily copy and paste any of the code here, this is simply for explanation purposes. If you want examples of code that will actually run, look in the examples folder under the "Code" tab above.

Contents:


check_array

check_array(imgpath, imgar)

The function "check_array" is used for "under-the-hood" operations as an easy way to check whether the user has input an array or a path (string) into a specific function. It then returns an array regardless of what the user has input. This is not intended to be used or implemented by users.

Parameters:

  • imgpath : string : Path to a given image/dataset/location
  • imgar : array : The image array that the user wants to use.

Returns:

  • ar : array : Image in the form of an array.

find_FWHM

find_FWHM(imgdata, fwhmrange=1.3)

The function "find_FWHM" returns the Full-Width at Half-Maximum of a set of data. This function finds the most prominent peak among the dataset, then uses the curve corresponding with that peak to find the FWHM.

Parameters:

  • imgdata : array : Data corresponding to a singular axis or a set of data that the user wants to find the FWHM of using the most prominent peak in the data.
  • fwhm_range (OPTIONAL) : float : Number which specifies the range the algorithm should look around the maximum of the data to find the "most prominent" peak to use when calculating the FWHM.

Returns:

  • fwhm : integer : Full-Width at Half-Maximum of the set of data.

find_centroid

find_centroid(imgpath='', imgar=[])

The function "find_centroid" returns x- and y-coordinate of the centroid based on the MAXIMUM INTENSITY of the image in each transverse dimension.

Parameters:

  • imgpath (OPTIONAL) : string : The path to the image the user wants to use.
  • imgar (OPTIONAL) : array : The image array that the user wants to use.

Returns:

  • centx : float : x-coordinate of centroid in given image.
  • centy : float : y-coordinate of centroid in given image.

find_proj_x

find_proj_x(imgpath='', imgar=[])

The function "find_proj_x" returns the projection of an image along the x-axis.

Parameters:

  • imgpath (OPTIONAL) : string : The path to the image that the user wants to use.
  • imgar (OPTIONAL) : array : The image array that the user wants to use.

Returns:

  • proj : array : Projection along x-axis.

find_proj_y

find_proj_y(imgpath='', imgar=[])

The function "find_proj_y" returns the projection of an image along the y-axis.

Parameters:

  • imgpath (OPTIONAL) : string : The path to the image that the user wants to use.
  • imgar (OPTIONAL) : array : The image array that the user wants to use.

Returns:

  • proj : array : Projection along y-axis.

find_line_x

find_line_x(ypixel, toavg=0, imgpath='', imgar=[])

The function "find_line_x" returns the lineout of an image that the user specifies and, if the user wants, averages (or finds the projection of) multiple lineouts.

Parameters:

  • ypixel : integer : Specifies at what ROW the user wants to take the lineout along the image in pixels.
  • toavg (OPTIONAL) : integer : Specifies the number of lineouts on EACH SIDE of the original lineout the user wants to create a projection with.
  • imgpath (OPTIONAL) : string : The path to the image that the user wants to use.
  • imgar (OPTIONAL) : array : The image array that the user wants to use.

Returns:

  • lineout : array : x lineout specified by the user.

find_line_y

find_line_y(xpixel, toavg=0, imgpath='', imgar=[])

The function "find_line_y" returns the lineout of an image that the user specifies and, if the user wants, averages (or finds the projection of) multiple lineouts.

Parameters:

  • xpixel : integer : Specifies at what COLUMN the user wants to take the lineout along the image in pixels.
  • toavg (OPTIONAL) : integer : Specifies the number of lineouts on EACH SIDE of the original lineout the user wants to create a projection with
  • imgpath (OPTIONAL) : string : The path to the image that the user wants to use.
  • imgar (OPTIONAL) : array : The image array that the user wants to use.

Returns:

  • lineout : array : y lineout specified by the user.

⚠️ **GitHub.com Fallback** ⚠️