Batsrus.jl Documentation

Overview

Note

This package is still under development, so be careful for any future breaking changes!

BATSRUS data reader and converter in Julia.

This package inherits the ideas and code structures from its predecessor in IDL (developed by Gábor Tóth) and MATLAB (developed by Hongyang Zhou), and was originally part of VisAna. It uses the VTK XML format writer writeVTK to generate files for Paraview and Tecplot.

This package provides the following functionalities:

  • simulation data reader
  • data format conversion
  • programming language interoperability

The ultimate goal is to build a convenient tool of reading and analyzing simulation outputs which is easy to install and easy to use.

Ready to use?

Feel free to contact the author for any help or collaboration!

Installation

Install VisAna from the julia REPL prompt with

using Pkg
Pkg.add("Batsrus")

Benchmark

Data loading speed of a 2.4GB 3D binary file, 317MB 3D binary file, and 65KB 2D binary file on Macbook Pro with quad core 2.2 GHz Intel i7 and 16 GB 1600 MHz DDR3:

2.4GBtmax [s]tmean [s]
Julia2.731.32
Python1.351.34
IDL6.186.08
MATLAB16.0210.60
317MBtmean [ms]
Julia180.8
Python179.5
IDL453.5
MATLAB698.4
65KBtmean [μs]
Julia163.36
Python4390.95
IDL1970.29
MATLAB19273.25

The Julia, IDL, and MATLAB version all shares the same kernel design. The timings are obtained for Julia v1.3.1, Python 3.7.6 + Numpy 1.18.1, IDL 8.5, and MATLAB R2018b. For dynamic languages, the first time when function gets executed is usually also the slowest. Currently spacepy performs slightly better because of the well-optimized numpy library in C. For small data sizes, Julia is much faster than others.

Calling From Python

In Python, you can easily take advantage of this package with the aid of PyJulia. After the installation, in the Python repl:

from julia import Batsrus
dir = 'test'
filename = '1d__raw_2_t25.60000_n00000258.out'
data = Batsrus.readdata(filename, dir=dir)

There you have it! Enjoy!

Python dependency

PyPlot package backend may be affected by the settings of PyJulia dependencies. If you want to set it back properly, you need to recompile the PyCall package in Julia.

Developers

VisAna is developed by Hongyang Zhou.