1
1
#!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
2
3
from __future__ import print_function
3
4
from __future__ import unicode_literals
4
5
import sys
23
24
raise
24
25
25
26
26
- VERSION = "0.2 .5"
27
+ VERSION = "0.1 .5"
27
28
28
29
29
30
#TODO: add slots and signals
@@ -33,8 +34,6 @@ class PIMCanvas(FigureCanvas):
33
34
def __init__ (self , parent = None , width = 6 , height = 4 , dpi = 100 ):
34
35
fig = Figure (figsize = (width , height ), dpi = dpi )
35
36
self .axes = fig .add_subplot (111 )
36
- # self.fig, self.axes = plt.subplots()
37
-
38
37
self .compute_initial_figure ()
39
38
40
39
FigureCanvas .__init__ (self , fig )
@@ -48,27 +47,13 @@ def __init__(self, parent=None, width=6, height=4, dpi=100):
48
47
def compute_initial_figure (self ):
49
48
plt .style .use ('bmh' )
50
49
51
- def plot_beta_hist (ax , a , b ):
52
- from numpy .random import beta
53
- ax .hist (beta (a , b , size = 10000 ), histtype = "stepfilled" ,
54
- bins = 25 , alpha = 0.8 , density = True )
55
-
56
- ax = self .axes
57
- # fig, ax = plt.subplots()
58
- plot_beta_hist (ax , 10 , 10 )
59
- plot_beta_hist (ax , 4 , 12 )
60
- plot_beta_hist (ax , 50 , 12 )
61
- plot_beta_hist (ax , 6 , 55 )
62
- ax .set_title ("'bmh' style sheet" )
63
- # plt.show()
64
-
65
50
def update_figure (self , data , plot_name = "" ):
66
51
self .axes .cla ()
67
52
self .axes .set_title (plot_name )
68
53
self .axes .set_ylabel ("Power Normalized" )
69
54
self .axes .set_xlabel ("Frequency [MHz]" )
70
55
71
- # Shapes:
56
+ # Shapes:
72
57
shape_im = np .array ([0.2 , 0.4 , 0.50 , 0.55 , 0.58 , 0.6 ,
73
58
0.6 , 0.6 , 0.6 ,
74
59
0.6 , 0.58 , 0.55 , 0.50 , 0.4 , 0.2 ])
@@ -87,13 +72,13 @@ def update_figure(self, data, plot_name=""):
87
72
88
73
# make pseudo PIM shape with edges lower than middle
89
74
y = np .outer (shape_im , np .ones (len (x ))).ravel ()
90
- y = y [::len (y )/ len (x )]
75
+ y = y [::int ( len (y )/ len (x ) )]
91
76
x2 = np .linspace (x .min (), x .max (), num = 124 )
92
77
y = spline (x , y , x2 )
93
78
94
79
self .axes .plot (x2 , y ,
95
- label = "IM Cf={0}" .format (x_cf ), alpha = 0.60 ,
96
- lw = "3" )
80
+ label = "IM Cf={0}" .format (x_cf ), alpha = 0.60 ,
81
+ lw = "3" )
97
82
98
83
rx_cf = rx [0 ] + (rx [1 ] - rx [0 ]) / 2
99
84
if rx_cf not in rx_present :
@@ -102,13 +87,13 @@ def update_figure(self, data, plot_name=""):
102
87
103
88
# make pseudo PIM shape with edges lower than middle
104
89
y = np .outer (shape_crr , np .ones (len (rx ))).ravel ()
105
- y = y [::len (y )/ len (rx )]
90
+ y = y [::int ( len (y )/ len (rx ) )]
106
91
rx2 = np .linspace (rx .min (), rx .max (), num = 124 )
107
92
y = spline (rx , y , rx2 , order = 2 )
108
93
109
94
self .axes .plot (rx2 , y ,
110
- label = "RX Cf={0}" .format (rx_cf ), alpha = 0.8 ,
111
- lw = "3" )
95
+ label = "RX Cf={0}" .format (rx_cf ), alpha = 0.8 ,
96
+ lw = "3" )
112
97
rx_present .append (rx_cf )
113
98
self .axes .legend ()
114
99
self .draw ()
@@ -122,13 +107,13 @@ def update_figure(self, data, plot_name=""):
122
107
x = np .linspace (pim [0 ], pim [1 ], num = 15 , endpoint = True )
123
108
x_cf = pim [0 ] + (pim [1 ] - pim [0 ]) / 2
124
109
y = np .outer (shape_im , np .ones (len (x ))).ravel ()
125
- y = y [::len (y )/ len (x )]
110
+ y = y [::int ( len (y )/ len (x ) )]
126
111
x2 = np .linspace (x .min (), x .max (), num = 124 )
127
112
y = spline (x , y , x2 )
128
113
129
114
self .axes .plot (x2 , y ,
130
- label = "IM Cf={0}" .format (x_cf ), alpha = 0.60 ,
131
- lw = "3" )
115
+ label = "IM Cf={0}" .format (x_cf ), alpha = 0.60 ,
116
+ lw = "3" )
132
117
"""self.axes.bar(x, y,
133
118
label="Cf={0}".format(x[0]+(x[-1]-x[0])/2),
134
119
alpha=0.60,
@@ -151,7 +136,7 @@ def __init__(self, widgets, *args, **kwargs):
151
136
152
137
scroll = QtWidgets .QScrollArea (self )
153
138
scroll .setWidgetResizable (True )
154
- scroll .setGeometry (100 ,100 ,100 ,100 )
139
+ scroll .setGeometry (100 , 100 , 100 , 100 )
155
140
self .content = QtWidgets .QWidget ()
156
141
scroll .setWidget (self .content )
157
142
lay = QtWidgets .QVBoxLayout (self .content )
@@ -384,6 +369,7 @@ def main():
384
369
385
370
# Allow the taking of command line arguements
386
371
app = QtWidgets .QApplication (sys .argv )
372
+ app .setStyleSheet ("QMessageBox { messagebox-text-interaction-flags: 5; }" )
387
373
388
374
main = MainWindow ()
389
375
# Ensure the execution stops correctly
0 commit comments