The Toolkit Reference Manual

Table of Contents

Next:   [Contents][Index]

The Toolkit Reference Manual

This document describes the Toolkit. In addition to this document, you may find useful information on Toolkit’s home page.

Copyright © 2014-2021 Okayama University, Last modified: 2021-07-25 10:10 by tkk </Users/tkk/xtreeml/doc/toolkit.texi>

Next: , Previous: , Up: Top   [Contents][Index]

1 Overview

For a long term geochemistry, rocks and datasets should be maintained physically and electronically. We have started to construct a rock depository named DREAM.

First, we have developed as a digital sentinel for the depository name Medusa, that is is a database server with web interface.

To manipulate records and process datasets by a personal computer, sets of utilities were developed. See Record operator Orochi. See Data format CASTEML. To correlate documents and rocks, we have developed LaTeX based program. See Document uploader Pmlatex. Since datasets are created by analytical instruments such as a mass spectrometer, eventually we want to correlate Medusa and the instruments.

The goal of this project is to build a toolkit that unites rocks, datasets, Medusa, and analytical instruments. We call it as the Fudo toolkit, after Emperor Go-Daigo who escaped Oki and initiated restoration on 1333 AD. Relationship between the Fudo toolkit and Medusa is like GNU and Linux. Medusa is the core but that is included in the Fudo toolkit.

Next: , Previous: , Up: Top   [Contents][Index]

2 Resource location

Packages and services are listed in this section. Most of packages are hosted by following sites.

Repository for packages -- public
Repository for packages -- local

Next: , Up: Resource location   [Contents][Index]

2.1 Packages

rails project -- medusa

Keep track any stones and boxes. Medusa documents the origin of a rock, its current storage location, the relationship, if any between the original rock and any sub-samples, and correlate any and all geochemical datasets associated with the rock.

See Server Medusa for detail. See web app -- Medusa for Echo for application. See web app -- Medusa for demo for application. See web app -- Medusa for zcoda for application. See web app -- Medusa for Agei for application.

gem package -- withrecursive

An ActiveRecord extension to add recursive association.

This extension helps to create hierarchical queries for self-referential models and allows to traverse ancestors or descendants, recursively.

See rails project -- medusa that refers this package.

gem package -- actsasmappable

Generate Google map from ActiveRecord model. Integrate a dynamic map in a Rails application. It can display geographical map tiles loaded from OpenStreetMap. The included map viewer is Leaflet.

See rails project -- medusa that refers this package.

titanium project -- sisyphus

Let Android App be client of Medusa.

See Labor Sisyphus for Android for detail. See gem package -- sisyphus-for-medusa.

gem package -- sisyphus-for-medusa

Create stone in Medusa and print barcode label on MS-Windows. This is a Web App that runs on PC. User creates a stone with label by one action using web browser as one does it using See Labor Sisyphus for Android.

See Labor Sisyphus for MS-Windows for detail. See titanium project -- sisyphus.

See gem package -- tepra that is referred by this package.

gem package -- orochi-for-medusa

A series of command-line utilities that manipulates records in Medusa. The utilities list, name, and find records in Medusa as GNU utilities do to files.

See Record operator Orochi for detail.

See gem package -- medusa_rest_client that is referred by this package. See gem package -- tepra that is referred by this package.

gem package -- casteml

A series of comprehensive utilities that handles CASTEML. The utilities download/upload datasets from/to Medusa. The utilities join, split, and convert datasets.

See Data format CASTEML for detail.

gem package -- pmlatex

Upload PDF file created by pmlatex.sty and pdflatex to Medusa. Create bib record in Medusa, then upload corresponding PDF file to the record. Also replace PDF and update title, date, and author.

See Document uploader Pmlatex for detail.

gem package -- medusa_rest_client

A series of Ruby interfaces to Medusa REST API. This gem is a client for Medusa REST API. Medusa REST API follows the Rails’s RESTful conventions, so this gem interacts with the Medusa REST API via ActiveResource.

See gem package -- orochi-for-medusa that refers to this package.

gem package -- tepra

Print QR-code by King Jim’s Tepra via command or REST interface. The program also works as label-print server. When the program is launched without argument, it runs as web server.

See gem package -- orochi-for-medusa that refers to this package. See gem package -- godigo that refers to this package. See gem package -- sisyphus-for-medusa that refers to this package. See Setup Tepra server for detail.

raspberry package -- DREAM-PI

DREAM-PI is a device that intermediate PubNub interfaces and barcode reader, balances, and NFC reader/writer. As of January 25, 2018, we use computer (Raspberry Pi) as an infrastructure. As an example of applications of DREAM-PI, we develop a web interface named Imoko. He transfers quantity of a specimen weighted in balance into Medusa using DREAM-PI. As of January 19, 2018, one computer (Raspberry Pi) can communicate with two balances and one barcode reader at once.

See Stone measurer Imoko for detail.

r package -- chelyabinsk

R package for geochemical datasets. This package reads and processes geochemical datasets, downloads CASTEML from Medusa, processes IONML, and plots typical geochemical datasets.

See R-library Chelyabinsk for detail. See manual. See gem package -- casteml that is referred by this package. See r package -- MedusaRClient that is referred by this package.

r package -- MedusaRClient

A series of R interfaces to Medusa. Using this package user can obtain date directly from Medusa.

See r package -- chelyabinsk that refers this package.

r package -- VisualAnalysis

R/Shiny interface to See rails project -- medusa for visualizing geochemical data. This app uses Leaflet, which is the leading open-source JavaScript library for interactive maps, and r package – chelyabinsk visualize geochemical dataset served by Medusa.

See r package -- chelyabinsk. See r package -- MedusaRClient.

python package -- image_mosaic

A series of image utilities. Use this ImageMosaic to crop, rotate, or enlarge bitmap images. This package took over the project ‘python package – opencvtool’ on 2018-08.

See gem package -- vstool that refers to this package. See gem package -- opencvtool that refers to this package. See rails project -- medusa that refers to this package. See rake project -- mosaic-sem that refers to this package. See also spots-warp in See gem package -- multi_stage

rails project -- machine_time

A machine-gazer who monitors ‘machine-time’ of analytical instruments. This program is Web App. The status is modified by this Web App or programs by ‘gem package – godigo’.

See Machine gazer for detail. See gem package -- godigo for client. See web app -- Session for machines for application.

www -- dream

This repository includes files in the html root directory of DREAM’s web-site. There are two sites, that are staging web-site and public web-site.

This repository also includes the configuration file for jobs to deploy the staging and public website. To update the site, edit index.php via GitLab’s UI and push the revision by clicking Commit changes button.

www -- toolkit

This repository includes files in the html root directory of Toolkit’s web-site. To update the site, push to the master. The GitLab system keeps the site up-to-date.

rails project -- epma_archiver

Export maps obtained by EPMA. The maps are shown by web pages. The maps are converted from raw JEOL data. Although target device of this project is JEOL JXA-8530F, the project can handle datasets obtained by JEOL JXA-8800. This project took over See rails project -- jxa from 2012-12.

See web app -- EPMA archiver that is the application of this project.

rails project -- jxa

Export point and area analyses obtained by EPMA. The maps are shown by web pages. The maps are converted from raw JEOL data. Target device of this project is JEOL JXA-8800 only. This project was took over by See rails project -- epma_archiver on 2012-12 and under maintenance mode.

See web app -- EPMA archiver for JXA-8800 that is the application of this project.

See gem package -- jxa1_api to export stagelist from Web App using this project.

gem package -- multi_stage

Project coordinates to other space. It is useful to convert stage coordinate of certain device such for EPMA into global coordinate in VisualStage 2007.

See also image-warp in See python package -- image_mosaic.

gem package – opencvtool that this package refers to.

gem package -- scalebar

Put scalebar on image. Create a LaTeX file that includes scale bar or scale grids with indexes.

gem package -- opencvtool

Ruby package that provides Ruby API that utilizes python package – image_mosaic.

See gem package -- multi_stage that refers to this package. See python package -- image_mosaic that is referred by this package. See rake project -- mosaic-sem that refers to this package.

gem package -- jxa1_api

Obtain stagelist from Web App using ‘rails project – jxa’. See rails project -- jxa that refers to this package.

gem package -- godigo

Ruby package with command-line client utilities to start and stop a session on a machine-gazer ‘rails project – machine_time’. The utilities help to keep track of machine status. This package also offers interface for synchronization of datasets. Action can be start, stop, and sync.

