Sun, 20 Jan 2008 17:09:31 +0100
add a 'receiving a plot' led
14
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
2 | """ |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
3 | state_decoder |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
4 | ============= |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
5 | |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
6 | Module for decoding the internal state of the HP3562A DSA, using the |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
7 | GPIB command "DSBN" (Dump State BiNary). |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
8 | |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
9 | This file can be exectued as a python script. Use '-h' for more informations. |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
10 | """ |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
11 | from HP3562A import format_header, decode_float, decode_string, decode_header |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
12 | |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
13 | from HP3562A.enum_types import * |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
14 | |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
15 | HEADER = [("Measurement mode", EMEAS, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
16 | ("Measurement 1", EMTYP, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
17 | ("Measurement 2", EMTYP, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
18 | ("Window type", EWINTYP, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
19 | ("Force/Expon window 1", EFEXPW, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
20 | ("Force/Expon window 2", EFEXPW, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
21 | ("Average type", EAVGTYP, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
22 | ("Overlap percentage", int, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
23 | ("Number of averages", int, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
24 | ("Sweep # of averages", int, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
25 | ("Trigger type", ETRGTYP, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
26 | ("Trigger slope", ETRGSLP, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
27 | ("Preview type", EPRVTYP, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
28 | ("Sample type", ESMPTYP, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
29 | ("Range units chan 1", ERNGUNT, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
30 | ("Range units chan 2", ERNGUNT, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
31 | ("Range type 1", ERNGTYP, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
32 | ("Range type 2", ERNGTYP, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
33 | ("Input coupling 1", EINCPL, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
34 | ("Input coupling 2", EINCPL, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
35 | ("Source type", ESRCTYP, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
36 | ("Chirp percent", int, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
37 | ("Burst percent", int, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
38 | ("Sweep direction", ESWPDIR, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
39 | ("Sweep mode", ESWPMOD, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
40 | ("Ext sample freq untis", EXAXIS, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
41 | ("Bandwidth units", EXAXIS, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
42 | ("Log span index", int, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
43 | ("Log start index", int, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
44 | ("Sweep rate units", EXAXIS, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
45 | ("Auto gain ref chan", EDEMODCH, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
46 | ("Demod channels", EDEMODCH, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
47 | ("Demod type chan 1", EDEMOD, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
48 | ("Demod type chan 2", EDEMOD, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
49 | ("Source level units", EXAXIS, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
50 | ("Source offset units", EXAXIS, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
51 | ("Trigger level units", EXAXIS, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
52 | ("Capt/thru length units", EXAXIS, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
53 | ("EU label 1", str, 's', 6), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
54 | ("EU label 2", str, 's', 6), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
55 | ("Auto carrier on/off", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
56 | ("Time average on/off", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
57 | ("Auto/fixed resolution", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
58 | ("Auto gain on/off", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
59 | ("Auto/fixed integrate",bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
60 | ("Fast average on/off", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
61 | ("Overload reject on/off", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
62 | ("Chan 1 float/ground", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
63 | ("Chan 2 float/ground", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
64 | ("Time throughput on/off", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
65 | ("Demodulation on/off", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
66 | ("EU/volts chan 1", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
67 | ("EU/volts chan 2", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
68 | ("Manual/auto arm", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
69 | ("Demod preview on/off", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
70 | ("Delete freq on/off", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
71 | ("Lin res Fstart pegged", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
72 | ("Swept Fstart pegged", bool, 'h', 2), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
73 | ("Force length chan 1", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
74 | ("Force length chan 2", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
75 | ("Expon time constant 1", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
76 | ("Expon time constant 2", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
77 | ("Sweep time", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
78 | ("Sweep rate", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
79 | ("Sweep resolution", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
80 | ("Sweep integrate time", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
81 | ("Auto gain level", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
82 | ("Auto gain limit", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
83 | ("Source level", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
84 | ("EU value chan 1", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
85 | ("EU value chan 2", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
86 | ("Trigger delay chan 1", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
87 | ("Trigger delay chan 2", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
88 | ("Integrate var thresh", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
89 | ("Capt/thru length", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
90 | ("Frequency span", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
91 | ("Time record length", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
92 | ("Frequency resolution", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
93 | ("Time resolution", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
94 | ("External sample rate", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
95 | ("Sample rate (actual)", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
96 | ("Range channel 1", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
97 | ("Range channel 2", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
98 | ("Preview time", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
99 | ("Trigger level", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
100 | ("Source dc offset", decode_float, None, 4), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
101 | ("Fixed sine frequency", decode_float, None, 8), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
102 | ("Start frequency", decode_float, None, 8), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
103 | ("Center frequency", decode_float, None, 8), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
104 | ("Sweep start", decode_float, None, 8), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
105 | ("Sweep end", decode_float, None, 8), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
106 | ("Carrier frequency", decode_float, None, 8), |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
107 | ] |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
108 | |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
109 | def decode_state(data): |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
110 | """ |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
111 | Decode the data (as generated by the HP3562A DSA in response to a |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
112 | "DSBN" command), and returns a dict (header) |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
113 | |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
114 | header is the dictionnary of the header of the dumped data block, |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
115 | """ |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
116 | header, idx = decode_header(data, HEADER) |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
117 | return header |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
118 | |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
119 | |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
120 | def main(): |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
121 | import sys |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
122 | import optparse |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
123 | opt = optparse.OptionParser("A simple tool for tracing a dumped trace") |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
124 | opt.add_option('-f', '--filename', default=None, |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
125 | dest='filename', |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
126 | help='Output filename. If not set, read from stdin') |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
127 | opt.add_option('-m', '--mode', default='binary', |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
128 | dest='mode', |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
129 | help='Dumping mode (may be "binary" [default], "ascii" or "ansi")', |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
130 | ) |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
131 | |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
132 | options, argv = opt.parse_args(sys.argv) |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
133 | |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
134 | |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
135 | if options.filename is None: |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
136 | print "Can't deal stdin for now..." |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
137 | sys.exit(1) |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
138 | #try: |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
139 | if 1: |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
140 | header = decode_state(open(options.filename, 'rb').read()) |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
141 | else: |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
142 | #except Exception, e: |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
143 | print "ERROR: can't read %s an interpret it as a HP3562 trace"%options.filename |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
144 | print e |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
145 | sys.exit(1) |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
146 | |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
147 | print format_header(header, HEADER, 100) |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
148 | |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
149 | if __name__ == "__main__": |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
150 | main() |
07e2cbf140df
several improvements; add an internal state reader
David Douard <david.douard@logilab.fr>
parents:
diff
changeset
|
151 |