Commit 1af4911f authored by root's avatar root
Browse files

camera binning

parent 2c006fdf
File mode changed from 100644 to 100755
No preview for this file type
......@@ -2,26 +2,26 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import sys\n",
"sys.path.append('../../')"
"sys.path.append('/home/data/lwfaserver/')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import DataManager as dm\n",
"io = dm.IO('Data/')"
"io = dm.IO('Data/EXP280717/')"
]
},
{
......@@ -69,7 +69,9 @@
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"for i in range(len(measurements)):\n",
......@@ -1530,7 +1532,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
"version": "3.5.3"
}
},
"nbformat": 4,
......
......@@ -2,18 +2,9 @@
"cells": [
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
"outputs": [],
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
......@@ -28,7 +19,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 5,
"metadata": {
"scrolled": true
},
......@@ -48,6 +39,16 @@
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/data/anaconda3/lib/python3.5/site-packages/bokeh/models/sources.py:91: BokehUserWarning: ColumnDataSource's columns must be of the same length. Current lengths: ('x', 100), ('y', 2)\n",
" \"Current lengths: %s\" % \", \".join(sorted(str((k, len(v))) for k, v in data.items())), BokehUserWarning))\n",
"/home/data/anaconda3/lib/python3.5/site-packages/bokeh/models/sources.py:91: BokehUserWarning: ColumnDataSource's columns must be of the same length. Current lengths: ('x', 1000), ('y', 100)\n",
" \"Current lengths: %s\" % \", \".join(sorted(str((k, len(v))) for k, v in data.items())), BokehUserWarning))\n"
]
}
],
"source": [
......@@ -56,8 +57,10 @@
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"execution_count": 23,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
......@@ -82,19 +85,19 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 24,
"metadata": {
"collapsed": true,
"scrolled": true
},
"outputs": [],
"source": [
"ps1.update(np.linspace(0,1,100), np.random.rand(100))"
"ps1.update(np.linspace(0,1,1000), np.random.rand(1000))"
]
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": 9,
"metadata": {},
"outputs": [
{
......@@ -120,13 +123,13 @@
},
{
"cell_type": "code",
"execution_count": 42,
"execution_count": 20,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"ps2d.update((np.random.random((70,100))*10000).astype('int16'),[0,2,0,5])"
"ps2d.update((np.random.random((1000,1000))*10000).astype('int16'),[0,2,0,5])"
]
},
{
......
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"dict_images_angles = np.load(\"Data/Interferometer/data.npy\").item()\n",
"projections = dict_images_angles['projections']\n",
"angles_rad = dict_images_angles['angles']\n",
"del dict_images_angles"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ -0.00000000e+00 2.30383461e-03 9.21533845e-03 2.06996049e-02\n",
" 3.67217275e-02 5.72642528e-02 8.22224611e-02 1.11561446e-01\n",
" 1.45176487e-01 1.82980319e-01 2.24850768e-01 2.70665660e-01\n",
" 3.20302824e-01 3.73587726e-01 4.30398194e-01 4.90559693e-01\n",
" 5.53880238e-01 6.20185296e-01 6.89282881e-01 7.60963554e-01\n",
" 8.35017874e-01 9.11236402e-01 9.89392246e-01 1.06924106e+00\n",
" 1.15055595e+00 1.23312748e+00 1.31667639e+00 1.40095834e+00\n",
" 1.48574643e+00 1.57079633e+00 1.65584622e+00 1.74063432e+00\n",
" 1.82491627e+00 1.90846518e+00 1.99103670e+00 2.07235159e+00\n",
" 2.15220041e+00 2.23035625e+00 2.30657478e+00 2.38062910e+00\n",
" 2.45230977e+00 2.52140736e+00 2.58771242e+00 2.65103296e+00\n",
" 2.71119446e+00 2.76800493e+00 2.82128983e+00 2.87092699e+00\n",
" 2.91674189e+00 2.95861233e+00 2.99641617e+00 3.03003121e+00\n",
" 3.05937019e+00 3.08432840e+00 3.10487093e+00 3.12089305e+00\n",
" 3.13237732e+00 3.13928882e+00 3.14159265e+00]\n"
]
}
],
"source": [
"print (angles_rad)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
% columns="iteration, evaluation, sigma, max axis length, min axis length, all principle axes lengths (sorted square roots of eigenvalues of C)", seed=1037295, Thu Jul 13 17:00:41 2017
0 0 1.0 1.00002500031 1.0 1.0 1.00002500031
1 6 0.915660140826 1.00002500031 1.0 1.0 1.00002500031
2 12 0.890360413058 0.968078193678 0.885294233445 0.885294233445 0.968078193678
3 18 0.71461903787 1.01062831124 0.804779737728 0.804779737728 1.01062831124
4 24 0.58870709103 0.904639802402 0.703681552377 0.703681552377 0.904639802402
5 30 0.619661499094 0.826787465017 0.622982684259 0.622982684259 0.826787465017
6 36 0.622161542581 0.920906048612 0.533629151044 0.533629151044 0.920906048612
7 42 0.58389487754 0.827152264022 0.567822878616 0.567822878616 0.827152264022
8 48 0.716232701306 0.825444141487 0.523349699701 0.523349699701 0.825444141487
9 54 0.587835012459 0.850188898258 0.558999817557 0.558999817557 0.850188898258
10 60 0.490613962725 0.84311290571 0.488341706866 0.488341706866 0.84311290571
% columns="iteration, evaluation, min max(neg(.)) min(pos(.)) max correlation, correlation matrix principle axes lengths (sorted square roots of eigenvalues of correlation matrix)", seed=1037295, Thu Jul 13 17:00:41 2017
0 0 0.0 0 0 0.0 1 1
1 6 0.0746812192916 0.0746812192916 0.0746812192916 0.0746812192916 1 1
2 12 0.201487094004 0.201487094004 0.201487094004 0.201487094004 1 1
3 18 0.181999216377 0.181999216377 0.181999216377 0.181999216377 1 1
4 24 0.204280718157 0.204280718157 0.204280718157 0.204280718157 0.892030987042 1.0973972472
5 30 0.396054944787 0.396054944787 0.396054944787 0.396054944787 0.892030987042 1.0973972472
6 36 0.362179980185 0.362179980185 0.362179980185 0.362179980185 0.798636350172 1.16712466351
7 42 0.448939791536 0.448939791536 0.448939791536 0.448939791536 0.798636350172 1.16712466351
8 48 0.194099827468 0.194099827468 0.194099827468 0.194099827468 0.897719428625 1.09274874855
9 54 0.0844621370705 0.0844621370705 0.0844621370705 0.0844621370705 0.897719428625 1.09274874855
10 60 0.14528845785 0.14528845785 0.14528845785 0.14528845785 0.924506107146 1.07018150697
% # columns="iteration, evaluation, sigma, axis ratio, bestever, best, median, worst objective function value, further objective values of best", seed=1037295, Thu Jul 13 17:00:41 2017
1 6 0.915660140826 1.00002500031 0.2733936687819944 2.7339366878199439e-01 3.29976280104 6.68648765513
2 12 0.890360413058 1.09351010896 0.2733936687819944 6.8794648686030913e-01 1.27079110755 5.08783490619
3 18 0.71461903787 1.25578250031 0.2733936687819944 3.8175160986960760e-01 1.52927807942 3.88414236728
4 24 0.58870709103 1.28558123962 0.08158138277203436 8.1581382772034361e-02 1.40932009229 1.74944487382
5 30 0.619661499094 1.32714357222 0.08158138277203436 1.6270546118481122e-01 0.378484893925 0.704343954145
6 36 0.622161542581 1.72574164438 0.08158138277203436 3.0180752682955569e-01 0.624826369466 1.17400662726
7 42 0.58389487754 1.45670823627 0.08158138277203436 8.1786695191235534e-02 0.67303712729 1.42798017316
8 48 0.716232701306 1.57723247373 0.08158138277203436 2.8997803712731912e-01 0.438139433758 1.85367140117
9 54 0.587835012459 1.52091086894 0.08158138277203436 1.1229985529676285e-01 0.183680885131 0.818595129993
10 60 0.490613962725 1.72648146545 0.08158138277203436 8.5745081736729123e-02 0.275049230949 1.10624243472
% # columns=["iteration, evaluation, sigma, void, void, stds==sigma*sqrt(diag(C))", seed=1037295, Thu Jul 13 17:00:41 2017
0 0 1.0 0 0 1.0 1.00002500031
1 6 0.915660140826 0 0 0.814118326968 0.883226735586
2 12 0.890360413058 0 0 0.768733317659 0.854981216248
3 18 0.71461903787 0 0 0.538121795987 0.614935141954
4 24 0.58870709103 0 0 0.393278759831 0.46352915738
5 30 0.619661499094 0 0 0.403195802873 0.516135015552
6 36 0.622161542581 0 0 0.409424105578 0.476260153902
7 42 0.58389487754 0 0 0.37660435621 0.437097147782
8 48 0.716232701306 0 0 0.420018280001 0.602589858691
9 54 0.587835012459 0 0 0.295619083926 0.483960199682
10 60 0.490613962725 0 0 0.225072640243 0.362804292453
% # columns="iteration, evaluation, void, void, void, xmean", seed=1037295, Thu Jul 13 17:00:41 2017 # scaling_of_variables: 1, typical_x: 0
0 0 0 0.0 nan 3.03790580166 7.27449869244
1 6 0 0.0 nan 2.77006232086 6.58648699893
2 12 0 0.0 nan 3.39441435733 7.42285437593
3 18 0 0.0 nan 3.18886535887 7.49829440899
4 24 0 0.0 nan 3.21846420778 7.14105220778
5 30 0 0.0 nan 2.9474384779 6.75126197005
6 36 0 0.0 nan 2.69005282395 6.80602650468
7 42 0 0.0 nan 3.11751197926 7.18066483834
8 48 0 0.0 nan 3.14222822301 6.55398450123
9 54 0 0.0 nan 3.05332036601 7.15991625534
10 60 0 0.0 nan 2.90940730892 7.05654763396
% # iter+eval+sigma+0+fitness+xbest, seed=1037295, Thu Jul 13 17:00:41 2017
1 6 0.915660140826 0 0.273393668782 2.57539594548 6.74624357304
2 12 0.890360413058 0 0.68794648686 3.12382126913 7.81116513993
3 18 0.71461903787 0 0.38175160987 3.18124483828 7.58175038388
4 24 0.58870709103 0 0.081581382772 3.15265078499 7.14907626925
5 30 0.619661499094 0 0.162705461185 2.7919920992 6.76206278424
6 36 0.622161542581 0 0.30180752683 2.48207480965 7.03884646543
7 42 0.58389487754 0 0.0817866951912 3.22128943125 7.09903224251
8 48 0.716232701306 0 0.289978037127 3.03748285121 6.51688063056
9 54 0.587835012459 0 0.112299855297 2.926317437 7.29265282049
10 60 0.490613962725 0 0.0857450817367 2.91954232833 7.16011240792
import numpy as np
from epics import PV, caput, caget
import ipywidgets as widgets
from IPython.display import display
def shut_down_laser(bt = None):
caput('F10HU-LMOT715:MOT.VAL', -22.9 - 90)
def shut_down_python(bt = None):
from subprocess import call
call(["pkill", "python"])
def emergency_stop(bt = None):
shut_down_laser(bt = None)
shut_down_python(bt = None)
class gui:
def __init__(self):
self.bt_laser = widgets.Button(
description='STOP LASER',
disabled=False,
button_style='warning',layout=widgets.Layout(width='50%', height='100px')
)
self.bt_laser.on_click(shut_down_laser)
self.bt_python = widgets.Button(
description='STOP PYTHON',
disabled=False,
button_style='warning',layout=widgets.Layout(width='50%', height='100px')
)
self.bt_python.on_click(shut_down_python)
self.bt_stop = widgets.Button(
description='EMERGENCY STOP',
disabled=False,
button_style='danger',layout=widgets.Layout(width='100%', height='200px')
)
self.bt_stop.on_click(emergency_stop)
def show(self):
display(widgets.VBox([widgets.HBox([self.bt_laser,self.bt_python]),self.bt_stop ]))
\ No newline at end of file
File mode changed from 100644 to 100755
{
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
"source": [
"%load_ext autoreload\n",
"%autoreload 2\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from Devices.CameraDelay import CameraDelay\n",
"\n",
"try:\n",
" delay_config = config['DelayGenerator']\n",
"except:\n",
" delay_config = {'jet_triggered': True,\n",
" 'mode': 'single shot',\n",
" 'rate': 10.,\n",
" 't_sleep': 0.05}\n",
"\n",
"delay = CameraDelay(delay_config)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'time': '2017-08-10_17-13-22.867681'}"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"delay.measure()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"connecting camera\n",
"available cameras:\n",
"<DeviceInfo Basler scA1600-14gm (21052921)>\n",
"<DeviceInfo Basler avA2300-25gmDSY (21547524)>\n",
"<DeviceInfo Basler acA3800-10gm (22005848)>\n",
"<DeviceInfo Basler scA1400-17gm (21145133)>\n",
"camera found =) Be happy\n",
"done\n"
]
}
],
"source": [
"from Devices.ScreenCamera import ScreenCamera\n",
"\n",
"try:\n",
" screen_config = config['ScreenCamera']\n",
"except:\n",
" screen_config = {\n",
" 'y0': 6.8,\n",
" 'z0': 8.45,\n",
" 'ExposureTimeAbs':1000,\n",
" 'TriggerMode':False}\n",
"\n",
"screen = ScreenCamera(screen_config)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"screen_config = {\n",
" 'y0': 6.8,\n",
" 'z0': 8.45,\n",
" 'ExposureTimeAbs':95,\n",
" 'TriggerMode':True}\n",
"\n",
"screen.set_config(screen_config)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"delay.measure()\n",
"screen.plot_measure(screen.measure())"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0, 0], dtype=int8)"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.array([0,2**15], dtype = 'int16').astype('int8')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from multiprocessing import Pool"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"def f (x):\n",
" \n",
" print (x)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"def testa():\n",
" p = Pool(4)\n",
" p.map(f, [test(1), test(2)])"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2\n",
"1\n"
]
}
],
"source": [
"testa()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"class test:\n",
" \n",
" def __init__(self, idi):\n",
" self.idi = idi\n",
" \n",
" def __str__(self):\n",
" \n",
" return str(self.idi)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"t = test(1)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n"
]
}
],
"source": [
"print (t)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true