horiba_raman_ccoverstreet package
Submodules
horiba_raman_ccoverstreet.mapping module
- class horiba_raman_ccoverstreet.mapping.RamanImage(img: <module 'PIL.Image' from '/home/docs/checkouts/readthedocs.org/user_builds/horiba-raman/envs/latest/lib/python3.12/site-packages/PIL/Image.py'>, extent: <built-in function array>)
Bases:
object- extent: array
- img: <module 'PIL.Image' from '/home/docs/checkouts/readthedocs.org/user_builds/horiba-raman/envs/latest/lib/python3.12/site-packages/PIL/Image.py'>
- class horiba_raman_ccoverstreet.mapping.RamanMapData(shift: array, pos: array, counts: array, dim: array, center: array, rotation: float, extent: array)
Bases:
objectHolds spectral data with positions, rotations, and extent
- center: array
- counts: array
- dim: array
- extent: array
- pos: array
- rotation: float
- shift: array
- horiba_raman_ccoverstreet.mapping.determine_dim_from_pos(pos)
Use map positions to calculate rows and columns
- Parameters:
- poslist[np.array]
List of positions (x,y) for collected spectra
- Returns:
- dimensionsnp.array
Dimensions (row, col) of the map
- horiba_raman_ccoverstreet.mapping.extract_maxes_from_range(shift, counts, shift_min, shift_max, normalize=False)
Returns all maxes for a given Raman shift range. Wrapper function for extract_max_from_range
- Parameters:
- shift
Raman shift array
- counts
2D array of count data for map spectra
- shift_min
Lower bound for Raman shift
- shift_max
Upper bound for Raman shift
- normalize
Optional argument to normalize extracted max value to the maximum of the spectrum
- Returns:
- maxes
Array of extracted maximums
- horiba_raman_ccoverstreet.mapping.parse_image_comb(bmp_filename, txt_filename)
Returns PIL Image object with corresponding extends from .txt version of the image
- Parameters:
- bmp_filename
Filename of the .bmp file taken from the LabSpec6 video feed
- txt_filename
Filename of the .txt file taken from the LabSpec6 video feed
- Returns:
- raman_imageRamanImage
- horiba_raman_ccoverstreet.mapping.parse_image_txt(filename)
Parses the gray-scale image saved in .txt format as saved from the “Video” tab in LabSpec6
- Parameters:
- filename
Path to txt file containing gray-scale image data and X/Y positions of pixels
- Returns:
- x
Numpy array (M) of x pixel positions
- y
Numpy array (M) of y pixel positions
- intensity
Numpy array (MxN) of gray-scale intensity values
- horiba_raman_ccoverstreet.mapping.parse_l6m_txt(filename)
Parse the txt version of the l6m file and return a RamanMapData object
- Parameters:
- filename
Filename of the txt version of the l6m file
- Returns:
- map_data: RamanMapData
- horiba_raman_ccoverstreet.mapping.quickplot_map(l6m_txt, img_bmp, img_txt, shift_min, shift_max, normalize=False, alpha=0.5)
Generate a quick representation of map data
- Parameters:
- l6m_txtstr
Filename for txt version of the l6m file
- img_bmpstr
Filename for bmp version of camera view
- img_txtstr
Filename for txt version of camera view
- shift_minfloat
Left bound for maximum value search
- shift_maxfloat
Right bound for maximum value search
- normalizebool
Normalize extracted maximum value for spectra by maximum of spectra
- alphafloat
Alpha value for imshow opacity of map overlay
horiba_raman_ccoverstreet.old_mapping module
- horiba_raman_ccoverstreet.old_mapping.determine_rectangular_map_dim(pos)
Guesses the dimensions of a set of positions assuming the map is rectangular
Params: - pos: 2d array with each row corresponding to an (X,Y) spectral position
Returns: - tuple (M, N) containig the shape of the rectangular map
- horiba_raman_ccoverstreet.old_mapping.extra_spectra_to_files(filename, dirname='extracted-spectra')
Extracts all raman spectra to a subdirectory from the .txt version of the l6m map file. The spatial position of spectra is included in extracted filename.
Params: - filename: path to txt file version of l6m file
- horiba_raman_ccoverstreet.old_mapping.extract_extent_from_pos_rect(pos, dim)
Extracts the extents from a given set of positions assuming rectangular grid
Params: - pos: 2d array with each row correspodning to an (X,Y) spectral position - dim: Dimensions of the rectangular grid
Returns: - tuple of (left, right, bottom, top)
- horiba_raman_ccoverstreet.old_mapping.extract_max_from_range(x, y, x_min, x_max, normalize=False)
Returns maximum y-value from a given x-range
Useful for phase mapping where Raman intensity from a certain spectral region can be overlayed onto a microscope image
Params: - x: x-values - y: y-values - x_min: lower x-bound for max search - x_max: upper x-bound for max search - normalize: Optional argument to normal the maximum value to the maximum of the spectra
- horiba_raman_ccoverstreet.old_mapping.extract_maxes_from_range(shift, counts, shift_min, shift_max, normalize=False)
Returns all maxes for a given Raman shift range. Wrapper function for extract_max_from_range
Params: - shift: Raman shift array - counts: 2D array of count data for map spectra - shift_min: lower bound for Raman shift - shift_max: upper bound for Raman shift - normalize: Optional argument to normalize extracted max value to the maximum of the spectrum
Returns: - Array of extracted maximums
- horiba_raman_ccoverstreet.old_mapping.parse_data_txt(filename)
Parses the .txt version of the l6m file when saving in the browser tab or map tab with the spectral window highlighted
Params: - filename: path to txt file version of l6m file
Returns: - 1D array containing Raman shift (cm^-1) bins - 2D array containing (x, y) positions - 2D array with each row containing the counts for a given position
- horiba_raman_ccoverstreet.old_mapping.parse_image_comb(bmp_filename, txt_filename)
Returns PIL Image object with corresponding extends from .txt version of the image
Params: - bmp_filename: Filename of the .bmp file taken from the LabSpec6 video feed - txt_filename: Filename of the .txt file taken from the LabSpec7 video feed
Returns: - img: PIL Image object for use with matplotlib.pyplot.imshow - extent: Extents for use with matplotlib.pyplot.imshow
- horiba_raman_ccoverstreet.old_mapping.parse_image_txt(filename)
Parses the gray-scale image saved in .txt format as saved from the “Video” tab in LabSpec6
Params: - filename: path to txt file containing gray-scale image data and X/Y positions of pixels
Returns: - Numpy array (M) of x pixel positions - Numpy array (M) of y pixel positions - Numpy array (MxN) of gray-scale intensity values
- horiba_raman_ccoverstreet.old_mapping.quickplot_rect_map(l6m_txt, img_bmp, img_txt, shift_min, shift_max, normalize=False)
Creates a quick matplotlib figure heatmap using provided shift_min and shift_max
Params: - l6m_text: text version of the LabSpec6 map file - img_bmp: bitmap image of the camera view - img_txt: text version of the camera view - shift_min: minimum Raman shift (left bound) for finding maximum - shift_max: maximum Raman shift (right bound) for finding maximum - normalize: should max value extracted be normalized to maximum of spectrum?