Quick Start

Create a Data Object

Create a data object from one of the built-in datasets.

import WrightTools as wt
# get some example files
from WrightTools import datasets
p = datasets.wt5.v1p0p1_MoS2_TrEE_movie  # list of filepaths
# open data object
data = wt.open(p)

The data contains some helpful attributes that we can inspect now:

>>> data.channel_names
['ai0', 'ai1', 'ai2', 'ai3', 'ai4', 'mc']
>>> data.axis_expressions
['w2', 'w1=wm', 'd2']
>>> data.shape
(41, 41, 23)

Make a Plot

WrightTools strives to make data visualization as quick and painless as possible.

Axes, labels, and units are brought along implicitly.

WrightTools offers a few handy ways to quickly visualize a data object, shown below. For more information, check see Artists, or check out our gallery.


wt.artists.quick1D(data, 'w1', at={'w2': [2, 'eV'], 'd2': [-100, 'fs']})

(Source code, png, pdf)



wt.artists.quick2D(data, 'w1=wm', 'd2', at={'w2': [2, 'eV']})

(Source code, png, pdf)


Interact with the Data

WrightTools has built in units support. For more information see Units.


>>> data.units
('nm', 'nm', 'fs')
>>> data.convert('eV')
axis w2 converted from nm to eV
axis w1=wm converted from nm to eV
>>> data.units
('eV', 'eV', 'fs')

Want fine control? You can always convert individual axes, e.g. data.w2.convert('wn').


Use split to break your dataset into smaller pieces.

>>> col = data.split('d2', 0.)
split data into 2 pieces along <d2>:
  0 : -inf to 0.00 fs (1, 1, 15)
  1 : 0.00 to inf fs (1, 1, 8)

(Source code, png, pdf)



Use clip to ignore points outside of a specific range.

data.ai0.clip(min=0.0, max=0.1)

(Source code, png, pdf)