~plane1/+junk/dissertation

« back to all changes in this revision

Viewing changes to src/Analysis/HPRF/hpc_spark_plot.py

  • Committer: plane1
  • Date: 2016-06-23 20:36:15 UTC
  • Revision ID: plane1@hawk.iit.edu-20160623203615-dqlye6youiil2bbh
Changed directory names for HPRF cavities to the acronyms now used in the dissertation (i.e., HC and DLHC)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf-8 -*-
2
 
"""
3
 
Created on Wed Feb 24 08:12:37 2016
4
 
 
5
 
@author: plane
6
 
"""
7
 
import math
8
 
import subprocess as proc
9
 
import sys
10
 
import platform
11
 
import numpy as np  # NumPy (multidimensional arrays, linear algebra, ...)
12
 
import matplotlib as mpl
13
 
import matplotlib.cm as cm
14
 
import matplotlib.collections as mcollections
15
 
import matplotlib.patches as mpatches
16
 
import matplotlib.pyplot as plt  # Matplotlib's pyplot: MATLAB-like syntax
17
 
import scipy.signal as sig
18
 
import scipy.special as special
19
 
import bisect as bi
20
 
import time
21
 
import pgl.comsol as comsol
22
 
import pgl.curve as curve
23
 
import pgl.labview as labview
24
 
import pgl.plot as plot
25
 
import pgl.signal as psig
26
 
import pgl.tektronix as tektronix
27
 
import pgl.mc as mc
28
 
import pgl.progress as prog
29
 
import pgl.cluster as clust
30
 
 
31
 
def reset_plot_params():
32
 
    mpl.rcParams['ytick.labelsize'] = 22
33
 
    mpl.rcParams['xtick.labelsize'] = 22
34
 
    mpl.rcParams['axes.labelsize'] = 26
35
 
    mpl.rcParams['font.size'] = 26
36
 
    mpl.rcParams['mathtext.default'] = 'regular'
37
 
    mpl.rcParams['figure.subplot.left'] = 0.02
38
 
    mpl.rcParams['figure.subplot.right'] = 0.98
39
 
    mpl.rcParams['figure.subplot.top'] = 0.9
40
 
    mpl.rcParams['figure.subplot.bottom'] = 0.1
41
 
    mpl.rcParams['figure.subplot.wspace'] = 0.2
42
 
    mpl.rcParams['figure.subplot.hspace'] = 0.2
43
 
reset_plot_params()
44
 
 
45
 
lv_directory = "C:\\Users\\plane\\Desktop\\Data\\HPRF\\HPRF 20120605\sparks_29p5MV-M_15Hz\\"
46
 
 
47
 
#lv_file = "spark_53_55.npz"
48
 
lv_file = "spark_66_68.npz"
49
 
#(times, raw_signals) = labview.load_data(lv_directory, lv_file,
50
 
#(times, raw_signals) = labview.load_data(lv_directory, lv_file, t0=286.401e-3, t1=287.241e-3,
51
 
(times, raw_signals) = labview.load_data(lv_directory, lv_file, t0=221.524e-3, t1=222.324e-3,
52
 
                                         channels=[0,1,2,3,4,5])
53
 
                                         #channels=[0,1,2,3,4,5,6])
54
 
signals = raw_signals
55
 
"""
56
 
lv_file = "reduced_53_55.npz"
57
 
(times, reduced_signals) = labview.load_data(lv_directory, lv_file, t0=286.401e-3, t1=287.241e-3,
58
 
                                             channels=[0,1])
59
 
                                             #channels=[0,1,2,3,4,5,6])
60
 
 
61
 
hammer_signals = raw_signals - reduced_signals
62
 
dt = times[1]
63
 
time_shift = 16e-6
64
 
offset = int(round(time_shift / dt))
65
 
hammer_signals = np.roll(hammer_signals, offset, axis=1)
66
 
blank = np.zeros((np.shape(hammer_signals)[0], offset))
67
 
hammer_signals[:,:offset] = blank
68
 
signals = raw_signals - hammer_signals
69
 
"""
70
 
 
71
 
plt.xlabel("Time (us)")
72
 
plt.ylabel("Amplitude (V)")
73
 
plot.plot_signals(times*1e6, signals, norm=True)
74
 
plt.tight_layout()