MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: spectra

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61773] Re: [mg61746] spectra
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Sat, 29 Oct 2005 01:32:40 -0400 (EDT)
  • References: <200510280725.DAA08688@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Oct 28, 2005, at 3:25 AM, Mars J <jmars at sun.ac.za> wrote:

> Hi members
> I have spectra I need to quanitify asap. Need a mathematica routine  
> that
> will enable me to determine the respective areas of the peaks.
> Any suggestions.

Assuming the spectra are one dimensional lists one strategy is to  
split the list into regions that are greater than a threshold, remove  
the regions less than the threshold and then sum the remaining  
sublists eg.

Plus@@@Select[Split[spectrum,#2>threshold&&#1>threshold&],First[#] 
 >threshold&]

Of course you probably want to know the regions to which the sums  
correspond, the following will return the number of points to the  
beginning of the list of each region after the list has been split.

Most[FoldList[#1+Length[#2]&,0,splitspectrum]]

Putting the two lists together then we can get the areas of the peaks  
and the position of the first point in the peak:

splitSpectrum[spectrum_,threshold_]:=Select[Split 
[spectrum,#2>threshold&&#1>threshold&],First[#]>threshold&]

getPositions[splitspectrum_]:=Most[FoldList[#1+Length[#2]&, 
0,splitspectrum]]

integratePeaks[spectrum_,threshold_]:=Block[{ss=splitSpectrum 
[spectrum,threshold],pos},pos=getPositions[ss];{#[[1]],Plus@@#[[2]]}&/ 
@Select[Transpose[{pos,ss}],First[#[[2]]]>threshold&]]

Regards,

Ssezi



  • References:
    • spectra
      • From: "Mars J <jmars@sun.ac.za>" <jmars@sun.ac.za>
  • Prev by Date: Re: Still bug in Random
  • Next by Date: New LinkageDesigner application for mechanical design with Mathematica
  • Previous by thread: Re: spectra
  • Next by thread: Integration over polytop