DataMethodsMixin

class Stoner.folders.mixins.DataMethodsMixin[source]

Bases: object

Methods for wokring with Stner.Data in py:class:`Stoner.DataFolder`s.

Methods Summary

concatenate([sort, reverse])

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

extract(*metadata, **kargs)

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

gather([xcol, ycol])

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

Methods Documentation

concatenate(sort=None, reverse=False)[source]

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

Keyword Arguments
  • sort (column index, None or bool, or clallable function) – Sort the resultant metadataObject by this column (if a column index), or by the x column if None or True, or not at all if False. sort is passed directly to the eponymous method as the order paramter.

  • reverse (bool) – Reverse the order of the sort (defaults to False)

Returns

The current objectFolder with only one metadataObject item containing all the data.

extract(*metadata, **kargs)[source]

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

Walks through the terminal group and gets the listed metadata from each file and constructsa replacement metadataObject.

Parameters

*metadata (str) – One or more metadata indices that should be used to construct the new data file.

Ketyword Arguments:
copy (bool):

Take a copy of the DataFolder before starting the extract (default is True)

Returns

An instance of a metadataObject like object.

gather(xcol=None, ycol=None)[source]

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

Builds the collected data into a Stoner.Core.metadataObject

Keyword Arguments
  • xcol (index or None) – Column in each file that has x data. if None, then the setas settings are used

  • ycol (index or None) – Column(s) in each filwe that contain the y data. If none, then the setas settings are used.

Notes

This is a wrapper around walk_groups that assembles the data into a single file for further analysis or plotting.