=====================
Top Percentile Filter
=====================
:doc:`/WorkProcessClassifiers/LocalAlgorithm/index` - :doc:`/WorkProcessClassifiers/OneDimensionalAlgorithm/index`

*Top Percentile Filter* algorithm replaces the original data values with a chosen percentile of a certain number of neighbor points (e.g. their left :math:`M` and right :math:`M` data points). Note that the choice of filter width :math:`L = 2M + 1` has a great impact on the processed results. It is equivalent to the *Centered Moving Median* algorithm if the 50th percentile is chosen.

.. rubric:: Input Parameters

+------------------------+------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------------+---------+
| Parameter              | Type                                           | Constraint                                                     | Description                                                          | Remarks |
+========================+================================================+================================================================+======================================================================+=========+
| :math:`Y[n]`           | :math:`Y[n] \in \mathbb R^N`                   | :math:`N \in \mathbb{N}`                                       | Input data sequence of length :math:`N`                              |         |
+------------------------+------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------------+---------+
| :math:`L`              | :math:`L \in \mathbb N`                        | :math:`L = 2M + 1, \quad M \in \mathbb{N}`                     |                                                                      |         |
+------------------------+------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------------+---------+
| :math:`p`              | :math:`p \in \mathbb{R}`                       | :math:`0 \leq p \leq 1`                                        | A specified percentile of a certain number of data points considered |         |
+------------------------+------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------------+---------+

.. rubric:: Output Parameters

+--------------------------------+--------------------------------------------------------+----------------------------------------+---------------------------------------------------+---------+
| Parameter                      | Type                                                   | Constraint                             | Description                                       | Remarks |
+================================+========================================================+========================================+===================================================+=========+
| :math:`\hat{Y}[n]`             | :math:`\hat{Y}[n] \in \mathbb R^N`                     | :math:`N \in \mathbb{N}`               | Output data sequence of length :math:`N`          |         |
+--------------------------------+--------------------------------------------------------+----------------------------------------+---------------------------------------------------+---------+

.. rubric:: Tool Support

* :doc:`/Tools/OriginLabTool/index`

.. rubric:: Single Steps using the Algorithm

* :doc:`/DataPreprocessing/DataCleaning/DataDenoising/DataDenoisingWithPercentileFilter/index`