forked from JanusWind/FC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjanus_widget_mfi_info.py
142 lines (97 loc) · 4.28 KB
/
janus_widget_mfi_info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
################################################################################
##
## Janus -- GUI Software for Processing Thermal-Ion Measurements from the
## Wind Spacecraft's Faraday Cups
##
## Copyright (C) 2016 Bennett A. Maruca ([email protected])
##
## This program is free software: you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation, either version 3 of the License, or (at your option) any later
## version.
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
##
## You should have received a copy of the GNU General Public License along with
## this program. If not, see http://www.gnu.org/licenses/.
##
################################################################################
################################################################################
## LOAD THE NECESSARY MODULES.
################################################################################
# Load the necessary modules for signaling the graphical interface.
from PyQt4.QtCore import SIGNAL
# Load the modules for displaying text output.
from janus_format_TextEdit import format_TextEdit
################################################################################
## DEFINE THE "widget_mfi_info" CLASS TO CUSTOMIZE "format_TextEdit".
################################################################################
class widget_mfi_info( format_TextEdit ) :
#-----------------------------------------------------------------------
# DEFINE THE INITIALIZATION FUNCTION.
#-----------------------------------------------------------------------
def __init__( self, core ) :
# Inherit all attribues of an instance of "format_TextEdit".
super( widget_mfi_info, self ).__init__( )
# Store the Janus core.
self.core = core
# Prepare to respond to signals received from the Janus core.
self.connect( self.core, SIGNAL('janus_rset'), self.resp_rset )
self.connect( self.core, SIGNAL('janus_chng_mfi'),
self.resp_chng_mfi )
# Set this text editor as read only (for the user).
self.setReadOnly( True )
# Populate this text editor with general information about this
# spectrum's MFI data.
self.make_txt( )
#-----------------------------------------------------------------------
# DEFINE THE FUNCTION FOR GENERATING THE TEXT FOR THIS TEXT AREA.
#-----------------------------------------------------------------------
def make_txt( self ) :
# Clear the text area (just in case there's some text already
# there).
self.clear( )
# If no Wind/FC ion spectrum has been (successfully) loaded,
# return.
if ( self.core.time_epc is None ) :
return
if ( self.core.n_vel == 0 ) :
return
# If a Wind/FC ion spectrum has been (successfully) loaded, but
# there are no Wind/MFI data (yet), return.
if ( self.core.n_mfi <= 0 ) :
return
# Print a summary of the Wind/MFI data.
self.prnt_htm( 'Number of Data: ' )
self.prnt_int( self.core.n_mfi )
self.prnt_brk( )
self.prnt_brk( )
self.prnt_htm( '<i>B</i> = ' )
self.prnt_dcm( self.core.mfi_avg_mag, 1, 'nT' )
self.prnt_brk( )
self.prnt_tab( 1 )
self.prnt_htm( '<i>B<sub>x</sub></i> = ' )
self.prnt_dcm( self.core.mfi_avg_vec[0], 1, 'nT' )
self.prnt_brk( )
self.prnt_tab( 1 )
self.prnt_htm( '<i>B<sub>y</sub></i> = ' )
self.prnt_dcm( self.core.mfi_avg_vec[1], 1, 'nT' )
self.prnt_brk( )
self.prnt_tab( 1 )
self.prnt_htm( '<i>B<sub>z</sub></i> = ' )
self.prnt_dcm( self.core.mfi_avg_vec[2], 1, 'nT' )
#-----------------------------------------------------------------------
# DEFINE THE FUNCTION FOR RESPONDING TO THE "rset" SIGNAL.
#-----------------------------------------------------------------------
def resp_rset( self ) :
# Clear the text.
self.clear( )
#-----------------------------------------------------------------------
# DEFINE THE FUNCTION FOR RESPONDING TO THE "chng_mfi" SIGNAL.
#-----------------------------------------------------------------------
def resp_chng_mfi( self ) :
# Regenerate the text.
self.make_txt( )