Maps

Rampy offers the possiblity to analyse maps from Raman spectrometers using the rampy.maps module.

Line and 2D Maps saved in CSV or TXT format from Horiba and Renishaw spectrometers can be loaded, and various data treatments can be performed afterwards.

Below you will find the documentation of the rampy.maps module, and have a look at the example notebooks too for further examples of use: Example notebooks

class rampy.maps.maps(file, spectrometer_type='horiba', map_type='2D', despiking=False, neigh=4, threshold=3)

A class for treating maps of Raman spectra.

Parameters:
  • file (str) – Filename including path

  • spectrometer_type (str, optional, default="horiba") – Type of spectrometer, choose between “horiba” or “renishaw”

  • map_type (str, optional, default="2D") – Type of map, choose between “2D” or “1D”

  • despiking (bool, optional, default=False) – Whether to apply despiking to remove spikes from the spectra

  • neigh (int, optional, default=4) – Number of points around spikes to select for calculating average value for despiking

  • threshold (int, optional, default=3) – Multiplier of sigma (RMSE) for spike detection

Note

The class automatically flips the frequency axis if it’s decreasing to ensure it’s always increasing.

background(bir, method='poly', **kwargs)

Correct a background from the initial signal I on a map using rampy.baseline.

Parameters:
  • bir (ndarray) – Arrays of the background interpolation regions

  • method (str, optional, default="poly") – Method for baseline correction, see rampy.baseline documentation for available methods

  • **kwargs

    Additional parameters for rampy.baseline()

Returns:

None, but sets self.I_background and self.I_corrected attributes

normalise(y, method='intensity')

Normalise the spectra to their max intensity, their area, or min-max normalisation.

Parameters:
  • y (ndarray) – The intensities to normalise (e.g., self.I_corrected)

  • method (str, optional, default="intensity") – Method used, choose between “area”, “intensity”, “minmax”

Returns:

None, but sets self.I_normalised attribute

smooth(y, method='whittaker', **kwargs)

Uses the smooth function of rampy to smooth the signals.

Parameters:
  • y (ndarray) – The intensities to smooth (e.g., self.I_corrected)

  • method (str, optional, default="whittaker") – Method for smoothing the signal

  • **kwargs

    Additional parameters for the smoothing method

Returns:

None, but sets self.y_smoothed attribute

centroid(y, region_to_investigate)

Calculate the centroid in a given region of interest.

Parameters:
  • y (ndarray) – The intensities to analyze (e.g., self.I_normalised)

  • region_to_investigate (1x2 array) – The x values of regions where the centroid will be measured

Returns:

None, but sets self.centroid_position attribute

intensity(y, region_to_investigate)

Get the maximum intensity in the region to investigate.

Parameters:
  • y (ndarray) – The intensities to consider (e.g., self.I_normalised)

  • region_to_investigate (1x2 array) – The x values of regions where the intensity will be measured

Returns:

None, but sets self.I_max attribute

area(y, region_to_investigate)

Get the area under the curve in the region to investigate.

Parameters:
  • y (ndarray) – The intensities to consider (e.g., self.I_normalised)

  • region_to_investigate (1x2 array) – The x values of regions where the area will be measured

Returns:

None, but sets self.A attribute

intensity_ratio(y, region_to_investigate)

Get the intensity ratio between two regions of interest.

Parameters:
  • y (ndarray) – The intensities to consider (e.g., self.I_normalised)

  • region_to_investigate (2x2 array) – The x values of regions where the intensity ratios will be measured

Returns:

None, but sets self.I_ratio attribute

area_ratio(y, region_to_investigate)

Get the area ratio between two regions of interest.

Parameters:
  • y (ndarray) – The intensities to consider (e.g., self.I_normalised)

  • region_to_investigate (2x2 array) – The x values of regions where the areas will be measured

Returns:

None, but sets self.A_ratio attribute

rampy.maps.read_renishaw(file)

Read Renishaw csv maps.

Parameters:

file (str) – Filename including path

Returns:

Tuple containing (X, Y, lambdas, intensities)

Return type:

tuple

  • X: m by n array of X positions

  • Y: m by n array of Y positions

  • lambdas: m by n array of Raman shifts

  • intensities: m by n array of intensities

rampy.maps.read_horiba(file, map_type='2D')

Read Horiba csv maps (1D, 2D).

Parameters:
  • file (str) – Filename including path

  • map_type (str, optional, default="2D") – 1D map (line) or 2D map

Returns:

For 2D maps: Tuple containing (X, Y, lambdas, intensities)

Returns:

For 1D maps: Tuple containing (X, lambdas, intensities)

Return type:

tuple

Raises:

ValueError – If map_type is not ‘1D’ or ‘2D’

rampy.maps.peak(X, Y, lambdas, intensities, function, Xrange, amp, Xmean, sigma, y0, A)

Fit peaks in a map. Work in progress.

Parameters:
  • X (ndarray) – X positions

  • Y (ndarray) – Y positions

  • lambdas (ndarray) – Raman shifts

  • intensities (ndarray) – Intensities

  • function (str) – Type of function to fit (‘gauss’ or ‘lorenz’)

  • Xrange (list or ndarray) – Range of X values to fit

  • amp (float) – Initial amplitude

  • Xmean (float) – Initial mean position

  • sigma (float) – Initial width

  • y0 (float) – Initial y-offset

  • A (float) – Initial area

Returns:

Tuple containing (results, rmap)

Return type:

tuple