Commit a756187b authored by Sauerwein Nick Jacob's avatar Sauerwein Nick Jacob
Browse files

after experiments / small changes

parent 3375f8c1
......@@ -106,8 +106,11 @@ def get_config(devices):
config = {'time': time}
for device in devices:
import time
t = time.time()
device_name = type(device).__name__
config[device_name] = device.get_config()
print (device_name,' config time: ',time.time() - t)
return config
def measure(devices, devices2measure = 'all'):
......@@ -124,8 +127,11 @@ def measure(devices, devices2measure = 'all'):
for device in devices2measure:
device_name = type(device).__name__
if hasattr(device, 'measure'):
import time
t = time.time()
data['measure'][device_name] = device.measure()
print (device_name,' measured')
print (device_name,' measure time: ',time.time() - t)
return data
......
......@@ -4,11 +4,16 @@ import matplotlib.pyplot as plt
'''
config file:
channel: channel on DRS4 where Cup is connected to
amplification: factor amplification of signal before drs4
R: resistance of termination [Ohm]
measurement file:
time: time (datetime object)
sig_time: time axis of signal
sig_uvolt: voltage of signal in uvolt
sig_uvolt: voltage of signal [uV]
peak_uvolt: negative peak voltage [uV]
charge: charge [fC]
'''
class FaradayCup:
......@@ -20,7 +25,8 @@ class FaradayCup:
def set_config(self,config):
self.channel = config['channel']
self.R = config['R']
self.amplification = config['amplification']
def get_config(self):
config = {}
config['channel'] = self.channel
......@@ -31,8 +37,8 @@ class FaradayCup:
import datetime
time = datetime.datetime.now()
measurement = {}
measurement = {'time': time,'sig_time': sig_time, 'sig_uvolt': sig_uvolt, 'peak_uvolt': np.min(sig_uvolt) }
charge = np.trapz(sig_uvolt, x = np.array(sig_time)*1e-9)*1e-6/self.R/self.amplification*1e15
measurement = {'time': time,'sig_time': sig_time, 'sig_uvolt': sig_uvolt, 'peak_uvolt': np.min(sig_uvolt),'charge': charge }
return measurement
def plot_measure(self, measurement, config = None):
......@@ -42,5 +48,5 @@ class FaradayCup:
plt.plot(measurement['sig_time'], measurement['sig_uvolt'])
plt.xlabel('Time [ns]')
plt.ylabel('Signal [uV]')
plt.title("Signal from measurement "+str(measurement['time']))
plt.title('Measured Charge: '+str(measurement['charge'])+' fC')
plt.tight_layout()
\ No newline at end of file
......@@ -2,22 +2,13 @@
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 1,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
......@@ -31,7 +22,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 2,
"metadata": {
"collapsed": false,
"deletable": true,
......@@ -78,7 +69,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 3,
"metadata": {
"collapsed": false,
"deletable": true,
......@@ -89,14 +80,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"best configuration of parabolic mirror (good automatic optimization)\n"
"pulled vacuum\n"
]
}
],
"source": [
"import DataManager as dm\n",
"io = dm.IO('Data/')\n",
"config = io.load(-2)\n",
"io = dm.IO('Data/Experiments310317/')\n",
"config = io.load(-1)\n",
"print (config['comment'])"
]
},
......@@ -203,7 +194,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 4,
"metadata": {
"collapsed": false,
"deletable": true,
......@@ -214,6 +205,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"C:\\Users\\sauerwein_n\\Desktop\\lwfatools\n",
"Connnection with motors sucessful!\n"
]
}
......@@ -250,7 +242,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 5,
"metadata": {
"collapsed": false,
"deletable": true,
......@@ -277,7 +269,10 @@
},
"outputs": [],
"source": [
"blade.get_config()"
"#import time\n",
"#t = time.time()\n",
"#blade.get_config()\n",
"#time.time() -t"
]
},
{
......@@ -292,7 +287,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 6,
"metadata": {
"collapsed": false,
"deletable": true,
......@@ -304,7 +299,6 @@
"output_type": "stream",
"text": [
"available cameras:\n",
"<DeviceInfo Basler scA1400-17gm (21145133)>\n",
"<DeviceInfo Basler avA2300-25gmDSY (21547524)>\n",
"camera found =) Be happy\n"
]
......@@ -362,7 +356,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 7,
"metadata": {
"collapsed": false,
"deletable": true,
......@@ -385,24 +379,13 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"{'time': '2017-03-29_10-39-30.348962'}"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"delay.measure()"
]
......@@ -419,7 +402,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 8,
"metadata": {
"collapsed": false,
"deletable": true,
......@@ -450,7 +433,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 9,
"metadata": {
"collapsed": false,
"deletable": true,
......@@ -461,7 +444,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"16.3315204836\n"
"-22.9\n"
]
}
],
......@@ -491,7 +474,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 10,
"metadata": {
"collapsed": false,
"deletable": true,
......@@ -503,10 +486,13 @@
"\n",
"try:\n",
" fara_config = config['FaradayCup']\n",
" fara = FaradayCup(fara_config, drs)\n",
"except:\n",
" fara_config = {'channel':2 }\n",
"\n",
"fara = FaradayCup(fara_config, drs)"
" fara_config = {'channel':2,\n",
" 'R': 50,\n",
" 'amplification': 1e4}\n",
" fara = FaradayCup(fara_config, drs)\n",
"\n"
]
},
{
......@@ -547,7 +533,7 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 11,
"metadata": {
"collapsed": false,
"deletable": true,
......@@ -567,7 +553,7 @@
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"io = dm.IO('Data/')\n",
"io = dm.IO('Data/Experiments310317/')\n",
"\n",
"%matplotlib\n",
"\n",
......@@ -577,7 +563,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": 12,
"metadata": {
"collapsed": false,
"deletable": true,
......@@ -585,7 +571,7 @@
},
"outputs": [],
"source": [
"devices = [delay,laser, inter, drs, fara, per, blade] #use this to run the LWFA\n",
"devices = [delay,inter,laser, drs, fara, per]#, blade] #use this to run the LWFA\n",
"#devices = [inter, per]\n",
"#devices = [per, para, laser, focus] #use this to do focus optimization\n",
"#devices = [td1, td2] #Use this do debug the gui and data menager"
......@@ -593,7 +579,7 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 13,
"metadata": {
"collapsed": false,
"deletable": true,
......@@ -601,10 +587,22 @@
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"DelayGenerator config time: 0.003999948501586914\n",
"Interferometer config time: 0.0009999275207519531\n",
"Laser config time: 0.005000114440917969\n",
"DRS4 config time: 0.003999948501586914\n",
"FaradayCup config time: 0.0\n",
"Periscope config time: 0.09599995613098145\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9687c609909a4a75862ad3471c1722d2"
"model_id": "8d19123d8dc64288a1afb6e962d07785"
}
},
"metadata": {},
......@@ -613,7 +611,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "550ad84aa4a6422caeedb061d82c5ece"
"model_id": "3de68129a6c041d1baafdeeea87fed78"
}
},
"metadata": {},
......@@ -622,7 +620,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a74d3f227f414c22a418441cc8eff8e2"
"model_id": "7d59bbbb7b3146f5a9e905e45d6361e4"
}
},
"metadata": {},
......@@ -631,7 +629,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b99db782ef5d4d038250a93f49c1c001"
"model_id": "7a2a230b0d844ff59cf8e68725647f1b"
}
},
"metadata": {},
......@@ -640,7 +638,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9ddf7ac6d426498c9817a24edc3cf1a4"
"model_id": "afa79dbebc194b8b85bccf3418508264"
}
},
"metadata": {},
......@@ -649,7 +647,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3032d69feffc464184f033ce44e0760f"
"model_id": "29cde36d473c4489945ec77cc369dde8"
}
},
"metadata": {},
......@@ -658,7 +656,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2bfb23e80c594eae8c297a15f2f7a2f5"
"model_id": "00ac058fd93f4235abc155675be9b5d7"
}
},
"metadata": {},
......@@ -667,7 +665,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6e5c019ba24743e6978fae40eff0e151"
"model_id": "1a35b1bd06d54b91867e3678fbb0c73f"
}
},
"metadata": {},
......@@ -676,7 +674,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "66c4f1b4d0a243eaac3b87dede72a7c8"
"model_id": "94cf6ebfa8da481cb3e7bb1ab4f24688"
}
},
"metadata": {},
......@@ -685,7 +683,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "5415b8fd31c546a6ad19f5dd596024c8"
"model_id": "94291a9b68ff4df4ad40802fd72477f4"
}
},
"metadata": {},
......@@ -694,7 +692,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c75838b0f39d4c3183c8d37dbed4c19a"
"model_id": "de65af8948b94433942ef5d2d3f4550b"
}
},
"metadata": {},
......@@ -703,7 +701,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "cb4894a731c5486cb5138f9fdf771bc8"
"model_id": "83a9f17ef7f8407a92135c4228389546"
}
},
"metadata": {},
......@@ -712,7 +710,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ddf9af4d8dfa4144a7214b2a04470b88"
"model_id": "83e1eba76703463ab6312b0577d3ee31"
}
},
"metadata": {},
......@@ -721,7 +719,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b67122affb1d4434a5ccc82c8d328c9c"
"model_id": "b0443f2db09a4e75948bdb1fa92f8197"
}
},
"metadata": {},
......@@ -730,11 +728,30 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7086fe7ca4c04da5b5f5f5dac9ee9091"
"model_id": "c74156e31d22403db81c3c39a42048eb"
}
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"[<Devices.DelayGenerator.DelayGenerator object at 0x00000000097D3F28>, <Devices.Interferometer.Interferometer object at 0x000000000959BFD0>, <Devices.Laser.Laser object at 0x000000000C5B05F8>, <Devices.FaradayCup.FaradayCup object at 0x000000000C5BF668>]\n",
"DelayGenerator config time: 0.0029997825622558594\n",
"Interferometer config time: 0.0010001659393310547\n",
"Laser config time: 0.004999876022338867\n",
"FaradayCup config time: 0.0\n",
"DelayGenerator measured\n",
"DelayGenerator measure time: 0.0010001659393310547\n",
"Interferometer measured\n",
"Interferometer measure time: 0.4744999408721924\n",
"Laser measured\n",
"Laser measure time: 0.03874993324279785\n",
"FaradayCup measured\n",
"FaradayCup measure time: 0.027499914169311523\n"
]
}
],
"source": [
......@@ -954,7 +971,7 @@
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python [default]",
"language": "python",
"name": "python3"
},
......@@ -968,7 +985,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
"version": "3.5.3"
},
"widgets": {
"state": {
......
py_elog @ 9e7ad854
Subproject commit 9e7ad854d005d682628ab887cff00aa1c30da248
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment