The present invention relates to a smoothing process for data that is acquired at specific intervals, such as measurement data that is acquired by a detector of an analysis device, for example.
A detector that is used in a liquid chromatograph, a gas chromatograph or the like, for example, obtains signal intensity for each specific period of time in a form of numerical data, and a chromatogram of a sample is obtained by graphing the numerical data. Numerical data of a signal obtained by the detector includes various noises, and to accurately grasp a trend of a signal waveform, a smoothing process is often performed to smooth the numerical data and to reduce an influence of the noise (for example, see Patent Document 1).
A smoothing process for such discrete data often uses a method of calculating a smoothed value for one point by performing convolutional operation on neighboring data on both sides of the point and a weight function. As the weight function, there are various functions such as a simple average function and a Gaussian function. As a similar method, there are, for example, a method of determining the smoothed value by approximating neighborhood data by a polynomial (Savitzky-Golay method), and an adaptive smoothing method.
Patent Document 1: Japanese Patent Laid-open Publication No. 2006-242750
In the case where data includes a baseline and a peak, the number of pieces of neighboring data on both sides to be used for smoothing (hereinafter “smoothing width”) has to have a smoothing width sufficient to suppress a noise component near the baseline. Normally, the smoothing width is fixed as a smoothing target range, and thus, if a smoothing process is performed on a peak with a width close to the smoothing width or on data at a peak portion with a width narrower than the smoothing width, distortion is caused in data near a peak apex (i.e., value becomes smaller than original data). The distortion affects calculation of a peak height or a peak area, and also, if peaks are close to each other, the peaks are possibly prevented from being separated from each other. That is, with a conventional smoothing method, a problem is sometimes caused with respect to reproducibility of data depending also on the type of the data.
Accordingly, the present invention aims to provide a data smoothing method which achieves improved reproducibility than conventional methods.
A data smoothing method according to the present invention is a data smoothing method for smoothing numerical data acquired at a plurality of data acquisition points or data based on the numerical data, by using numerical data at data acquisition points present in a smoothing width including a data acquisition point at which respective numerical data is acquired or data based on the numerical data.
The data smoothing method includes
a standard error calculation step of calculating a standard error of numerical data at each data acquisition point or data based on the numerical data;
a smoothing width determination step, performed after the standard error calculation step, of determining the smoothing width for each of the data acquisition points based on the standard error of the numerical data at each of the data acquisition points or the data based on the numerical data, in such away that the smoothing width becomes narrower for a data acquisition point for which the standard error of the numerical data or the data based on the numerical error is greater; and
a smoothing step of performing a smoothing process on the numerical data at each of the data acquisition points or the data based on the numerical data, by using the numerical data at the data acquisition points present in the smoothing width determined in the smoothing width determination step or the data based on the numerical data.
The “data acquisition point” refers to a point at which numerical data is acquired, and in the case of data that is acquired at specific intervals, the “data acquisition point” refers to each time point of acquisition of the numerical data.
Details of the “standard error” will be given later, but by determining the “standard error” of numerical data at each data acquisition point or data based on the numerical data, a size of variation in the data at the data acquisition points (i.e., a size of a change in a gradient of the data) may be grasped. Accordingly, by determining the standard error, a baseline portion and a range where a change in the gradient of data is great (i.e., an absolute value of a second derivative is large) may be identified in a data series based on numerical values.
With the data smoothing method of the present invention, in the smoothing width determination step, the smoothing width for each of the data acquisition points may be determined based on the standard error that is calculated in the standard error calculation step and a smoothing width table that is prepared in advance. This facilitates determination of the smoothing width.
Further, a normalization step, performed after the standard error calculation step and before the smoothing width determination step, of normalizing the standard error that is calculated in the standard error calculation step by a predetermined calculation method may be provided, where, in the smoothing width determination step, the smoothing width for each of the data acquisition points may be determined based on the standard error that is normalized in the normalization step and a smoothing width table that is prepared in advance.
A program according to the present invention performs the data smoothing method described above, by being executed by a computer.
With the data smoothing method according to the present invention, a standard error is calculated for numerical data at each data acquisition point or data that is based on the numerical data, and a smoothing width is determined based on the standard error in such a way that the smoothing width is more reduced for a data acquisition point with a greater standard error, and thus, the smoothing width is great in a range, such as a baseline portion, where a change in a gradient of data is small (i.e., an absolute value of a second derivative is small), and the smoothing width is small in a range, such as a peak portion, where the change in the gradient of data is great (i.e., the absolute value of the second derivative is large). Accordingly, smoothed data close to original data can be acquired, and reproducibility is improved compared to that of a conventional smoothing process.
The program according to the present invention is able to perform the smoothing method described above, and a smoothing process which achieves high reproducibility may be executed on a computer.
Hereinafter, an example of a data smoothing method according to the present invention, and a program for performing the method will be described.
First, an outline of the smoothing method of the present example will be described with reference to a flowchart in
A standard error of numerical data that is acquired at each data acquisition point at specific intervals by a detector of an analysis device or of data that is based on the numerical data is calculated. The standard error may be determined by dividing residual sum of squares for a regression line by degrees of freedom and by taking a square root, for example. When a regression line calculated from numerical data is represented by Y=ax+b, a standard error SE may be determined by the following Expression (1).
Here, yi is numerical data at a data acquisition point i, Yi is a predicted value at the data acquisition point i based on a regression line, and n is a standard error calculation width that is determined in advance. The standard error calculation width indicates that calculation of a standard error is performed by using numerical data at data acquisition points in a range of ±A of a corresponding data acquisition point. That is, n=2A+1 is true. Accordingly, to calculate the standard error for the data acquisition point i, pieces of numerical data at data acquisition points (i−A) to (i+A) are used.
After the standard error is calculated for each data acquisition point, normalization of the standard error is performed. Normalization of the standard error is correction of the standard error to a predetermined scale by using a factor or the like that is prepared in advance, such that a smoothing width may be determined by applying the standard error to a table, for determining a smoothing width, that is prepared in advance. Such a normalized standard error will be referred to below as a “normalized standard error”.
After the standard error is normalized, the normalized standard error is applied to a table for determining the smoothing width (hereinafter referred to as “smoothing width table”) such as Table 2 or Table 2 shown below, and a smoothing width to be applied to the smoothing process for each data acquisition point is determined. A smoothing width means that, to perform a smoothing process on a data acquisition point i, pieces of numerical data in a range of ±B of the data acquisition point i, or in other words, pieces of numerical data at data acquisition points (i−B) to (i+B), are used. In the following, “B” indicating front and rear widths of the smoothing width will be referred to as “smoothing half width”.
As is clear from Table 2 and Table 3, the smoothing width is set to be smaller as the standard error (normalized standard error) is greater. At a data acquisition point with a great standard error, a gradient of numerical data has a great variation width with respect to preceding and following data acquisition points, and thus, by performing a smoothing process with a narrow smoothing width on the numerical data at such a data acquisition point, a value close to the original data may be obtained as the smoothed data.
After determining the smoothing width in the above manner, a smoothing process is performed on the numerical data at each data acquisition point by using the smoothing width. There are various methods for the smoothing process, and any of the methods may be used; for example, a Savitzky-Golay method may be cited. With smoothing by the Savitzky-Golay method, calculation for smoothing is performed by using coefficients shown in Table 1 below.
In Table 1, numerical values in a top row indicate a smoothing width (Width), and numerical values in a second row indicate a smoothing half width (Half Width). Numerical values in third and subsequent rows indicate coefficients that are used for calculation for smoothing. For example, in smoothing for a data acquisition point for which the smoothing width is determined to be “7”, coefficients listed in a fourth column from the left are used, and the following Expression (2) is established. Numerical data is smoothed by using Expression (2), and smoothed data Y′i is thereby calculated.
Y′
i= 1/105(35yi+30(yi−1+yi+1)+15(y1−2+yi+2)−10(yi−3+yi+3)) (2)
An example of performing a smoothing process on a signal value waveform in
First, the standard error SE of original numerical data that is obtained by the detector is calculated. The standard error SE here is a standard error on a predicted value based on a regression line of neighboring 2A+1 points, and is calculated by using Expression (1) described above. The standard error SE and the original numerical data are shown superimposed with each other as shown in
The standard error SE of the numerical data at each data acquisition point is normalized so as to be applicable to the smoothing width table of Table 2 prepared in advance, and a normalized standard error SE′ is thus obtained.
Then, a standard deviation S and a mean M of the normalized standard errors SE′ in a baseline range that is determined in advance are determined. In the present example, the standard deviation S and the mean M are used as a basis for determining the smoothing width. A level to which each normalized standard error SE′ corresponds is extracted from levels shown in the smoothing width table of Table 2, and the smoothing half width is thus determined. Here, “C” is a smoothing width adjustment level and takes a value smaller than a smoothing half width B, and “d” is a smoothing width adjustment constant and takes a value greater than 0.
The numerical data at each data acquisition point is smoothed by the Savitzky-Golay method described above, by using the normalized standard error SE′ and the smoothing half width determined based on Table 2 described above. The result is shown in
As is clear from
A description will be given of an example of performing the smoothing process on a melting curve obtained by measuring a substance.
The standard error SE of the numerical data at each data acquisition point is normalized so as to be applicable to a smoothing width table of Table 3 prepared in advance, and a normalized standard error SE′ is thus obtained.
A level to which each normalized standard error SE′ corresponds is extracted from levels shown in the smoothing width table of Table 3, and the smoothing half width is thus determined. Here, “C” is a smoothing width adjustment level and takes a value smaller than a smoothing half width B, and “d” is a smoothing width adjustment constant and takes a value greater than (−1/C) and smaller than (1/C).
The numerical data at each data acquisition point is smoothed by the Savitzky-Golay method described above, by using the normalized standard error SE′ and the smoothing half width determined based on Table 3 described above. The result is shown in
As is clear from
In the examples described above, before determining the smoothing width, the standard error SE is normalized and the normalized standard error SE′ is determined, and the smoothing width is determined based on the normalized standard error SE′. However, the present invention is not limited to such a case, and a smoothing width table may be prepared in advance so as to enable determination of the smoothing width based on the standard error SE, and the smoothing width may be determined by applying the standard error SE to the smoothing width table.
Next, an example of a computer on which a smoothing program for performing the smoothing method described above is installed will be described with reference to
An arithmetic processing device 4 is electrically connected to an analysis device 2. The arithmetic processing device 4 is implemented by, for example, a general-purpose personal computer (PC) but may alternatively be a computer dedicated to the analysis device 2. Detector signals which are acquired at the analysis device 2 at specific intervals are input as numerical data to the arithmetic processing device 4. A smoothing program 6 for smoothing the numerical data output from the analysis device 2 is stored in the arithmetic processing device 4.
The smoothing program 6 is configured of a standard error calculation part 8, a standard error normalization part 10, a smoothing width determination part 12, and a smoothing processing part 14. The arithmetic processing device 4 includes a smoothing width table holding part 16 holding a smoothing width table that is created in advance (such as Table 2 or Table 3). The smoothing width table holding part 16 is implemented by an area in a data storage device provided inside the arithmetic processing device 4.
The standard error calculation part 8 is configured to calculate the standard error SE of the numerical data at each data acquisition point or of data that is based on the numerical data, by using Expression (1) described above.
The standard error normalization part 10 is configured to determine the normalized standard error SE′ by normalizing the standard error SE to be applicable to the smoothing width table. Additionally, the standard error normalization part 10 is not an indispensable structural element, and is not required in the case where the standard error SE is to be used as it is for determination of the smoothing width.
The smoothing width determination part 12 is configured to determine the smoothing width by applying the normalized standard error SE′ or the standard error SE to the smoothing width table.
The smoothing processing part 14 is configured to perform, using the smoothing width determined by the smoothing width determination part 12, a smoothing process on the numerical data at each data acquisition point or on data that is based on the numerical data, by using a smoothing processing method such as the Savitzky-Golay method.
2: Analysis device
4: Arithmetic processing device
6: Smoothing program
8: Standard error calculation part
10: Standard error normalization part
12: Smoothing width determination part
14: Smoothing processing part
16: Smoothing width table holding part