~plane1/+junk/dissertation

« back to all changes in this revision

Viewing changes to src/Analysis/DL-HPRF/microphone_locations.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 18:32:40 2016
4
 
 
5
 
@author: plane
6
 
"""
7
 
import math
8
 
import subprocess as proc
9
 
import os
10
 
import os.path as path
11
 
import sys
12
 
import platform
13
 
import numpy as np  # NumPy (multidimensional arrays, linear algebra, ...)
14
 
import matplotlib as mpl
15
 
import matplotlib.cm as cm
16
 
import matplotlib.collections as mcollections
17
 
import matplotlib.patches as mpatches
18
 
import matplotlib.pyplot as plt  # Matplotlib's pyplot: MATLAB-like syntax
19
 
import scipy.signal as sig
20
 
import scipy.special as special
21
 
import bisect as bi
22
 
import time
23
 
import pgl.comsol as comsol
24
 
import pgl.curve as curve
25
 
import pgl.labview as labview
26
 
import pgl.plot as plot
27
 
import pgl.signal as psig
28
 
import pgl.tektronix as tektronix
29
 
import pgl.mc as mc
30
 
import pgl.progress as prog
31
 
import pgl.cluster as clust
32
 
import pgl.hpc as hpc
33
 
 
34
 
def reset_plot_params():
35
 
    mpl.rcParams['ytick.labelsize'] = 22
36
 
    mpl.rcParams['xtick.labelsize'] = 22
37
 
    mpl.rcParams['axes.labelsize'] = 26
38
 
    mpl.rcParams['font.size'] = 26
39
 
    mpl.rcParams['mathtext.default'] = 'regular'
40
 
    mpl.rcParams['figure.subplot.left'] = 0.02
41
 
    mpl.rcParams['figure.subplot.right'] = 0.98
42
 
    mpl.rcParams['figure.subplot.top'] = 0.9
43
 
    mpl.rcParams['figure.subplot.bottom'] = 0.1
44
 
    mpl.rcParams['figure.subplot.wspace'] = 0.2
45
 
    mpl.rcParams['figure.subplot.hspace'] = 0.2
46
 
reset_plot_params()
47
 
 
48
 
def plot_mic_locations(mic_xs, mic_ys):
49
 
    fig = plt.gcf()
50
 
    ax = fig.gca()
51
 
    mic_radius = 1.5
52
 
 
53
 
    patches = []
54
 
    for coordinate in zip(mic_xs, mic_ys):
55
 
        patches.append(mpatches.Circle(coordinate, mic_radius))
56
 
    collection = mcollections.PatchCollection(patches, cmap=cm.brg,
57
 
                                              norm=mpl.colors.Normalize(0.,1.),
58
 
                                              alpha=0.2)
59
 
    collection.set_array(np.array([0.25, 0.5, 0.75]))
60
 
    ax.add_collection(collection)
61
 
 
62
 
 
63
 
    """
64
 
    patches = []
65
 
    for coordinate in zip(source_xs_120,source_ys_120):
66
 
        patches.append(mpatches.Circle(coordinate, error_radius))
67
 
    collection = mcollections.PatchCollection(patches, cmap=cm.brg, norm=mpl.colors.Normalize(0.,1.), alpha=0.2)
68
 
    collection.set_array(np.repeat(1.0, len(source_xs_120)))
69
 
    ax.add_collection(collection)
70
 
    """
71
 
 
72
 
    # cavity
73
 
    origin_x = np.zeros(1)
74
 
    origin_y = np.zeros(1)
75
 
    cavity_radius = 10000
76
 
    #plt.scatter([0, 0], [0, 0], s=[90000, 0], c=[3,1], cmap=cm.Set1, alpha=0.1)
77
 
    cavity=plt.Circle((0,0),15.24,color='k',alpha=0.1)
78
 
    ax.add_artist(cavity)
79
 
 
80
 
    plt.xlim((-16, 16))
81
 
    plt.ylim((-16, 16))
82
 
 
83
 
fig = plt.figure(figsize=(21.0, 7.0))
84
 
fig.text(0.51, 0.04, 'x (cm)', ha='center', va='center', fontsize=26)
85
 
fig.text(0.02, 0.52, 'y (cm)', ha='center', va='center', rotation='vertical', fontsize=26)
86
 
plt.gcf().subplots_adjust(bottom=0.15, left=0.06)
87
 
 
88
 
plt.subplot(131)
89
 
plot_mic_locations([-10.91, 4.210, 6.696], [1.436, -10.16, 8.727])
90
 
plt.subplot(132)
91
 
plot_mic_locations([4.210, 6.696, -10.91], [-10.16, 8.727, 1.436])
92
 
plt.subplot(133)
93
 
plot_mic_locations([-1.436, 10.16, -8.727], [-10.91, 4.210, 6.696])
94
 
 
95
 
plt.tight_layout()
 
 
b'\\ No newline at end of file'