prefs

Module to hold module-global variables as preferences.

Warning

DO NOT hardcode prefs here.

A prefs.json file should be generated with an appropriate autopilot.setup routine

Before importing any other autopilot module,

Examples

from autopilot import prefs prefs_file = ‘~/autopilot/prefs.json’ # or some .json prefs file prefs.init(prefs_file)

And to add a pref

Examples

prefs.add(‘PARAM’, ‘VALUE”)

Functions:

add(param, value)

Add a pref after init

compute_calibration([path, calibration, …])

Parameters
  • path

git_version(repo_dir)

Get the git hash of the current commit.

init([fn])

Initialize prefs on autopilot start.

Classes:

odict

alias of collections.OrderedDict

Data:

prefdict

stores a dictionary of preferences that mirrors the global variables.

prefdict = {'AGENT': 'docs', 'AUDIOSERVER': 'docs', 'AUTOPILOT_ROOT': '/home/docs/checkouts/readthedocs.org/user_builds/auto-pi-lot/checkouts/latest/autopilot'}

stores a dictionary of preferences that mirrors the global variables.

init(fn=None)[source]

Initialize prefs on autopilot start.

Parameters

fn (str, dict) – a path to prefs.json or a dictionary of preferences

add(param, value)[source]

Add a pref after init

Parameters
  • param (str) – Allcaps parameter name

  • value – Value of the pref

git_version(repo_dir)[source]

Get the git hash of the current commit.

Stolen from numpy’s setup

and linked by ryanjdillon on SO

Parameters

repo_dir (str) – directory of the git repository.

Returns

git commit hash.

Return type

unicode

compute_calibration(path=None, calibration=None, do_return=False)[source]
Parameters
  • path

  • calibration

  • do_return

Returns: