ekpy.control package

Submodules

ekpy.control.core module

class ekpy.control.core.experiment(run_function=None)

Bases: object

checks(params)

Method to perform a set of checks on params before starting a scan. Default is simple pass.

config_path(path)

Config the path to save data. If path does not exist, user will be prompted to create.

Parameters

path (str) – Path

n_param_scan(kw_scan_params, fixed_params, scan_param_order, ntrials=1, print_progress=True, plot=False)

Perform a measurement over a set of params and save the data/meta data.

Parameters
  • kw_scan_params (dict) – Parameters to scan.

  • fixed_params (dict) – Parameters to keep fixed.

  • scan_param_order (array-like) – Order of scan parameters.

  • ntrials (int) – Number of trials to perform.

  • plot (bool) – Plot as data is collected.

Examples

>>> exp = experiment()
>>>     kw_scan_params = {
                'frequency':['147hz', '47hz'],
                'amplitude':['50ua','100ua', '250ua', '500ua', '750ua', '850ua','1000ua',],
                'harmonic':[1,2]
        }
>>>     fixed_params = {
                'lockin':lockin,
                'current_source':current_source,
                'identifier':'D0',
                'angle':20,
                'channel_width':2,
                'channel_length':20,
                'bar_width':1.5,
                'nave':5,
                'delay':'default',
                'time_constant':'3s',
                'sensitivity':'10uv/pa',
        }
>>> order = ['harmonic', 'frequency', 'amplitude']
#Perform scan
>>> exp.n_param_scan(kw_scan_params, fixed_params, order)
show_run_function_help()

Return help (used to view docstring/call args etc.) for self.run_function.

Returns

Help on self.run_function

Return type

(help)

terminate()

Placeholder method for termination. This method should be overriden.

Example

Example of overriding the terminate method to perform a set of actions upon erroring/completion of n_param_scan.

def terminate(self):
        # set the internal amplitude of the lockin to its lowest value
        srs.set_internal_amplitude(self.lockin, 0.0004)
ekpy.control.core.trial(run_function, run_function_args, path, return_df=False, save_meta_data_pickle=True)

A trial for an experiment. This will save each trial (as csv) to path with a unique name (indexed by trial if an identical basename already exists). Also creates and saves meta data to path. The specified run_function must return ((str) base_name, (dict) meta_data, (pandas.dataframe) data).

Parameters
  • run_function (function) – A run_function that returns: ` ((str) base_name, (dict) meta_data, (pandas.dataframe) data) `

  • run_function_args (dict) – Dict of arguments for the specified run_function

  • path (str) – Save location.

  • return_df (bool) – Return the resulting data (pandas.DataFrame)

  • save_meta_data_csv (bool) – Save the meta_data as a pickle file in addition to .csv. This is carry over from a legacy version.

ekpy.control.plotting module

ekpy.control.plotting.update_plot(fig)

Interactively update fig in Jupyter notebook.

Parameters

fig (matplotlib.figure.Figure) – updated figure to replot

Module contents