Module wafer::input[][src]

Any required file input (apart from configuration) is handled here. Plain text and binary formats.

Re-exports

use config::Config;
use config::FileType;
use config::Grid;
use csv;
use errors::*;
use grid;
use ndarray::Array1;
use ndarray::Array3;
use ndarray::ArrayViewMut3;
use ndarray::Axis;
use ndarray::Zip;
use ndarray_parallel::prelude::*;
use noisy_float::prelude::*;
use potential::PotentialSubSingle;
use rmps;
use ron::de::from_reader as ron_reader;
use serde_json;
use serde_yaml;
use slog::Logger;
use std::fs::create_dir;
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
use std::process::Command;
use std::process::Stdio;

Structs

PlainRecord

A simple struct to parse data from a plain csv file

Constants

_IMPL_DESERIALIZE_FOR_PlainRecord

Functions

check_input_dir

Checks that the folder input exists. If not, creates it. This doesn't specifically need to happen for all instances, but we may want to put restart values in there later on.

check_potential_file

Checks if a potential file exists in the input directory

check_potential_sub_file

Checks if a potential_sub file exists in the input directory

check_wavefunction_file

Checks if a wavefunction file exists in the input directory

fill_data

Once data has been pulled from disk into a convertable format, we contstruct an array ready to calculate on. This requires the addition of a central difference buffer zone and may require the data to be resampled if input sizes differ from the size of the data on disk.

fill_sub_data

Returns a variable array of potential_sub data, which is resized if needed.

load_wavefunctions

Loads previously computed wavefunctions from disk.

potential

Loads potential file from disk. Handles cases where multiple files exist.

potential_sub

Loads potential_sub file from disk. Handles cases where multiple files exist.

read_csv

Given a filename, this function reads in the data of a csv file and parses the values into a 3D array. There are a few caveats to this as the file may be of a different shape to the requested size in the configuration file. The routine therefore attempts to resample/interpolate the data to fit the required parameters.

read_json

Loads an array from a json file on disk.

read_mpk

Loads an array from a mpk file on disk.

read_ron

Loads an array from a ron file on disk.

read_sub_csv

Loads a potential_sub value or array from a csv file on disk.

read_sub_json

Loads a potential_sub value or array from a json file on disk.

read_sub_mpk

Loads a potential_sub value or array from a messagepack file on disk.

read_sub_ron

Loads a potential_sub value or array from a ron file on disk.

read_sub_yaml

Loads a potential_sub value or array from a yaml file on disk.

read_yaml

Loads an array from a yaml file on disk.

script_potential

Loads potential file from a script.

trilerp_resize

Trilinear interpolation to resize an array. i.e, if we have v.size = (50,50,50), and size = (100, 100, 100) then the output will be (100,100,100) linearly interpolated

wavefunction

Loads wavefunction file from disk. Handles cases where multiple files exist.