qcodespp 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. qcodespp/__init__.py +77 -0
  2. qcodespp/actions.py +237 -0
  3. qcodespp/data/__init__.py +0 -0
  4. qcodespp/data/data_array.py +555 -0
  5. qcodespp/data/data_set.py +926 -0
  6. qcodespp/data/format.py +338 -0
  7. qcodespp/data/gnuplot_format.py +425 -0
  8. qcodespp/data/hdf5_format.py +537 -0
  9. qcodespp/data/hdf5_format_hickle.py +63 -0
  10. qcodespp/data/io.py +241 -0
  11. qcodespp/data/location.py +171 -0
  12. qcodespp/instrument_drivers/Keysight/Keysight_34450A.py +9 -0
  13. qcodespp/instrument_drivers/Keysight/__init__.py +0 -0
  14. qcodespp/instrument_drivers/Keysight/private/Keysight_344xxA.py +456 -0
  15. qcodespp/instrument_drivers/Keysight/private/__init__.py +0 -0
  16. qcodespp/instrument_drivers/Lakeshore/Model_340.py +483 -0
  17. qcodespp/instrument_drivers/Lakeshore/__init__.py +0 -0
  18. qcodespp/instrument_drivers/QDevil/159fit_params_high_latest.json +386 -0
  19. qcodespp/instrument_drivers/QDevil/159fit_params_low_latest.json +386 -0
  20. qcodespp/instrument_drivers/QDevil/QDAC2.py +3229 -0
  21. qcodespp/instrument_drivers/QDevil/QDAC2_Array.py +300 -0
  22. qcodespp/instrument_drivers/QDevil/QSwitch_elab.py +652 -0
  23. qcodespp/instrument_drivers/QDevil/__init__.py +0 -0
  24. qcodespp/instrument_drivers/ZI/ZIHF2LI.py +415 -0
  25. qcodespp/instrument_drivers/ZI/ZIMFLI.py +764 -0
  26. qcodespp/instrument_drivers/ZI/ZIMFLI_sync.py +108 -0
  27. qcodespp/instrument_drivers/ZI/ZIUHFLI.py +2179 -0
  28. qcodespp/instrument_drivers/ZI/__init__.py +1 -0
  29. qcodespp/instrument_drivers/__init__.py +0 -0
  30. qcodespp/instrument_drivers/cryogenic/CryogenicSMS120C.py +599 -0
  31. qcodespp/instrument_drivers/cryogenic/__init__.py +0 -0
  32. qcodespp/instrument_drivers/instrument_mocks.py +379 -0
  33. qcodespp/instrument_drivers/multiplexer_instrument.py +287 -0
  34. qcodespp/instrument_drivers/national_instruments/PXI_4461.py +451 -0
  35. qcodespp/instrument_drivers/national_instruments/PXI_4462.py +290 -0
  36. qcodespp/instrument_drivers/national_instruments/PXI_6259.py +436 -0
  37. qcodespp/instrument_drivers/national_instruments/PXI_6733.py +230 -0
  38. qcodespp/instrument_drivers/national_instruments/PXI_6733_e.py +243 -0
  39. qcodespp/instrument_drivers/national_instruments/__init__.py +0 -0
  40. qcodespp/instrument_drivers/oxford/__init__.py +0 -0
  41. qcodespp/instrument_drivers/oxford/mercuryiPS_serial.py +658 -0
  42. qcodespp/instrument_drivers/oxford/triton.py +434 -0
  43. qcodespp/instrument_drivers/tektronix/Keithley_2000_Scan.py +65 -0
  44. qcodespp/instrument_drivers/tektronix/Keithley_2182a.py +190 -0
  45. qcodespp/instrument_drivers/tektronix/Keithley_2400.py +158 -0
  46. qcodespp/instrument_drivers/tektronix/Keithley_2450.py +242 -0
  47. qcodespp/instrument_drivers/tektronix/Keithley_2700.py +397 -0
  48. qcodespp/instrument_drivers/tektronix/Keithley_6500.py +161 -0
  49. qcodespp/instrument_drivers/tektronix/__init__.py +0 -0
  50. qcodespp/instrument_drivers/yokogawa/GS200.py +513 -0
  51. qcodespp/instrument_drivers/yokogawa/__init__.py +0 -0
  52. qcodespp/loops.py +1342 -0
  53. qcodespp/measure.py +310 -0
  54. qcodespp/parameters.py +311 -0
  55. qcodespp/plotting/RemotePlot.py +469 -0
  56. qcodespp/plotting/RemotePlotClient.py +367 -0
  57. qcodespp/plotting/RemoteQtPlotWidgets.py +871 -0
  58. qcodespp/plotting/__init__.py +0 -0
  59. qcodespp/plotting/analysis_tools.py +195 -0
  60. qcodespp/plotting/colors.py +135 -0
  61. qcodespp/plotting/offline/__init__.py +0 -0
  62. qcodespp/plotting/offline/datatypes.py +999 -0
  63. qcodespp/plotting/offline/design.py +906 -0
  64. qcodespp/plotting/offline/design.ui +1578 -0
  65. qcodespp/plotting/offline/editor.py +2966 -0
  66. qcodespp/plotting/offline/filters.py +561 -0
  67. qcodespp/plotting/offline/fits.py +1171 -0
  68. qcodespp/plotting/offline/helpers.py +288 -0
  69. qcodespp/plotting/offline/iconGadget.png +0 -0
  70. qcodespp/plotting/offline/main.py +55 -0
  71. qcodespp/plotting/offline/popupwindows.py +1848 -0
  72. qcodespp/plotting/offline/qcodes_pp_extension.py +328 -0
  73. qcodespp/plotting/offline/sidebars.py +1108 -0
  74. qcodespp/station.py +290 -0
  75. qcodespp/utils/__init__.py +0 -0
  76. qcodespp/utils/helpers.py +618 -0
  77. qcodespp/utils/visa_helpers.py +61 -0
  78. qcodespp/version.py +12 -0
  79. qcodespp-0.1.0.dist-info/METADATA +91 -0
  80. qcodespp-0.1.0.dist-info/RECORD +82 -0
  81. qcodespp-0.1.0.dist-info/WHEEL +4 -0
  82. qcodespp-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,561 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created on Thu Nov 9 20:05:23 2017
