From 3ac5464f53ae56639357ef8ed430eec130f85773 Mon Sep 17 00:00:00 2001 From: sfop Date: Mon, 29 May 2017 12:30:00 +0200 Subject: [PATCH] Script execution --- script/Devices/ImageStats.py | 39 +----------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/script/Devices/ImageStats.py b/script/Devices/ImageStats.py index d264236..7a4a583 100644 --- a/script/Devices/ImageStats.py +++ b/script/Devices/ImageStats.py @@ -8,44 +8,6 @@ import ch.psi.pshell.imaging.ImageListener as ImageListener from operator import add, mul, sub, truediv from ch.psi.pshell.imaging.Utils import sub -def arrmul(a, b): - """Multiply 2 series of the same size. - - Args: - - a(list, tuple, array ...): subscriptable object containing numbers - b(list, tuple, array ...): subscriptable object containing numbers - - Returns: - List - - """ - return map(mul, a, b) - -def center_of_mass(data, x = None): - """Calculate the center of mass of a series, and its rms. - - Args: - - data(list, tuple, array ...): subscriptable object containing numbers - x(list, tuple, array ..., optional): x coordinates - - Returns: - Tuple (com, rms) - - """ - if x is None: - x = Arr.indexesDouble(len(data)) - data_sum = sum(data) - if (data_sum==0): - return float('nan') - xmd = arrmul( x, data) - com = sum(xmd) / data_sum - xmd2 = arrmul( x, xmd) - com2 = sum(xmd2) / data_sum - rms = math.sqrt(abs(com2 - com * com)) - return (com, rms) - def get_centroid(source): bi = source.getImage() if bi is None: @@ -231,6 +193,7 @@ if __name__ == "__builtin__": sensors = [image_stats.com_x_mean, image_stats.com_y_mean, image_stats.com_x_stdev, image_stats.com_y_stdev] image_stats.captureBackground(5) + #image_stats.enableBackground(True) def before_sample(): image_stats.update()