| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/usr/bin/python2.7 | ||
| import pykst as kst | ||
|
|
||
| client=kst.Client("TestX2") | ||
|
|
||
| v1 = client.new_generated_vector(-10, 10, 1000) | ||
| e1 = client.new_equation(v1, "sin(x)") | ||
| c1 = client.new_curve(e1.x(), e1.y()) | ||
| p1 = client.new_plot() | ||
| p1.add(c1) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #!/usr/bin/python2.7 | ||
| import pykst as kst | ||
| from numpy import * | ||
| import time | ||
|
|
||
| client=kst.Client("VectorIO") | ||
|
|
||
| t0 = time.clock() | ||
|
|
||
| # create a pair of numpy arrays | ||
| x = linspace( 0, 50, 500000) | ||
| y = sin(x) | ||
|
|
||
| t1 = time.clock() | ||
|
|
||
| # copy the numpy arrays into kst and plot them | ||
| V1 = client.new_editable_vector(x) | ||
| V2 = client.new_editable_vector(y) | ||
| c1 = client.new_curve(V1, V2) | ||
| p1 = client.new_plot() | ||
| p1.add(c1) | ||
|
|
||
| t2 = time.clock() | ||
|
|
||
| # copy numpy array back into python. | ||
| A = V2.get_numpy_array() | ||
|
|
||
| t3 = time.clock() | ||
|
|
||
| # manipulate the array in python, and plot it in kst | ||
| A = A*A | ||
| V3 = client.new_editable_vector(A) | ||
| c2 = client.new_curve(V1, V3) | ||
| p1.add(c2) | ||
|
|
||
| # manipulate it again, and replace it in kst | ||
| A = A/2 | ||
| V2.load(A) | ||
|
|
||
| print "creation of numpy arrays took", t1 - t0, "s" | ||
| print "copying onto kst and plotting took", t2-t1, "s" | ||
| print "copying from kst into python took:", t3-t2, "s" | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/usr/bin/python2.7 | ||
| import pykst as kst | ||
|
|
||
| client=kst.Client("PlotLayoutDemo") | ||
|
|
||
| #autolayout in tab 1 | ||
| p1 = client.new_plot(font_size = 12) | ||
|
|
||
| client.new_plot(font_size = 12) | ||
| client.new_plot(font_size = 12) | ||
| client.new_plot(font_size = 12) | ||
| client.new_plot(font_size = 12) | ||
| client.new_plot(font_size = 12) | ||
| client.new_plot(font_size = 12) | ||
| client.new_plot(font_size = 12) | ||
| client.new_plot(font_size = 12) | ||
|
|
||
| client.cleanup_layout(3) | ||
|
|
||
| p1.set_global_font(family = "Courier", font_size = 6) | ||
|
|
||
| # manual grid | ||
| client.new_tab() | ||
| for x in [.125, 0.375, 0.625, 0.875]: | ||
| for y in [.125, 0.375, 0.625, 0.875]: | ||
| client.new_plot((x,y),(0.25,0.25)) | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,35 +1,33 @@ | ||
| #!/usr/bin/python2.7 | ||
| import pykst as kst | ||
|
|
||
| client=kst.Client("RenameDemo") | ||
| V1=client.new_data_vector("/home/cbn/programs/KDE/kst_tutorial/gyrodata.dat", | ||
| field="INDEX", | ||
| start=0,num_frames=1000) | ||
|
|
||
| V2=client.new_data_vector("/home/cbn/programs/KDE/kst_tutorial/gyrodata.dat", | ||
| field="Column 2", | ||
| start=0,num_frames=1000) | ||
|
|
||
| c1 = client.new_curve(V1, V2) | ||
|
|
||
| p1 = client.new_plot(font_size = 12) | ||
|
|
||
| p1.add(c1) | ||
|
|
||
| print "-------------- Scalar list -------------" | ||
| print client.get_scalar_list() | ||
|
|
||
| print "-------------- Vector list -------------" | ||
| vectors = client.get_vector_list() | ||
| print vectors | ||
| print "----------" | ||
|
|
||
| # change the name of the vector made from field "Column 1" | ||
| for Vname in vectors: | ||
| Vr = client.data_vector(Vname) | ||
| if Vr.field() == "Column 2": | ||
| print "Changing name of ", Vr.name(), " to A Gyro" | ||
| Vr.set_name("A Gyro") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/usr/bin/python2.7 | ||
| import pykst as kst | ||
|
|
||
| client=kst.Client("viewitems") | ||
|
|
||
|
|
||
| P1=client.new_plot((0.25,0.25),(0.5,0.5),0) | ||
| P1.set_x_range(-10.0,10.0) | ||
| P1.set_global_font("courier",12,False,False) | ||
|
|
||
| C1 = client.new_circle((0.9,0.3),0.1, stroke_width = 2, stroke_brush_color="red") | ||
| C1.set_fill_color("Green") | ||
|
|
||
| B1 = client.new_box((0.9,0.9), (0.1,0.1), fill_color="pink") | ||
|
|
||
| E1 = client.new_ellipse((0.1, 0.7), (0.1, 0.1), 45, fill_color="blue") | ||
|
|
||
| A1 = client.new_arrow((0.1, 0.5), 0.1, 45, False, True, 18) | ||
| A1.set_stroke_style(3) | ||
|
|
||
| L1 = client.new_line((0.1, 0.5), 0.1, 15, stroke_width=4, stroke_brush_color="green") | ||
| L1.set_stroke_style(2) | ||
|
|
||
| Label = client.new_label("Label Here", (0.7,0.7), 0, 16, font_family="courier") | ||
| Label.set_font_italic(True) | ||
|
|
||
|
|