See Machine gazer for detail. See rails project -- machine_time for the server.

See gem package -- tepra that is referred by this package.

gem package -- machine_time_client

Ruby package to connect machine_time object and machine-gazer’s RESTful web service. A client for interacting with a machine-gazer by See rails project -- machine_time by REST. The machine-gazer REST API follows the Rails’s RESTful conventions, so this gem uses ActiveResource to interact with the machine-gazer REST API. This gem allows Ruby developers to access the API and manage machine_time object on the machine-gazer.

See gem package -- godigo that refers to this library.

gem package -- vstool

A series of VisualStage 2007 related utilities. Obtain stage coordinate from VisualStage 2007, transform and export the image, and attach the image to VisualStage 2007.

See Vstool for detail.

See python package -- image_mosaic that this package refers to. See python package -- vs2007 that this package refers to.

gem package -- visual_stage

A Ruby wrapper for ‘python package – vs2007’. To control and refer to VisualStage 2007 from Ruby, call this Ruby gem package.

See python package -- vs2007 that this package refers to.

python package -- vs2007

Control and refer to the Windows application ‘VisualStage 2007’. This package offers two programs (vs and vs-api) that communicate with the program ‘VisualStage 2007’. With the two commands, one can write a program that talks to VisualStage 2007. The command vs is for starting/stopping the program VisualStage 2007, opening/closing its data file, and outputting its address and attachment. The program vs-api is for sending local command to VisualStage-API with an argument.

See gem package -- visual_stage and vs_attach_image.m in See matlab script -- VisualSpots that refers to this package.

python package -- jxmap

Convert a map file created by JEOL’s EPMA to a tiff file. Datasets of area analyses using JEOL’s EPMA are stored in file with extension *.map. A program by this package reads *.map file and writes *.tiff file. Also, a program by this package identifies phases using algorithm k-mean.

See web app -- EPMA archiver that refers to this package. See rails project -- jxa that refers to this package.

This project took over rake project – jxa1 from 2012-12.

rake project -- mosaic-sem

Create a mosaic from images by JEOL JSM-7001F accompanied with imajeoletry files. Images are typically obtained by JEOL JSM-7001F. This is a rake project with templates. This works only when local environment is setup properly.

See gem package -- opencvtool that refers to this package. See python package -- image_mosaic that refers to this package.

emacs package -- fudo

Scripts written in Elisp.

See Emacs script for detail.

ruby/perl/shell script -- xtreeml

Scripts written in Ruby, Perl, and Shell.

See Ruby/Perl/Shell script for detail.

matlab script -- VisualSpots

Scripts written in Matlab.

See Matlab script for detail.

Previous: , Up: Resource location   [Contents][Index]

2.2 Services

web app -- Medusa for Echo

See rails project -- medusa.

ID Query

Return URL of page for a stone https://dream/?q=stone-ID.

web app -- EPMA archiver

See rails project -- epma_archiver.

Export area analyses on JXA-8530F.

web app -- EPMA archiver for JXA-8800

See rails project -- jxa.

Export point and area analyses on JXA-8800.

Zabbix for DREAM

Monitor DREAM services and send messages on failure.

Jenkins for Fudo
web app -- Medusa for demo

See rails project -- medusa.

web app -- Medusa for zcoda

See rails project -- medusa.

web app -- Medusa for Agei

See rails project -- medusa.

web app -- Session for machines

See rails project -- machine_time.

Project manager for Fudo development

Next: , Previous: , Up: Top   [Contents][Index]

3 Install

Most programs are installed as Ruby gem. Install Ruby 2.7 (86 or 64) without Devkit then install gem as following. For MS-Windows, we recommend RubyInstaller for Windows. By installing single gem package, several programs will be placed.

$ gem source -a
$ gem install gem-name

Locate a configuration file ~/.orochirc with following lines to access Medusa.

user: admin
password: admin

All commands are listed in Command index. See Command index. Most of them are with online help. Call them with help option as shown below.

$ <program-name> --help

Next: , Previous: , Up: Top   [Contents][Index]

4 Changelog


Local server relocated from ‘devel’ to ‘gitlab’.


Revise structure of manual significantly.


Typically the server is configured to offer automatic transfer from http to https. However, Sisyphus for Android does not work with the transfer. The detail is described.


Sisyphus: Prevent duplicated registration. Add option to start with camera on registration of a stone. Obtain list of printers from printer server ‘Tepra’.


Revise structure of manual significantly.


Sisyphus: Login to Medusa using Okadai ID card. Add capabilities to list history and search online.


Add r package -- chelyabinsk to the list.


Move Medusa related projects to GitHub.


The manual is converted to Texinfo format.


Sisyphus: Update status of stone in Medusa 9.2 using inventory API. Add ability to read and write NFC tag.


Sisyphus: Refactor codes to be consistent with Medusa 9.0.


Sisyphus: Add capability to print barcode to label printer SATO Petit lapin. See Barcode printer (Petit lapin).

Next: , Previous: , Up: Top   [Contents][Index]

5 Stone gazer

Next: , Up: Stone gazer   [Contents][Index]

5.1 Server Medusa

See (medusa)Top. See rails project -- medusa. Medusa is the core program in the Fudo toolkit.

Next: , Previous: , Up: Stone gazer   [Contents][Index]

5.2 Labor Sisyphus for Android

See (sisyphus-en)Top. See titanium project -- sisyphus.

There are several ways to update status of a stone. The most fundamental way is to use web browser. More casual and fast approach is to utilize smart phone.

The goal of this project is let smart phone be a Medusa client utilizing its Camera to take photograph and scan barcode, and NFC capability. As of February 25 (2018), we only support Android. The screen of Sisyphus for Android is shown in Figure 2.


Figure 2: Screen of Sisyphus

Sisyphus for Android creates a new stone, a new box, and a link between a stone and a box. To create a new stone or a new box, tap ‘New stone’ button, or ‘New box’ button, respectively. To make a links, (1) load pre-existing box by tapping ‘reload’ button and scan barcode tag equipped with the box, and (2) load pre-existing stone by tapping ‘Scan barcode’ button and scan barcode tag equipped with the stone. When there is the link already, the operation updates inventory status of the stone.

Sisyphus for Android can print QR-code label. To do so, setup label printer first. See Barcode printer. Barcode printer (Petit lapin). To configure Sisyphus for Android, tap ‘Settings’ tab. When you want to take photo first on creation of a new stone, check appropriate option.

Sisyphus for Android can scan not only barcode tag but also NFC tag. Also you can let Sisyphus for Android log into Medusa using NFC ID card.

As of October 7, 2020, Sisyphus for Android can only talk ‘https:’.

Next: , Previous: , Up: Stone gazer   [Contents][Index]

5.3 Labor Sisyphus for MS-Windows

See gem package -- sisyphus-for-medusa.

The most basic action for Medusa is to create a record for a stone. This package offers Web App that lets a user create a stone and have a label at the same time.

To create a record in Medusa and have a label at the same time, you use Web App sisyphus that runs on MS-Windows. Functionality that the Web App provides is subset of those by Android App Sisyphus. See Labor Sisyphus for Android. If the Android App is working great, this tool is not necessary for you.

Setup label printer first. See Barcode printer. Then install gem package -- sisyphus-for-medusa as shown below.

CMD> gem source -a
CMD> gem install sisyphus-for-medusa
CMD> gem update sisyphus-for-medusa
CMD> which sisyphus
CMD> sisyphus

A program named sisyphus.bat will be installed to somewhere appropriate. The program is Web App that runs on http://localhost:8890/. Check where it is by which sisyphus and launch it. Access to it by web browser. On creation of a record, a label would be created automatically.

Create a shortcut of sisyphus.bat and place it in ~/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/. Also create a bookmark to http://localhost:8890/ and keep it in Bookmarks Toolbar on web browser.

Next: , Previous: , Up: Stone gazer   [Contents][Index]

5.4 Record operator Orochi

See gem package -- orochi-for-medusa.

Utilities that talk to Medusa is named orochi-for-medusa. They run with Ruby on MS-Windows.

$ gem source -a
$ gem install orochi-for-medusa
$ gem update orochi-for-medusa

The program reads a configuration file ~/.orochirc. The file should look like below.

user: admin
password: admin

Commands shown below allow you to manipulate records in Medusa as if GNU tools do on files and directories.

