Module: IO

Input-Output handling

Regular TXT files

WDATA

Todo

Describe properties

Todo

Give references

Module: Myio

This module provides functions to read and write data in different formats.

Currently supported formats: - Text files (.txt) with columnar data - Grid information files (_info.txt)

Planned features: - WDATA format support using Forbes’ python library

List of functions

libnest.myio.dimension(nx, ny, nz)

Calculates the dimensionality of the problem.

Parameters:
  • nx (int) – number of grid points along x-axis

  • ny (int) – number of grid points along y-axis

  • nz (int) – number of grid points along z-axis

Returns:

dimensionality of the problem

Return type:

int

libnest.myio.readDimTxt(PATH, PREFIX)

Reads data from the file PREFIX_info.txt in location PATH. It gets information about the grid size and returns them in a list.

Note

Works for 1D, 2D, and 3D grids. A dimension not listed in the file defaults to 1 (a flat direction).

Parameters:
  • PATH (string) – location path

  • PREFIX (string) – prefix of the file

Returns:

a list of points in each direction [NX, NY, NZ].

Return type:

list of ints

libnest.myio.txt2df(file, sufix, cols)

Reads *.txt files to pandas dataframe.

Parameters:
  • file (string) – path and prefix to the data

  • sufix (string) – sufix pointing to the type of data e. g. ‘density’, ‘delta’ etc.

  • cols (list of strings) – names of columns in the file

Returns:

data about spatial extend of observables

Return type:

pandas.DataFrame