flatspin.data

Data management

Module Contents

Classes

Dataset

Functions

col_group(x)

match_column(pattern, columns)

match column pattern from available columns

match_columns(patterns, columns)

match column patterns

csv_columns(filename)

Parse column names at the top of a CSV file

save_csv(df, filename)

read_csv(filename, index_col=None)

save_hdf(df, filename)

read_hdf(filename)

hdf_columns(filename)

read_npy(filename)

save_npy(df, filename)

npy_columns(filename)

read_npz(filename)

save_npz(df, filename)

npz_columns(filename)

archive_key(filename)

get_format(filename)

is_archive_format(fmt)

is_archive(filename)

is_tablefile(filename)

list_dir(filename)

list_npz(filename)

list_hdf(filename)

listfiles(filename)

to_table(data)

match_any(name, patterns)

read_table(filename, index_col=None, **kwargs)

save_table(data, filename)

table_columns(filename)

read_tables(filenames, index_col=None)

read_geometry(filename='geometry.csv')

read_vectors(filenames, quantity='mag', t=None)

crop(X, crop, axis=-1)

Crop array X along one or more axes

rolling_window(X, win_shape, step=1, method='sum')

Apply a function over a rolling window of X

filter_df(df, **kwargs)

Filter dataframe by key=value or range key=start:stop

digitize(X, threshold=0)

bit_array(x, n_bits)

Convert number x to array of bits

array_bit(a)

Convert bit array a to number

vector_grid(pos, vectors, grid_size=None, crop_width=None, win_shape=None, win_step=None, normalize=True, return_grid=False)

Process vectors on a grid

load_output(dataset, quantity, t=None, grid_size=None, crop_width=None, win_shape=None, win_step=None, flatten=True)

Load output vectors from dataset, with optional post-processing

Attributes

table_formats

table_extensions

archive_formats

table_patterns

flatspin.data.col_group(x)
flatspin.data.match_column(pattern, columns)

match column pattern from available columns m -> (mx, my, mz) m.region*x

flatspin.data.match_columns(patterns, columns)

match column patterns

flatspin.data.csv_columns(filename)

Parse column names at the top of a CSV file

flatspin.data.save_csv(df, filename)
flatspin.data.read_csv(filename, index_col=None)
flatspin.data.save_hdf(df, filename)
flatspin.data.read_hdf(filename)
flatspin.data.hdf_columns(filename)
flatspin.data.read_npy(filename)
flatspin.data.save_npy(df, filename)
flatspin.data.npy_columns(filename)
flatspin.data.read_npz(filename)
flatspin.data.save_npz(df, filename)
flatspin.data.npz_columns(filename)
flatspin.data.table_formats
flatspin.data.table_extensions
flatspin.data.archive_formats = ['npz', 'hdf']
flatspin.data.table_patterns
flatspin.data.archive_key(filename)
flatspin.data.get_format(filename)
flatspin.data.is_archive_format(fmt)
flatspin.data.is_archive(filename)
flatspin.data.is_tablefile(filename)
flatspin.data.list_dir(filename)
flatspin.data.list_npz(filename)
flatspin.data.list_hdf(filename)
flatspin.data.listfiles(filename)
flatspin.data.to_table(data)
flatspin.data.match_any(name, patterns)
flatspin.data.read_table(filename, index_col=None, **kwargs)
flatspin.data.save_table(data, filename)
flatspin.data.table_columns(filename)
flatspin.data.read_tables(filenames, index_col=None)
flatspin.data.read_geometry(filename='geometry.csv')
flatspin.data.read_vectors(filenames, quantity='mag', t=None)
flatspin.data.crop(X, crop, axis=- 1)

Crop array X along one or more axes crop is a tuple (before, after) for each axis to crop axis specifies which axis to start cropping from

flatspin.data.rolling_window(X, win_shape, step=1, method='sum')

Apply a function over a rolling window of X

flatspin.data.filter_df(df, **kwargs)

Filter dataframe by key=value or range key=start:stop

class flatspin.data.Dataset(index=None, params={}, info={}, basepath=None)

Bases: object

property name(self)
__getitem__(self, i)
__repr__(self)

Return repr(self).

__str__(self)

Return str(self).

keys(self)
items(self)
iterrows(self)
__iter__(self)
__len__(self)
__eq__(self, other)

Return self==value.

subset(self, i)
filter(self, **kwargs)
groupby(self, key)
sort_values(self, column)
row(self, row=0)
id(self, row=0)
static read(basepath)
save(self, basepath=None)
file(self, filename)
files(self, patterns=None, squash=True)
tablefile(self, tablename, squash=True)
tablefiles(self, patterns=None, squash=True)
flatspin.data.digitize(X, threshold=0)
flatspin.data.bit_array(x, n_bits)

Convert number x to array of bits

flatspin.data.array_bit(a)

Convert bit array a to number

flatspin.data.vector_grid(pos, vectors, grid_size=None, crop_width=None, win_shape=None, win_step=None, normalize=True, return_grid=False)

Process vectors on a grid

flatspin.data.load_output(dataset, quantity, t=None, grid_size=None, crop_width=None, win_shape=None, win_step=None, flatten=True)

Load output vectors from dataset, with optional post-processing