Command: orochi-help

List all orochi commands

Command: orochi-cd

Change the orochi working box

Command: orochi-ditto

Clone box recursively

Command: orochi-download

Download full datasets for poly-families

Command: orochi-find

Search Medusa by keyword

Command: orochi-label

See Barcode printer. Create barcode label with Medusa-ID and stone-name. It takes stone-ID as an argument and obtains stone-name from Medusa. Then it tosses them to an external program tepra. This is useful when you do not know name of stone but ID.

CMD> orochi-label    20110119154409-142363
⇒ tepra print "20110119154409-142363,Heaven"

When failed to resolve, it creates a label without name.

CMD> orochi-label    19991231-999999
⇒ tepra print "19991231-999999,19991231-999999"
Command: orochi-ls

List box contents

Command: orochi-mkstone

Create a stone (or box), if it does not already exist

Command: orochi-mv

Store a stone to a box

Command: orochi-name

Query stone-ID to Medusa and returns its name

Command: orochi-open

Open record by default browser

Command: orochi-place

Search Medusa and return latitude and longitude

Command: orochi-pwd

Print full hierarchy of orochi working box

Command: orochi-rename

Rename record or change attribute

Command: orochi-rm

Remove a specified record

Command: orochi-stone-in-box

Transform stone to box

Command: orochi-uniq

Repeat only one stone in family

Command: orochi-upload

Upload any files to web service by Medusa

Command: orochi-url

Show record in standard output by curl and w3m

With iRuby and medusa_rest_client, direct edition of records is possible. First access to a record of concern using web browser. You see corresponding internal ID such as ‘1950’. Then access again with appending ‘.json’ to the URL. You see name of properties. Launch iRuby and edit the record as shown below.

$ irb
irb(main):001:0> require "medusa_rest_client"
=> true
irb(main):002:0> include MedusaRestClient
=> Object
irb(main):003:0> obj = Specimen.find(1950)
=> #<MedusaRestClient::Specimen:0x007ff7d24d19e0 @attributes={"id"=>1950, "name"=>"AD03", "specimen_type"=>"Drill-cored sample", "description"=>"Tertiary basalt lava provided by M.  Kono. Sample locality: AD section in J\\\"{o}kuldalur, eastern Iceland.", "parent_id"=>nil, "place_id"=>nil, "box_id"=>201, "physical_form_id"=>4, "classification_id"=>5, "quantity"=>nil, "quantity_unit"=>nil, "created_at"=>"2009-04-14T09:04:53.000+09:00", "updated_at"=>"2016-01-08T08:38:14.057+09:00", "igsn"=>nil, "age_min"=>9999, "age_max"=>1120, "age_unit"=>"ka", "size"=>"", "size_unit"=>"", "collected_at"=>nil, "collection_date_precision"=>"", "collector"=>"", "collector_detail"=>"", "global_id"=>"20090414090453936.hkitagawa"}, @prefix_options={}, @persisted=true>
irb(main):006:0> obj.age_min
=> 9999
irb(main):007:0> obj.age_min = 1060
=> 1060
=> true

Next: , Previous: , Up: Stone gazer   [Contents][Index]

5.5 Document uploader Pmlatex

See gem package -- pmlatex. These commands scan the report, upload the report, and correlate samples to the report.

Command: pmlatex --help

Give you an idea about a work flow.

Command: pmlatex add

Create a new bib in Medusa and insert the bib-ID

Command: pmlatex commit

Upload and replace pdf file in Medusa

Command: pmlatex update

Update title and author of a bib in Medusa

Command: pmlatex scan

Scan a document and correlate stones with the bib

To store a report to Medusa requires several steps. A bibliography record should be created. A report in PDF file should be uploaded and linked to the bibliography record. Stones referred in the report should be correlated to the bibliography record. A suite of programs placed by ‘gem package – pmlatex’ helps the steps in a following way.

$ ls
report.tex   report.pdf
$ pmlatex add report
⇒ create a new bib in Medusa and insert the bib-ID
$ pdflatex report
⇒ compile to have a pdf file
$ reducepdf report.pdf
⇒ reduce size of a pdf file
$ pmlatex commit report
⇒ upload the pdf file to Medusa as a bib
$ pmlatex update report
⇒ update title and author of a bib in Medusa
$ pmlatex commit report
⇒ replace pdf in Medusa

It is convenient to have a local bib file with all stones and all bibs stored in Medusa such in ~/texmf/bibtex/bib/ref_dream.bib. As of June 17, 2016, you cannot download ref_dream.bib from Medusa yet.

Previous: , Up: Stone gazer   [Contents][Index]

5.6 Surface with images

On a plain ‘surface’ of a sample, a coordinate should be defined first. We refer to the coordinate as device-zero (or world) coordinate.

An image is obtained by microscopy such as secondary electron microscopy. The image should be accompanied with an Affine matrix to project the image to the device coordinate. Essentially the Affine matrix contains information of x-and-y coordinate, magnification, and angle of rotation.

An image projected in the device coordinate can be re-projected into the device-zero coordinate using an Affine matrix of a device-zero coordinate relative to a device coordinate. Essentially, the Affine matrix contains information of x-and-y shift and angle of rotation.

Since each device coordinate is fragile and not important, Medusa stores an image with a combined Affine matrix which is a product of an Affine matrix of an image to device coordinate and an Affine matrix of device-zero coordinate relative to device coordinate. We refer to an image with the combined Affine matrix as a μImage. As inferred already, a μImage can be projected into device-zero coordinate. The surface is visualized by overlays of μImages that are projected into the device-zero coordinate.

Medusa creates a ‘mosaic’ that consists of multiple layers of images that is projected into the device-zero coordination. Dimension of a mosaic is determined to include all μImage.

To improve performance on visualization, Medusa prepares a mosaic in five resolutions, that are 256x256, 512x512, 1024x1024, 2048x2048, 4096x4096, 8192x8192.

As of September 21, 2017, a surface of mnt-CBK1b-i <stone: 20160820170853-707954> is visualized by μImages at

Next: , Previous: , Up: Top   [Contents][Index]

6 Stone measurer Imoko

See raspberry package -- DREAM-PI.

There are several ways to update status of a stone. The most fundamental way is to use web browser. More robust and fast approach is to write a client that runs on PC utilizing barcode reader and NFC reader. Connection between PC and barcode reader is via Bluetooth while that between PC and NFC reader is USB. The connection between PC and the devices are fragile and it is not easy to maintain reliable connection, with paying day-to-day effort.

Thus we decided to setup a dedicated computer (Raspberry Pi). The relationship among device is shown below. As of May 8, 2017, interface to NFC is not yet implemented.

browser <http> web interface <PubNub> Computer
Balance <USB><RS232C> Computer <Bluetooth> Barcode reader

Imoko is web interface to update quantity of stones using DREAM-PI. Typical operation, after setup, is shown below.

Imoko can create barcode label via printer. To specify the printer, configure DREAM-PI.

Next: , Previous: , Up: Top   [Contents][Index]

7 Data format CASTEML

Next: , Up: Data format CASTEML   [Contents][Index]

7.1 CASTEML Introduction

CASTEML is a CASTEM language that describes chemical property (or ‘abundance’) of specimen (or ‘stone’). Chemical property (or ‘abundance’) is obtained by session (or ‘analysis’). CASTEML can describe multiple stones as well. CASTEML with mono stone and multiple stones are referred as mono CASTEML and multi CASTEML, respectively.

Until 2019, CASTEM accepts only single session to describe abundances of a stone, even they were obtained by a few sessions. Thus abundances described by several sessions were re-described in a virtual session.

From September, 2019, CASTEML accepts a few sessions to describe a stone. To have a CASTEML with several sessions, create a table that is linked to a bibliography in Medusa, and download the table using casteml download. Most of tables in Medusa describes chemical properties of multiple stones that were determined by several sessions.

Next: , Previous: , Up: Data format CASTEML   [Contents][Index]

7.2 CASTEML commands

CASTEML is processed by a series of programs. Some download and upload datasets from or to Medusa, and others join, split, and convert CASTEML files. See gem package -- casteml.

On subsection, primitive commands and links for genetic operations are summarized.

Primitive commands
Command: casteml --help

Return list of sub commands.

Command: casteml sub-command --help

Show help for sub-command.

$ casteml download --help
Usage: casteml download [options] ID0 [ID1 ...] [options]
Command: casteml download

