feat(codec): parse Blastware's _XML.XML event report
The reference for the Series 3 decode checker: scalars and value units, channels, the job number, the user notes in order under their operator-edited labels, waveform rows as printed (ragged where channels end at different lengths) and histogram intervals. Seven real DL2 events as fixtures, each covering a case the comparison must handle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
This commit is contained in:
1 parent
6bdd140c29
commit
52809a5310
16 files changed
+18056
No files matched your search
@@ -0,0 +1,133 @@
|
||||
"""
|
||||
minimateplus/bw_xml_report.py — parse Blastware's `_XML.XML` event report.
|
||||
|
||||
Blastware's ACH keeps, in `Sent/`, a full XML report beside each event binary:
|
||||
`<stem>_<ext>_XML.XML` for `<stem>.<ext>`. It carries every field of the event
|
||||
report plus every waveform sample or histogram interval, and DL2's backup holds
|
||||
one for 70,042 Series 3 events back to 2016 (its ASCII reports start in 2025).
|
||||
SFM uses it only to check its own decode, never as data.
|
||||
|
||||
The small `<stem>_<ext>.XML` summary beside it writes decimal commas and is not
|
||||
this file.
|
||||
|
||||
Layout (FileVersion 8.0), as the parser reads it:
|
||||
|
||||
- top-level simple elements, e.g. ``<SampleRate>1024 sps</SampleRate>``
|
||||
- value elements, e.g. ``<TranPPV><Value>0.015</Value><Units>in/s</Units></TranPPV>``
|
||||
- ``<Channels><Channel>Tran</Channel>...</Channels>``
|
||||
- the job number and up to four user notes, between the top-level
|
||||
``<Units>`` and ``<GeoRange>``; each note is tagged with its
|
||||
operator-editable label (``Project``, ``Location``, ``Seis.Loc`` ...) and
|
||||
an empty note is omitted
|
||||
- waveform: ``WaveformDataChannels/Data/Row/Cell``. A row holds only the
|
||||
channels still running: where channels end at different lengths, the last
|
||||
rows have fewer cells
|
||||
- histogram: ``HistogramData`` with ``HistogramDataColumnTitle/ColumnTitle``
|
||||
and ``HistogramDataIntervals``, alternating ``Time`` and ``Row``
|
||||
|
||||
Cell and value text is kept exactly as printed (``">100"``, ``"N/A"``,
|
||||
``"OORANGE"``, ``"6.7 Volts"``); interpreting it is the comparison's job.
|
||||
|
||||
Pure: no I/O beyond reading the file passed to `parse_xml_report_file`.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import Optional, Union
|
||||
|
||||
|
||||
@dataclass
|
||||
class XmlReport:
|
||||
scalars: dict[str, str]
|
||||
units: dict[str, str]
|
||||
event_units: Optional[str]
|
||||
channels: list[str]
|
||||
job_number: Optional[str]
|
||||
notes: list[tuple[str, str]]
|
||||
sample_rows: Optional[list[list[str]]]
|
||||
interval_columns: Optional[list[str]]
|
||||
intervals: Optional[list[tuple[str, list[str]]]]
|
||||
|
||||
|
||||
def _text(el: ET.Element) -> str:
|
||||
return (el.text or "").strip()
|
||||
|
||||
|
||||
def _cells(row: ET.Element) -> list[str]:
|
||||
return [_text(c) for c in row.findall("Cell")]
|
||||
|
||||
|
||||
def parse_xml_report(data: bytes) -> XmlReport:
|
||||
"""Parse the bytes of an `_XML.XML` event report. Raises ValueError when
|
||||
they are not well-formed XML (a truncated file, for one)."""
|
||||
try:
|
||||
root = ET.fromstring(data)
|
||||
except ET.ParseError as exc:
|
||||
raise ValueError(f"not a well-formed XML report: {exc}") from exc
|
||||
|
||||
scalars: dict[str, str] = {}
|
||||
units: dict[str, str] = {}
|
||||
event_units: Optional[str] = None
|
||||
channels: list[str] = []
|
||||
job_number: Optional[str] = None
|
||||
notes: list[tuple[str, str]] = []
|
||||
sample_rows: Optional[list[list[str]]] = None
|
||||
interval_columns: Optional[list[str]] = None
|
||||
intervals: Optional[list[tuple[str, list[str]]]] = None
|
||||
|
||||
in_notes = False
|
||||
for el in root:
|
||||
tag = el.tag
|
||||
if tag == "Units" and len(el) == 0:
|
||||
event_units = _text(el)
|
||||
scalars[tag] = event_units
|
||||
in_notes = True
|
||||
continue
|
||||
if tag == "GeoRange":
|
||||
in_notes = False
|
||||
if in_notes and len(el) == 0:
|
||||
# Job number and user notes: never scalars, so the comparison
|
||||
# scores each once.
|
||||
if tag == "JobNumber":
|
||||
job_number = _text(el)
|
||||
elif _text(el):
|
||||
notes.append((tag, _text(el)))
|
||||
continue
|
||||
if tag == "Channels":
|
||||
channels = [_text(c) for c in el.findall("Channel")]
|
||||
elif tag == "WaveformDataChannels":
|
||||
data_el = el.find("Data")
|
||||
if data_el is not None:
|
||||
sample_rows = [_cells(r) for r in data_el.findall("Row")]
|
||||
elif tag == "HistogramData":
|
||||
titles = el.find("HistogramDataColumnTitle")
|
||||
interval_columns = ([" ".join(_text(t).split()) for t in titles.findall("ColumnTitle")]
|
||||
if titles is not None else [])
|
||||
body = el.find("HistogramDataIntervals")
|
||||
intervals = []
|
||||
time: Optional[str] = None
|
||||
for child in (body if body is not None else []):
|
||||
if child.tag == "Time":
|
||||
time = _text(child)
|
||||
elif child.tag == "Row":
|
||||
intervals.append((time or "", _cells(child)))
|
||||
time = None
|
||||
elif el.find("Value") is not None:
|
||||
scalars[tag] = _text(el.find("Value"))
|
||||
u = el.find("Units")
|
||||
if u is not None:
|
||||
units[tag] = _text(u)
|
||||
elif len(el) == 0:
|
||||
scalars[tag] = _text(el)
|
||||
|
||||
return XmlReport(
|
||||
scalars=scalars, units=units, event_units=event_units, channels=channels,
|
||||
job_number=job_number, notes=notes, sample_rows=sample_rows,
|
||||
interval_columns=interval_columns, intervals=intervals,
|
||||
)
|
||||
|
||||
|
||||
def parse_xml_report_file(path: Union[str, Path]) -> XmlReport:
|
||||
return parse_xml_report(Path(path).read_bytes())
|
||||
BIN
Binary file not shown.
+3292
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
+113
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Event>
|
||||
<FileVersion>8.0</FileVersion>
|
||||
<EventType>Full Histogram</EventType>
|
||||
<SerialNumber>BE11529</SerialNumber>
|
||||
<Version>V 10.72-8.17 MiniMate Plus</Version>
|
||||
<FileName>M529L4XQ.R30H</FileName>
|
||||
<HistogramStartTime>14:54:39</HistogramStartTime>
|
||||
<HistogramStartDate>2025-07-02</HistogramStartDate>
|
||||
<HistogramStopTime>14:55:08</HistogramStopTime>
|
||||
<HistogramStopDate>2025-07-02</HistogramStopDate>
|
||||
<Channels>
|
||||
<Channel>Tran</Channel>
|
||||
<Channel>Vert</Channel>
|
||||
<Channel>Long</Channel>
|
||||
<Channel>MicL</Channel>
|
||||
</Channels>
|
||||
<NumberofIntervals>1.00</NumberofIntervals>
|
||||
<IntervalSize>1 minute</IntervalSize>
|
||||
<SampleRate>1024 sps</SampleRate>
|
||||
<BatteryLevel>6.3 Volts</BatteryLevel>
|
||||
<Calibration>April 29, 2025 by Instantel</Calibration>
|
||||
<Units>in/s and dB(L)</Units>
|
||||
<Location>Test Loc</Location>
|
||||
<GeoRange>
|
||||
<Value>10.000</Value>
|
||||
<Units>in/s</Units>
|
||||
</GeoRange>
|
||||
<TranPPV>
|
||||
<Value>2.430</Value>
|
||||
<Units>in/s</Units>
|
||||
</TranPPV>
|
||||
<VertPPV>
|
||||
<Value>0.940</Value>
|
||||
<Units>in/s</Units>
|
||||
</VertPPV>
|
||||
<LongPPV>
|
||||
<Value>1.900</Value>
|
||||
<Units>in/s</Units>
|
||||
</LongPPV>
|
||||
<TranZCFreq>
|
||||
<Value>13</Value>
|
||||
<Units>Hz</Units>
|
||||
</TranZCFreq>
|
||||
<VertZCFreq>
|
||||
<Value>>100</Value>
|
||||
<Units>Hz</Units>
|
||||
</VertZCFreq>
|
||||
<LongZCFreq>
|
||||
<Value>5.8</Value>
|
||||
<Units>Hz</Units>
|
||||
</LongZCFreq>
|
||||
<TranPeakTime>14:55:08</TranPeakTime>
|
||||
<TranPeakDate>2025-07-02</TranPeakDate>
|
||||
<VertPeakTime>14:55:08</VertPeakTime>
|
||||
<VertPeakDate>2025-07-02</VertPeakDate>
|
||||
<LongPeakTime>14:55:08</LongPeakTime>
|
||||
<LongPeakDate>2025-07-02</LongPeakDate>
|
||||
<PeakVectorSum>
|
||||
<Value>3.095</Value>
|
||||
<Units>in/s</Units>
|
||||
</PeakVectorSum>
|
||||
<PeakVectorSumTime>14:55:08</PeakVectorSumTime>
|
||||
<PeakVectorSumDate>2025-07-02</PeakVectorSumDate>
|
||||
<Microphone>Linear Weighting</Microphone>
|
||||
<MicLPSPL>
|
||||
<Value>106.0</Value>
|
||||
<Units>dB(L)</Units>
|
||||
</MicLPSPL>
|
||||
<MicLTime>14:55:08</MicLTime>
|
||||
<MicLDate>2025-07-02</MicLDate>
|
||||
<MicLZCFreq>
|
||||
<Value>51</Value>
|
||||
<Units>Hz</Units>
|
||||
</MicLZCFreq>
|
||||
<TranTestFreq>7.5 Hz.</TranTestFreq>
|
||||
<TranTestRatio>4.0</TranTestRatio>
|
||||
<TranTestResults>Passed</TranTestResults>
|
||||
<VertTestFreq>7.6 Hz.</VertTestFreq>
|
||||
<VertTestRatio>3.7</VertTestRatio>
|
||||
<VertTestResults>Passed</VertTestResults>
|
||||
<LongTestFreq>7.2 Hz.</LongTestFreq>
|
||||
<LongTestRatio>4.0</LongTestRatio>
|
||||
<LongTestResults>Passed</LongTestResults>
|
||||
<MicLTestFreq>0.0 Hz.</MicLTestFreq>
|
||||
<MicLTestAmplitude>0 mv</MicLTestAmplitude>
|
||||
<MicLTestResults>Check</MicLTestResults>
|
||||
<UsbSummaryChannels>
|
||||
</UsbSummaryChannels>
|
||||
<MonitorLog>2025-07-02 14:54:39 - 2025-07-02 14:55:08 "Event Recorded Modem Exit"</MonitorLog>
|
||||
<HistogramData>
|
||||
<HistogramDataColumnTitle>
|
||||
<ColumnTitle> Tran Peak in/s </ColumnTitle>
|
||||
<ColumnTitle> Tran Freq Hz </ColumnTitle>
|
||||
<ColumnTitle> Vert Peak in/s </ColumnTitle>
|
||||
<ColumnTitle> Vert Freq Hz </ColumnTitle>
|
||||
<ColumnTitle> Long Peak in/s </ColumnTitle>
|
||||
<ColumnTitle> Long Freq Hz </ColumnTitle>
|
||||
<ColumnTitle> Geo PVS in/s </ColumnTitle>
|
||||
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
|
||||
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
|
||||
<ColumnTitle> MicL Freq Hz </ColumnTitle>
|
||||
</HistogramDataColumnTitle>
|
||||
<HistogramDataIntervals>
|
||||
<Time>2025-07-02 14:55:08</Time>
|
||||
<Row>
|
||||
<Cell>2.430</Cell><Cell>13</Cell><Cell>0.940</Cell><Cell>>100</Cell><Cell>1.900</Cell><Cell>5.8</Cell><Cell>3.095</Cell><Cell>0.001</Cell><Cell>106.0</Cell><Cell>51</Cell></Row>
|
||||
</HistogramDataIntervals>
|
||||
</HistogramData>
|
||||
<HistogramDataUsbChannels>
|
||||
</HistogramDataUsbChannels>
|
||||
|
||||
</Event>
|
||||
BIN
Binary file not shown.
+98
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Event>
|
||||
<FileVersion>8.0</FileVersion>
|
||||
<EventType>Full Histogram</EventType>
|
||||
<SerialNumber>BE16352</SerialNumber>
|
||||
<Version>V 10.72-8.17 MiniMate Plus</Version>
|
||||
<FileName>R352HFZ7.530H</FileName>
|
||||
<HistogramStartTime>21:17:27</HistogramStartTime>
|
||||
<HistogramStartDate>2018-06-04</HistogramStartDate>
|
||||
<HistogramStopTime>21:17:39</HistogramStopTime>
|
||||
<HistogramStopDate>2018-06-04</HistogramStopDate>
|
||||
<Channels>
|
||||
<Channel>Tran</Channel>
|
||||
<Channel>Vert</Channel>
|
||||
<Channel>Long</Channel>
|
||||
</Channels>
|
||||
<NumberofIntervals>1.00</NumberofIntervals>
|
||||
<IntervalSize>1 minute</IntervalSize>
|
||||
<SampleRate>1024 sps</SampleRate>
|
||||
<BatteryLevel>6.7 Volts</BatteryLevel>
|
||||
<Calibration>September 13, 2017 by Instantel</Calibration>
|
||||
<Units>in/s</Units>
|
||||
<Project>JV 241 - 1425 Spanlers Mill Rad</Project>
|
||||
<Client>Walsh Granite JV</Client>
|
||||
<UserName>Terra-Mechanics Inc- D. Harrison</UserName>
|
||||
<Seis.Loc>Loc #1 - 1425 Spanlers Mill Rd</Seis.Loc>
|
||||
<GeoRange>
|
||||
<Value>10.000</Value>
|
||||
<Units>in/s</Units>
|
||||
</GeoRange>
|
||||
<TranPPV>
|
||||
<Value>0.355</Value>
|
||||
<Units>in/s</Units>
|
||||
</TranPPV>
|
||||
<VertPPV>
|
||||
<Value>2.475</Value>
|
||||
<Units>in/s</Units>
|
||||
</VertPPV>
|
||||
<LongPPV>
|
||||
<Value>0.770</Value>
|
||||
<Units>in/s</Units>
|
||||
</LongPPV>
|
||||
<TranZCFreq>
|
||||
<Value>73</Value>
|
||||
<Units>Hz</Units>
|
||||
</TranZCFreq>
|
||||
<VertZCFreq>
|
||||
<Value>30</Value>
|
||||
<Units>Hz</Units>
|
||||
</VertZCFreq>
|
||||
<LongZCFreq>
|
||||
<Value>24</Value>
|
||||
<Units>Hz</Units>
|
||||
</LongZCFreq>
|
||||
<TranPeakTime>21:17:39</TranPeakTime>
|
||||
<TranPeakDate>2018-06-04</TranPeakDate>
|
||||
<VertPeakTime>21:17:39</VertPeakTime>
|
||||
<VertPeakDate>2018-06-04</VertPeakDate>
|
||||
<LongPeakTime>21:17:39</LongPeakTime>
|
||||
<LongPeakDate>2018-06-04</LongPeakDate>
|
||||
<PeakVectorSum>
|
||||
<Value>2.552</Value>
|
||||
<Units>in/s</Units>
|
||||
</PeakVectorSum>
|
||||
<PeakVectorSumTime>21:17:39</PeakVectorSumTime>
|
||||
<PeakVectorSumDate>2018-06-04</PeakVectorSumDate>
|
||||
<TranTestFreq>7.5 Hz.</TranTestFreq>
|
||||
<TranTestRatio>3.7</TranTestRatio>
|
||||
<TranTestResults>Passed</TranTestResults>
|
||||
<VertTestFreq>7.4 Hz.</VertTestFreq>
|
||||
<VertTestRatio>3.6</VertTestRatio>
|
||||
<VertTestResults>Passed</VertTestResults>
|
||||
<LongTestFreq>7.6 Hz.</LongTestFreq>
|
||||
<LongTestRatio>3.6</LongTestRatio>
|
||||
<LongTestResults>Passed</LongTestResults>
|
||||
<UsbSummaryChannels>
|
||||
</UsbSummaryChannels>
|
||||
<MonitorLog>2018-06-04 21:17:26 - 2018-06-04 21:17:39 "Event Recorded Modem Exit"</MonitorLog>
|
||||
<HistogramData>
|
||||
<HistogramDataColumnTitle>
|
||||
<ColumnTitle> Tran Peak in/s </ColumnTitle>
|
||||
<ColumnTitle> Tran Freq Hz </ColumnTitle>
|
||||
<ColumnTitle> Vert Peak in/s </ColumnTitle>
|
||||
<ColumnTitle> Vert Freq Hz </ColumnTitle>
|
||||
<ColumnTitle> Long Peak in/s </ColumnTitle>
|
||||
<ColumnTitle> Long Freq Hz </ColumnTitle>
|
||||
<ColumnTitle> Geo PVS in/s </ColumnTitle>
|
||||
</HistogramDataColumnTitle>
|
||||
<HistogramDataIntervals>
|
||||
<Time>2018-06-04 21:17:39</Time>
|
||||
<Row>
|
||||
<Cell>0.355</Cell><Cell>73</Cell><Cell>2.475</Cell><Cell>30</Cell><Cell>0.770</Cell><Cell>24</Cell><Cell>2.552</Cell></Row>
|
||||
</HistogramDataIntervals>
|
||||
</HistogramData>
|
||||
<HistogramDataUsbChannels>
|
||||
</HistogramDataUsbChannels>
|
||||
|
||||
</Event>
|
||||
BIN
Binary file not shown.
+3968
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
+116
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Event>
|
||||
<FileVersion>8.0</FileVersion>
|
||||
<EventType>Full Histogram</EventType>
|
||||
<SerialNumber>BE18004</SerialNumber>
|
||||
<Version>V 10.72-8.17 MiniMate Plus</Version>
|
||||
<FileName>T004JTRF.ME0H</FileName>
|
||||
<HistogramStartTime>12:49:26</HistogramStartTime>
|
||||
<HistogramStartDate>2022-12-28</HistogramStartDate>
|
||||
<HistogramStopTime>12:49:33</HistogramStopTime>
|
||||
<HistogramStopDate>2022-12-28</HistogramStopDate>
|
||||
<Channels>
|
||||
<Channel>Tran</Channel>
|
||||
<Channel>Vert</Channel>
|
||||
<Channel>Long</Channel>
|
||||
<Channel>MicL</Channel>
|
||||
</Channels>
|
||||
<NumberofIntervals>1.00</NumberofIntervals>
|
||||
<IntervalSize>1 minute</IntervalSize>
|
||||
<SampleRate>1024 sps</SampleRate>
|
||||
<BatteryLevel>6.3 Volts</BatteryLevel>
|
||||
<Calibration>June 24, 2022 by Instantel</Calibration>
|
||||
<Units>in/s and psi(L)</Units>
|
||||
<Project>Robinson Run Bridge No 3-201 Marshall</Project>
|
||||
<Client>Mele & Mele & Sons, Inc.</Client>
|
||||
<UserName>Terra-Mechanics Inc. - D. Harrison</UserName>
|
||||
<SeisLoc>Location #1 - 201 Marshall Road</SeisLoc>
|
||||
<GeoRange>
|
||||
<Value>10.000</Value>
|
||||
<Units>in/s</Units>
|
||||
</GeoRange>
|
||||
<TranPPV>
|
||||
<Value>0.940</Value>
|
||||
<Units>in/s</Units>
|
||||
</TranPPV>
|
||||
<VertPPV>
|
||||
<Value>1.095</Value>
|
||||
<Units>in/s</Units>
|
||||
</VertPPV>
|
||||
<LongPPV>
|
||||
<Value>1.045</Value>
|
||||
<Units>in/s</Units>
|
||||
</LongPPV>
|
||||
<TranZCFreq>
|
||||
<Value>32</Value>
|
||||
<Units>Hz</Units>
|
||||
</TranZCFreq>
|
||||
<VertZCFreq>
|
||||
<Value>47</Value>
|
||||
<Units>Hz</Units>
|
||||
</VertZCFreq>
|
||||
<LongZCFreq>
|
||||
<Value>14</Value>
|
||||
<Units>Hz</Units>
|
||||
</LongZCFreq>
|
||||
<TranPeakTime>12:49:33</TranPeakTime>
|
||||
<TranPeakDate>2022-12-28</TranPeakDate>
|
||||
<VertPeakTime>12:49:33</VertPeakTime>
|
||||
<VertPeakDate>2022-12-28</VertPeakDate>
|
||||
<LongPeakTime>12:49:33</LongPeakTime>
|
||||
<LongPeakDate>2022-12-28</LongPeakDate>
|
||||
<PeakVectorSum>
|
||||
<Value>1.358</Value>
|
||||
<Units>in/s</Units>
|
||||
</PeakVectorSum>
|
||||
<PeakVectorSumTime>12:49:33</PeakVectorSumTime>
|
||||
<PeakVectorSumDate>2022-12-28</PeakVectorSumDate>
|
||||
<Microphone>Linear Weighting</Microphone>
|
||||
<MicLPSPL>
|
||||
<Value>0.0</Value>
|
||||
<Units>psi(L)</Units>
|
||||
</MicLPSPL>
|
||||
<MicLTime>12:49:33</MicLTime>
|
||||
<MicLDate>2022-12-28</MicLDate>
|
||||
<MicLZCFreq>
|
||||
<Value>47</Value>
|
||||
<Units>Hz</Units>
|
||||
</MicLZCFreq>
|
||||
<TranTestFreq>7.4 Hz.</TranTestFreq>
|
||||
<TranTestRatio>3.7</TranTestRatio>
|
||||
<TranTestResults>Passed</TranTestResults>
|
||||
<VertTestFreq>7.5 Hz.</VertTestFreq>
|
||||
<VertTestRatio>3.6</VertTestRatio>
|
||||
<VertTestResults>Passed</VertTestResults>
|
||||
<LongTestFreq>7.5 Hz.</LongTestFreq>
|
||||
<LongTestRatio>4.1</LongTestRatio>
|
||||
<LongTestResults>Passed</LongTestResults>
|
||||
<MicLTestFreq>0.0 Hz.</MicLTestFreq>
|
||||
<MicLTestAmplitude>0 mv</MicLTestAmplitude>
|
||||
<MicLTestResults>Check</MicLTestResults>
|
||||
<UsbSummaryChannels>
|
||||
</UsbSummaryChannels>
|
||||
<MonitorLog>2022-12-28 12:49:25 - 2022-12-28 12:49:33 "Event Recorded Modem Exit"</MonitorLog>
|
||||
<HistogramData>
|
||||
<HistogramDataColumnTitle>
|
||||
<ColumnTitle> Tran Peak in/s </ColumnTitle>
|
||||
<ColumnTitle> Tran Freq Hz </ColumnTitle>
|
||||
<ColumnTitle> Vert Peak in/s </ColumnTitle>
|
||||
<ColumnTitle> Vert Freq Hz </ColumnTitle>
|
||||
<ColumnTitle> Long Peak in/s </ColumnTitle>
|
||||
<ColumnTitle> Long Freq Hz </ColumnTitle>
|
||||
<ColumnTitle> Geo PVS in/s </ColumnTitle>
|
||||
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
|
||||
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
|
||||
<ColumnTitle> MicL Freq Hz </ColumnTitle>
|
||||
</HistogramDataColumnTitle>
|
||||
<HistogramDataIntervals>
|
||||
<Time>2022-12-28 12:49:33</Time>
|
||||
<Row>
|
||||
<Cell>0.940</Cell><Cell>32</Cell><Cell>1.095</Cell><Cell>47</Cell><Cell>1.045</Cell><Cell>14</Cell><Cell>1.358</Cell><Cell>0.001</Cell><Cell>104.9</Cell><Cell>47</Cell></Row>
|
||||
</HistogramDataIntervals>
|
||||
</HistogramData>
|
||||
<HistogramDataUsbChannels>
|
||||
</HistogramDataUsbChannels>
|
||||
|
||||
</Event>
|
||||
BIN
Binary file not shown.
+3204
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
+7049
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,83 @@
|
||||
"""
|
||||
Blastware's `_XML.XML` event report, parsed (decode checker, Task 1).
|
||||
|
||||
Expected values are copied from the fixture XML files themselves.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from minimateplus.bw_xml_report import parse_xml_report, parse_xml_report_file
|
||||
|
||||
FIX = Path(__file__).parent / "fixtures/decode-checker-10-29-26"
|
||||
|
||||
|
||||
def test_scalars_units_and_special_text():
|
||||
r = parse_xml_report_file(FIX / "T1905KDW_5F0W_XML.XML")
|
||||
assert r.scalars["SampleRate"] == "1024 sps"
|
||||
assert r.scalars["RecordTime"] == "1.0 sec."
|
||||
assert r.scalars["TranPPV"] == "0.005" and r.units["TranPPV"] == "in/s"
|
||||
assert r.scalars["VertZCFreq"] == ">100" # entity unescaped
|
||||
assert r.scalars["TranZCFreq"] == "N/A"
|
||||
assert r.scalars["TranTestResults"] == "Check"
|
||||
assert r.scalars["BatteryLevel"] == "6.7 Volts"
|
||||
assert r.job_number == "1" and r.notes == []
|
||||
assert r.channels == ["Tran", "Vert", "Long", "MicL"]
|
||||
|
||||
|
||||
def test_waveform_sample_rows():
|
||||
r = parse_xml_report_file(FIX / "T1905KDW_5F0W_XML.XML")
|
||||
assert len(r.sample_rows) == 1024
|
||||
assert r.sample_rows[0] == ["-0.005", "0.000", "0.000", "81.94"]
|
||||
assert r.intervals is None
|
||||
|
||||
|
||||
def test_ragged_rows_are_kept_as_printed():
|
||||
r = parse_xml_report_file(FIX / "T438HGTZ_B30W_XML.XML")
|
||||
assert len(r.sample_rows) == 2304
|
||||
assert r.sample_rows[-4] == ["-0.185", "0.235", "-0.255", "-87.96"]
|
||||
assert r.sample_rows[-1] == ["-0.245"] # only Long still running
|
||||
|
||||
|
||||
def test_relabelled_notes_keep_their_tags_in_order():
|
||||
r = parse_xml_report_file(FIX / "M529L4XQ_R30H_XML.XML")
|
||||
assert r.notes == [("Location", "Test Loc")]
|
||||
r = parse_xml_report_file(FIX / "T004JTRF_ME0H_XML.XML")
|
||||
assert r.notes[1] == ("Client", "Mele & Mele & Sons, Inc.")
|
||||
assert r.event_units == "in/s and psi(L)"
|
||||
|
||||
|
||||
def test_notes_and_job_number_are_not_scalars():
|
||||
r = parse_xml_report_file(FIX / "T004JTRF_ME0H_XML.XML")
|
||||
assert "Project" not in r.scalars and "SeisLoc" not in r.scalars
|
||||
r = parse_xml_report_file(FIX / "T1905KDW_5F0W_XML.XML")
|
||||
assert "JobNumber" not in r.scalars
|
||||
|
||||
|
||||
def test_histogram_intervals_and_columns():
|
||||
r = parse_xml_report_file(FIX / "M529L4XQ_R30H_XML.XML")
|
||||
assert r.interval_columns[0] == "Tran Peak in/s" and len(r.interval_columns) == 10
|
||||
assert r.intervals == [("2025-07-02 14:55:08",
|
||||
["2.430", "13", "0.940", ">100", "1.900", "5.8", "3.095", "0.001", "106.0", "51"])]
|
||||
assert r.sample_rows is None
|
||||
|
||||
|
||||
def test_no_mic_histogram_has_seven_columns():
|
||||
r = parse_xml_report_file(FIX / "R352HFZ7_530H_XML.XML")
|
||||
assert r.event_units == "in/s"
|
||||
assert r.channels == ["Tran", "Vert", "Long"]
|
||||
assert len(r.interval_columns) == 7 and len(r.intervals[0][1]) == 7
|
||||
|
||||
|
||||
def test_oorange_and_range_values():
|
||||
r = parse_xml_report_file(FIX / "M007HVWF_K30W_XML.XML")
|
||||
assert r.scalars["TranPPV"] == "OORANGE"
|
||||
assert r.scalars["GeoRange"] == "1.250" and r.units["GeoRange"] == "in/s"
|
||||
|
||||
|
||||
def test_truncated_xml_raises_valueerror():
|
||||
data = (FIX / "M529L4XQ_R30H_XML.XML").read_bytes()
|
||||
with pytest.raises(ValueError):
|
||||
parse_xml_report(data[: len(data) // 2])
|
||||
Reference in new issue
Block a user