예제 #1
0
        /// <summary>
        /// Returns a RetentionTimeValues which is the result of merging the passed in set of values.
        /// The returned merge things will have a start and end time which encompasses all of the values.
        /// The RetentionTime and Fwhm will be set from the RetentionTimeValues with the greatest Height.
        /// </summary>
        public static RetentionTimeValues Merge(params RetentionTimeValues[] values)
        {
            RetentionTimeValues best = null;

            foreach (var value in values)
            {
                if (value == null)
                {
                    continue;
                }

                if (best == null || value.Height > best.Height)
                {
                    best = value;
                }

                if (best.StartRetentionTime > value.StartRetentionTime ||
                    best.EndRetentionTime < value.EndRetentionTime)
                {
                    best = ChangeProp(ImClone(best), im =>
                    {
                        im.StartRetentionTime = Math.Min(best.StartRetentionTime, value.StartRetentionTime);
                        im.EndRetentionTime   = Math.Max(best.EndRetentionTime, value.EndRetentionTime);
                    });
                }
            }

            return(best);
        }
 protected RetentionTimeValues? ScaleRetentionTimeValues(ChromFileInfoId chromFileInfoId, RetentionTimeValues? retentionTimeValues)
 {
     if (!retentionTimeValues.HasValue)
     {
         return null;
     }
     if (null == RetentionTimeTransformOp)
     {
         return retentionTimeValues;
     }
     IRegressionFunction regressionFunction;
     if (!RetentionTimeTransformOp.TryGetRegressionFunction(chromFileInfoId, out regressionFunction))
     {
         return null;
     }
     return retentionTimeValues.Value.Scale(regressionFunction);
 }