Amp: Testing plot for monomineral P sensor

Plot Amp in Al6 - Fe3+Ti+Cr space. For amp_simakin.

Details

Reference
Data mineral
Input wtp

Использовать Проверить

  • заголовок
  • краткое описание
  • статья
  • ссылка
  • карточка
  • подробное описание
  • код
  • тест

Код метода

source('recalc_amp_13ecnk.r');

classifydiag.amp_al_feticr <- function (wtp_data, annotate=T, ...){

ds <- selectNames(recalc.amp_13ecnk(wtp_data),
                  c("Name", "Al_c6_pfu", "Fe_p3_pfu", "Ti_C_pfu", "Cr_C_pfu"));

pts <- data.frame(Name=ds$Name,
                  X=ds$Fe_p3_pfu + ds$Ti_C_pfu + ds$Cr_C_pfu,
                  Y=ds$Al_c6_pfu);

ds$P <- 16.051*(1.8*ds$Al_c6_pfu/(1.8-ds$Fe_p3_pfu-ds$Ti_C_pfu-ds$Cr_C_pfu))-7.819;

maxpoint <- ds[ds$P == max(ds$P),]

spoints <- ds[maxpoint$P-ds$P < 1,]

model <- lm(Al_c6_pfu~(Fe_p3_pfu+Ti_C_pfu+Cr_C_pfu),spoints)
mb <- model$coefficients[1]
mk <- model$coefficients[2]

limits <- c(0,2,-1,2);

scale <- 1.8/(1.8 - (maxpoint$Fe_p3_pfu + maxpoint$Ti_C_pfu + maxpoint$Cr_C_pfu))

mpX <- maxpoint$Fe_p3_pfu + maxpoint$Ti_C_pfu + maxpoint$Cr_C_pfu
mpY <- maxpoint$Al_c6_pfu


marks  <- data.frame(Label=c("Key point\n(1.8,0)",
                             paste0("PmaxLine\n P_max=",format(round(max(ds$P), 1), nsmall = 1) ),
                             paste0("PmeanLine\n P_mean=",format(round(mean(spoints$P), 1), nsmall = 1))),
                     X=c(1.8 , 0 , 0),
                     Y=c(0.0, scale*mpY+0.2, mb-0.2));

lines <- data.frame(X1 = c(mpX, 0,         0),
                    Y1 = c(mpY, scale*mpY, mb),
                    X2 = c(1.8, mpX,       1.8),
                    Y2 = c(0,   mpY,       mk*1.8+mb));

labels <- c("Fe3+Ti+Cr", "Al6");

ret <- c();

ret$type <- "diagram";
ret$points <- pts;
ret$limits <- limits;
ret$lines <- lines;
ret$marks <- marks;
ret$labels  <- labels;

return(ret);
}