##// END OF EJS Templates
Added current probes data plots generator notebook....
jeandet -
r3:7399cbc3c6c0
parent child
Show More
@@ -0,0 +1,141
1 {
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": 1,
6 "metadata": {
7 "collapsed": true
8 },
9 "outputs": [],
10 "source": [
11 "import numpy as np\n",
12 "import matplotlib\n",
13 "matplotlib.use('Agg')\n",
14 "import matplotlib.pyplot as plt\n",
15 "import pandas as pds\n",
16 "import os\n",
17 "import glob\n",
18 "from multiprocessing import dummy\n",
19 "\n",
20 "pool = dummy.Pool(3)\n",
21 "\n",
22 "files=glob.glob(\"/home/jeandet/Documents/DATA/BOOT_CUR_*C_*V.txt.csv.fixed.calibrated\")"
23 ]
24 },
25 {
26 "cell_type": "code",
27 "execution_count": 2,
28 "metadata": {},
29 "outputs": [],
30 "source": [
31 "power_on_left_index=325000\n",
32 "power_on_right_index=350000\n",
33 "\n",
34 "memory_wash_index={}\n",
35 "sw_start_index={}\n",
36 "for file in files:\n",
37 " calibrated=pds.read_csv(file,sep=\"\\t\")\n",
38 " \n",
39 " avg=calibrated[\"CH2\"].iloc[7000000:7000500].mean()\n",
40 " memory_wash_index[file]=np.where(calibrated[\"CH2\"].iloc[7000000:8000000]>=avg+30)[0][0]+7000000\n",
41 " \n",
42 " avg=calibrated[\"CH2\"].iloc[10100000:10100500].mean()\n",
43 " sw_start_index[file]=np.where(calibrated[\"CH2\"].iloc[10300000:10800000]>=avg+30)[0][0]+10300000\n",
44 " \n",
45 " del calibrated\n",
46 "\n",
47 "\"\"\"\n",
48 "18+1 pulses, each RMAP packet is limited to 4*4000 bytes\n",
49 "LFR FSW 3.0.0.22:\n",
50 ".text segment = 285136 bytes\n",
51 ".data segment = 4976 bytes\n",
52 "\n",
53 "-> .text correspond to 17.821 packets or 17x16000 bytes packets plus 1x13136 bytes packet\n",
54 "-> .data correspond to 0.311 packet \n",
55 "\n",
56 "Auto detected before sw start\n",
57 "\"\"\"\n",
58 "\n",
59 "\n",
60 "SBM1_left_index=14100000\n",
61 "SBM1_right_index=14350000\n",
62 "\n"
63 ]
64 },
65 {
66 "cell_type": "code",
67 "execution_count": 3,
68 "metadata": {
69 "collapsed": true
70 },
71 "outputs": [],
72 "source": [
73 "def plot(df,left,right,sufix):\n",
74 " if not os.path.isfile(file+sufix):\n",
75 " ax=df.iloc[left:right].plot(figsize=(24,12))\n",
76 " plt.ylabel('Current (mA)')\n",
77 " plt.xlabel('Time (Β΅s)')\n",
78 " plt.savefig(file+sufix,dpi=1200,format='pdf')\n",
79 " plt.close()"
80 ]
81 },
82 {
83 "cell_type": "code",
84 "execution_count": 4,
85 "metadata": {
86 "collapsed": true
87 },
88 "outputs": [],
89 "source": [
90 "for file in files:\n",
91 " if not os.path.isfile(file+\".pdf\"):\n",
92 " calibrated=pds.read_csv(file,sep=\"\\t\")\n",
93 " plot(calibrated,power_on_left_index,power_on_right_index,\"_power_on.pdf\")\n",
94 "\n",
95 " index=memory_wash_index[file]\n",
96 " plot(calibrated,index-10000,index+150000,\"_memory_wash.pdf\")\n",
97 "\n",
98 " index=sw_start_index[file]\n",
99 " plot(calibrated,index-320000,index-500,\"_spw_upload.pdf\")\n",
100 "\n",
101 " index=sw_start_index[file]\n",
102 " plot(calibrated,index-2000,index+500000,\"_sw_start.pdf\")\n",
103 "\n",
104 " plot(calibrated,SBM1_left_index,SBM1_right_index,\"_SBM1.pdf\")\n",
105 "\n",
106 " plot(calibrated,0,-1,\".pdf\")\n",
107 " del calibrated\n"
108 ]
109 },
110 {
111 "cell_type": "code",
112 "execution_count": null,
113 "metadata": {
114 "collapsed": true
115 },
116 "outputs": [],
117 "source": []
118 }
119 ],
120 "metadata": {
121 "kernelspec": {
122 "display_name": "Python 3",
123 "language": "python",
124 "name": "python3"
125 },
126 "language_info": {
127 "codemirror_mode": {
128 "name": "ipython",
129 "version": 3
130 },
131 "file_extension": ".py",
132 "mimetype": "text/x-python",
133 "name": "python",
134 "nbconvert_exporter": "python",
135 "pygments_lexer": "ipython3",
136 "version": "3.5.3"
137 }
138 },
139 "nbformat": 4,
140 "nbformat_minor": 2
141 }
General Comments 0
You need to be logged in to leave comments. Login now