public Peak1DArray ReadSpectrumPeaks(string spectrumID) { RaiseDisposed(); try { int sampleIndex, experimentIndex, scanIndex; Parse(spectrumID, out sampleIndex, out experimentIndex, out scanIndex); using (MassSpectrometerSample sample = batch.GetSample(sampleIndex).MassSpectrometerSample) using (MSExperiment msExp = sample.GetMSExperiment(experimentIndex)) { Clearcore2.Data.MassSpectrum ms = msExp.GetMassSpectrum(scanIndex); Peak1DArray pa = new Peak1DArray( ms.NumDataPoints, BinaryDataCompressionType.ZLib, BinaryDataType.Float32, BinaryDataType.Float64); for (int i = 0; i < ms.NumDataPoints; i++) { pa.Peaks[i] = new Peak1D(ms.GetYValue(i), ms.GetXValue(i)); } return(pa); } } catch (Exception ex) { throw new MzLiteIOException(ex.Message, ex); } }
private static IEnumerable <Peak1D> Yield(Clearcore2.Data.MassSpectrum wiffSpectrum) { for (int i = 0; i < wiffSpectrum.NumDataPoints; i++) { yield return(new Peak1D( wiffSpectrum.GetYValue(i), wiffSpectrum.GetXValue(i))); } }
public Peak1D this[int idx] { get { if (idx < 0 || idx >= Length) { throw new IndexOutOfRangeException(); } return(new Peak1D( wiffSpectrum.GetYValue(idx), wiffSpectrum.GetXValue(idx))); } }