mpacts.io. csv_read

In order to be able to use this module import it like this:

import mpacts.io.csv_read
#or assign it to a shorter name
import mpacts.io.csv_read as csv

CSV_State

class mpacts.io.csv_read.CSV_State(step, BaseName_in=None, doNotThrow=False)

Bases: mpacts.io.readerstatebase.ReaderStateBase

Reading in csv-files (written using the CSVWriter). Uses numpy. State object to access the contents of a DEMeter written file(s).

Can be used as an iterator (iterating over all saved time-steps) and with direct access ‘[]’ operator to access a specific time/time-step.

The ‘get’ member is used to return a specific array from the file.

CSV_State(name, parent, **kwargs)
get(pcName, arrayName)

returns the saved array with specified arrayName in particle container pcName as a numpy-array; the csv-file saves only Scalar arrays, e.g.: x becomes x_0, x_1, x_2, but when extracting, we try to combine the components again for ease-of-use.

Params:
-pcName particle container name
-arrayName name of array to get
read_and_set_time(pcName, fname)
set_step(step, verbose=1)