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 = ‘/usr/autopilot/prefs.json’ # or some .json prefs file prefs.init(prefs_file)

And to add a pref

Examples

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

Data:

prefdict

stores a dictionary of preferences that mirrors the global variables.

Functions:

init([fn])

Initialize prefs on autopilot start.

add(param, value)

Add a pref after init

git_version(repo_dir)

Get the git hash of the current commit.

compute_calibration([path, calibration, …])

Parameters
  • path

prefdict = {'AGENT': 'docs', 'AUDIOSERVER': 'docs', 'AUTOPILOT_ROOT': '/home/docs/checkouts/readthedocs.org/user_builds/auto-pi-lot/checkouts/v0.3.2/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: