skippylab package


skippylab.daq module

Use the scope as a DAQ

class skippylab.daq.DAQ[source]

Bases: object

A virtual DAQ using an oscilloscope

acquire(*pullargs, **pullkwargs)[source]

Go through the instrument list and trigger their pull methods to build an event

Keyword Arguments:
 **pullkwargs (dict) – will be passed on the individual pull methods
acquire_n_events(n_events, trigger_hook=<function DAQ.<lambda>>, trigger_hook_args=(None, ), pull_args=(), pull_kwargs={})[source]

Continuous acquisition. Acquires n events. Yields events. Use trigger hook to define a function to decide when data is returned.

  • n_events (int) – Number of events to acquire
  • trigger_hook (callable) – Trigger condition
  • trigger_hook_args (tuple) – Arguments for the trigger condition


register_instrument(instrument, label='instrument')[source]

Register an instrument and assign a channel to it. Instruments must have a pull() method which allows to pull data from them at a certain event.

  • instrument (ducktype) – needs to be configured already and must have a pull() method
  • channel_name (int) – identify the instrument under this registered channel


class skippylab.daq.Event(use_datetime=False)[source]

Bases: object

DAQ will return events when triggered.


Give it a timestamp! Time in seconds


skippylab.loggers module

Prepare logging functionality for the module

skippylab.loggers.get_logger(loglevel, logfile=None)[source]

A root logger with a formatted output logging to stdout and a file

  • loglevel (int) – 10,20,30,… the higher the less logging
  • logfile (str) – write logging to this file as well as stdout


skippylab.plotting module

Convenient plot functions

skippylab.plotting.plot_histogram(bincenters, bincontent, fig=None, savename='test.png', remove_empty_bins=True)[source]

Plot a histogram returned by TektronixDPO4104B.get_histogram Use pylab.plot

  • bincenters (np.ndarray); bincenters (x) –
  • bincontent (np.ndarray) – bincontent (y)
Keyword Arguments:
  • fig (pylab.figure) – A figure instance
  • savename (str) – where to save the figure (full path)
  • remove_empty_bins (bool) – Cut away preceeding and trailing zero bins
skippylab.plotting.plot_waveform(wf_header, wf_data, fig=None, savename=None, use_mv_and_ns=True, color=None)[source]

Make a plot of a single acquisition

  • wf_header (dict) – custom waveform header
  • wf_data (np.ndarray) – waveform data
Keyword Arguments:
  • fig (pylab.figure) – A figure instance
  • savename (str) – where to save the figure (full path)
  • use_mv_and_ns (bool) – use mV and ns instead of V and s

pylab.fig module

Convenient operations[source]

Get the average waveform

Parameters:waveforms (iterable of np.ndarrays) –
Returns:np.ndarray, xs, xstep, method=<Mock name='mock.integrate.simps' id='140515038155160'>, impedance=50)[source]

Integrate a waveform, i.e. a voltage curve. If the desired result shall be indeed a charge, please make sure to give xs in seconds and impedance in Ohm accordingly. xstep needs to be in seconds as well.

  • waveform (np.ndarray) – voltage values
  • xs (np.ndarray) – timing values
  • xstep (float) – timing bin size
Keyword Arguments:
  • method (func) – integration method
  • impedance (float) – needed to calculate actual charge

float, converter=<function <lambda>>)[source]

load a waveform from a file

Parameters:filenaame (str) – An existing filename
Keyword Arguments:
 converter (func) – If the data is saved in digitizer levels, use the converter function to convert to Volts
Returns:tuple (dict, np.ndarray), waveform, filename)[source]

save a waveform together with its header

  • header (dict) – Some metainformation about the waveform
  • waveform (np.ndarray) – the actual voltage data
  • filename (str) – a filename where the data should be saved


Module contents

Package to read out TektronixDPO4104B oscilloscope