Download CASTEML file from Medusa.

Command: casteml join

Join several CASTEML files to a single multi-CASTEML file.

Command: casteml split

Split one multi-CASTEML file into multiple CASTEML files.

Command: casteml upload

Upload a CASTEML file to Medusa.

Command: casteml convert

Convert (pml csv tsv isorg) to (pml csv tsv isorg org dataframe tex pdf).

Command: casteml spots

Export spots info in a CASTEML file to a LaTeX file.

Command: casteml download

Download CASTEML file from Medusa.

Note that casteml join, casteml download, and casteml convert do not care about duplicates of records. We recommend to convert to CSV file and manipulate them using external tool such as uniq.

More genetic operations

To upload spot analyses with image by casteml upload, see See (stone-operation-en)Publish spots information.

To download and revise CASTEML files, see See (stone-operation-ja)化学属性を入力.

Small tools that deal CASTEML files are shown as below. See Emacs script. See Matlab script. See Ruby/Perl/Shell script.

Previous: , Up: Data format CASTEML   [Contents][Index]

7.3 CASTEML polymorph

Datasets described by CASTEML can be described in different formats (or polymorphs), which are listed in Table 7. The ‘R:pmlame’ is defined as a two-dimensional dataframe with row of stone and column of chem under R environment. The polymorphs can be obtained from CASTEML. The relationship between CASTEML and polymorphs as shown in Figure 1. Brief descriptions of convert commands are shown in Table 8.

Row and column of ‘CSV:dflame’ correspond to chem and stone, respectively. This system is used in Janoušek et al. [1]. See section 3.6 ‘Spiderplots’ in it.

Table 7: Row and column of polymorphs.


Figure 1: Relationship between CASTEML and polymorphs of CASTEML, and commands for conversion.

Table 8: Convert commands between CASTEML and polymorphs.

casteml convert –medusa9 -f pmlCSV:tblameCASTEMLSee Data format CASTEML.
casteml convert -f dflameCASTEMLCSV:dflameSee Data format CASTEML.
cbk.convert.castemlCASTEMLCSV:dflameSee r package -- chelyabinsk.
cbk.write.castemlR:pmlameCASTEMLSee r package -- chelyabinsk. r package -- chelyabinsk. r package -- chelyabinsk.
cbk.write.tblameR:pmlameCSV:tblameSee r package -- chelyabinsk. r package -- chelyabinsk.
orgtbl-to-Rorgtbl:tblameR:pmlameSee Emacs script.
org-table-export-csvfileorgtbl:tblameCSV:tblameSee Emacs script.
castbl-to-latexorgtbl:tblameCASTEMLSee Emacs script.
pmlclipboardCASTEMLSee Ruby/Perl/Shell script.

Next: , Previous: , Up: Top   [Contents][Index]

8 Data format IONML

See R-library Chelyabinsk.

The IONML is xml file that contains one acquisition, that is with ion signals of multiple elements with certain cycles, using mass spectrometry.

The IONML can be in form of pmlame which is R object referred as ‘ion-type pmlame’ and ‘IONCSV’ that consists of columns of time and ion intensities. The first column of each line should be number of ‘cycle’. Colname of the IONCSV should be ‘time’ and name of element followed by atomic weight (‘Si29’ instead of ‘29Si’).

Table 9: Structure of polymorphs of IONML.


Next: , Up: Data format IONML   [Contents][Index]

8.1 Create IONML

See R-library Chelyabinsk.

To create IONML, convert raw data file originated from a mass spectrometer using appropriate script shown below.

RubyScript: ionml-exp.rb

Convert text file *.exp from Thermo Triton to ionml.

RubyScript: ionml-icp.rb

Convert text file *.xls from Agilent 7500cs to ionml.

RubyScript: ionml-vg5400.rb

Convert text file *.nob from VG 5400 to ionml.

RubyScript: ionml-ims1270.rb

Convert text file asc_*.ais from Cameca ims-1270 to ionml.

RubyScript: ionml-ims5f.rb

Convert text file *.asc from Cameca ims-5f to ionml.

RubyScript: ionml-ims1280.rb

Convert text file *.asc from Cameca ims-1280 to ionml.

Rscript: ionml-laicpqms.R

Convert text file *.csv from Thermo iCAP-Q to ionml. See R-library Chelyabinsk.

Rfunc: ionml.convert.ioncsv

Convert ioncsv file *.ion from Thermo iCAP-Q to ionml. See R-library Chelyabinsk.

PerlScript: ionml-laicpqms.plx

Convert text file *.csv from Thermo iCAP-Q to ionml.

Makefile that creates several ionml files at once is shown below as an example.

# -*- mode: makefile -*-
SRCS:=$(wildcard *.asc)

.PHONY: all clean
all: $(TARGETS)

%.ionml: %.asc $(SCRIPT) Makefile
	$(CC) $(CFLAGS) $(SCRIPT) $< > $ 
	rm -f $(TARGETS)

Previous: , Up: Data format IONML   [Contents][Index]

8.2 Read IONML

See R-library Chelyabinsk. See Matlab script.

To read IONML, use Matlab script or R script as shown below.

Rfunc: cbk:read.ionml

Return raw signal of the whole period. See r package -- chelyabinsk.


Return ionic ratio online with statistical information. See r package -- chelyabinsk.


Return average and standard error of ionic ratio. See r package -- chelyabinsk.

MatlabScript: readionml.m

Read IONML and return raw signal of the whole period. See Matlab script.

Two examples to process LA-ICP-QMS acquisition is shown below. Issue R commands or write an R script.

$ ls
$ Rscript ionml-laicpqms.R --input "ref_gl_tahiti@10um@x80@1.csv"
$ ls
ref_gl_tahiti@10um@x80@1.csv ref_gl_tahiti@10um@x80@1.xml
R> library(chelyabinsk)
R> pmlame0 <-"ref_gl_tahiti@10um@x80@1.xml",representative_time=TRUE)
R> time    <- pmlame0["time"]
R> intlame <- pmlame0[colnames(pmlame0)!="time"]
R> chem    <- colnames(intlame)
R> col     <- rainbow(length(chem))
R> matplot(time,intlame,type="l",col=col,lty=1,xlab="time",ylab="intensity")
R> legend("topleft",chem,col=col,lty=1,ncol=2,cex=0.5)
#!/usr/bin/env Rscript
rplotfile <- 'Rplots.pdf'; pdf(rplotfile)
pmlame0   <-"ref_gl_tahiti@10um@x80@1.xml",representative_time=TRUE)
time      <- pmlame0["time"]
intlame   <- pmlame0[colnames(pmlame0)!="time"]
chem      <- colnames(intlame)
col       <- rainbow(length(chem))

Next: , Previous: , Up: Top   [Contents][Index]

9 Barcode operation

Next: , Up: Barcode operation   [Contents][Index]

9.1 Barcode reader

Next: , Up: Barcode reader   [Contents][Index]

9.1.1 Setup device

USB - Bluetooth adapter

When a computer is not with Bluetooth interface, you have to install USB-Bluetooth adapter. A device with USB such as those by SANWA SUPPLY dosn’t work. Those without CSR woke such for those by IO-DATA.

Connect to PC

Make the PC to the waiting state for adding a Bluetooth device, and make the barcode reader in discovery mode.

Enter PIN code

PC will asked to enter PIN code, so enter 12345678. If the barcode reader cannot connect to your PC, read PIN Reference code 12345678 and Submit PIN with the code reader.

Create a quick connect barcode

To let barcode reader know Bluetooth address of the device, you have to prepare a device-connection code. Find 6-byte Bluetooth-address of the computer. ‘More Bluetooth setting’ -> ‘hardware’ tab -> ‘Devices’ -> Choose ‘Generic Bluetooth Radio’ -> ‘Properties’ -> ‘Advanced’ tab -> ‘Address:’(e.g., 00:1b:dc:06:ac:d6)

Visit vendor’s web and enter 12-digit numbers that you got such as 001bdc06acd6. Print the code and hang it around the computer.

Connect to COM port

Add a COM port to PC that runs MS-Windows by following steps. ‘More Bluetooth setting’ -> ‘Option’ tab -> Check all checkboxes -> ‘COM Ports’ tab -> ‘Add...’ button After a while the driver will be installed and the new number will be assigned to the COM port.

