- class Stoner.formats.attocube.AttocubeScan(*args, **kargs)¶
An ImageStack subclass that can load scans from the AttocubeScan SPM System.
AttocubeScan represents a scan from an Attocube SPM system as a 3D stack of scan data with associated metadata. Indexing the AttocubeScan with either an integer or a partial match to one the signals saved in the scan will pull out that particular scan as a
If the scan was a dual pass scan with forwards and backwards data, then the root AttocubeScan will contain the common metadata derived from the Scan parameters and then two sub-stacks that represent the forwards (‘fwd’) and backwards (‘bwd’) scans.
The AttocubeScan constructor will with take a rrot name of the scan - e.g. “SC_099” or alternatively a scan number integer. It will then look in the stack’s directory for matching files and builds the scan stack from them. Currently, it uses the scan parameters.txt file and any ASCII stream files .asc files. 2D linescans are not currently supported or imported.
The native file format for an AttocubeScan is an HDF5 file with a particilar structure. The stack is saved into an HDF5 group which then has a type and module attribute that specifies the class and module pf the Python object that created the group - sof for an AttocubeScan, the type attribute is AttocubeScan.
There is a class method
AttocubeSca.read_hdf5()to read the stack from the HDSF format and an instance method
AttocubeScan.to_hdf()that will save to either a new or existing HDF file format.
The class provides other methods to regrid and flatten images and may gain other capabilities in the future.
Implement load and save to/from multipage TIFF files.
- scan_no (int):
The scan number as defined in the Attocube software.
- compression (str):
The HDF5 compression algorithm to use when writing files
- compression_opts (int):
The lelbel of compression to use (depends on compression algorithm)
Construct the attocube subclass of ImageStack.
Add a new group to the current baseFolder with the given key.
Align each image in the folder to the reference image.
Iterate over all the files in the Folder and all it's sub Folders recursely.
Append an item to the folder object.
Return a ImageStack of the images in the current group.
asfloat([normalise, clip, clip_negative])
Convert stack to floating point type.
average([weights, _box, _metadata])
Get an array of average pixel values for the stack.
Clear the subgroups.
compress([base, key, keep_terminal])
Compresses all empty groups from the root up until the first non-empty group is located.
convert(dtype[, force_copy, uniform, normalise])
Convert an image to the requested data-type.
correct_drifts(refindex[, threshold, ...])
Align images to correct for image drift.
Provide a count method like a sequence.
Crop the imagestack to a box.
Return intensity limits, i.e. (min, max) tuple, of imarray dtype.
S.extend(iterable) -- extend sequence by appending elements from the iterable
Preload the contents of the DiskBasedFolderMixin.
file(name, value[, create, pathsplit])
recursely add groups in order to put the named value into a virtual tree of
filter([filter, invert, copy, recurse, prune])
Filter the current set of files by some criterion.
filterout(filter[, copy, recurse, prune])
Synonym for self.filter(filter,invert=True).
Compresses all the groups and sub-groups iunto a single flat file list.
Create a new ImageArray from a tiff file.
Return either a sub-group or named object from this folder.
Scan the current directory, optionally recursively to build a list of filenames.
Sort Files into a series of objectFolders according to the value of the key.
index(name[, start, end])
Provide an index method like a sequence.
Implement the insert method with the option to append as well.
Return the key,value pairs for the subbroups of this folder.
Filter out earlier revisions of files with the same name.
Return the keys used to access the sub-=groups of this folder.
Remove a background signla by fitting an appropriate function.
Load all files from this group into memory.
Construct a name from the value object if possible.
Run the ImageFile.mask.select() on each image.
Calculate the mean value of all the images in the stack.
Call the plot method for each metadataObject, but switching to a subplot each time.
Carry out processing on a newly loaded file to set means and extra metadata.
Return and remove either a subgroup or named object from this folder.
Return the most recent subgroup from this folder.
Remove any empty groups from the objectFolder (and subgroups).
read_hdf5(filename, *args, **kargs)
Create a new instance from an hdf file.
Regrid the data sets based on PosX and PosY channels.
S.remove(value) -- remove first occurrence of value.
S.reverse() -- reverse IN PLACE
Save the entire data folder out to disc using the groups as a directory tree.
Select a subset of the objects in the folder based on flexible search criteria on the metadata.
Return or set a subgroup or named object.
Pass through to
Return an array of the metadata values for each item/file in the top level group.
sort([key, reverse, recurse])
Sort the files by some key.
stddev([weights, _box, _metadata])
Calculate weighted standard deviation for stack.
stderr([weights, _box, _metadata])
Calculate standard error in the stack average.
Subtract a background image (or index) from all images in the stack.
Save the AttocubeScan to an hdf5 file.
Save the ImageArray as a tiff image with metadata.
Take the file list an unflattens them according to the file paths.
Remove the instance from memory without losing the name in the Folder.
Update this folder with a dictionary or another folder.
Return the sub-groups of this folder.
Create a matplotlib animated view of the contents.
Walk through a heirarchy of groups and calls walker for each file.
Return a list of tuples of metadataObjects drawn from the specified groups.
Return a list of just the filename parts of the objectFolder.
Get the list of channels saved in the scan.
Clone just does a deepcopy as a property for compatibility with
Just read the local debug value.
Build a single list of all of our defaults by iterating over the __mro__, caching the result.
Give the maximum number of levels of group below the current objectFolder.
Just alias directory to root now.
Return an iterator of potentially unloaded named objects.
Subfolders are held in an ordered dictionary of groups.
Iterate over just the images in the Folder.
Produce the 3D stack of images - as [image,x,y].
Return a default instance of the type of object in the folder.
Return True if the folder is empty.
Override the parent class key to use the directory attribute.
Return a tuple that describes the number of files and groups in the folder.
Iterate only over those members of the folder in memory.
Return a callable that will load the files on demand.
List just the names of the objects in the folder.
Return a list of the groups as a generator.
Get the biggest image dimensions in the stack.
Give the minimum number of levels of group below the current objectFolder.
Iterate over the objectFolder that checks whether the loaded metadataObject objects have any data.
Return an array of True/False for whether we've loaded a metadataObject yet.
Return the objects in the folder are stored in a
Provide support for getting the pattern attribute.
Return the real folder root.
Return the proxy for the setas attribute for each object in the folder.
Return the stack shape - after re-ordering the indices.
Return the size of an individual image or False if not all images are the same size.
Return the number of levels of group before a group with files is found.
Return the (sub)class of the