#!/usr/bin/env python import csv import getopt import os, sys import scipy.interpolate import numpy as np import matplotlib.pyplot as plt X_MAX = 100 Y_MAX = 50 def usage(): print("""usage: {} [OPTION...] CSV-FILE... -c do cubic interpolation -l do linear interpolation -h show this help and exit""".format(os.path.basename(sys.argv[0]))) def plot(x, y, x_max, y_max, x_name, y_name, title, cubic, linear, xnew=None, f=None, f2=None): plt.plot(x, y, 'o') if linear: plt.plot(xnew, f(xnew), '-') if cubic: plt.plot(xnew, f2(xnew), '--') leg = [ 'data' ] if linear: leg.append('linear') if cubic: leg.append('cubic') plt.legend(leg, loc='best') plt.axis([0, x_max, 0, y_max], 'equal') plt.xlabel(x_name) plt.ylabel(y_name) plt.title(title) plt.grid(True) plt.show() def read_and_plot_csv(csv_file, cubic, linear, x_max=X_MAX, y_max=Y_MAX): print("Reading data...") reader = csv.reader(open(csv_file, 'r'), delimiter=',') x_name,y_name = reader.next() # header line X = np.array([[float(_x), float(_y)] for _x,_y in reader ]) x = X[:,0] y = X[:,1] xnew = f = f2 = None # interpolate data points if cubic or linear: xnew = np.linspace(min(x), max(x), len(x)*5) if linear: print("Calculating linear interpolation...") f = scipy.interpolate.interp1d(x, y) if cubic: print("Calculating cubic interpolation...") f2 = scipy.interpolate.interp1d(x, y, kind='cubic') plot(x, y, x_max, y_max, x_name, y_name, csv_file, cubic, linear, xnew, f, f2) def main(): try: opts, args = getopt.getopt(sys.argv[1:], "clh") except getopt.GetoptError, err: print(str(err)) usage() sys.exit(-1) if len(args) < 1: usage() sys.exit(-1) cubic = False linear = False for o, a in opts: if o == '-c': cubic = True elif o == '-l': linear = True elif o == '-h': usage() sys.exit(0) else: assert False, "unhandled option" for csv in args: if not os.path.exists(csv): print "Error: File %s not found, skipping" % csv continue read_and_plot_csv(csv, cubic, linear) if __name__ == '__main__': main() 6f351b0c681503358f'/>
path: root/Documentation/devicetree
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-08-03 08:40:24 +1000
committerDave Airlie <airlied@redhat.com>2016-08-03 08:40:24 +1000
commit586efded6b8beb932e9a356f351b0c681503358f (patch)
tree1c9af56fa0d2c70bf93cf5a02429f4b5b7d11007 /Documentation/devicetree
parentdfd2e9ab6a7db56a5f5bb55f71485a92613c8e11 (diff)
parent2fc4d838aaf2607216eda5ce9dba18fa14422a31 (diff)
Merge branch 'generic-zpos-v8' of http://git.linaro.org/people/benjamin.gaignard/kernel into drm-next
Merge generic ZPOS property support, this was backed up behind some other changes I didn't have a stable branch point for. Now they are merged to Linus tree this pull is just drm patches. * 'generic-zpos-v8' of http://git.linaro.org/people/benjamin.gaignard/kernel: drm: rcar: use generic code for managing zpos plane property drm/exynos: use generic code for managing zpos plane property drm: sti: use generic zpos for plane drm: add generic zpos property
Diffstat (limited to 'Documentation/devicetree')