crashmetrics.isomme¶
isomme
¶
ISO-MME (ISO/TS 13499) test data: read and write.
ISO-MME is the exchange format for crash test and simulation channels used by test labs, NHTSA and Euro NCAP (for example for virtual testing submissions). A test is a folder (or a zip of it)::
<test>/
<test>.mme test header ("Key :Value" lines)
Channel/
<test>.chn list of channels
<test>.001 one file per channel: header, then values
<test>.002
...
Each channel has a 16-character channel code, e.g. 11HEADCG0000H3ACXA
is test object 1, position 1, head centre of gravity, Hybrid III,
acceleration, x, CFC 1000 (see parse_channel_code).
Functions:
read_isomme: Read a test folder, its.mmefile or a.zip.write_isomme: Write channels as an ISO-MME test folder (for example CAE results for a virtual testing submission).parse_channel_code: Split a channel code into its fields.
Header keys and values are kept as text. Values NOVALUE become NaN.
The time of each channel comes from Time of first sample and
Sampling interval (implicit), from a reference time channel
(explicit), or, if neither is given, is None. Text in UTF-8,
Windows-1252 or ISO-8859-1 is read.
FILTER_CLASSES
module-attribute
¶
Filter class letter (last character of a channel code) -> CFC.
0 means unfiltered; other letters are kept as given.
ChannelCode
dataclass
¶
ChannelCode(
code: str,
test_object: str,
position: str,
main_location: str,
fine_location_1: str,
fine_location_2: str,
fine_location_3: str,
dimension: str,
direction: str,
filter_class: str,
)
Fields of a 16-character ISO-MME channel code.
test_object
instance-attribute
¶
1st character, e.g. 1 for the first vehicle or dummy.
fine_location_3
instance-attribute
¶
Characters 11-12; often the dummy type (H3, TH, HF ...).
dimension
instance-attribute
¶
Characters 13-14, e.g. AC acceleration, FO force, DS
displacement.
filter_class
instance-attribute
¶
16th character: A CFC 1000, B 600, C 180, D 60,
0 unfiltered.
Channel
dataclass
¶
Channel(
code: str,
name: str,
unit: str,
time: NDArray[float64] | None,
values: NDArray[float64],
header: dict[str, list[str]] = dict(),
)
One ISO-MME channel.
time
instance-attribute
¶
Time in s, or None if the file gives no time base.
header
class-attribute
instance-attribute
¶
All header entries of the channel file (key -> values in order).
parsed_code
property
¶
parsed_code: ChannelCode | None
ChannelCode fields, or None if the code is not 16 characters.
info
¶
First value of a header key ("" if missing or NOVALUE).
IsoMmeTest
dataclass
¶
IsoMmeTest(
test_number: str,
header: dict[str, list[str]],
channels: dict[str, Channel],
)
An ISO-MME test: header and channels.
header
instance-attribute
¶
Entries of the .mme file (key -> values in order; Comments
and other repeated keys keep every value).
info
¶
First value of a test header key ("" if missing or NOVALUE).
parse_channel_code
¶
parse_channel_code(code: str) -> ChannelCode
Split a 16-character ISO-MME channel code into its fields.
read_isomme
¶
read_isomme(path: str | Path) -> IsoMmeTest
Read an ISO-MME test.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
The test folder, its |
required |
write_isomme
¶
write_isomme(
directory: str | Path,
test_number: str,
channels: Mapping[str, tuple[ArrayLike, ArrayLike]],
units: Mapping[str, str] | None = None,
names: Mapping[str, str] | None = None,
header: Mapping[str, str | Sequence[str]] | None = None,
data_source: str = "calculated",
) -> Path
Write channels as an ISO-MME 1.6 test folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str | Path
|
Parent directory; the test folder |
required |
test_number
|
str
|
Test number, used for the folder and file names. |
required |
channels
|
Mapping[str, tuple[ArrayLike, ArrayLike]]
|
Channel code -> |
required |
units
|
Mapping[str, str] | None
|
Unit and name per channel code (default: empty). |
None
|
names
|
Mapping[str, str] | None
|
Unit and name per channel code (default: empty). |
None
|
header
|
Mapping[str, str | Sequence[str]] | None
|
Extra |
None
|
data_source
|
str
|
|
'calculated'
|
Returns:
| Type | Description |
|---|---|
Path
|
The test folder. |