Setup-codes for barcode reader is shown in a table below. There are more options. For example, you can change time duration before sleep. See manual for detail.

(a)toolkit-figures/M05201Clear All CodeXML Rules
(b)toolkit-figures/M41802Reset RS232 Factory Defaults
(c)toolkit-figures/M26101QR Code On
(d)toolkit-figures/M17004Set Suffix to CR+LF
(e)toolkit-figures/M74601Enable Auto Save Last Bluetooth Address
(f)toolkit-figures/M121015 min instead of 90 s before sleep
(g)toolkit-figures/M50702notify on out of range
(h)toolkit-figures/M18802Save Settings

Previous: , Up: Barcode reader   [Contents][Index]

9.1.2 Connect to COM port

Add a COM port to PC that runs MS-Windows by following steps. Go ‘Control Panel’ → ‘Bluetooth Devices’ → ‘Bluetooth Settings’. Check ‘Allow Bluetooth devices to find this PC’ for initial connection. Then switch to ‘COM Ports’ tab and click ‘add’. Create a port with ‘incoming’ property. Typically ‘Serial Port Name’ of the new port is COM4. Clear all ports to avoid confusion when necessary. Also remove all ‘Code Reader’ related icons from ‘Devices and Printers’ in Control Panel when necessary.

Note that communication between software and scanner consists of two steps, that are scanner↔COM4 and COM4↔software. The former is via Bluetooth and latter has nothing to do with Bluetooth. In other word, software does not know if the input is from Bluetooth.

You can check Bluetooth connection by Tera Term. Launch it and try to monitor input from the serial port. If the software recognizes the port dedicated for Bluetooth connection, scan the device-connection code. If asked, pair the device by typing the passcode. The scanner is supposed to beep once. If it beeps multiple times (like four), try to scan the code again. Scan a barcode on your stone. You will see input from the scanner at console of ‘Tera Term’.

The port should be described in a configuration file. Orochi applications refer to ˜/.orochirc as of January 27, 2020. Device number on Cygwin is one less than COM number on MS-Windows. The port COM4 should be expressed as serial_port: /dev/ttyS3 in the file.

Next: , Previous: , Up: Barcode operation   [Contents][Index]

9.2 Barcode printer

As of January 24 (2020), we support Tepra by Japanese vendor King Jim. Install device driver and program SPC 10 provided by King Jim. Before going into next steps, make sure you can print something using the software SPC 10. A botched setup will likely make you miserable for quite some time. When necessary, change system locale to Japanese during installation.

Next: , Up: Barcode printer   [Contents][Index]

9.2.1 Setup Tepra server

See gem package -- tepra. Print label with QR-code using Ruby gem named tepra. Install the gem as shown below.

CMD> gem source -a
CMD> gem install tepra
CMD> gem update tepra

Have a configuration file ~/.teprarc. An example is shown below.

:printer: KING JIM SR3900P
:port: 8889
:timeout: 5

The program will be installed on somewhere appropriate such as c:/Ruby27-x64/bin/. Check where it is. When tepra is launched with option print and an argument input.csv, it creates barcode labels. Issue following commands for test.

CMD> which tepra
CMD> tepra print "1234567890,Allende"

Most of the time, failure is because the program cannot find printer. This often happens when printer is connected on Wi-Fi instead of USB. Identify name of the printer on SPC 10 such as KING JIM SR5900P-NW. Put it to a configuration file ̃~/.teprarc. A line should look like :printer: KING JIM SR5900P-NW.

Following commands allow you to print QR-code to King Jim’s Tepra.

Command: tepra --help

Show instruction for setup.

Command: tepra

Launch server to accept query via REST interface.

Command: tepra print

print QR-code with number and name.

The program tepra works as label-print server. When tepra is launched without argument, it runs as web server. Access http://localhost:8889/ by Firefox and try to print label. To make this PC Tepra server for Android, give PC a static IP address. External URL will look like Print the URL with barcode and put the label onto PC (and the label printer), so that Android App can be configured quickly. Create a shortcut of tepra.bat and place it in ~/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/.

Next: , Previous: , Up: Barcode printer   [Contents][Index]

9.2.2 Configure Android

See Labor Sisyphus for Android. The Android App Sisyphus prints label with QR-code via the Tepra server.

On the Android App, tap Configuration tab. Push Label subsection and set URL by scan of the QR code. Now printer icon on main tab will do the job.

Previous: , Up: Barcode printer   [Contents][Index]

9.2.3 Configure web browser

During record browsing of Medusa using web browser Firefox on MS-Windows, to click ‘label’ icon initiates downloading CSV file with extension .label. To print label from the web browser, the CSV file with extension .label should be deflected to tepra print. As of March 22 (2015), we setup web browser Firefox in following manner.

  1. Create a file with extension .BAT that contains single line tepra print %1.
  2. Convert the file with extension .BAT into a file with extension .EXE by third party’s utility such as Bat_To_Exe_Converter.
  3. Correlate file with extension .label and the EXE file on Firefox’s Options.

To creates a label from command line with stone-ID known, call orochi-label. See Record operator Orochi.

To duplicate a label using barcode reader, call perl -S tepra-duplicate. See Ruby/Perl/Shell script.

To relocate a stone using barcode reader, call ruby -S stone. See Ruby/Perl/Shell script.

Previous: , Up: Barcode operation   [Contents][Index]

9.3 Barcode printer (Petit lapin)

From both Sisyphus for android and WordPad for MS-Windows, one can have label of QR barcode by label printer SATO PT-208e.

Next: , Up: Barcode printer (Petit lapin)   [Contents][Index]

9.3.1 Setup SATO PT-208e

The label printer is supposed to have static IP address. Configure the device and network. Fudo’s SATO PT-208e has MAC address 00:80:92:4e:a6:ad and is assigned by odnet. It is recommended to set ‘auto power-off time’ to 480 minutes instead of default 5 minutes. Use PT200e設定ツール to configure the parameter. Port 1024 is used for configuration communication.

The label ribbon is ‘item number 565035121, プチラパンラベル,サー マル,P20xW25 (E)’.

Next: , Previous: , Up: Barcode printer (Petit lapin)   [Contents][Index]

9.3.2 Configure Android for Petit lapin

See Labor Sisyphus for Android.

To print to SATO PT-208e from the Android App, you need SmaPri Driver for Android, which is printer server that runs on the Android device. You can download demo version from SATO’s web site. On SmaPri Driver that runs on the Android device, type in IP address of PT-208e. Also, set printer disconnection timer to ‘Every label print’ to allow connections from other Androids.

For example on SmaPri Driver for Android, specify On Sisyphus for Android, specify http://localhost:8080.

Previous: , Up: Barcode printer (Petit lapin)   [Contents][Index]

9.3.3 Configure PC for Petit lapin

You can print QR code from WordPad under MS-Windows Vista. First install Printer driver for MS-Windows from SATO’s web site. The printer name can be something like ‘SATO PT208e’.

Then configure the driver to have a paper setup for the label ribbon. Dimension of the paper is 20 mm length, 25 mm width, and 3 mm gap. The paper name can be something like ‘Standard Label P20 x W25 mm’. Also setup a barcode font to substitute letters by QR code. On クリエイ トフォント tab, create a new バーコードフォント by ‘新規登録’. The font name can be something like ‘SATO DREAM QR2’. Select バーコー ド種 to be QR コードモデル 2.

On WordPad, choose printer ‘SATO PT208e’ and the paper setup for 20 x 25 mm. With appropriate margin (left and top to 0.2 inch, right and bottom to 0.05 inch), list stone IDs delimited by new page ‘^L’. Hi-light all text, and set font and size to ‘SATO DREAM QR2’ and 2 point, then choose print from menu.

A file in rich text format that was successfully printed on February 12, 2016 is shown in Listing below.

CMD> type stray-code.rtf
{\rtf1\ansi\ansicpg932\deff0\deflang1033\deflangfe1041{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fswiss\fprq1\fcharset128 SATO DREAM QR2;}}
{\*\generator Msftedit;}\viewkind4\uc1\pard\f0\fs12 DREAM\par
\fs10 20160213000000-000001\fs12\par
\lang1041\f1\fs6 20160213000000-000001\page
\lang1033\f0\fs12 DREAM\par
\fs10 20160213000000-000002\fs12\par
\lang1041\f1\fs6 20160213000000-000002\page
\lang1033\f0\fs12 DREAM\par
\fs10 20160213000000-000003\fs12\par
\lang1041\f1\fs6 20160213000000-000003\page
CMD> write /pt stray-code.rtf "SATO PT208e"
CMD> ...

