Expand description
Delfi is a crate which seeks to minimize the code needed to save your data to a csv-file. No matter which form your data takes it should be easy to save it to csv! The crate is centralized around two core concept:
- The Datapoint: A set of data elements which can be recorded to csv-format
- The Dataset: A collection of datapoints, optionally with labels
A quick example using std-arrays:
use delfi::Dataset;
let t = [0.0, 0.5, 1.0];
let x = [1.0, 2.0, 4.0];
let ds = Dataset::from_columns([t, x]).with_labels(["time", "length"]);
ds.save("./resources/data/examples/basic.csv").unwrap();Here is a slighlty more complex example using ndarrays:
use delfi::dataset;
use ndarray::Array;
const N: usize = 1000;
let x = Array::linspace(0., 10., N+1);
let y = Array::logspace(10., 0., 2., N+1);
let dataset = dataset!{
"x" => x,
"y" => y,
};
let directory = std::fs::canonicalize("./resources/data/examples/").unwrap();
let filepath = directory.join("ndarray.csv");
dataset.save(&filepath).unwrap();Modules§
- datapoint
- Module containing code related to the Datapoint trait Implementations on the Datapoint trait
- dataset
- Module containing implementations on the Dataset struct Implementations on the Dataset struct
Macros§
- dataset
- Macro for creating a dataset from a set of labelled columns
Structs§
- Dataset
- A dataset is a collection of datapoints (for more information on this see the Datapoint trait).
Traits§
- Datapoint
- A datapoint is a collection of dataelements which can be recorded to the csv-format.