spym.process package

Submodules

spym.process.filters module

class spym.process.filters.Filters(spym_instance)[source]

Bases: object

Filters.

destripe(**kwargs)[source]

Find and remove scan stripes by averaging neighbourhood lines.

Parameters:
  • min_length – only scars that are as long or longer than this value (in pixels) will be marked.

  • hard_threshold – the minimum difference of the value from the neighbouring upper and lower lines to be considered a defect.

  • soft_threshold – values differing at least this much do not form defects themselves, but they are attached to defects obtained from the hard threshold if they touch one.

  • sign – whether mark stripes with positive values, negative values or both.

  • rel_threshold – the minimum difference of the value from the neighbouring upper and lower lines to be considered a defect (in physical values). Overwrite hard_threshold.

Returns:

destriped 2d array.

gauss(**kwargs)[source]

Apply Gaussian smoothing filter.

Parameters:

size – size of the filter in pixels.

mean(**kwargs)[source]

Apply mean smoothing filter.

Parameters:

size – size of the filter in pixels.

median(**kwargs)[source]

Apply median smoothing filter.

Parameters:

size – size of the filter in pixels.

sharpen(**kwargs)[source]

Apply a sharpening filter.

Parameters:
  • size – size of the filter in pixels.

  • alpha – weight.

spym.process.filters.destripe(image, min_length=20, hard_threshold=0.4, soft_threshold=0.2, sign='positive', rel_threshold=None)[source]

Find and remove scan stripes by averaging neighbourhood lines.

Parameters:
  • image – 2d numpy array.

  • min_length – only scars that are as long or longer than this value (in pixels) will be marked.

  • hard_threshold – the minimum difference of the value from the neighbouring upper and lower lines to be considered a defect.

  • soft_threshold – values differing at least this much do not form defects themselves, but they are attached to defects obtained from the hard threshold if they touch one.

  • sign – whether mark stripes with positive values, negative values or both.

  • rel_threshold – the minimum difference of the value from the neighbouring upper and lower lines to be considered a defect (in physical values). Overwrite hard_threshold.

Returns:

destriped 2d array.

spym.process.filters.gauss(image, size=3)[source]

Apply Gaussian smoothing filter.

Parameters:
  • image – numpy array.

  • size – size of the filter in pixels.

Returns:

filtered numpy array.

spym.process.filters.mean(image, size=3)[source]

Apply mean smoothing filter.

Parameters:
  • image – numpy array.

  • size – size of the filter in pixels.

Returns:

filtered numpy array.

spym.process.filters.median(image, size=3)[source]

Apply median smoothing filter.

Parameters:
  • image – numpy array.

  • size – size of the filter in pixels.

Returns:

filtered numpy array.

spym.process.filters.sharpen(image, size=3, alpha=30)[source]

Apply a sharpening filter.

Parameters:
  • image – numpy array.

  • size – size of the filter in pixels.

  • alpha – weight.

Returns:

filtered numpy array.

spym.process.level module

class spym.process.level.Level(spym_instance)[source]

Bases: object

Level.

align(**kwargs)[source]

Align rows.

Parameters:
  • baseline – defines how baselines are estimated; ‘mean’ (default), ‘median’, ‘poly’.

  • axis – axis along wich calculate the baselines.

  • poly_degree – polnomial degree if baseline=’poly’.

fixzero(**kwargs)[source]

Add a constant to all the data to move the minimum (or the mean value) to zero.

Parameters:

to_mean – bool, optional. If true move mean value to zero, if false move mimimum to zero (default).

plane(**kwargs)[source]

Corrects for sample tilting by subtraction of a plane.

spym.process.level.align(image, baseline='mean', axis=1, poly_degree=2)[source]

Align rows.

Parameters:
  • image – 2d numpy array.

  • baseline – defines how baselines are estimated; ‘mean’ (default), ‘median’, ‘poly’.

  • axis – axis along wich calculate the baselines.

  • poly_degree – polnomial degree if baseline=’poly’.

Returns:

corrected 2d numpy array.

spym.process.level.fixzero(image, to_mean=False)[source]

Add a constant to all the data to move the minimum (or the mean value) to zero.

Parameters:
  • image – numpy array.

  • to_mean – bool, optional. If true move mean value to zero, if false move mimimum to zero (default).

Returns:

numpy array.

spym.process.level.plane(image)[source]

Corrects for image tilting by subtraction of a plane.

Parameters:

image – 2d numpy array.

Returns:

flattened image as 2d numpy array.

Module contents