R build status license

knitr::opts_chunk$set(echo = TRUE, eval = FALSE)
library(knitr)
library(data.table)

Overview

This package generates mass concentration maps and phase distribution maps based on X-ray mapping data and spot analysis data from EPMA.

See "[How to]" for a usage and Yasumoto et al. (2018) for implementations.

Current version supports data from JEOL-style EPMA.

Installation

Copy & paste a following command to R.

source("https://install-github.me/atusy/qntmap")

How to

  1. [EPMA analysis] (spot before map)
  2. [Export data] from EPMA to PC
  3. [Run qntmap on R] for data processing.

Details below.

EPMA analysis

Conversion is performed by utilizing spot analysis data as internal standards. Thus, [spot analysis][Spot analysis] must be done prior to [mapping][Mapping].

Spot analysis

Mapping

Example of analytical conditions

| | Spot | Map | Comment | |:--------------------|------:|--------:|:--------------------------------| |Acceralating Voltage | 15 kV | 15 kV | Must be same in spot and map | |Probe diameter | 3 μm | 20 μm | Must be smaller in spot than map| |Probe current | 10 nA | 100 nA | | |Peak dwell | 10 sec| 120 msec| | |Background dwell | 5 sec| NA | No need to analyze in map |

Export data {#Export}

  1. ASCII convert mapping data into matrix format, and save the result in the directory where raw data is stored (e.g., .map/1).
  2. Export whole directory of analysis containing .map directory and .qnt directory

Required files

Spot analysis

The exported data are stored in a directory named by .qnt in most environments. If using JXA-8230, a directory's name is {PROJECT}_{#}_QNT where {PROJECT} is name of a project's name defined by user or "PROJECT" if undefined, and{#} is a variable integer (e.g., PROJECT_0001_QNT).

kable(fread(system.file(package = "qntmap", "extdata", "files-qnt.csv")))

Map analysis

The exported data are stored in a directory .map/{#} where {#} is a variable integer in most environments (e.g., .map/1). If using JXA-8230, a directory name is {PROJECT}_{#1}_MAP_{#2}_csv where {PROJECT} is name of a project's name defined by user or "PROJECT" if undefined, and{#1} and {#2} are variable integers (e.g., PROJECT_0001_MAP_0001_csv).

kable(fread(system.file(package = "qntmap", "extdata", "files-map.csv")))

* indicates wild cards.

Run qntmap on R

For data processing.

Interactive mode

Follow instructions shown by running the following code.

library(qntmap)
qntmap()

As a result, phase identification result is saved in "clustering" directory and mass concentration data as csv files in "qntmap" directory both under the directory contaning mapping data.

Note that interactive mode has limited functions. Use [manual mode][Manual mode] for full functionality.

Manual mode

A work-flow is available with an example dataset at https://qntmap.atusy.net/articles/qntmap.html .

library(qntmap)

# Required parameters
wd <- '.' # path to the working directory
dir_map <- '.map/1' # relative/absolute path to the directory containing ascii converted X-ray map files (1_map.txt, 2_map.txt, and so on)"
dir_qnt <- '.qnt' # relative/absolute path to the directory containing .qnt files (pkint.qnt, net.qnt, and so on)"


# Optional parameters

## A character vector to specify phases tend to be smaller than mapping probe diameter
fine_phase <- NULL 

## A csv file indicating name of the phase of n-th quantitative point analysis.
## The file path is absolute or relative to `dir_qnt`.
## If NULL, names are assumed to be specified in comments during EPMA analysis.
phase_list <- NULL 

# Run analysis

# Set working directory
setwd(wd)

# Load mapping data
# Change value of DT (dead time in nanoseconds) depending on EPMA.
# 1100 ns is a value applied by JEOL JXA-8105.
xmap <- read_xmap(wd = dir_map, DT = 1100)

# Compile quantitative data
qnt <- read_qnt(wd = dir_qnt, phase_list = phase_list, renew = TRUE)
## Check 'phase_list0.csv' under 'dir_qnt' to see if name of phases are provided properly.
## If not, modify the csv file and specify the path of modified one to `phase_list` in "Optional parameters" section and rerun the above code.

# Determine initial cluster centers
centers <- find_centers(xmap = xmap, qnt = qnt, fine_phase = fine_phase)
## Check 'centers0.csv' under the `wd` and modify on demand.
## If modified, assign content of the modified csv file by running
## centers <- data.table::fread('path to the modified csv file')

# Phase identification
# Assign group_cluster = TRUE if you want to integrate same phases subgrouped by suffix after '_' 
# (e.g., garnet_a and garnet_b are integrated to garnet if TRUE)
cls <- cluster_xmap(xmap = xmap, centers = centers, group_cluster = FALSE)

# Quantify X-ray maps
qmap <- quantify(
  xmap = xmap, qnt = qnt, cluster = cls, fine_phase = fine_phase
)
## Resulting files are saved in `qntmap` directory` under `dir_map`.

# Summarize result
summary(qmap)
## This shows minimum, lower quantile, median, mean, upper quantile, and maximum values of variables.


atusy/qntmap documentation built on April 11, 2021, 4:45 p.m.