Module wafer::output[][src]

All file output is handled in this module. Plain text and binary options are both here.

Re-exports

use chrono::Local;
use csv;
use ndarray::Array3;
use ndarray::ArrayView3;
use ndarray::Zip;
use ndarray_parallel::prelude::ParApply2;
use noisy_float::prelude::*;
use ordinal::Ordinal;
use rayon;
use rmps;
use ron::ser::to_string_pretty as ron_string;
use ron::ser::PrettyConfig;
use serde::Serialize;
use serde_json;
use serde_yaml;
use std::fs::copy;
use std::fs::create_dir_all;
use std::fs::remove_file;
use std::fs::File;
use std::io::prelude::*;
use term_size;
use yansi::Color::Blue;
use config::Config;
use config::FileType;
use config::Index3;
use errors::*;
use grid;
use potential;
use potential::PotentialSubSingle;

Structs

ObservablesOutput

Structured output of observable values

PROJDATE

Date & time at which the simulation was started. Used as a unique identifier for the output directory of a run.

PlainRecord

A simple struct to parse data to a plain csv file

TERMWIDTH

Width of program output to screen.

Constants

_IMPL_SERIALIZE_FOR_ObservablesOutput
_IMPL_SERIALIZE_FOR_PlainRecord

Statics

PROJDATE
TERMWIDTH

Functions

check_output_dir

Generates a unique folder inside an output directory for the current simulation.

copy_config

Copies the current configuration file to the project folder

finalise_measurement

Sets up the final measurements for each wavefunction, printing them to screen and saving them to disk.

get_project_dir

Each simulation has a unique folder output so as not to overwrite other instances. This function gets the name of the current folder.

get_term_size

Uses term_size to pull in the terminal width and from there sets the output pretty printing value to an appropriate value (between 70-100).

observables_csv

Saves the observables to a plain csv file.

observables_json

Saves the observables to a json file.

observables_mpk

Saves the observables to a messagepack binary file.

observables_ron

Saves the observables to a ron file.

observables_yaml

Saves the observables to a yaml file.

potential

Handles the saving of potential data to disk.

potential_sub

Handles the saving of potential_sub data to disk (if required).

print_banner

Simply prints the Wafer banner with current commit info and thread count.

print_measurements

Pretty prints measurements at current step to screen

print_observable_header

Pretty prints a header for the subsequent observable data

print_summary

Pretty print final summary

remove_partial

Removes a temporary _partial file from the current output directory. Should only be called if a converged file is written.

sanitize_string

Sanitizes strings such that they will create safe filenames. For now, only used with the project_name variable in the configuration.

wavefunction

Saves a wavefunction to disk, and controls what format (plain text or binary) the data should be handled as.

write_csv

Outputs an array to disk in a plain, csv format

write_json

Outputs an array to disk in json format

write_mpk

Outputs an array to disk in the messagepack binary format

write_ron

Outputs an array to disk in ron format

write_sub_csv

Outputs a potential_sub to disk in csv format

write_sub_json

Outputs a potential_sub to disk in json format

write_sub_mpk

Outputs a potential_sub to disk in messagepack format

write_sub_ron

Outputs a potential_sub to disk in ron format

write_sub_yaml

Outputs a potential_sub to disk in yaml format

write_yaml

Outputs an array to disk in yaml format