--- myst: substitutions: bloc: python: 21,22 cpp: 15-16 bloc2: python: 29,30 cpp: 23-24 bloc3: python: 21-22 cpp: 14,15 --- (dataserver_data_pattern_selection)= # Pattern selection It can be necessary during a study to apply filters on the patterns; i.e. to include or to exclude patterns depending on criterion. For example, to select the patterns with x1 lower than 3.0 and x2 lower than 55.0 from the `geyser` database, {{uranie}} code is as follows: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/dataserver/data/" + language + "/draw_geyser_scatterplot_selection." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc[language] + "\n" + "```" }} The obtained figure is: {{ "```{" "figure" "} " + parent_dir + "/roottest/build/uranie/doc/dataserver/data/" + language + "/geyser_4/geyser_scatterplot_selection.png\n" ":align: center\n" ":name: dataserver_geyser_scatterplot_selection\n" + figure_scale + "\n" "\n" 'Graph with a selection definition\n' "```" }} The result of the `scan` method applied on this {{tds}} object yields: {{ "```{literalinclude} " + parent_dir + "/usermanual/dataserver/files/selectionGeyserScan.dat\n" + ":language: none\n" + "```" }} We have obtained 53 patterns among 278 respecting the given criterion without having to specify this criterion for the `draw` and `scan` calls. To get the same result, we could have executed the following command as well: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/dataserver/data/" + language + "/draw_geyser_scatterplot_selection." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc2[language] + "\n" + "```" }} However, in this case, we have to repeat the criterion for each command. It is also possible to exclude patterns coming from `TDataServer` with the `setCut` method. {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/dataserver/data/" + language + "/draw_geyser_scatterplot_cut." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc3[language] + "\n" + "```" }} The obtained figure is as follows: {{ "```{" "figure" "} " + parent_dir + "/roottest/build/uranie/doc/dataserver/data/" + language + "/geyser_3/geyser_scatterplot_cut.png\n" ":align: center\n" ":name: dataserver_geyser_scatterplot_cut\n" + figure_scale + "\n" "\n" 'Graph with a definition of *Cut*\n' "```" }} It can be noticed in the title of {numref}`dataserver_geyser_scatterplot_cut`, that it simply corresponds to the opposite of criterion's meaning with respect to the one given by the `setCut` method with the **! ( )** character. Thus, the `setCut` method consists in passing on the negation of the criterion to the `setSelect` command. Finally, it is perfectly possible to delete the current filters with the methods `clearSelect` and `clearCut`, and retrieving the unfiltered results. {{ "````{" "tip" "}" + "\n" + "Every modifications of the ongoing selection (meaning doing a new selection or removing it) is now clearing automatically the vectors that contain statistical properties of attributes and the database of already computed quantiles. This is reminded with an information line shown below:\n" + "```{" "literalinclude" "} " + parent_dir + "/usermanual/dataserver/figures/razStatAndQuantileProperties.out\n" + ":language: none\n" + "```" + "\n" "````" }} ```{admonition} Summary: Filters management regarding patterns - `setSelect` ( **TString** sselect) Patterns selection ensuring the criterion *sselect* - `setCut` ( **TString** scut) Excluding the patterns ensuring the criterion *scut* - `clearSelect`() / `clearCut`() Deletes the current filter. Any modification of the selection is now clearing the vector of statistic (mean, std, min and max) introduced in [](#dataserver_attribute_variable_information) as well as the map containing quantiles. This is done in order to be sure that the method used to performed these estimation are called once again to take into account the change in selection. An informative message is displayed to remind this clearing. ```