# Experiment class

The Experiment class is intended for use in the Jupyter notebook environment.

class `pymeasure.experiment.experiment.``Experiment`(title, procedure, analyse=<function Experiment.<lambda>>)

  Bases: `object`

  Class which starts logging and creates/runs the results and worker processes.

      procedure = Procedure()
      experiment = Experiment(title, procedure)
      experiment.start()
      experiment.plot_live('x', 'y', style='.-')

      for a multi-subplot graph:

      import pylab as pl
      ax1 = pl.subplot(121)
      experiment.plot('x','y',ax=ax1)
      ax2 = pl.subplot(122)
      experiment.plot('x','z',ax=ax2)
      experiment.plot_live()

  Variables

    value – The value of the parameter

  Parameters

    - title – The experiment title

    - procedure – The procedure object

    - analyse – Post-analysis function, which takes a pandas dataframe as input and returns it with added (analysed) columns. The analysed results are accessible via experiment.data, as opposed to experiment.results.data for the ‘raw’ data.

    - _data_timeout – Time limit for how long live plotting should wait for datapoints.

  `clear_plot`()

    Clear the figures and plot lists.

  property `data`

    Data property which returns analysed data, if an analyse function is defined, otherwise returns the raw data.

  `pcolor`(xname, yname, zname, *args, **kwargs)

    Plot the results from the experiment.data pandas dataframe in a pcolor graph. Store the plots in a plots list attribute.

  `plot`(*args, **kwargs)

    Plot the results from the experiment.data pandas dataframe. Store the plots in a plots list attribute.

  `plot_live`(*args, **kwargs)

    Live plotting loop for jupyter notebook, which automatically updates (an) in-line matplotlib graph(s). Will create a new plot as specified by input arguments, or will update (an) existing plot(s).

  `start`()

    Start the worker

  `update_line`(ax, hl, xname, yname)

    Update a line in a matplotlib graph with new data.

  `update_pcolor`(ax, xname, yname, zname)

    Update a pcolor graph with new data.

  `update_plot`()

    Update the plots in the plots list with new data from the experiment.data pandas dataframe.

  `wait_for_data`()

    Wait for the data attribute to fill with datapoints.

`pymeasure.experiment.experiment.``create_filename`(title)

  Create a new filename according to the style defined in the config file. If no config is specified, create a temporary file.

`pymeasure.experiment.experiment.``get_array`(start, stop, step)

  Returns a numpy array from start to stop

`pymeasure.experiment.experiment.``get_array_steps`(start, stop, numsteps)

  Returns a numpy array from start to stop in numsteps

`pymeasure.experiment.experiment.``get_array_zero`(maxval, step)

  Returns a numpy array from 0 to maxval to -maxval to 0