Next: , Previous: , Up: Top   [Contents][Index]

10 R-library Chelyabinsk

See Data format CASTEML. See Data format IONML. See r package -- chelyabinsk. See manual.

This R library ‘Chelyabinsk’ allows you process geochemical datasets, namely CASTEML and IONML.

Geochem format for R PMLAME

The core data structure used in this library is a ‘R:pmlame’, which is a polymorph of CASTEML (See Data format CASTEML). An example of ‘R:pmlame’ is expressed by a table with rows-and-columns as shown below. See Data format IONML.

              SiO2       Li       Sr
ref-gl-tahiti 0.59 2.08e-05 1.07e-04
ref-cpx-klb1  0.52 1.37e-06 3.61e-05

Application – mass balancing

Create three CSV files, which are elemental abundances of phases, elemental abundances of whole-rock (WR), and modal abundances and densities of phases and WR. Then issue the following command. These csv files should be in the structure of ‘tblame’. The densities of typical phases are summarized in

$ cat insitu.csv

$ cat wholerock.csv

$ cat mode.csv

$ Rscript -e "chelyabinsk::cbk.plot.balance(\"insitu.csv\",\"wholerock.csv\",\"mode.csv\")"

R> library(chelyabinsk)
R> pdf("Rplots.pdf")
R> cbk.plot.balance("insitu.csv","wholerock.csv","mode.csv")

$ echo Makefile
# -*- mode: makefile -*-

all: $(PLOT)

$(PLOT): $(INSITU).csv $(WR).csv $(MODE).csv Makefile
	Rscript -e "chelyabinsk::cbk.plot.balance(\"$(INSITU).csv\", \"$(WR).csv\", \"$(MODE).csv\")"
	open $(PLOT)

	rm -f $(PLOT)

Next: , Previous: , Up: Top   [Contents][Index]

11 Okadai utilities

These commands allow you to operate analytical machine, image manipulation, and documentation.

Next: , Up: Okadai utilities   [Contents][Index]

11.1 Vstool

See gem package -- vstool. See Matlab script. vs_attach_image.m is the core program and others assist it.

Command: vs-attach-image option imagefile [imagefile2,...]

Create imageometry and copy IMAGEFILE obtained under a live session, to VisualStage 2007. Create only imageometry with OPTION --dry-run. Image format of PNG, JPG, BMP, and TIF are supported.

To upload image with imageometry to web service by Medusa, have images with PNG or JPG format and call Command orochi-upload.

Image format supported are summarized in See (stone-operation-ja)画像の登録.

MatlabScript vs_attach_image.m.

Typical work flow to upload mosaic to VisualStage and Echo using vs-attach-image is shown below.

cmd> dir
20200214-1808/  20200214-1808.jpg  20200214-1808.mapxml  20200214-1808.semstg  20200214-1808.txt
cmd> vs-attach-image 20200214-1808.jpg
cmd> orochi-upload 20200214-1808.jpg --stone_id=20200213095448-577600 --surface_id=20200213115535-834552 --layer=BSE
cmd> cd 20200214-1808/
cmd> vs-attach-image --dry-run *.jpg
cmd> orochi-upload *.jpg --surface_id=20200213115535-834552 --layer=BSE

cmd> dir
cmd> vs-attach-image --dry-run cnso-om-mcs4a@2763.jpg
matlab>> spots
cmd> dir
cnso-om-mcs4a@2763.jpg  cnso-om-mcs4a@2763.geo  cnso-om-mcs4a@2763.tex  cnso-om-mcs4a@2763.pml
cmd> casteml-upload cnso-om-mcs4a@2763.pml

Restart a process TileWorker when necessary.

Command: loop-vs-attach-image

Automatically attach images obtained by SEM to VisualStage 2007. This command is background daemon that calls vs-attach-image.

Command: vs-add-file

No description is available.

Command: vs-attach-image-1269 imagefile

Upload IMAGEFILE of view from the top on Cameca’s sample holder to VisualStage 2007.

Command: vs-attach-image-1270 imagefile

Upload IMAGEFILE of view from the top on Cameca’s sample holder to VisualStage 2007.

Command: vs-get-affine

Return Affine matrix under current session of VisualStage 2007.

Next: , Previous: , Up: Okadai utilities   [Contents][Index]

11.2 Image

These commands save your time on image manipulation.

RubyScript: spots0 [options] imagefile

Generate a cosmetic LaTeX file from IMAGEFILE.

Command: image-scalebar [--grid=1 --width=25.4] imagefile

Put scalebar on IMAGEFILE.

To draw a scale bar on an image, call this command. A PMLaTeX file to show the image with scale bar is created. When PMLaTeX file already exists, it does nothing.

When an imagefile is accompanied with imajeoletry *.txt which is created by JEOL JSM-7001F, the command does not prompt you to type in magnification. The magnification is relative to 12 cm.

See gem package -- scalebar.

PerlScript: imagex [options] imagefile [imagefile2...]

Create a LaTeX catalog file for IMAGEFILE.

Command: spots-warp [options] stagelist.txt

Project coordinate described in STAGELIST.TXT to other space. See gem package -- multi_stage.

Command: image-warp [options] imagefile

Project IMAGEFILE into VS space based on Affine matrix affine_xy2vs stored in imageometry file and export sub-area of the VS space as image file. See python package -- image_mosaic.

Command: image-get-affine [options] imagefile

Return affine_xy2vs (also affine_ij2vs and anchors_xy) estimated from anchors and anchors_ij in imageometry file. This command also reads anchors_ij via GUI and anchors via stdin. This command is subset of image-warp, without image manipulation. See python package -- image_mosaic.

Command: warp_image [options] imagefile

Transform IMAGEFILE using Affine matrix affine_ij2ij and export image. Affine matrix can be specified by (1) 3x3 matrix, (2) center of rotation in original image, rotation angle, and magnification as similar to haffine_from_params, and (3) coordinates where the 4 corners of the original image are projected. The area to be exported can be specified by width and height via arguments. Without width and height specified, those of the original image would be applied. This program also imposes the original image on wall image. In this case, the area to be exported is set by width and height of the wall image. See python package -- image_mosaic.

Command: blend-image imagefile0 imagefile1 x y width height alpha beta

Impose image to wall image with alpha blend techniques. Location to impose the image is set by ij coordinates via arguments. See python package -- image_mosaic.

Next: , Previous: , Up: Okadai utilities   [Contents][Index]

11.3 Emacs script

See emacs package -- fudo.

Some of Fudo software can be invoked from GNU Emacs. Install emacs package -- fudo. Evaluate following symbolic expressions.

