Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RigakuFiles.jl

CI codecov stable dev Aqua QA

Read Rigaku X-ray diffractometer output files (SmartLab, MiniFlex, Ultima) in Julia.

Highlights

  • Canonical .ras (with *RAS_HEADER_START / *RAS_INT_START markers) and simplified .txt exports
  • Multi-scan files in a single read
  • Common metadata surfaced as typed fields; the full raw header is preserved too
  • Three-column attenuator data tolerated
  • Works with either Unix or Windows line endings

Installation

using Pkg
Pkg.add(url="https://github.com/garrekstemo/RigakuFiles.jl")
using RigakuFiles

Quick start

using RigakuFiles

# Single-scan file; throws if the file actually contains >1 scan
scan = only(RigakuFile("mysample.ras"))

scan.sample      # "ZIF-62 Test"
scan.target      # "Cu"
scan.wavelength  # 1.540593  (Kα1, Å)
scan.x           # Vector{Float64} of 2θ values
scan.y           # Vector{Float64} of intensities

Multi-scan files

RigakuFile is an AbstractVector{RigakuScan}, so iteration, indexing, and length all work directly:

file = RigakuFile("multiscan.ras")
length(file)     # number of scans
file[1]          # first scan

for s in file
    println(s.comment, ": ", length(s), " points")
end

If you want the first scan of a possibly-multi-scan file and are fine ignoring the rest:

scan = first(RigakuFile("maybe_multi.ras"))

Accessors

wavelength_alpha1(scan)   # Kα1 wavelength (Å)
wavelength_alpha2(scan)   # Kα2 wavelength (Å), or 0.0 if not recorded
wavelength_beta(scan)     # Kβ wavelength (Å),  or 0.0 if not recorded
scan_step(scan)           # Scan step size
scan_speed(scan)          # Scan speed
detector(scan)            # Detector name, e.g. "HyPix3000(H)"

Anything not exposed by the accessors is available in scan.metadata (a Dict{String, String}). See the documentation for the full field list and file-format notes.

Issues and contributions

If you run into a Rigaku file this package mis-parses — especially one from a firmware version or instrument line not yet covered — please open an issue. A minimal excerpt of the offending file (sample names can be redacted) is the most helpful thing to attach.

Releases

Packages

Contributors

Languages