Average of alternating injections

Hello

I have a question 

Haw can I calculate the average of peak area for alternating injections 

Parents Reply
  • Hello,

     

    Is there something in common between the injections that you want to average(sample name, vial position, label, ect.) Below is a CC example that averages peak areas for identified peaks for all injections in the same vial.

     

    CurrentSequence.AllIdentifiedPeaks.Where(function (x) x.Compound_Name = CurrentPeakOrGroup.Compound_Name).Where(function (x) x.Injection.Sample.Sample_VialNumber = CurrentInjection.Sample.Sample_VialNumber).Select(function(x) x.Peak_Area).Average

     

    Marty Adams

Children
  • Hello,

     

    This CC would average the current injection with the next by Sample_OrderNumber in the result set. This would be a more generic way to get the average. 

     

    CurrentSequence.AllIdentifiedPeaks.Where(function (x) x.Compound_Name = CurrentPeakOrGroup.Compound_Name).Where(function(x) x.Injection.Sample.Sample_OrderNumber = CurrentSample.Sample_OrderNumber Or x.Injection.Sample.Sample_OrderNumber = (CurrentSample.Sample_OrderNumber +1)).Select(function(x) x.Peak_Area).Average

     

Was this helpful?