Theriak-Domino: Merging Pixelmaps Results

pixelmaps_names

Domino can be run in several modes, one of which is the pix X Y mode, in which Domino calculates the stable compositions, molar abundances, densities, and other things across a grid (e.g., a P-T grid). The results come in the form of many files, commonly over a hundred, saved in the _pixelmaps folder by default. Each is a text file, but without a .txt or other extension. Each file has two columns: the grid calculation sequence number (e.g., 1 to 10000, for a 100 x 100 grid), and the values for whatever calculated characteristic is in the file. The files have no column labels. In addition, files containing information on stable phases, rather than bulk characteristics, have values only where the phase is stable on the grid. Some phases may be stable over the whole grid, so the file will have 10000 lines (in the example), one for each grid point. If a phase is stable at only one grid point, it will have only one line. Manually getting all, or even some of the many different files into a spreadsheet for further model analysis would be a nuisance. Wouldn’t it be nice to have a little program to merge all those files for you?

This is a little R program, plus a special .csv file (Excel example below, you save as .csv) that does several things. It merges all pixelmaps files into a single table (except metadata files), each file name becomes its respective column label, grid calculation sequence numbers are lined-up, grid values are added as row labels (e.g., P-T), the variables are sorted into blocks, each containing one phase, and finally it saves the merged table as a .csv file.

R script as an ASCII text file (txt) Change extension to .rmd and RStudio etc. should read it just fine. The system doesn’t allow me to upload .rmd files.
Here’s an example of the .csv file you need (but in Excel format)

The R script itself contains extensive comments on the parts you have to change yourself, and what the different parts do. The parts you have to change yourself include a few file paths and file names near the program top, and stable phases you want grouped near the program bottom. The program is formatted as an .Rmd document, so is most easily read in RStudio or similar R programming shell.

R is a free, open-source programming language, and RStudio is a free, open-source programming environment. There are many tutorials on how to get started, which should be enough to run this program if you are unfamiliar with R. You will also need to install the tidyverse and janitor packages, which is easy to do in RStudio.

The .csv file you need is really the backbone on which the merged table of pixelmaps files is built. It can be made with any spreadsheet and saved to .csv. You can look at the example, linked above, but here’s an explanation of the format.

csv_example

The .csv file should look like this. 

The example file, linked above, has 3 columns labeled Seq, TC, and Bar, for grid calculation sequence number, temperature in degrees C, and pressure in bars, respectively. If you want different column labels, you have to change their names in both the R script and in the .csv file.

The sequence number has to range from 1 to the number of grid points you asked Domino to calculate. In the example above, the grid was 100 x 100, so 10000 points, and thus 10000 lines in the .csv file, plus the column labels.

The actual grid coordinate values can be a little confusing. Domino first steps through the X-axis, then increments Y, and then repeats. Watch the screen while Domino does it’s work, and you’ll see which P-T (or other) values and intervals it’s using for the grid. They might not start and end exactly at the X-Y coordinate corners.

This R program doesn’t actually care what values the TC and Bar columns have in them, but it does care about the column labels. Remember, if you don’t want your columns labeled Seq, TC, and Bar, you’ll need to change the labels in both the program and the .csv file.