Stoner Package

Primary Classes

Stoner.Data(*args, **kwargs)

Base class object that represents a matrix of data, associated metadata and column headers.

Stoner.DataFolder(*args, **kwargs)

Provide an interface to manipulating lots of data files stored within a directory structure on disc.

Stoner.Image.ImageFile(*args)

An Image file type that is analogous to Stoner.Data.

Stoner.Image.ImageFolder(*args, **kwargs)

Folder object for images.

Inheritance Diagrams

Inheritance diagram of Stoner.Data
Inheritance diagram of Stoner.DataFolder
Inheritance diagram of Stoner.ImageFile
Inheritance diagram of Stoner.ImageFolder

Numerical Data Objects

Core Package and Modules

Stoner.core.base Module

Base classes for the Stoner package.

Functions

string_to_type(value)

Given a string value try to work out if there is a better python type dor the value.

Classes

_evaluatable()

Placeholder to indicate that special action needed to convert a string representation to valid Python type.

RegexpDict

An ordered dictionary that permits looks up by regular expression.

TypeHintedDict(*args, **kwargs)

Extends a blist.sorteddict to include type hints of what each key contains.

metadataObject(*args)

Represent some sort of object that has metadata stored in a Stoner.Core.TypeHintedDict object.

Stoner.core.array Module

Provides the DataArray class.

A subclass of numpy.ma.MaskedArray that knows that columns have names.

Classes

DataArray(input_array, *args, **kwargs)

A sub class of numpy.ma.MaskedArray with a copy of the setas attribute to allow indexing by name.

Stoner.core.setas Module

setas module provides the setas class for DataFile and friends.

Classes

Setas([row, bless, source])

A Class that provides a mechanism for managing the column assignments in a DataFile like object.

ColumnHeadersDescriptor()

Descriptor that exposes the column headers managed by the Setas object.

Stoner.core.exceptions Module

Stoner Package specific exceptions.

Functions

assertion(condition[, message])

Raise an error when condition is false.

Classes

StonerAssertionError

An exception raised when the library thinks an assertion has failed.

StonerLoadError

An exception thrown by the file loading routines in the Stoner Package.

StonerSetasError

An exception tjrown when we try to access a column in data without setas being set.

StonerUnrecognisedFormat

An exception thrown by the file loading routines in the Stoner Package.

Stoner.core.utils Module

Functions

add_core(other, newdata)

Implement the core work of adding other to self and modifying newdata.

and_core(other, newdata)

Implement the core of the & operator, returning data in newdata.

sub_core(other, newdata)

Worker for the subtraction.

mod_core(other, newdata)

Implement the column deletion method.

copy_into(source, dest)

Copy the data associated with source to dest.

decode_string(value)

Expand a string of column assignments, replacing numbers with repeated characters.

Classes

Tab_Delimited()

A customised csv dialect class for reading tab delimited text files.

Analysis Package

Stoner.analysis Package

Subpaclage to support the data analysis functions.

Stoner.analysis.fitting Package

Provides additional functionality for doing curve fitting to data.

Classes

ODR_Model(*args, **kwargs)

A wrapper for converting lmfit models to odr models.

Fitting Models

Plot Package and Modules

Stoner.plot Package

Stoner.plot sub-package - contains classes and functions for visuallising data.

Most of the plotting functionality is provided by the PlotMixin mixin class which is available through the Stoner.Data class.

The formats module provides a set of template classes for producing different plot styles and formats. The Stoner.plot.util module provides some handy utility functions.

Classes

PlotMixin(*args, **kwargs)

A mixin class that works with Stoner.Core.DataFile to add additional plotting functionality.

Stoner.plot.formats Module

Plot Templates module - contains classes that style plots produced by Data.

Classes

TexFormatter()

An axis tick label formatter that emits Tex formula mode code.

TexEngFormatter([unit, places, sep, usetex, ...])

An axis tick label formatter that emits Tex formula mode code.

DefaultPlotStyle(*_, **kwargs)

Produces a default plot style.

GBPlotStyle(*_, **kwargs)

Template developed for Gavin's plotting.

JTBPlotStyle(*_, **kwargs)

Template class for Joe's Plot settings.

JTBinsetStyle(*_, **kwargs)

Template class for Joe's Plot settings.

PRBPlotStyle(*_, **kwargs)

A figure Style for making figures for Phys Rev * Jounrals.

SketchPlot(*_, **kwargs)

Turn on xkcd plot style.

SeabornPlotStyle