4
+
5
+ @author: Joeri de Bruijckere, Damon Carrad
6
+ """
7
+
8
+ import numpy as np
9
+ from scipy import ndimage, signal
10
+ from scipy.interpolate import interp1d, interp2d
11
+
12
+
13
+ # Filter definitions
14
+
15
+ def derivative(data, method, times_x, times_y):
16
+ times_x, times_y = int(times_x), int(times_y)
17
+ if len(data) == 3:
18
+ for _ in range(times_x):
19
+ data[-1] = np.gradient(data[-1], data[0][:,0], axis=0)
20
+ for _ in range(times_y):
21
+ data[-1] = np.gradient(data[-1], data[1][0,:], axis=1)
22
+ elif len(data) == 2:
23
+ for _ in range(times_y):
24
+ data[-1] = np.gradient(data[-1], data[0])
25
+ return data
26
+
27
+ def integrate(data, method, times_x, times_y):
28
+ times_x, times_y = int(times_x), int(times_y)
29
+ if len(data) == 3:
30
+ if method=='Z':
31
+ for _ in range(times_x):
32
+ data[-1] = np.cumsum(data[-1], axis=0)
33
+ for _ in range(times_y):
34
+ data[-1] = np.cumsum(data[-1], axis=1)
35
+ elif method=='Y':
36
+ for _ in range(times_y):
37
+ data[1] = np.cumsum(data[1], axis=1)
38
+ elif method=='X':
39
+ for _ in range(times_x):
40
+ data[0] = np.cumsum(data[0], axis=0)
41
+ elif len(data) == 2:
42
+ if method in ['Y','Z']:
43
+ for _ in range(times_y):
44
+ data[-1] = np.cumsum(data[-1])
45
+ elif method == 'X':
46
+ for _ in range(times_x):
47
+ data[0] = np.cumsum(data[0])
48
+
49
+ return data
50
+
51
+ def smooth(data, method, width_x, width_y):
52
+ filters = {'Gauss': ndimage.gaussian_filter,
53
+ 'Median': ndimage.median_filter}
54
+ filters1d = {'Gauss': ndimage.gaussian_filter1d}
55
+
56
+ if method == 'Gauss':
57
+ width_x, width_y = float(width_x), float(width_y)
58
+ elif method == 'Median':
59
+ width_x, width_y = int(np.ceil(float(width_x)))+1, int(np.ceil(float(width_y)))+1
60
+ if len(data) == 3:
61
+ if width_x:
62
+ if width_y:
63
+ data[-1] = filters[method](data[-1], [width_x, width_y])
64
+ else:
65
+ data[-1] = filters1d[method](data[-1], width_x, axis=0)
66
+ else:
67
+ if width_y:
68
+ data[-1] = filters1d[method](data[-1], width_y, axis=1)
69
+ elif len(data) == 2:
70
+ if width_y:
71
+ data[-1] = filters1d[method](data[-1], width_y)
72
+ return data
73
+
74
+ def sav_gol(data, method, window_length, polyorder):
75
+ polyorder = int(polyorder)
76
+ window_length = int(window_length)
77
+ if window_length < polyorder:
78
+ window_length = polyorder + 1
79
+ if window_length % 2 == 0:
80
+ window_length += 1
81
+ if 'Y' in method:
82
+ axis = 1
83
+ elif 'X' in method:
84
+ axis = 0
85
+ deriv = method.count('d')
86
+ if len(data) == 3:
87
+ data[-1] = signal.savgol_filter(data[-1], window_length, polyorder,
88
+ deriv=deriv, axis=axis)
89
+ for _ in range(deriv):
90
+ data[-1] /= np.gradient(data[axis], axis=axis)
91
+ elif len(data) == 2:
92
+ data[-1] = signal.savgol_filter(data[-1], window_length, polyorder,
93
+ deriv=deriv)
94
+ for _ in range(deriv):
95
+ data[-1] /= np.gradient(data[0])
96
+ return data
97
+
98
+ def crop_x(data, method, left, right):
99
+ if method != 'Lim':
100
+ min_data = np.min(data[0])
101
+ max_data = np.max(data[0])
102
+ left, right = float(left), float(right)
103
+ if (left < right and max_data > left and min_data < right):
104
+ if method == 'Abs':
105
+ mask = ((data[0] < left) | (data[0] > right))
106
+ elif method == 'Rel':
107
+ mask = (((data[0] >= min_data) & (data[0] <= min_data + abs(left))) |
108
+ ((data[0] <= max_data) & (data[0] >= max_data - abs(right))))
109
+ if len(data) == 3:
110
+ for i in [1,2,0]:
111
+ data[i] = np.ma.compress_rowcols(np.ma.masked_array(data[i], mask=mask), axis=0)
112
+ elif len(data) == 2:
113
+ for i in [1,0]:
114
+ data[i] = np.ma.masked_array(data[i], mask=mask)
115
+ return data
116
+
117
+ def crop_y(data, method, bottom, top):
118
+ if len(data) == 3 and method != 'Lim':
119
+ min_data = np.min(data[1])
120
+ max_data = np.max(data[1])
121
+ bottom, top = float(bottom), float(top)
122
+ if (bottom < top and max_data > bottom and min_data < top):
123
+ for i in [0,2,1]:
124
+ if method == 'Abs':
125
+ mask = ((data[1] < bottom) | (data[1] > top))
126
+ elif method == 'Rel':
127
+ mask = (((data[1] >= min_data) & (data[1] <= min_data + abs(bottom))) |
128
+ ((data[1] <= max_data) & (data[1] >= max_data - abs(top))))
129
+ data[i] = np.ma.compress_rowcols(
130
+ np.ma.masked_array(data[i], mask=mask), axis=1)
131
+ return data
132
+
133
+ def roll_x(data, method, position, amount):
134
+ if len(data) == 3:
135
+ amount = int(amount)
136
+ position = int(position)
137
+ data[2][:,position:] = np.roll(data[2][:,position:], shift=amount, axis=0)
138
+ return data
139
+
140
+ def roll_y(data, method, position, amount):
141
+ if len(data) == 3:
142
+ amount = int(amount)
143
+ position = int(position)
144
+ data[2][position:,:] = np.roll(data[2][position:,:], shift=amount, axis=1)
145
+ return data
146
+
147
+ def cut_x(data, method, left, width):
148
+ if len(data) == 3:
149
+ left, width = int(left), int(width)
150
+ part1 = data[-1][:left,:]
151
+ part2 = data[-1][left:left+width,:]
152
+ part3 = data[-1][left+width:,:]
153
+ data[-1] = np.vstack((part1,part3,part2))
154
+ return data
155
+
156
+ def cut_y(data, method, bottom, width):
157
+ if len(data) == 3:
158
+ bottom, width = int(bottom), int(width)
159
+ part1 = data[-1][:,:bottom]
160
+ part2 = data[-1][:,bottom:bottom+width]
161
+ part3 = data[-1][:,bottom+width:]
162
+ data[-1] = np.hstack((part1,part3,part2))
163
+ return data
164
+
165
+ def swap_xy(data, method, setting1, setting2):
166
+ data[0], data[1] = data[1], data[0]
167
+ return data
168
+
169
+ def flip(data, method, setting1, setting2):
170
+ if method == 'U-D':
171
+ data[-1] = np.fliplr(data[-1])
172
+ elif method == 'L-R':
173
+ data[-1] = np.flipud(data[-1])
174
+ return data
175
+
176
+ def normalize(data, method, point_x, point_y):
177
+ if method == 'Max':
178
+ norm_value = np.max(data[-1])
179
+ elif method == 'Min':
180
+ norm_value = np.min(data[-1])
181
+ elif method == 'Point' and len(data) == 3:
182
+ x_index = np.argmin(np.abs(data[0][:,0] - float(point_x)))
183
+ y_index = np.argmin(np.abs(data[1][0,:] - float(point_y)))
184
+ norm_value = data[-1][x_index,y_index]
185
+ elif method == 'Point' and len(data) == 2:
186
+ x_index = np.argmin(np.abs(data[0] - float(point_x)))
187
+ norm_value = data[-1][x_index]
188
+ elif method == 'Min to Max':
189
+ norm_value = np.max(data[-1]) - np.min(data[-1])
190
+ data[-1] = data[-1]-np.min(data[-1])
191
+ data[-1] = data[-1] / norm_value
192
+ return data
193
+
194
+ def subtract_average(data, method, setting1, setting2):
195
+ shape=np.shape(data[-1])
196
+ if method == 'Z':
197
+ average=np.average(data[-1])
198
+ for i in range(shape[0]):
199
+ data[-1][i] = data[-1][i]-average
200
+ elif method == 'Y':
201
+ average=np.average(data[1])
202
+ for i in range(shape[0]):
203
+ data[1][i] = data[1][i]-average
204
+ elif method == 'X':
205
+ average=np.average(data[0])
206
+ for i in range(shape[0]):
207
+ data[0][i] = data[0][i]-average
208
+ return data
209
+
210
+ def offset_line_by_line(data,method,index,setting2):
211
+ index=int(index)
212
+ if len(data) == 3:
213
+ shape=np.shape(data[-1])
214
+ if method=='Z':
215
+ newdata=np.zeros_like(data[-1])
216
+ for i in range(shape[0]):
217
+ for j in range(shape[1]):
218
+ newdata[i][j]=data[-1][i][j]-data[-1][i][index]
219
+ data[-1]=newdata
220
+ elif method=='Y':
221
+ newdata=np.zeros_like(data[-1])
222
+ for i in range(shape[0]):
223
+ for j in range(shape[1]):
224
+ newdata[i][j]=data[1][i][j]-data[1][i][index]
225
+ data[1]=newdata
226
+ else:
227
+ print('Cannot offset 1D data line by line. Use regular offset')
228
+
229
+ return data
230
+
231
+ def subtract_ave_line_by_line(data,method,setting1,setting2):
232
+ if len(data) == 3:
233
+ shape=np.shape(data[-1])
234
+ if method=='Z':
235
+ newdata=np.zeros_like(data[-1])
236
+ for i in range(shape[0]):
237
+ average=np.average(data[-1][i])
238
+ for j in range(shape[1]):
239
+ newdata[i][j]=data[-1][i][j]-average
240
+ data[-1]=newdata
241
+ elif method=='Y':
242
+ newdata=np.zeros_like(data[-1])
243
+ for i in range(shape[0]):
244
+ average=np.average(data[1][i])
245
+ for j in range(shape[1]):
246
+ newdata[i][j]=data[1][i][j]
247
+ data[1]=newdata
248
+ else:
249
+ print('Cannot subtract average from 1D data line by line. Use subract average')
250
+
251
+ return data
252
+
253
+ def offset(data, method, setting1, setting2, array=None):
254
+ axis = {'X': 0, 'Y': 1, 'Z': 2}
255
+ if array is not None:
256
+ if len(data) == 3:
257
+ if setting2=='+':
258
+ data[axis[method]] += array
259
+ else:
260
+ data[axis[method]] = np.subtract(data[axis[method]],array)
261
+ elif len(data) == 2 and axis[method] < 2:
262
+ if setting2=='+':
263
+ data[axis[method]] += array
264
+ else:
265
+ data[axis[method]] = np.subtract(data[axis[method]],array)
266
+ else:
267
+ value=float(setting1)
268
+ if len(data) == 3:
269
+ for i,row in enumerate(data[axis[method]]):
270
+ for j,val in enumerate(row):
271
+ data[axis[method]][i][j] += value
272
+ elif len(data) == 2 and axis[method] < 2:
273
+ for j,val in enumerate(data[axis[method]]):
274
+ data[axis[method]][j] += value
275
+ return data
276
+
277
+ def absolute(data, method, setting1, setting2):
278
+ data[-1] = np.absolute(data[-1])
279
+ return data
280
+
281
+ # def multiply(data, method, setting1, setting2):
282
+ # if setting1 == 'e^2/h':
283
+ # value = 0.025974
284
+ # else:
285
+ # value = float(setting1)
286
+
287
+ # axis = {'X': 0, 'Y': 1, 'Z': 2}
288
+ # if len(data) == 3:
289
+ # data[axis[method]] *= value
290
+ # elif len(data) == 2 and axis[method] < 2:
291
+ # data[axis[method]] *= value
292
+ # return data
293
+
294
+ def multiply(data, method, setting1, setting2, array=None):
295
+ axis = {'X': 0, 'Y': 1, 'Z': 2}
296
+ if array is not None:
297
+ if len(data) == 3:
298
+ data[axis[method]] *= array
299
+ elif len(data) == 2 and axis[method] < 2:
300
+ data[axis[method]] *= array
301
+
302
+ else:
303
+ if setting1 == 'e^2/h':
304
+ value = 0.025974
305
+ else:
306
+ value = float(setting1)
307
+
308
+ if len(data) == 3:
309
+ for i,row in enumerate(data[axis[method]]):
310
+ for j,val in enumerate(row):
311
+ data[axis[method]][i][j] *= value
312
+ elif len(data) == 2 and axis[method] < 2:
313
+ for j,val in enumerate(data[axis[method]]):
314
+ data[axis[method]][j] *= value
315
+ return data
316
+
317
+ # def divide(data, method, setting1, setting2):
318
+ # axis = {'X': 0, 'Y': 1, 'Z': 2}
319
+ # if len(data) == 3:
320
+ # data[axis[method]] /= float(setting1)
321
+ # elif len(data) == 2 and axis[method] < 2:
322
+ # data[axis[method]] /= float(setting1)
323
+ # return data
324
+
325
+ def divide(data, method, setting1, setting2, array=None):
326
+ axis = {'X': 0, 'Y': 1, 'Z': 2}
327
+ if array is not None:
328
+ if len(data) == 3:
329
+ data[axis[method]] /= array
330
+ elif len(data) == 2 and axis[method] < 2:
331
+ data[axis[method]] /= array
332
+
333
+ else:
334
+ value=float(setting1)
335
+ if len(data) == 3:
336
+ for i,row in enumerate(data[axis[method]]):
337
+ for j,val in enumerate(row):
338
+ data[axis[method]][i][j] /= value
339
+ elif len(data) == 2 and axis[method] < 2:
340
+ for j,val in enumerate(data[axis[method]]):
341
+ data[axis[method]][j] /= value
342
+ return data
343
+
344
+
345
+ def logarithm(data, method, setting1=10, setting2=None):
346
+ if setting1 == 'e':
347
+ function = np.ma.log
348
+ elif setting1 == '10':
349
+ function = np.ma.log10
350
+ elif setting1 == '2':
351
+ function = np.ma.log2
352
+ else:
353
+ print('Setting 1 is not a valid base. Use e, 10 or 2')
354
+ if method == 'Mask':
355
+ data[-1] = function(data[-1])
356
+ elif method == 'Shift':
357
+ min_value = np.amin(data[-1])
358
+ if min_value <= 0.0:
359
+ data[-1] = function(data[-1]-min_value)
360
+ else:
361
+ data[-1] = function(data[-1])
362
+ elif method == 'Abs':
363
+ data[-1] = function(np.abs(data[-1]))
364
+ return data
365
+
366
+ def power(data, method, setting1, setting2):
367
+ axis = {'X': 0, 'Y': 1, 'Z': 2}
368
+ value=float(setting1)
369
+ if len(data) == 3:
370
+ for i,row in enumerate(data[axis[method]]):
371
+ for j,val in enumerate(row):
372
+ data[axis[method]][i][j] = data[axis[method]][i][j]**value
373
+ elif len(data) == 2 and axis[method] < 2:
374
+ for j,val in enumerate(data[axis[method]]):
375
+ data[axis[method]][j] = data[axis[method]][j]**value
376
+ return data
377
+
378
+ def root(data, method, setting1, setting2):
379
+ root = float(setting1)
380
+ axis = {'X': 0, 'Y': 1, 'Z': 2}
381
+ if root > 0:
382
+ if len(data) == 3:
383
+ for i,row in enumerate(data[axis[method]]):
384
+ for j,val in enumerate(row):
385
+ data[axis[method]][i][j] = np.abs(data[axis[method]][i][j])**(1/root)
386
+ elif len(data) == 2 and axis[method] < 2:
387
+ for j,val in enumerate(data[axis[method]]):
388
+ data[axis[method]][j] = np.abs(data[axis[method]][j])**(1/float(setting1))
389
+ return data
390
+
391
+ def interpolate(data, method, n_x, n_y):
392
+ if len(data) == 3:
393
+ x, y = data[0][:,0], data[1][0,:]
394
+ f_z = interp2d(y, x, data[2], kind=method)
395
+ n_x, n_y = int(n_x), int(n_y)
396
+ min_x, max_x = np.amin(data[0]), np.amax(data[0])
397
+ min_y, max_y = np.amin(data[1]), np.amax(data[1])
398
+ yp, xp = np.linspace(min_y, max_y, n_y), np.linspace(min_x, max_x, n_x)
399
+ data[1], data[0] = np.meshgrid(yp, xp)
400
+ data[2] = f_z(yp, xp)
401
+ elif len(data) == 2:
402
+ f = interp1d(data[0], data[1], kind=method)
403
+ n_x = int(n_x)
404
+ min_x, max_x = np.amin(data[0]), np.amax(data[0])
405
+ data[0] = np.linspace(min_x, max_x, n_x)
406
+ data[1] = f(data[0])
407
+ return data
408
+
409
+ def add_slope(data, method, a_x, a_y):
410
+ if len(data) == 3:
411
+ a_x, a_y = float(a_x), float(a_y)
412
+ data[-1] += a_x*data[0] + a_y*data[1]
413
+ elif len(data) == 2:
414
+ a_y = float(a_y)
415
+ data[-1] += a_y*data[0]
416
+ return data
417
+
418
+ def subtract_trace(data, method, index, setting2):
419
+ if len(data) == 3:
420
+ index = int(float(index))
421
+ if method == 'Hor':
422
+ data[-1] -= np.tile(data[-1][:,index], (len(data[-1][0,:]),1)).T
423
+ elif method == 'Ver':
424
+ data[-1] -= np.tile(data[-1][index,:], (len(data[-1][:,0]),1))
425
+ return data
426
+
427
+ def invert(data, method, setting1, setting2):
428
+ axis = {'X': 0, 'Y': 1, 'Z': -1}
429
+ data[axis[method]] = 1./data[axis[method]]
430
+ return data
431
+
432
+
433
+ class Filter:
434
+ DEFAULT_SETTINGS = {'Derivative': {'Method': ['Mid'],
435
+ 'Settings': ['0', '1'],
436
+ 'Function': derivative,
437
+ 'Checkstate': 2},
438
+ 'Integrate': {'Method': ['Z','Y','X'],
439
+ 'Settings': ['0', '1'],
440
+ 'Function': integrate,
441
+ 'Checkstate': 2},
442
+ 'Smoothen': {'Method': ['Gauss', 'Median'],
443
+ 'Settings': ['0', '2'],
444
+ 'Function': smooth,
445
+ 'Checkstate': 2},
446
+ 'Savitzy-Golay smoothing': {'Method': ['Y','X','dY','dX','ddY','ddX'],
447
+ 'Settings': ['7', '2'],
448
+ 'Function': sav_gol,
449
+ 'Checkstate': 2},
450
+ 'Add/Subtract': {'Method': ['X','Y','Z'],
451
+ 'Settings': ['0', ''],
452
+ 'Function': offset,
453
+ 'Checkstate': 2},
454
+ 'Multiply': {'Method': ['X','Y','Z'],
455
+ 'Settings': ['1', ''],
456
+ 'Function': multiply,
457
+ 'Checkstate': 2},
458
+ 'Divide': {'Method': ['X','Y','Z'],
459
+ 'Settings': ['1', ''],
460
+ 'Function': divide,
461
+ 'Checkstate': 0},
462
+ 'Add Slope': {'Method': [''],
463
+ 'Settings': ['0', '-1'],
464
+ 'Function': add_slope,
465
+ 'Checkstate': 2},
466
+ 'Invert': {'Method': ['X','Y','Z'],
467
+ 'Settings': ['', ''],
468
+ 'Function': invert,
469
+ 'Checkstate': 0},
470
+ 'Normalize': {'Method': ['Max', 'Min', 'Min to Max','Point'],
471
+ 'Settings': ['', ''],
472
+ 'Function': normalize,
473
+ 'Checkstate': 2},
474
+ 'Subtract average': {'Method': ['Z', 'Y', 'X'],
475
+ 'Settings': ['', ''],
476
+ 'Function': subtract_average,
477
+ 'Checkstate': 2},
478
+ 'Offset line by line': {'Method': ['Z', 'Y'],
479
+ 'Settings': ['', ''],
480
+ 'Function': offset_line_by_line,
481
+ 'Checkstate': 2},
482
+ 'Subtract average line by line': {'Method': ['Z', 'Y'],
483
+ 'Settings': ['', ''],
484
+ 'Function': subtract_ave_line_by_line,
485
+ 'Checkstate': 2},
486
+ 'Subtract trace': {'Method': ['Ver', 'Hor'],
487
+ 'Settings': ['0', ''],
488
+ 'Function': subtract_trace,
489
+ 'Checkstate': 0},
490
+ 'Logarithm': {'Method': ['Mask','Shift','Abs'],
491
+ 'Settings': ['10', ''],
492
+ 'Function': logarithm,
493
+ 'Checkstate': 2},
494
+ 'Power': {'Method': ['X','Y','Z'],
495
+ 'Settings': ['2', ''],
496
+ 'Function': power,
497
+ 'Checkstate': 2},
498
+ 'Root': {'Method': ['X','Y','Z'],
499
+ 'Settings': ['2', ''],
500
+ 'Function': root,
501
+ 'Checkstate': 2},
502
+ 'Absolute': {'Method': [''],
503
+ 'Settings': ['', ''],
504
+ 'Function': absolute,
505
+ 'Checkstate': 2},
506
+ 'Flip': {'Method': ['L-R','U-D'],
507
+ 'Settings': ['', ''],
508
+ 'Function': flip,
509
+ 'Checkstate': 2},
510
+ 'Interp': {'Method': ['linear','cubic','quintic'],
511
+ 'Settings': ['800', '600'],
512
+ 'Function': interpolate,
513
+ 'Checkstate': 0},
514
+ 'Roll X': {'Method': ['Index'],
515
+ 'Settings': ['0', '0'],
516
+ 'Function': roll_x,
517
+ 'Checkstate': 0},
518
+ 'Roll Y': {'Method': ['Index'],
519
+ 'Settings': ['0', '0'],
520
+ 'Function': roll_y,
521
+ 'Checkstate': 0},
522
+ 'Crop X': {'Method': ['Abs', 'Rel', 'Lim'],
523
+ 'Settings': ['-1', '1'],
524
+ 'Function': crop_x,
525
+ 'Checkstate': 0},
526
+ 'Crop Y': {'Method': ['Abs', 'Rel', 'Lim'],
527
+ 'Settings': ['-2', '2'],
528
+ 'Function': crop_y,
529
+ 'Checkstate': 0},
530
+ 'Cut X': {'Method': ['Index'],
531
+ 'Settings': ['0', '0'],
532
+ 'Function': cut_x,
533
+ 'Checkstate': 0},
534
+ 'Cut Y': {'Method': ['Index'],
535
+ 'Settings': ['0', '0'],
536
+ 'Function': cut_y,
537
+ 'Checkstate': 0},
538
+ 'Swap X/Y': {'Method': [''],
539
+ 'Settings': ['', ''],
540
+ 'Function': swap_xy,
541
+ 'Checkstate': 2},
542
+ }
543
+
544
+ def __init__(self, name, method=None, settings=None, checkstate=None):
545
+ self.name = name
546
+ default_settings = self.DEFAULT_SETTINGS.copy()
547
+ self.method_list = default_settings[name]['Method']
548
+ if method:
549
+ self.method = method
550
+ else:
551
+ self.method = self.method_list[0]
552
+ if settings:
553
+ self.settings = settings
554
+ else:
555
+ self.settings = default_settings[name]['Settings']
556
+ if checkstate:
557
+ self.checkstate = checkstate
558
+ else:
559
+ self.checkstate = default_settings[name]['Checkstate']
560
+ self.function = default_settings[name]['Function']
561
+