parent 2abfc98f
This diff is collapsed.
File moved
 { "cells": [], "metadata": {}, "nbformat": 4, "nbformat_minor": 2 }
AnalysisTools.py 0 → 100755
 from uncertainties import unumpy, ufloat import matplotlib.pyplot as plt import numpy as np def make_statistic(xs ,ys, error_x): from uncertainties import unumpy arg = np.argsort(xs) xs = xs[arg] ys = ys[arg] i = 0 x_mean = [] x_error = [] y_mean = [] y_error = [] n = [] ys_act = [] xs_act = [] x_act = 0 while i < len(xs): x_act = (x_act * len(xs_act)+ xs[i])/(len(xs_act) + 1) ys_act += [ys[i]] xs_act += [xs[i]] if i < len(xs) -1 and abs(xs[i+1] - x_act) < error_x: i = i+1 else: x_mean += [np.mean(xs_act)] x_error += [np.std(xs_act, ddof = 1)/np.sqrt(len(xs_act))] y_mean += [np.mean(ys_act)] y_error += [np.std(ys_act, ddof = 1)/np.sqrt(len(xs_act))] n += [len(xs_act)] x_act = 0 ys_act = [] xs_act = [] i = i+1 return unumpy.uarray(x_mean, x_error), unumpy.uarray(y_mean, y_error), n def errorplot(ux, uy): plt.errorbar(unumpy.nominal_values(ux), unumpy.nominal_values(uy), xerr = unumpy.std_devs(ux),yerr = unumpy.std_devs(uy), fmt= '--o', elinewidth = 10, ecolor = 'y') \ No newline at end of file
 ... ... @@ -7,8 +7,12 @@ import Globals as g import matplotlib.pyplot as plt def get_item_in_dict(dic, address): for step in address: dic = dic[step] return dic def print_dict(dictionary, ident = '', braces=1, plot = True): """ Recursively prints nested dictionaries.""" ... ... @@ -220,6 +224,39 @@ class IO: datas += [data] n += 1 return datas def select(self, keys = [{}], kind = 'measure'): #example of key: {'address': ['where', 'to', 'find', 'data'], 'value': [val, 'b', error]} # 'b': bigger, 's': smaller, 'e': equals, in case of 'e' the error variable should be defined. results = [] for filename in glob.iglob(self.path+kind+'*.npy'): data = np.load(filename).item() take = True for key in keys: try: if key['value'] == 'b': if key['value'] >= get_item_in_dict(data, key['address']): take = False print ('test') if key['value'] == 's': if key['value'] <= get_item_in_dict(data, key['address']): take = False if key['value'] == 'e': if key['value'] - key['value'] <= get_item_in_dict(data, key['address']) or key['value'] + key['value'] >= get_item_in_dict(data, key['address']): take = False except: take = False if take: results += [data] return results ... ...
No preview for this file type
 ... ... @@ -63,9 +63,16 @@ def getposL(): def maaR(angle): rev=-1 cmd("MAA0,"+str(int(angle*1000000))+","+str(rev)+",60000") while cmd("GS0",output=True)[-2]!=str(3): #while cmd("GS0",output=True)[-2]!=str(3): #print(cmd("GS0",output=True)[-2]) time.sleep(0.3) #time.sleep(0.1) angle_ac = getposR() #print (angle_ac) while abs(angle_ac-angle)>0.01: time.sleep(0.2) angle_ac = getposR() #print (angle_ac) def mpaL(pos): cmd("MPA1,"+str(int(pos*1000000))+",60000") ... ...

199 KB

 ... ... @@ -78,12 +78,14 @@ class ParabolicMirror: if output: print ('FWHMxs: ',FWHMxs) print ('maxints: ',maxints) print ('mean(maxits): ',np.mean(maxints)) res = np.sqrt(np.array(FWHMxs)**2 + np.array(FWHMys)**2)/np.sqrt(2)*4096/np.array(maxints)*intmult mean, error = np.mean(res), np.std(res, ddof = -1) global reduce_int if np.mean(maxints) > 4e3: redurce_int = True reduce_int = True print ('will be attenuated') if output: print ('mean: ',mean,'error: ', error) ... ... @@ -138,7 +140,7 @@ class ParabolicMirror: def after_it(res): print ('###################') print ('step done') global reduce_int global reduce_int, intmult if reduce_int: config_laser = laser.get_config() config_laser['attenuation'] = config_laser['attenuation']/1.2 ... ...
No preview for this file type
No preview for this file type
 ... ... @@ -348,8 +348,6 @@ def main(devices, io, parallel = False): elif output_check.value: dm.plot_measure(measurement, devices2measure,plot_config, 0.01) plt.pause(0.001) plt.draw_all(force = True) print ('maximal possible rate: ',np.round(1/(time.time() -t),1)) if (1/rate_text.value - (time.time() -t) < 0): ... ...
This diff is collapsed.
 ... ... @@ -103,8 +103,8 @@ def plot_server_2d(connecim = None,connecext = None, config = {'xlabel' : '','yl tools = 'pan,wheel_zoom,save,crosshair,resize,reset') from bokeh.models.tools import BoxZoomTool p.add_tools(BoxZoomTool(match_aspect = True)) p.plot_height = 400 p.plot_width = 400 p.plot_height = 480 p.plot_width = 480 if config['image']: from bokeh.palettes import Greys256 palette = Greys256 ... ... @@ -166,7 +166,7 @@ class Plot2DServer: self.show() def show(self): open_window(self.url, width = 500) open_window(self.url, width = 530) def update(self,image ,extent): self.connecext_ch.send(extent) ... ...
No preview for this file type
No preview for this file type
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!