Post

SpecDataPoint

The basic mass spectrum data point, an m/z and intensity pair.


Remarks

The basic mass spectrum data point: an m/z and intensity pair. This is the point type of Spectrum.


Constructors

SyntaxDescription
SpecDataPoint(double mz = 0, double intensity = 0)Creates a data point, with both values defaulting to zero.

Properties

IdentifierTypeDescription
MzdoubleThe mass to charge ratio (m/z) value for this data point.
IntensitydoubleThe intensity value for this data point.

Methods

MethodReturnsDescription
CompareTo(SpecDataPoint x)intOrders data points by m/z alone. Two points at the same m/z compare as equal.
Read(BinaryReader reader)voidReads the m/z then the intensity from the stream, each as a double.
Write(BinaryWriter writer)voidWrites the m/z then the intensity to the stream, each as a double.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using Nova.Data;

SpecDataPoint[] peaks =
{
  new SpecDataPoint(600.30, 2000.0),
  new SpecDataPoint(445.12, 10523.0),
  new SpecDataPoint(522.77, 850.0)
};

// IComparable orders by Mz, so no comparer is needed.
Array.Sort(peaks);

foreach (SpecDataPoint peak in peaks)
{
  Console.WriteLine(peak.Mz);
}
This post is licensed under CC BY 4.0 by the author.

Trending Tags