add geometry functions to translate and rotate lists and define lines and cubic lines

add data function to fold a list and geometry_plot functions to plot lines and tests for the geometry functions
This commit is contained in:
2019-08-28 11:39:50 +02:00
parent 5b6d8b77ae
commit f47fa19cd2
35 changed files with 12169 additions and 121 deletions

View File

@@ -24,11 +24,11 @@ class TestFit(unittest.TestCase):
"""test function"""
file_name = "test_fit.dat"
x, y = data_read(file_name, 3, 2)
subplot(2,2,1)
subplot(2, 2, 1)
plot(x, y, '.-')
subplot(2,2,2)
subplot(2, 2, 2)
dx = x[1] - x[0]
dydx = gradient(y, dx) # central differences
x_fit = linspace(x[0], x[-1], 150 if len(x) < 50 else len(x)*3)
@@ -36,16 +36,16 @@ class TestFit(unittest.TestCase):
plot(x, dydx, '.-')
plot(x_fit, y_fit, 'r:')
title('FWHM: %f' % FWHM)
subplot(2,2,3)
subplot(2, 2, 3)
plot(x, y, '.-')
xlim(popt[1]-2*FWHM, popt[1]+2*FWHM)
subplot(2,2,4)
subplot(2, 2, 4)
plot(x, dydx, '.-')
plot(x_fit, y_fit, 'r:')
xlim(popt[1]-2*FWHM, popt[1]+2*FWHM)
show()
self.assertEqual(FWHM, 0.12975107355013618)