Initial centroids are determined by comparing data points from the quantified spots and mapped pixels from the same coordinates. First, mapping intensities counted from multi-phase pixels are removed from the dataset (See "Multi-phase pixels" section). Second, if the removal reduces sample size of some phases to less than 10, then the mapping intensities are restored from signal intensities from spot analysis. Third, for each phase, median values of signal intensities are utilized as initial centroids. Forth, if there are missing values especially for intensities of electrons (secondary, backscatter, ...), imputation is performed for them (See "Impute missings" section).

  phase = everything(),
  element = everything(),
  saveas = "centers0.csv",
  epma = tidy_epma(qnt, xmap),
  fine_phase = NULL,



An object generated by read_xmap()


An object generated by read_qnt()


Selected ones are referenced to detect outliers. Default selects everything. Tidy selection is available. For example c(Si, Ti) selects them, and c(-Si, -Ti) selects everything except them.


Selected ones are referenced to detect outliers. Default selects everything. Tidy selection is available. For example c(Si, Ti) selects them, and c(-Si, -Ti) selects everything except them.


File name to save result. FALSE if not saving.


A value returned by tidy_epma()


Deprecated as of qntmap > 0.4.0. Use phase instead.


Arguments passed on to find_outlier


A type of the interval. Data points outside intervals are treated as outliers. If "prediction" (default), prediction intervals are used based on Poisson process. If `"tukey"``, conditional lower and upper whiskers are used where the lower is $Q_1/4 - 1.5 IQR$ and the upper is $Q_3/4 + 1.5 IQR$.


Applicable when interval = "prediction". If "rq" (default), quantile regression is performed (quantreg::rq()). If "lsfit", least square regression is performed (stats::lsfit()).


A percentile of predictive interaval. Applicable when interval = "prediction".

Multi-phase pixels

X-ray mapping inevitably involves multi-phase pixels, especially for fine-grained phases. When the multi-phase pixels are member of training data set, initial centroids can be biased. This is why guessing centroids is based on median() instead of mean(). However, if pixels to guess centroids for cetrtain phase are comprising a large number of or even a full of multi-phase pixels, median() is still vulnerable. For example, refer to a reprinted figure 5 from Yasumoto et al. (2018), and captions in original article. Phases such as Amp, Di, and Pl are outlying the regression curves due to multi-phase pixels. For these phases, median values of peak X-ray intensities from X-ray mapping are unreliable values for initial centroids. Thus, data points from multi-phase pixels should be regarded as outliers, and imputetions should be performed on them. In qntmap, mapping intensities are simply substituted by spot intensities.

Outliers are identified by examining if confidence intervals data points overlap with predictive intervals or conditional whiskers of Tukey's choice.

Impute missings

When spot analysis on some phases are performed outside the mapping area, X-ray intensities under mapping conditions can be calculated from quantified peak intensities. However, intensities of secondary and backscatter electrons cannot be calculated because electrons are generally not analyzed in spot analysis. Thus, imputation is performed. First, calculate median values of mapping X-ray intensities. Second, find a pixel in the map which have closest value to the median values. Third, retrive electron intensities from that pixel and utilize as a centroid.

Note that missing values may remain if certain elements are analyzed in spot analysis but not in mapping analysis.


Yasumoto, A., Yoshida, K., Kuwatani, T., Nakamura, D., Svojtka, M., & Hirajima, T. (2018). A rapid and precise quantitative electron probe chemical mapping technique and its application to an ultrahigh-pressure eclogite from the Moldanubian Zone of the Bohemian Massif (Nové Dvory, Czech Republic). American Mineralogist, 103(10), 1690-1698,