Class Inheritance Diagram
Inheritance diagram of Stoner.plot.formats.TexFormatter, Stoner.plot.formats.TexEngFormatter, Stoner.plot.formats.DefaultPlotStyle, Stoner.plot.formats.GBPlotStyle, Stoner.plot.formats.JTBPlotStyle, Stoner.plot.formats.JTBinsetStyle, Stoner.plot.formats.PRBPlotStyle, Stoner.plot.formats.SketchPlot, Stoner.plot.formats.DefaultPlotStyle

Stoner.plot.utils Module

Functions

errorfill(x, y[, yerr, xerr, color, ls, lw, ...])

Plot data with errors marked by a filled region.

File Formats Package Module

Data Classes

Stoner.formats.data Package

Sub-package of routines to load Data objects in different formats.

This sub-package is lazy-loaded but then pulls in all of the modules in order to register the routines.

Image Classes

Stoner.formats.image Package

Sub-package of routines to load ImageFile objects in different formats.

This sub-package is lazy-loaded but then pulls in all of the modules in order to register the routines.

Folders package - Collections Classes

Main Classes

Stoner.folders Package

Core support for working with collections of files in the Stoner.DataFolder.

Classes

DataFolder(*args, **kwargs)

Provide an interface to manipulating lots of data files stored within a directory structure on disc.

PlotFolder(*args, **kwargs)

A Stoner.folders.BaseFolder that knows how to ploth its underlying data files.

Class Inheritance Diagram
Inheritance diagram of Stoner.folders.mixins.DataFolder, Stoner.folders.mixins.PlotFolder

Folders Package and Submodules

Stoner.folders.core Module

Provide the base classes and functions for the Stoner.DataFolder class.

Classes

BaseFolder(*args, **kwargs)

A base class for objectFolders that supports both a sequence of objects and a mapping of instances of itself.

Stoner.folders.mixins Module

mixin classes for Stoner.folders.core.baseFoler.

Classes

DiskBasedFolderMixin(*args, **kwargs)

A Mixin class that implements reading metadataObjects from disc.

DataFolder(*args, **kwargs)

Provide an interface to manipulating lots of data files stored within a directory structure on disc.

PlotFolder(*args, **kwargs)

A Stoner.folders.BaseFolder that knows how to ploth its underlying data files.

Stoner.folders.functions Module

Folder functions for binding as methods to BaseFolder.

Functions

append(arr, values[, axis])

Append values to the end of an array.

array(object[, dtype, copy, order, subok, ...])

array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0,

concatenate(folder[, sort, reverse])

Concatenates all the files in a objectFolder into a single metadataObject like object.

extract(folder, *metadata, **kwargs)

Extract metadata from each of the files in the terminal group.

gather(folder[, xcol, ycol])

Collect xy and y columns from the subfiles in the final group in the tree.

isiterable(value)

Check to see if a value is iterable.

np_any(a[, axis, out, keepdims, where])

Test whether any array element along a given axis evaluates to True.

Stoner.folders.each Module

Classes and support functions for the Stoner.DataFolder.each.magic attribute.

Classes

Item(folder)

Provides a proxy object for accessing methods on the inividual members of a Folder.

Class Inheritance Diagram
Inheritance diagram of Stoner.folders.each.Item

Stoner.folders.metadata Module

Provides classes and functions to support the Stoner.DataFolder.metadata magic attribute.

Classes

MetadataProxy(folder)

Provide methods to interact with a whole collection of metadataObjects' metadata.

Class Inheritance Diagram
Inheritance diagram of Stoner.folders.metadata.MetadataProxy

Image Subpackage

Main Image Classes

Stoner.Image Package

Supackage to provide image processing capabilities.

The Stoner.Image package provides a means to carry out image processing functions in a smilar way that Stoner.Core and Stoner.Data and Stoner.DataFolder do. The Stomner.Image.core module contains the key classes for achieving this.

Classes

ImageArray(*args, **kwargs)

A numpy array like class with a metadata parameter and pass through to skimage methods.

ImageFile(*args)

An Image file type that is analogous to Stoner.Data.

ImageFolder(*args, **kwargs)

Folder object for images.

ImageStack(*args, **kwargs)

An alternative implementation of an image stack based on BaseFolder.

KerrArray(*args, **kwargs)

A subclass for Kerr microscopy specific image functions.

KerrStack(*args, **kwargs)

Represent a stack of Kerr images.

MaskStack(*args, **kwargs)

Represent a set of masks for Kerr images.

Class Inheritance Diagram
Inheritance diagram of Stoner.Image.core.ImageArray, Stoner.Image.core.ImageFile, Stoner.Image.folders.ImageFolder, Stoner.Image.stack.ImageStack, Stoner.Image.kerr.KerrArray, Stoner.Image.kerr.KerrStack, Stoner.Image.kerr.MaskStack

