1 | <!doctype html>
|
---|
2 | <html lang="en">
|
---|
3 | <head>
|
---|
4 | <meta charset="utf-8">
|
---|
5 | <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
|
---|
6 | <meta name="generator" content="pdoc 0.10.0" />
|
---|
7 | <title>ammosreader.AmmosIFReader API documentation</title>
|
---|
8 | <meta name="description" content="I provide a specialized Ammos Reader for IF data." />
|
---|
9 | <link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
|
---|
10 | <link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
|
---|
11 | <link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
|
---|
12 | <style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
|
---|
13 | <style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
|
---|
14 | <style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
|
---|
15 | <script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
|
---|
16 | <script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
|
---|
17 | </head>
|
---|
18 | <body>
|
---|
19 | <main>
|
---|
20 | <article id="content">
|
---|
21 | <header>
|
---|
22 | <h1 class="title">Module <code>ammosreader.AmmosIFReader</code></h1>
|
---|
23 | </header>
|
---|
24 | <section id="section-intro">
|
---|
25 | <p>I provide a specialized Ammos Reader for IF data.</p>
|
---|
26 | <details class="source">
|
---|
27 | <summary>
|
---|
28 | <span>Expand source code</span>
|
---|
29 | </summary>
|
---|
30 | <pre><code class="python">"""I provide a specialized Ammos Reader for IF data."""
|
---|
31 | import logging
|
---|
32 |
|
---|
33 | from ammosreader.AbstractAmmosReader import AbstractAmmosReader
|
---|
34 | from ammosreader.AmmosGlobalFrameBody import AmmosGlobalFrameBody
|
---|
35 | from ammosreader.AmmosIFDataHeader import AmmosIFDataHeader
|
---|
36 | from ammosreader.AmmosExtendedIFDataHeader import AmmosExtendedIFDataHeader
|
---|
37 | from ammosreader.AmmosIFDataBody import AmmosIFDataBody
|
---|
38 | from ammosreader.AmmosIFDataBlock import AmmosIFDataBlock
|
---|
39 | from ammosreader.AmmosIFDataBlockHeader import AmmosIFDataBlockHeader
|
---|
40 |
|
---|
41 |
|
---|
42 | class AmmosIFReader(AbstractAmmosReader):
|
---|
43 | """I read the IF data embedded in an R&S AMMOS recording."""
|
---|
44 |
|
---|
45 | def __init__(self, file_name):
|
---|
46 | super().__init__(file_name)
|
---|
47 |
|
---|
48 | def read_next_global_frame_body_data_header(self):
|
---|
49 |
|
---|
50 | header_size = AmmosIFDataHeader.HEADER_SIZE
|
---|
51 |
|
---|
52 | bytes = self.ammos_file.read(header_size)
|
---|
53 |
|
---|
54 | logging.info("\nReading global frame body standard data header\n")
|
---|
55 | if ((not bytes) or (len(bytes) < header_size)):
|
---|
56 | logging.debug("Can not read all %s bytes of global frame body data header", header_size)
|
---|
57 | return None
|
---|
58 | return AmmosIFDataHeader.from_bytes(bytes)
|
---|
59 |
|
---|
60 | def read_next_global_frame_body_extended_data_header(self):
|
---|
61 | """
|
---|
62 | I return the next global frame body extended data header from current position in file.
|
---|
63 |
|
---|
64 | :return: the next Ammos Extended IF data header or None if incomplete
|
---|
65 | :rtype: AmmosExtendedIFDataHeader
|
---|
66 | """
|
---|
67 | header_size = AmmosExtendedIFDataHeader.HEADER_SIZE
|
---|
68 |
|
---|
69 | bytes = self.ammos_file.read(header_size)
|
---|
70 |
|
---|
71 | logging.info("\nReading global frame body extended data header\n")
|
---|
72 | if ((not bytes) or (len(bytes) < header_size)):
|
---|
73 | logging.debug("Can not read all %s bytes of global frame extended data header", header_size)
|
---|
74 | return None
|
---|
75 | return AmmosExtendedIFDataHeader.from_bytes(bytes)
|
---|
76 |
|
---|
77 | def read_next_if_data_body(self, number_of_data_blocks, data_length):
|
---|
78 | """
|
---|
79 | I return the next data body read from current position in file.
|
---|
80 |
|
---|
81 | :param number_of_data_blocks: the number of data blocks inside the body
|
---|
82 | :type number_of_data_blocks: int
|
---|
83 |
|
---|
84 | :param data_length: the length of the raw data inside a single block
|
---|
85 | :type data_length: int
|
---|
86 | """
|
---|
87 | header_size = AmmosIFDataBlockHeader.HEADER_SIZE
|
---|
88 |
|
---|
89 | data_body = AmmosIFDataBody()
|
---|
90 |
|
---|
91 | block_length = header_size + data_length
|
---|
92 |
|
---|
93 | total = number_of_data_blocks*block_length
|
---|
94 |
|
---|
95 | byte_string = self.ammos_file.read(block_length)
|
---|
96 |
|
---|
97 | if len(byte_string) != total:
|
---|
98 | logging.debug("Can not read all %s bytes of data body", total)
|
---|
99 | return None
|
---|
100 |
|
---|
101 | for i in range(0, number_of_data_blocks):
|
---|
102 | result = byte_string[i*block_length:(i*block_length+block_length)]
|
---|
103 | data_body.add_data_block(AmmosIFDataBlock(AmmosIFDataBlockHeader.from_bytes(result[0:header_size]),
|
---|
104 | result[header_size:]))
|
---|
105 |
|
---|
106 | return data_body
|
---|
107 |
|
---|
108 | def read_next_global_frame_body(self, data_header_length):
|
---|
109 | """
|
---|
110 | I return the next global frame body read from current position in file.
|
---|
111 |
|
---|
112 | :param data_header_length: the length of the data header
|
---|
113 | :type data_header_length: int
|
---|
114 | """
|
---|
115 | if_data_header = None
|
---|
116 |
|
---|
117 | if data_header_length == AmmosIFDataHeader.HEADER_SIZE:
|
---|
118 | if_data_header = self.read_next_global_frame_body_data_header()
|
---|
119 | if data_header_length == AmmosExtendedIFDataHeader.HEADER_SIZE:
|
---|
120 | if_data_header = self.read_next_global_frame_body_extended_data_header()
|
---|
121 |
|
---|
122 | if if_data_header is None:
|
---|
123 | logging.debug("Data header missing")
|
---|
124 | return None
|
---|
125 |
|
---|
126 | if_data_body = self.read_next_if_data_body(if_data_header.block_count, if_data_header.block_length)
|
---|
127 |
|
---|
128 | if if_data_body is None:
|
---|
129 | logging.debug("Data body missing")
|
---|
130 | return None
|
---|
131 |
|
---|
132 | return AmmosGlobalFrameBody(if_data_header, if_data_body)
|
---|
133 |
|
---|
134 | def data(self):
|
---|
135 | return b"".join([each.global_frame_body.data_body.data for each in self.container.global_frames])</code></pre>
|
---|
136 | </details>
|
---|
137 | </section>
|
---|
138 | <section>
|
---|
139 | </section>
|
---|
140 | <section>
|
---|
141 | </section>
|
---|
142 | <section>
|
---|
143 | </section>
|
---|
144 | <section>
|
---|
145 | <h2 class="section-title" id="header-classes">Classes</h2>
|
---|
146 | <dl>
|
---|
147 | <dt id="ammosreader.AmmosIFReader.AmmosIFReader"><code class="flex name class">
|
---|
148 | <span>class <span class="ident">AmmosIFReader</span></span>
|
---|
149 | <span>(</span><span>file_name)</span>
|
---|
150 | </code></dt>
|
---|
151 | <dd>
|
---|
152 | <div class="desc"><p>I read the IF data embedded in an R&S AMMOS recording.</p>
|
---|
153 | <p>I am the standard constructor for Ammos Readers.</p>
|
---|
154 | <p>Additional information about the file can be added as key/value pairs in tags</p>
|
---|
155 | <p>:param file_name: The file to read Ammos data from
|
---|
156 | :type file_name: str</p></div>
|
---|
157 | <details class="source">
|
---|
158 | <summary>
|
---|
159 | <span>Expand source code</span>
|
---|
160 | </summary>
|
---|
161 | <pre><code class="python">class AmmosIFReader(AbstractAmmosReader):
|
---|
162 | """I read the IF data embedded in an R&S AMMOS recording."""
|
---|
163 |
|
---|
164 | def __init__(self, file_name):
|
---|
165 | super().__init__(file_name)
|
---|
166 |
|
---|
167 | def read_next_global_frame_body_data_header(self):
|
---|
168 |
|
---|
169 | header_size = AmmosIFDataHeader.HEADER_SIZE
|
---|
170 |
|
---|
171 | bytes = self.ammos_file.read(header_size)
|
---|
172 |
|
---|
173 | logging.info("\nReading global frame body standard data header\n")
|
---|
174 | if ((not bytes) or (len(bytes) < header_size)):
|
---|
175 | logging.debug("Can not read all %s bytes of global frame body data header", header_size)
|
---|
176 | return None
|
---|
177 | return AmmosIFDataHeader.from_bytes(bytes)
|
---|
178 |
|
---|
179 | def read_next_global_frame_body_extended_data_header(self):
|
---|
180 | """
|
---|
181 | I return the next global frame body extended data header from current position in file.
|
---|
182 |
|
---|
183 | :return: the next Ammos Extended IF data header or None if incomplete
|
---|
184 | :rtype: AmmosExtendedIFDataHeader
|
---|
185 | """
|
---|
186 | header_size = AmmosExtendedIFDataHeader.HEADER_SIZE
|
---|
187 |
|
---|
188 | bytes = self.ammos_file.read(header_size)
|
---|
189 |
|
---|
190 | logging.info("\nReading global frame body extended data header\n")
|
---|
191 | if ((not bytes) or (len(bytes) < header_size)):
|
---|
192 | logging.debug("Can not read all %s bytes of global frame extended data header", header_size)
|
---|
193 | return None
|
---|
194 | return AmmosExtendedIFDataHeader.from_bytes(bytes)
|
---|
195 |
|
---|
196 | def read_next_if_data_body(self, number_of_data_blocks, data_length):
|
---|
197 | """
|
---|
198 | I return the next data body read from current position in file.
|
---|
199 |
|
---|
200 | :param number_of_data_blocks: the number of data blocks inside the body
|
---|
201 | :type number_of_data_blocks: int
|
---|
202 |
|
---|
203 | :param data_length: the length of the raw data inside a single block
|
---|
204 | :type data_length: int
|
---|
205 | """
|
---|
206 | header_size = AmmosIFDataBlockHeader.HEADER_SIZE
|
---|
207 |
|
---|
208 | data_body = AmmosIFDataBody()
|
---|
209 |
|
---|
210 | block_length = header_size + data_length
|
---|
211 |
|
---|
212 | total = number_of_data_blocks*block_length
|
---|
213 |
|
---|
214 | byte_string = self.ammos_file.read(block_length)
|
---|
215 |
|
---|
216 | if len(byte_string) != total:
|
---|
217 | logging.debug("Can not read all %s bytes of data body", total)
|
---|
218 | return None
|
---|
219 |
|
---|
220 | for i in range(0, number_of_data_blocks):
|
---|
221 | result = byte_string[i*block_length:(i*block_length+block_length)]
|
---|
222 | data_body.add_data_block(AmmosIFDataBlock(AmmosIFDataBlockHeader.from_bytes(result[0:header_size]),
|
---|
223 | result[header_size:]))
|
---|
224 |
|
---|
225 | return data_body
|
---|
226 |
|
---|
227 | def read_next_global_frame_body(self, data_header_length):
|
---|
228 | """
|
---|
229 | I return the next global frame body read from current position in file.
|
---|
230 |
|
---|
231 | :param data_header_length: the length of the data header
|
---|
232 | :type data_header_length: int
|
---|
233 | """
|
---|
234 | if_data_header = None
|
---|
235 |
|
---|
236 | if data_header_length == AmmosIFDataHeader.HEADER_SIZE:
|
---|
237 | if_data_header = self.read_next_global_frame_body_data_header()
|
---|
238 | if data_header_length == AmmosExtendedIFDataHeader.HEADER_SIZE:
|
---|
239 | if_data_header = self.read_next_global_frame_body_extended_data_header()
|
---|
240 |
|
---|
241 | if if_data_header is None:
|
---|
242 | logging.debug("Data header missing")
|
---|
243 | return None
|
---|
244 |
|
---|
245 | if_data_body = self.read_next_if_data_body(if_data_header.block_count, if_data_header.block_length)
|
---|
246 |
|
---|
247 | if if_data_body is None:
|
---|
248 | logging.debug("Data body missing")
|
---|
249 | return None
|
---|
250 |
|
---|
251 | return AmmosGlobalFrameBody(if_data_header, if_data_body)
|
---|
252 |
|
---|
253 | def data(self):
|
---|
254 | return b"".join([each.global_frame_body.data_body.data for each in self.container.global_frames])</code></pre>
|
---|
255 | </details>
|
---|
256 | <h3>Ancestors</h3>
|
---|
257 | <ul class="hlist">
|
---|
258 | <li><a title="ammosreader.AbstractAmmosReader.AbstractAmmosReader" href="AbstractAmmosReader.html#ammosreader.AbstractAmmosReader.AbstractAmmosReader">AbstractAmmosReader</a></li>
|
---|
259 | <li>abc.ABC</li>
|
---|
260 | </ul>
|
---|
261 | <h3>Methods</h3>
|
---|
262 | <dl>
|
---|
263 | <dt id="ammosreader.AmmosIFReader.AmmosIFReader.data"><code class="name flex">
|
---|
264 | <span>def <span class="ident">data</span></span>(<span>self)</span>
|
---|
265 | </code></dt>
|
---|
266 | <dd>
|
---|
267 | <div class="desc"></div>
|
---|
268 | <details class="source">
|
---|
269 | <summary>
|
---|
270 | <span>Expand source code</span>
|
---|
271 | </summary>
|
---|
272 | <pre><code class="python">def data(self):
|
---|
273 | return b"".join([each.global_frame_body.data_body.data for each in self.container.global_frames])</code></pre>
|
---|
274 | </details>
|
---|
275 | </dd>
|
---|
276 | <dt id="ammosreader.AmmosIFReader.AmmosIFReader.read_next_global_frame_body"><code class="name flex">
|
---|
277 | <span>def <span class="ident">read_next_global_frame_body</span></span>(<span>self, data_header_length)</span>
|
---|
278 | </code></dt>
|
---|
279 | <dd>
|
---|
280 | <div class="desc"><p>I return the next global frame body read from current position in file.</p>
|
---|
281 | <p>:param data_header_length: the length of the data header
|
---|
282 | :type data_header_length: int</p></div>
|
---|
283 | <details class="source">
|
---|
284 | <summary>
|
---|
285 | <span>Expand source code</span>
|
---|
286 | </summary>
|
---|
287 | <pre><code class="python">def read_next_global_frame_body(self, data_header_length):
|
---|
288 | """
|
---|
289 | I return the next global frame body read from current position in file.
|
---|
290 |
|
---|
291 | :param data_header_length: the length of the data header
|
---|
292 | :type data_header_length: int
|
---|
293 | """
|
---|
294 | if_data_header = None
|
---|
295 |
|
---|
296 | if data_header_length == AmmosIFDataHeader.HEADER_SIZE:
|
---|
297 | if_data_header = self.read_next_global_frame_body_data_header()
|
---|
298 | if data_header_length == AmmosExtendedIFDataHeader.HEADER_SIZE:
|
---|
299 | if_data_header = self.read_next_global_frame_body_extended_data_header()
|
---|
300 |
|
---|
301 | if if_data_header is None:
|
---|
302 | logging.debug("Data header missing")
|
---|
303 | return None
|
---|
304 |
|
---|
305 | if_data_body = self.read_next_if_data_body(if_data_header.block_count, if_data_header.block_length)
|
---|
306 |
|
---|
307 | if if_data_body is None:
|
---|
308 | logging.debug("Data body missing")
|
---|
309 | return None
|
---|
310 |
|
---|
311 | return AmmosGlobalFrameBody(if_data_header, if_data_body)</code></pre>
|
---|
312 | </details>
|
---|
313 | </dd>
|
---|
314 | <dt id="ammosreader.AmmosIFReader.AmmosIFReader.read_next_global_frame_body_data_header"><code class="name flex">
|
---|
315 | <span>def <span class="ident">read_next_global_frame_body_data_header</span></span>(<span>self)</span>
|
---|
316 | </code></dt>
|
---|
317 | <dd>
|
---|
318 | <div class="desc"></div>
|
---|
319 | <details class="source">
|
---|
320 | <summary>
|
---|
321 | <span>Expand source code</span>
|
---|
322 | </summary>
|
---|
323 | <pre><code class="python">def read_next_global_frame_body_data_header(self):
|
---|
324 |
|
---|
325 | header_size = AmmosIFDataHeader.HEADER_SIZE
|
---|
326 |
|
---|
327 | bytes = self.ammos_file.read(header_size)
|
---|
328 |
|
---|
329 | logging.info("\nReading global frame body standard data header\n")
|
---|
330 | if ((not bytes) or (len(bytes) < header_size)):
|
---|
331 | logging.debug("Can not read all %s bytes of global frame body data header", header_size)
|
---|
332 | return None
|
---|
333 | return AmmosIFDataHeader.from_bytes(bytes)</code></pre>
|
---|
334 | </details>
|
---|
335 | </dd>
|
---|
336 | <dt id="ammosreader.AmmosIFReader.AmmosIFReader.read_next_global_frame_body_extended_data_header"><code class="name flex">
|
---|
337 | <span>def <span class="ident">read_next_global_frame_body_extended_data_header</span></span>(<span>self)</span>
|
---|
338 | </code></dt>
|
---|
339 | <dd>
|
---|
340 | <div class="desc"><p>I return the next global frame body extended data header from current position in file.</p>
|
---|
341 | <p>:return: the next Ammos Extended IF data header or None if incomplete
|
---|
342 | :rtype: AmmosExtendedIFDataHeader</p></div>
|
---|
343 | <details class="source">
|
---|
344 | <summary>
|
---|
345 | <span>Expand source code</span>
|
---|
346 | </summary>
|
---|
347 | <pre><code class="python">def read_next_global_frame_body_extended_data_header(self):
|
---|
348 | """
|
---|
349 | I return the next global frame body extended data header from current position in file.
|
---|
350 |
|
---|
351 | :return: the next Ammos Extended IF data header or None if incomplete
|
---|
352 | :rtype: AmmosExtendedIFDataHeader
|
---|
353 | """
|
---|
354 | header_size = AmmosExtendedIFDataHeader.HEADER_SIZE
|
---|
355 |
|
---|
356 | bytes = self.ammos_file.read(header_size)
|
---|
357 |
|
---|
358 | logging.info("\nReading global frame body extended data header\n")
|
---|
359 | if ((not bytes) or (len(bytes) < header_size)):
|
---|
360 | logging.debug("Can not read all %s bytes of global frame extended data header", header_size)
|
---|
361 | return None
|
---|
362 | return AmmosExtendedIFDataHeader.from_bytes(bytes)</code></pre>
|
---|
363 | </details>
|
---|
364 | </dd>
|
---|
365 | <dt id="ammosreader.AmmosIFReader.AmmosIFReader.read_next_if_data_body"><code class="name flex">
|
---|
366 | <span>def <span class="ident">read_next_if_data_body</span></span>(<span>self, number_of_data_blocks, data_length)</span>
|
---|
367 | </code></dt>
|
---|
368 | <dd>
|
---|
369 | <div class="desc"><p>I return the next data body read from current position in file.</p>
|
---|
370 | <p>:param number_of_data_blocks: the number of data blocks inside the body
|
---|
371 | :type number_of_data_blocks: int</p>
|
---|
372 | <p>:param data_length: the length of the raw data inside a single block
|
---|
373 | :type data_length: int</p></div>
|
---|
374 | <details class="source">
|
---|
375 | <summary>
|
---|
376 | <span>Expand source code</span>
|
---|
377 | </summary>
|
---|
378 | <pre><code class="python">def read_next_if_data_body(self, number_of_data_blocks, data_length):
|
---|
379 | """
|
---|
380 | I return the next data body read from current position in file.
|
---|
381 |
|
---|
382 | :param number_of_data_blocks: the number of data blocks inside the body
|
---|
383 | :type number_of_data_blocks: int
|
---|
384 |
|
---|
385 | :param data_length: the length of the raw data inside a single block
|
---|
386 | :type data_length: int
|
---|
387 | """
|
---|
388 | header_size = AmmosIFDataBlockHeader.HEADER_SIZE
|
---|
389 |
|
---|
390 | data_body = AmmosIFDataBody()
|
---|
391 |
|
---|
392 | block_length = header_size + data_length
|
---|
393 |
|
---|
394 | total = number_of_data_blocks*block_length
|
---|
395 |
|
---|
396 | byte_string = self.ammos_file.read(block_length)
|
---|
397 |
|
---|
398 | if len(byte_string) != total:
|
---|
399 | logging.debug("Can not read all %s bytes of data body", total)
|
---|
400 | return None
|
---|
401 |
|
---|
402 | for i in range(0, number_of_data_blocks):
|
---|
403 | result = byte_string[i*block_length:(i*block_length+block_length)]
|
---|
404 | data_body.add_data_block(AmmosIFDataBlock(AmmosIFDataBlockHeader.from_bytes(result[0:header_size]),
|
---|
405 | result[header_size:]))
|
---|
406 |
|
---|
407 | return data_body</code></pre>
|
---|
408 | </details>
|
---|
409 | </dd>
|
---|
410 | </dl>
|
---|
411 | <h3>Inherited members</h3>
|
---|
412 | <ul class="hlist">
|
---|
413 | <li><code><b><a title="ammosreader.AbstractAmmosReader.AbstractAmmosReader" href="AbstractAmmosReader.html#ammosreader.AbstractAmmosReader.AbstractAmmosReader">AbstractAmmosReader</a></b></code>:
|
---|
414 | <ul class="hlist">
|
---|
415 | <li><code><a title="ammosreader.AbstractAmmosReader.AbstractAmmosReader.add_tag" href="AbstractAmmosReader.html#ammosreader.AbstractAmmosReader.AbstractAmmosReader.add_tag">add_tag</a></code></li>
|
---|
416 | <li><code><a title="ammosreader.AbstractAmmosReader.AbstractAmmosReader.read_all_frames_left" href="AbstractAmmosReader.html#ammosreader.AbstractAmmosReader.AbstractAmmosReader.read_all_frames_left">read_all_frames_left</a></code></li>
|
---|
417 | <li><code><a title="ammosreader.AbstractAmmosReader.AbstractAmmosReader.read_next_global_frame_header" href="AbstractAmmosReader.html#ammosreader.AbstractAmmosReader.AbstractAmmosReader.read_next_global_frame_header">read_next_global_frame_header</a></code></li>
|
---|
418 | <li><code><a title="ammosreader.AbstractAmmosReader.AbstractAmmosReader.read_next_single_frame" href="AbstractAmmosReader.html#ammosreader.AbstractAmmosReader.AbstractAmmosReader.read_next_single_frame">read_next_single_frame</a></code></li>
|
---|
419 | <li><code><a title="ammosreader.AbstractAmmosReader.AbstractAmmosReader.rewind_to_start" href="AbstractAmmosReader.html#ammosreader.AbstractAmmosReader.AbstractAmmosReader.rewind_to_start">rewind_to_start</a></code></li>
|
---|
420 | </ul>
|
---|
421 | </li>
|
---|
422 | </ul>
|
---|
423 | </dd>
|
---|
424 | </dl>
|
---|
425 | </section>
|
---|
426 | </article>
|
---|
427 | <nav id="sidebar">
|
---|
428 | <h1>Index</h1>
|
---|
429 | <div class="toc">
|
---|
430 | <ul></ul>
|
---|
431 | </div>
|
---|
432 | <ul id="index">
|
---|
433 | <li><h3>Super-module</h3>
|
---|
434 | <ul>
|
---|
435 | <li><code><a title="ammosreader" href="index.html">ammosreader</a></code></li>
|
---|
436 | </ul>
|
---|
437 | </li>
|
---|
438 | <li><h3><a href="#header-classes">Classes</a></h3>
|
---|
439 | <ul>
|
---|
440 | <li>
|
---|
441 | <h4><code><a title="ammosreader.AmmosIFReader.AmmosIFReader" href="#ammosreader.AmmosIFReader.AmmosIFReader">AmmosIFReader</a></code></h4>
|
---|
442 | <ul class="">
|
---|
443 | <li><code><a title="ammosreader.AmmosIFReader.AmmosIFReader.data" href="#ammosreader.AmmosIFReader.AmmosIFReader.data">data</a></code></li>
|
---|
444 | <li><code><a title="ammosreader.AmmosIFReader.AmmosIFReader.read_next_global_frame_body" href="#ammosreader.AmmosIFReader.AmmosIFReader.read_next_global_frame_body">read_next_global_frame_body</a></code></li>
|
---|
445 | <li><code><a title="ammosreader.AmmosIFReader.AmmosIFReader.read_next_global_frame_body_data_header" href="#ammosreader.AmmosIFReader.AmmosIFReader.read_next_global_frame_body_data_header">read_next_global_frame_body_data_header</a></code></li>
|
---|
446 | <li><code><a title="ammosreader.AmmosIFReader.AmmosIFReader.read_next_global_frame_body_extended_data_header" href="#ammosreader.AmmosIFReader.AmmosIFReader.read_next_global_frame_body_extended_data_header">read_next_global_frame_body_extended_data_header</a></code></li>
|
---|
447 | <li><code><a title="ammosreader.AmmosIFReader.AmmosIFReader.read_next_if_data_body" href="#ammosreader.AmmosIFReader.AmmosIFReader.read_next_if_data_body">read_next_if_data_body</a></code></li>
|
---|
448 | </ul>
|
---|
449 | </li>
|
---|
450 | </ul>
|
---|
451 | </li>
|
---|
452 | </ul>
|
---|
453 | </nav>
|
---|
454 | </main>
|
---|
455 | <footer id="footer">
|
---|
456 | <p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
|
---|
457 | </footer>
|
---|
458 | </body>
|
---|
459 | </html> |
---|