in_out_class module¶
This module provides the classes InClass and OutClass.
From this module one can import the classes InClass and OutClass. The class InClass allows to create objects that read in the data. The class OutClass allows to create objects that output the results.
- Required Packages:
pandas
numpy
matplotlib.pyplot
seaborn
- Provides:
InClass
OutClass
- class in_out_class.InClass(data_path='data/')¶
Bases:
objectClass for reading the data.
Objects of the InClass read the data files in a given path. You can either read all files at once using read_data with the default option or read the numerics and statistics part seperately using read_statistics and read_numerics or you can define which files to read by passing a list of the file names to read_data.
- Parameters
data_path (str) – (Relative) Path of the directory with the data files. Default: “data/”
- data_path¶
(Relative) Path of the directory with the data files.
- Type
str
- expec¶
Data of the expec.t file
- Type
none or pandas dataframe
- npop¶
Data of the npop.t file
- Type
none or pandas dataframe
- table¶
Data of the table.dat file
- Type
none or numpy array
- efield¶
Data of the efield.t file
- Type
none or numpy array
- nstate_i¶
Data of the nstate_i.t file
- Type
none or numpy array
- read_functions¶
Dictionary that maps file name to suitable tailored reader function
- Type
dict
- names_to_attributes¶
Dictionary that maps file names to class attributes
- Type
dict
- read_data(file_names=['expec.t', 'npop.t', 'table.dat', 'efield.t', 'nstate_i.t'])¶
Reads all the files whose names are given as input.
- Parameters
file_names (list of str) – List of file names. Default: file_names=[ “expec.t”, “npop.t”, “table.dat”, “efield.t”, “nstate_i.t”, ]
- read_numerics_data()¶
Calls read_data with file names that correspond to numerics.
The relevant file names are [“efield.t”, “nstate_i.t”]
- read_statistics_data()¶
Calls read_data with file names that correspond to statistics.
The relevant file names are [“expec.t”, “npop.t”, “table.dat”]
- class in_out_class.OutClass(statistics, numerics, savepdf=False, write_out=False)¶
Bases:
objectClass for outputting the results.
Based on a statistics and a numerics object the OutClass creates objects which provide functions to plot relevant plots and save relevant results. Plots can be saved to files, too.
- Parameters
statistics (object of StatisticsClass) – Object of StatisticsClass which contains the results of the statistical analysis.
numerics (object of NumericsClass) – Object of NumericsClass which contains the results of the statistical analysis.
savepdf (bool) – Flag whether the plots should be saved to PDF files (True) or not (False). Default: False
write_out (bool) – Flag whether the results should be saved in files (True) or not (False). Default: False
- statistics¶
Object of StatisticsClass which contains the results of the statistical analysis.
- Type
object of StatisticsClass
- numerics¶
Object of NumericsClass which contains the results of the statistical analysis.
- Type
object of NumericsClass
- savepdf¶
Flag whether the plots should be saved to PDF files (True) or not (False). Default: False
- Type
bool
- write_out¶
Flag whether the results should be saved in files (True) or not (False). Default: False
- Type
bool
- plot_numerics()¶
Plot all numerics plots. Possibly save them.
The plots will be displayed in the main notebook. Depending on the flag savepdf, the plots are also saved to pdf files.
- plot_statistics()¶
Plot all statistic plots. Possibly save them.
The plots will be displayed in the main notebook. Depending on the flag savepdf, the plots are also saved to pdf files.
- statistics_out()¶
Possibly write output files (expect for plots) for statistics.
- The output files are:
task4_out.csv
task5_out.npy