Stoner.Image.folders Module

Classes

ImageFolderMixin()

Mixin to provide a folder object for images.

ImageFolder(*args, **kwargs)

Folder object for images.

Class Inheritance Diagram
Inheritance diagram of Stoner.Image.folders.ImageFolderMixin, Stoner.Image.folders.ImageFolder

Stoner.Image.stack Module

Classes

ImageStackMixin(*args, **kwargs)

Implement an interface for a BaseFolder to store images in a 3D numpy array for faster access.

ImageStack(*args, **kwargs)

An alternative implementation of an image stack based on BaseFolder.

ImageStack(*args, **kwargs)

An alternative implementation of an image stack based on BaseFolder.

Class Inheritance Diagram
Inheritance diagram of Stoner.Image.stack.ImageStackMixin, Stoner.Image.stack.ImageStack, Stoner.Image.stack.ImageStack

Stoner.Image.attrs Module

Classes

DrawProxy(*args, **kwargs)

Provides a wrapper around skimage.draw to allow easy drawing of objects onto images.

MaskProxy(*args)

Provides a wrapper to support manipulating the image mask easily.

Class Inheritance Diagram
Inheritance diagram of Stoner.Image.attrs.DrawProxy, Stoner.Image.attrs.MaskProxy

Attocube SPM Scans

Stoner.formats.attocube.AttocubeScan(*args, ...)

An ImageStack subclass that can load scans from the AttocubeScan SPM System.

Additional Image Functions

Stoner.Image.imagefuncs Module

Functions

adjust_contrast(im[, lims, percent])

Rescale the intensity of the image.

align(im, ref[, method])

Use one of a variety of algroithms to align two images.

convert(image, dtype[, force_copy, uniform, ...])

Convert an image to the requested data-type.

correct_drift(im, ref, **kwargs)

Align images to correct for image drift.

subtract_image(im, background[, contrast, ...])

Subtract a background image from the ImageArray.

fft(im[, shift, phase, remove_dc, gaussian, ...])

Perform a 2d fft of the image and shift the result to get zero frequency in the centre.

filter_image(im[, sigma])

Alias for skimage.filters.gaussian.

gridimage(im[, points, xi, method, ...])

Use scipy.interpolate.griddata() to shift the image to a regular grid of coordinates.

hist(im, *args, **kwargs)

Pass through to matplotlib.pyplot.hist() function.

imshow(im[, figure, ax, title, title_args, ...])

Quickly plot of image.

level_image(im[, poly_vert, poly_horiz, ...])

Subtract a polynomial background from image.

normalise(im[, scale, sample, limits, ...])

Norm alise the data to a fixed scale.

profile_line(img[, src, dst, linewidth, ...])

Wrap sckit-image method of the same name to get a line_profile.

quantize(im, output[, levels])

Quantise the image data into fixed levels given by a mapping.

radial_coordinates(im[, centre, pixel_size, ...])

Return a map of the radial coordinates of an image from a given centre, with adjustments for pixel size.

radial_profile(im[, angle, r, centre, ...])

Extract a radial profile line from an image.

remove_outliers(im[, percentiles, replace])

Find values of the data that are beyond a percentile of the overall distribution and replace them.

rotate(im, angle[, resize, center, order, ...])

Rotate image by a certain angle around its center.

translate(im, translation[, add_metadata, ...])

Translate the image.

translate_limits(im, translation[, reverse])

Find the limits of an image after a translation.

plot_histogram(im[, bins])

Plot the histogram and cumulative distribution for the image.

threshold_minmax(im[, threshmin, threshmax])

Return a boolean array which is thresholded between threshmin and threshmax.

do_nothing(image)

Nulop function for testing the integration into ImageArray.

denoise(im[, weight])

Rename the skimage restore function.

Stoner.Image.util Module

Code adapted from skimage module.

Functions

sign_loss(dtypeobj_in, dtypeobj)

Warn over loss of sign information when converting image.

prec_loss(dtypeobj_in, dtypeobj)

Warn over precision loss when converting image.

_dtype(itemsize, *dtypes)

Return first of dtypes with itemsize greater than `itemsize.

_dtype2(kind, bits[, itemsize])

Return dtype of kind that can store a bits wide unsigned int.

Kerr Image Handling

Stoner.Image.kerr Module

Classes

KerrArray(*args, **kwargs)

A subclass for Kerr microscopy specific image functions.

KerrStack(*args, **kwargs)

Represent a stack of Kerr images.

MaskStack(*args, **kwargs)

Represent a set of masks for Kerr images.