7. Files and file names¶
7.1. mesh files (.nmesh
, .nmesh.h5
)¶
Files that contain a finite element mesh. See Nmesh file format.
7.2. Simulation scripts (.py
)¶
Files that contain simulation program code. The ending is (by
convention) .py
which reflects that the programming language used
is Python.
All the example codes provided in the Guided Tour are such simulation scripts.
7.3. Data files (.ndt
)¶
ndt
stands for |Nmag| Data Table, analog to odt
files (`OOMMF`_
Data Table) for the OOMMF project. In fact, ndt
and odt
files
are very similar.
ndt
files are ascii files where each row corresponds to one time
step (or, more generally, configuration of the system). The columns
contain:
- metadata such as
- a unique identifier for every row
- the time at which the row was written
- (spatially) averaged field data
The first two lines contain information about what data is stored in the various columns:
- The first line provides a header
- The second line provides the SI units
All other lines contain the actual data.
The file can be loaded into any data processing software (such as MS Excel, Origin, Matlab, Gnuplot, ...). However, often it is more convenient to use the ncol tool to select the relevant columns, and only to pass the filtered data to a post-processing (e.g. plotting) program.
Data is written into the ndt
file whenever the save_data method
of the simulation object is called.
7.4. Data files (.h5
)¶
The h5
data files store spatially resolved fields. The format is
a binary and compressed `hdf5`_ format to which we have convenient
access via the `pytables`_ package for Python. The user should not have
to worry about reading this file directly, but use the nmagpp tool to
access the data.
7.5. File names for data files¶
The filenames for the Data files (.ndt) and Data files (.h5) are given by
concatenation of the simulation name, the extension _dat.
and
the extension (.h5
or .ndt
).
When a simulation object is created, for example in a file called
mybar.py
starting like this:
import nmag
sim = nmag.Simulation(name="bar")
then the simulation name is bar
.
If no name is provided, i.e. the file mybar.py
starts like this:
import nmag
sim = nmag.Simulation()
then the simulation name will be the run id. The run id is the
filename of the simulation script (without the .py
extension),
i.e. the simulation name then will be mybar
.
Let us assume for the rest of this section that the simulation name
is bar
. Once we use the save_data command, for example like this:
sim.save_data()
an ndt
file will be created, with name bar_dat.ndt
(= bar
+ _dat.
+ ndt
).
Similarly, if we write the fields spatially resolved:
sim.save_data(fields='all')
a h5 data file with name bar_dat.h5
(= bar
+ _dat.
+ h5
)
will be created.
7.6. File names for log files¶
A log file is created that stores (most of) the messages displayed to
stdout (i.e. the screen). The name of the log file starts with the
name of the simulation script (without the .py
extension), and ends with _log.log
.
For example, a simulation script with name mybar.py
will have an
associated log file with name mybar_log.log
.
Another three files will be created if the (undocumented)
--dumpconf
switch is provided. This are primarily of use to the
developers and can usually be ignored:
mybar_log.conf
: This can be used to configure what data is logged.mybar_ocaml.conf
: Configuration of some variables used in the ocaml codemybar_nmag.conf
: Some variables used in the nmag code