aosss.basic package

Submodules

aosss.basic.conversion module

Basic routines, they don’t use anything from parent module

aosss.basic.conversion.sparse_cube_to_colors(scube, visible_range=None, flag_scale=False, method=0)

Returns a [nY, nX, 3] red-green-blue (0.-1.) matrix

Parameters:
  • scube
  • visible_range – if passed, the true human visible range will be affine-transformed to visible_range in order to use the red-to-blue scale to paint the pixels
  • flag_scale – whether to scale the luminosities proportionally the weight for each spectra will be the area under the flux
  • method – see aosss.physics.spectrum_to_rgb()

aosss.basic.maths module

Low-level maths def’s

aosss.basic.maths.bc_rubber(vx)

Convex Polygonal Line baseline correction

Parameters:vx – vector

Returns: vx-rubberband(vx)

aosss.basic.maths.rubberband(vx)

Convex polygonal line (aka rubberband)

Parameters:vx – 1-D numpy array

Returns: the rubberband: a 1-D numpy array with same shape as vx

This function stretches a polygonal line from below vx. The vertices of this multi-segment line will touch troughs of vx without crossing vx

This was inspired on – but is not equivalent to – OPUS SB_Rubberband baseline correction [1]. However, this one is parameterless, whereas OPUS RBBC asks for a number of points.

References

[1] Bruker Optik GmbH, OPUS 5 Reference Manual. Ettlingen: Bruker, 2004.

aosss.basic.maths.poly_baseline(flux, order, epsilon=None, maxit=None)

” Polynomial baseline

Parameters:
  • flux – np 1D array (“flux”)
  • order – polynomial order
  • epsilon – tolerance to stop iterations. If zero or no value given, will default to sqrt(1/30*num_points)
  • maxit – if informed, will restrict the maximum number of iterations to this value

Returns: the baseline vector

Reference: Beier BD, Berger AJ. Method for automated background subtraction from Raman spectra containing known contaminants. The Analyst. 2009; 134(6):1198-202. Available at: http://www.ncbi.nlm.nih.gov/pubmed/19475148.

Converted from MATLAB (IRootLab)

aosss.basic.misc module

aosss.basic.misc.compile_simids(specs)

Compiles a list of simulation IDs (e.g., ‘C000793’) from a sequence of specifications

Parameters:specs

[spec0, spec1, ...], where each element may be:

  • a number (convertible to int), or
  • a range such as ‘1000-1010’ (string)

Returns: list of strings starting with “C”

Module contents