input_output module

class input_output.input_data(filename, filedir)

Bases: object

Data object that handles reading in the data.

Parameters
  • filename (string) – The filename of the input file.

  • filedir (string) – The directory containing the input file.

check_read()

Method that determines if numpy array or pandas dataframe are to be read, based on the input file name.

Returns

True if pandas dataframe is to be read; false if numpy array is to be read.

Return type

bool

read_in()

Reads in the data into an numpy array or pandas dataframe.

Returns

Returns the data either in an array or dataframe.

Return type

numpy array/pandas dataframe

class input_output.output_data(data, indices, outdir, option, data2=0)

Bases: object

Data object that handles plotting and writing data.

Parameters
  • data (numpy array/pandas dataframe) – The data to be plotted/printed.

  • indices (integer list) – The column indices that remain if insignificant entries were skipped.

  • option (string) – The option that handles the output processing - choose from: expecval, MOpop, transdipmom, efield, aucofu.

  • data2 (numpy array/pandas dataframe) – The additional data, if two sets of data are processed for that specific output option.

plot0()

Expectation value output method. Generates plot - the specified output data is generated and saved to the corresponding file.

plot1()

MO populations output method. Generates data files and plot - the specified output data is generated and saved to the corresponding files.

plot2()

Transition dipole moment output method. Generates data files and plot - the specified output data is generated and saved to the corresponding files.

plot3()

Electric field output method. Generates data files and plot - the specified output data is generated and saved to the corresponding files.

plot4()

Autocorrelation function output method. Generates data files and plot - the specified output data is generated and saved to the corresponding files.

plot5()

Default output method - no output.

plotparams(myplot, strx, stry)

Method to define plotting parameters such as font size.

Parameters
  • myplot (string) – Name of the figure object (typically ‘ax’).

  • strx (string) – Name of the x axis label.

  • stry (string) – Name of the y axis label.

main module

main.get_run_type(name)

Determines the run type of the data processing.

Parameters

name (string) – Determines a switch case based on the input file name. Possible options are expect.t, npop.t, table.dat, efield.t, nstate_i.t.

Returns

The name of the function to call for the selected case.

Return type

function name

main.main(data_in, dir_in, dir_out, threshd=1e-05)

Main function call if analysis package is to be run as a script.

Parameters
  • data_in (string) – Input file name.

  • dir_in (string) – Input file directory.

  • dir_out (string) – Output file directory.

  • threshd (float) – The variance threshold below which data is considered as constant and not included in the output.

main.run_abort(data, threshd)
main.run_efield(data, threshd, dir_out)

Handles the call to read efield.t data; Fourier-transforms relevant values (values that are not constant) and plots the resulting spectrum.

Parameters
  • data (numpy array) – The data to process.

  • threshd (float) – The variance threshold below which data is considered as constant and not included in the output.

  • dir_out (string) – Output file directory.

main.run_expec(data, threshd, dir_out)

Handles the call to read and plot expect.t data; only plots relevant values (values that are not constant).

Parameters
  • data (pandas dataframe) – The data to process.

  • threshd (float) – The variance threshold below which data is considered as constant and not included in the output.

  • dir_out (string) – Output file directory.

main.run_npop(data, threshd, dir_out)

Handles the call to read npop.t data; discards irrelevant columns (columns that remain constant); constructs the correlation matrix and prints/plots the result.

Parameters
  • data (pandas dataframe) – The data to process.

  • threshd (float) – The variance threshold below which data is considered as constant and not included in the output.

  • dir_out (string) – Output file directory.

main.run_nstate(data, threshd, dir_out)

Handles the call to read nstate_i.t data; calculates, prints and plots the autocorrelation function; Fourier-transforms and plots the autocorrelation function.

Parameters
  • data (numpy array) – The data to process.

  • threshd (float) – The variance threshold below which data is considered as constant and not included in the output.

  • dir_out (string) – Output file directory.

main.run_table(data, threshd, dir_out)

Handles the call to read table.dat data; calculates Euclidean distance (L2 norm) of the vectors in the table.

Parameters
  • data (numpy array) – The data to process.

  • threshd (float) – The variance threshold below which data is considered as constant and not included in the output.

  • dir_out (string) – Output file directory.

numerical module

numerical.DFT(wavef, realdft=True)

Function to compute the discrete Fourier transform of the given function.

Parameters
  • wavef (numpy array, real or complex) – The data with time data in the first row and the real or complex-valued vectors in the following rows.

  • realdft (bool) – Denotes if only positive frequency components of the DFT are returned.

Returns

The energy grid points of the Fourier-transformed function and the Fourier-transformed function.

Return type

numpy array, real; numpy array, complex

numerical.aucofu(wavef)

Function to compute the autocorrelation function from the given vectors (with respect to the first time step).

Parameters

wavef (numpy array, complex) – The wave function over time.

Returns

The autocorrelation function over time.

Return type

numpy array, complex

numerical.calc_auto(wavef)

Helper function to compute the vector overlap.

Parameters

wavef (numpy array, complex) – The wave function over time.

Returns

The autocorrelation function over time.

Return type

numpy array, complex

statistical module

statistical.check_significance(data, threshd)

Checks which columns are significant based on the set threshold for numpy arrays and pandas dataframes. Deletes insignificant columns.

Parameters
  • data (numpy array/pandas dataframe) – The data object.

  • threshd (float) – The variance threshold below which data is considered as constant and not included in the output.

Returns

The data object without insignificant columns and the indices that correspond to the original columns that remain, for plotting/labeling purposes. purposes.

Return type

numpy array/pandas dataframe, integer list/string list

statistical.correlation_matrix(data)

Calculates the correlation matrix of a dataframe and orders by degree of correlation.

Parameters

data (pandas dataframe) – The data object.

Returns

The correlation matrix sorted with highest correlation on the top.

Return type

pandas series

statistical.euclidean_distance(list_ref, list_comp, vectors)

Calculates the Euclidean distance (L2 norm) between pairs of vectors.

Parameters
  • list_ref (integer list) – A list with the indices of the reference vectors.

  • list_comp (integer list) – A list with the indices of the vectors to compare to.

  • data (numpy array) – The data object.

Returns

The Euclidean distance (L2 norm) for comparison vs. reference vectors.

Return type

numpy array