Appendix C.
The list_utility module
The following is a listing of the list_utility.py file on the LI-6800.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Thanks to Ari Kornfeld @ akorn@carnegiescience.edu
import numpy as np
from random import sample
def linearList(vv1, vv2, nn, rounded=2):
# v1 - starting value,
# v2 - ending value
# n - number of values
v1 = float(vv1)
v2 = float(vv2)
n = int(nn)
v_range = [f for f in list(np.linspace(0, 1, num=n))]
setpoints = [v1 + f*(v2-v1) for f in v_range]
return list(np.around(setpoints, rounded))
def randomList(v1, v2, n, rounded=2):
return sample(linearList(v1, v2, n, rounded=rounded),n)
def makeOrtho(listOfLists, lock_index=-1, max_cor=0.1, outfile=''):
# listOfLists should contain 2 or more lists of setpoints. If
sizes not equal, smallest size is n
# returns listOfLists with setpoint sorted to provide maximum
orthogonality (minimum correltion)
# if you don't want one of the lists sorted, specify that index
as lock_index. 0 = first list, 1 = 2nd, etc.
listCount = len(listOfLists)
10-1Using LI-6800 Background Programs