(add-to-list 'package-archives '("dream" . ""))
(package-install 'fudo)

These commands allow you edit text efficiently.

Elisp: fudo-eshell

Call eshell and suggest commands for spotDoc operation.

Elisp: fudo-browse-spotDoc &optional spotDoc-URL

View spotDoc by web browser, sftp client, and Dired.

Elisp: fudo-for-echo regexp

List stones in Echo with regexp matched. With selection of stone, you can insert reference to LaTeX document, plot related datasets, or call orochi or casteml. You need the newest copy of database as local file in ~/.emacs.d/auto-stone-list.

Elisp: fudo-barcode-scan rubyscript

Launch rubyscript that accepts input from barcode reader interactively. Make sure if the script runs on its own.

Elisp: fudo-solar-abundance

Return solar elemental composition with atomic weight and isotope abundances.

Elisp: fudo-isocircle isorg-file option

Create a LaTeX file with isocircles from ISORG-FILE. This command calls casteml spots and processes ISORG-FILE.

Elisp: fudo-texify-casteml stones &optional texfile

Create TEXFILE of STONES or from casteml. This function calls external command chelyabinsk::cbk.texify. See R-library Chelyabinsk. When called interactively, this prompts to specify existing casteml file.

Elisp: fudo-mv-1270-chain start end

Synthesize a shell script to rename files by chain analysis using ims-1270.

Elisp: fudo-automosaic-demo list-area list-element

Demonstrate how to create a shell script that invokes automosaic. This command internally calls fudo-automosaic.

Elisp: orgtbl-to-R TABLE PARAMS

Convert an orgtbl-mode TABLE to R statements to have multiple variables. Have an org-table in R script as shown below.

comment.datain <- "
#+TBLNAME: tblame0
#+ORGTBL: SEND datain:tblame0 orgtbl-to-R :no-escape t :dataframe t
| rownames | stone | phase | d18O | d17O | En | Fs | Wo |
| ol_chd1  | chd1  | ol    |    2 |    1 | 98 |  0 |  2 |
| ol_chd2  | chd1  | ol    |    3 |    2 | 90 | 10 |  0 |
| cpx_chd1 | chd1  | cpx   |    1 |  0.5 |  5 |  0 | 45 |
| cpx_chd2 | chd2  | cpx   |    5 |    3 |  2 |  0 | 48 |
| opx_chd3 | chd8  | opx   |   -1 | -0.5 | 99 |  0 |  1 |

## BEGIN RECEIVE ORGTBL datain:tblame0
## END RECEIVE ORGTBL datain:tblame0
Elisp: orgtbl-to-matlab TABLE PARAMS

Convert an orgtbl-mode TABLE to Matlab statements to have multiple variables.

Elisp: org-table-export-csvfile TABLE OUTFILE

Write an orgtbl-mode TABLE into csvfile. This is wrapper to org-table-export. See (org)Built-in table editor.

Elisp: castbl-to-latex TABLE PARAMS

Convert an orgtbl-mode TABLE referred as ‘castable’ to a table in LaTeX. At the same time export the TABLE to CASTEML using casteml convert. See (toolkit)Data format CASTEML. Have an org-table in LaTeX file as shown below.

Some programs refer to major elements as oxide (e. g., FeO) instead of as metal (e.g., Fe). When an element stays in a sample in oxide form, it is safe to store concentration both in oxide and metal.

% BEGIN RECEIVE ORGTBL 2019-02/20190214-0851
% END RECEIVE ORGTBL 2019-02/20190214-0851
#+ORGTBL: SEND 2019-02/20190214-0851 castbl-to-latex :no-escape t
| session           |      |                       ISZ9 |                      ISZ10 |
| stone-ID          |      | 20100310092602184.stokeshi | 20100310092602096.stokeshi |
| SiO2              | cg/g |                      65.31 |                      74.07 |
| FeO               | cg/g |                       3.96 |                       0.61 |
| Fe                | cg/g |                            |                            |
| P2O5              | cg/g |                       0.19 |                       0.05 |
| P                 | cg/g |                            |                            |
| Li                | ug/g |                            |                       65.8 |
| B                 | ug/g |                            |                            |
| Pb                | ug/g |                            |                     34.093 |
| U                 | ug/g |                            |                      3.585 |
| d18O              |      |                            |                            |
| d18O_error        |      |                            |                            |
| Sr87zSr86         |      |                            |                            |
| Sr87zSr86_error   |      |                            |                            |
| Pb206zPb204       |      |                            |                            |
| Pb206zPb204_error |      |                            |                            |

When you toss the table in Emacs, a CSV file is generated and it will be further converted into a CASTEML file by castbl-to-latex with commands shown below.

CMD> casteml convert -f pml 20190214-0844.csv > 20190214-0844.pml

Next: , Previous: , Up: Okadai utilities   [Contents][Index]

11.4 Matlab script

See matlab script -- VisualSpots.

These commands allow you visualize coordinates in image and read datasets from mass spectrometry.

MatlabScript: oxideweight.m

Return molecular weight of oxides per cation.

>> oxideweight('FeO')
ans = 71.8464
>> doc oxideweight
MatlabScript: isotable.m

Return atomic weight and isotope abundance.

>> isotable('Li7')
ans =
>>  [m R nicknames] = isotable('Li7')
m =
R =
nicknames =
>> isotable('Si30')
ans =
MatlabScript: isotope_constants.m

Return atomic weight and isotope abundance.

>> [mass, ratio] = isotope_constants;
>> mass.Li7
>> ratio.Li7
MatlabScript: isotope.m

Define element mass, isotope mass and isotope abundances on workspace.

>> isotope
>> whos
  Name      Size            Bytes  Class
  H         1x1              3704  struct
  Li        1x1              3704  struct
  O         1x1              5184  struct
>> O.mass
ans =
     data: 15.9994
     unit: 'amu'
    label: 'atomic weight'
MatlabScript: atomic_ratio.m

Read a CASTEML file and return molar number of atom relative to Si-28.

See online help by following command.

>> doc atomic_ratio

Procedure to estimate atomic ratios (F19/Si30, Cl35/Si30, and Cl37/Si30) of reference glass ref-gl-myk1-1 is shown below as an example.

$ cd ref_data/
$ casteml download 20150518154615-539156 > ref-gl-myk1-1.pml
>> atomic_ratio('ref-gl-myk1-1',{'19F','35Cl','37Cl'},'ref','30Si')
MatlabScript: spots.m

Create relative-spot table and LaTeX file from image interactively.

This script creates LaTeX file of an image with spots information in it. It also creates a CASTEML file with spot coordinates embedded. With the CASTEML file, you can upload analyses with image and spots.

See online help by following command.

>> doc spots
MatlabScript: vs_attach_image.m

Transform an image to VS space and upload the image to VisualStage 2007.

This Matlab script converts an image to fit into space of VisualStage 2007. You will click three anchors of image and move stage to the three corresponding location by VisualStage 2007. This creates the converted image, and imageometry (with Affine matrix). After image creation, this attaches the image to VisualStage 2007.

See online help by following command.

>> doc vs_attach_image

See python package -- vs2007 that is referred by this script. vs-attach-image.

MatlabScript: demo_calib.m

Estimate ionic yield from atomic_ratio and ionic_ratio of reference materials. This command obtain obtain atomic_ratio from local casteml files. If the command cannot not find the files, this automatically downloads them from Medusa. There are two scenes you want to estimate ionic yield, that are one with LA-ICP-QMS and one with ims-5F.

  1. LA-ICP-QMS: The ionic_ratio is load from spreadsheet/demo_calib.m. Needless to say, you have to edit the script.
  2. ims-5f: The ionic_ratio is load from from local CDF files. Revise autoload/demo_calib.m for minor optimization.
MatlabScript: readionml.m

Read IONML and return raw signal of the whole period. See Read IONML.

See online help by following command.

>> doc readionml
MatlabScript: read_casteml.m

Read elemental info from CASTEML file. To refer to element info, this will download CASTEML file.

Previous: , Up: Okadai utilities   [Contents][Index]

11.5 Ruby/Perl/Shell script

See ruby/perl/shell script -- xtreeml.

These scripts allow you concentrate more on science.

RubyScript: tepra-duplicate

See Barcode operation. Duplicate QR-code using barcode reader and label printer. It tosses letters obtained by barcode reader to external program orochi-label. This is useful when you want to place stone’s name and ID on notebook.

Install gem package – rubyserial by gem install rubyserial in advance.

See also online-help of the program.

ruby -S tepra-duplicate.rb --help
RubyScript: stone

See Barcode operation. Relocate a stone. This program is supposed to be used with barcode reader. See also online-help of the program.

ruby -S stone.rb --help
RubyScript: stones

See Barcode operation. Do inventory count. This program is supposed to be used with barcode reader. See also online-help of the program.

ruby -S stones.rb --help
RubyScript: sutex LaTeX-document

Issue series of programs to push the document to Echo and spotDoc. Following programs are called sequentially.

  1. pmlatex add
  2. pmlatex scan
  3. latexmk
  4. latexmk -c
  5. reducepdf
  6. pmlatex update
  7. pmlatex commit
  8. icp commit

Check if the document was uploaded correctly. See spotDoc.

PerlScript: icp spotDoc-URL

Copy and restore a document to/from spotDoc.

(let ((default-directory (sesame-junk-dir)))
  (select-frame (make-frame-command)) (eshell)
  (insert "pwd") (eshell-send-input)
  (insert "# Hint: perl -S icp spotDoc-URL") (eshell-send-input)
  (sesame-browse-url ""))
$ pwd
$ perl -S icp
$ cd TS-Dhofar-018/; vi report.tex
PerlScript: lsims path-do-analysis-dir

List directory under HOSTPATH on HOST.

PerlScript: TimeBokan dir1 dir2

Copy local dir to remote dir in fashion of Apple’s Time Machine.

PerlScript: cips2cdf infile

Convert Cameca’s datafile to NASA’s CDF.

PerlScript: vs-warp-spots-1270

Convert device’s coordinate to world’s.

PerlScript: dust-imposer-tex

Draw ellipses on LaTeX picture environment.

PerlScript: qrcode

Download QR-code image from a remote server.

ShellScript: mergepdf infile ... infileN outfile

Merge pdf files using Ghostscript.

ShellScript: reducepdf infile

Reduce size of a PDF file using Ghostscript.

ShellScript: stone-diff

Compare Medusa record by record using auto-stone-list.

ShellScript: pml

Export TSV in clipboard to CASTEML file on Desktop. This is for Mac and MS-Windows.

Export TSV-format dataset in clipboard to standard CASTEML file. Download template for Excel from, fill your data, copy the data region to clipboard, then launch pml.bat. This command scans data in clipboard and exports the dataset to ~/Desktop.

AppleScript: OpenTemplateAndPrint

Print barcode label to P-Touch 2430PC by Brother.

Next: , Previous: , Up: Top   [Contents][Index]

12 Machine gazer

The machine gazer consists of server and client. See rails project -- machine_time for server.

See gem package -- godigo for client. These commands allow you to keep track of ‘machine’ status. Have a configuration file ~/.godigo as shown below.

:machine: MACHINE-1
Command: godigo-session start

Start ‘machine’ on machine-server to log status

Command: godigo-session stop

Stop ‘machine’ on machine-server to log status and issue sync

Command: godigo-session sync

Synchronize local directory to remote directory specified in a configuration file ~/.godigo

Next: , Previous: , Up: Top   [Contents][Index]

13 Command index

Jump to:   A   B   C   E   G   I   L   M   O   P   R   S   T   V   W  
Index Entry  Section

AppleScript OpenTemplateAndPrint: Ruby/Perl/Shell script

blend-image: Image

casteml --help: CASTEML commands
casteml convert: CASTEML commands
casteml download: CASTEML commands
casteml join: CASTEML commands
casteml plot: CASTEML commands
casteml split: CASTEML commands
casteml spots: CASTEML commands
casteml upload: CASTEML commands
Command casteml sub-command --help: CASTEML commands

Elisp castbl-to-latex: Emacs script
Elisp fudo-automosaic-demo: Emacs script
Elisp fudo-barcode-scan: Emacs script
Elisp fudo-browse-spotDoc: Emacs script
Elisp fudo-eshell: Emacs script
Elisp fudo-for-echo: Emacs script
Elisp fudo-isocircle: Emacs script
Elisp fudo-mv-1270-chain: Emacs script
Elisp fudo-solar-abundance: Emacs script
Elisp fudo-texify-casteml: Emacs script
Elisp org-table-export-csvfile: Emacs script
Elisp orgtbl-to-matlab: Emacs script

godigo-session start: Machine gazer
godigo-session stop: Machine gazer
godigo-session sync: Machine gazer

image-get-affine: Image
image-scalebar: Image
image-warp: Image

loop-vs-attach-image: Vstool

MatlabScript atomic_ratio.m: Matlab script
MatlabScript demo_calib.m: Matlab script
MatlabScript isotable.m: Matlab script
MatlabScript isotope.m: Matlab script
MatlabScript isotope_constants.m: Matlab script
MatlabScript oxideweight.m: Matlab script
MatlabScript readionml.m: Read IONML
MatlabScript readionml.m: Matlab script
MatlabScript read_casteml.m: Matlab script
MatlabScript spots.m: Matlab script
MatlabScript vs_attach_image.m: Matlab script

orgtbl-to-R: Emacs script
orochi-cd: Record operator Orochi
orochi-ditto: Record operator Orochi
orochi-download: Record operator Orochi
orochi-find: Record operator Orochi
orochi-help: Record operator Orochi
orochi-label: Record operator Orochi
orochi-ls: Record operator Orochi
orochi-mkstone: Record operator Orochi
orochi-mv: Record operator Orochi
orochi-name: Record operator Orochi
orochi-open: Record operator Orochi
orochi-place: Record operator Orochi
orochi-pwd: Record operator Orochi
orochi-rename: Record operator Orochi
orochi-rm: Record operator Orochi
orochi-stone-in-box: Record operator Orochi
orochi-uniq: Record operator Orochi
orochi-upload: Record operator Orochi
orochi-url: Record operator Orochi

PerlScript cips2cdf: Ruby/Perl/Shell script
PerlScript dust-imposer-tex: Ruby/Perl/Shell script
PerlScript icp: Ruby/Perl/Shell script
PerlScript imagex: Image
PerlScript ionml-laicpqms.plx: Create IONML
PerlScript lsims: Ruby/Perl/Shell script
PerlScript qrcode: Ruby/Perl/Shell script
PerlScript TimeBokan: Ruby/Perl/Shell script
PerlScript vs-warp-spots-1270: Ruby/Perl/Shell script
pmlatex --help: Document uploader Pmlatex
pmlatex add: Document uploader Pmlatex
pmlatex commit: Document uploader Pmlatex
pmlatex scan: Document uploader Pmlatex
pmlatex update: Document uploader Pmlatex

Rfunc cbk:read.ionml: Read IONML
Rfunc ionml.convert.ioncsv: Create IONML
Rfunc Read IONML
Rfunc Read IONML
Rscript ionml-laicpqms.R: Create IONML
RubyScript ionml-exp.rb: Create IONML
RubyScript ionml-icp.rb: Create IONML
RubyScript ionml-ims1270.rb: Create IONML
RubyScript ionml-ims1280.rb: Create IONML
RubyScript ionml-ims5f.rb: Create IONML
RubyScript ionml-vg5400.rb: Create IONML
RubyScript spots0: Image
RubyScript stone: Ruby/Perl/Shell script
RubyScript stones: Ruby/Perl/Shell script
RubyScript sutex: Ruby/Perl/Shell script
RubyScript tepra-duplicate: Ruby/Perl/Shell script

ShellScript mergepdf: Ruby/Perl/Shell script
ShellScript pml: Ruby/Perl/Shell script
ShellScript reducepdf: Ruby/Perl/Shell script
ShellScript stone-diff: Ruby/Perl/Shell script
spots-warp: Image

tepra: Setup Tepra server
tepra --help: Setup Tepra server
tepra print: Setup Tepra server

vs-add-file: Vstool
vs-attach-image: Vstool
vs-attach-image-1269: Vstool
vs-attach-image-1270: Vstool
vs-get-affine: Vstool

warp_image: Image

Jump to:   A   B   C   E   G   I   L   M   O   P   R   S   T   V   W  

Previous: , Up: Top   [Contents][Index]

14 Project index

Jump to:   E   G   I   J   M   P   R   T   W   Z  
Index Entry  Section

emacs package – fudo: Packages

gem package – actsasmappable: Packages
gem package – casteml: Packages
gem package – godigo: Packages
gem package – jxa1_api: Packages
gem package – machine_time_client: Packages
gem package – medusa_rest_client: Packages
gem package – multi_stage: Packages
gem package – opencvtool: Packages
gem package – orochi-for-medusa: Packages
gem package – pmlatex: Packages
gem package – scalebar: Packages
gem package – sisyphus-for-medusa: Packages
gem package – tepra: Packages
gem package – visual_stage: Packages
gem package – vstool: Packages
gem package – withrecursive: Packages

ID Query: Services

Jenkins for Fudo: Services

matlab script – VisualSpots: Packages

Project manager for Fudo development: Services
python package – image_mosaic: Packages
python package – jxmap: Packages
python package – vs2007: Packages

r package – chelyabinsk: Packages
r package – MedusaRClient: Packages
r package – VisualAnalysis: Packages
rails project – epma_archiver: Packages
rails project – jxa: Packages
rails project – machine_time: Packages
rails project – medusa: Packages
rake project – mosaic-sem: Packages
raspberry package – DREAM-PI: Packages
Repository for packages – local: Resource location
Repository for packages – public: Resource location
ruby/perl/shell script – xtreeml: Packages

titanium project – sisyphus: Packages

web app – EPMA archiver: Services
web app – EPMA archiver for JXA-8800: Services
web app – Medusa for Agei: Services
web app – Medusa for demo: Services
web app – Medusa for Echo: Services
web app – Medusa for zcoda: Services
web app – Session for machines: Services
www – dream: Packages
www – toolkit: Packages

Zabbix for DREAM: Services

Jump to:   E   G   I   J   M   P   R   T   W   Z