Skip to content

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 .mme file 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_CLASSES: dict[str, int | None] = {
    "A": 1000,
    "B": 600,
    "C": 180,
    "D": 60,
    "0": None,
}

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

test_object: str

1st character, e.g. 1 for the first vehicle or dummy.

position instance-attribute

position: str

2nd character, e.g. 1 driver, 3 front passenger.

main_location instance-attribute

main_location: str

Characters 3-6, e.g. HEAD, CHST, PELV, NECK.

fine_location_3 instance-attribute

fine_location_3: str

Characters 11-12; often the dummy type (H3, TH, HF ...).

dimension instance-attribute

dimension: str

Characters 13-14, e.g. AC acceleration, FO force, DS displacement.

direction instance-attribute

direction: str

15th character: X, Y, Z, R (resultant) ...

filter_class instance-attribute

filter_class: str

16th character: A CFC 1000, B 600, C 180, D 60, 0 unfiltered.

cfc property

cfc: int | None

CFC of the filter class letter, None if unfiltered or unknown.

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: NDArray[float64] | None

Time in s, or None if the file gives no time base.

values instance-attribute

values: NDArray[float64]

Values (NaN for NOVALUE samples).

header class-attribute instance-attribute

header: dict[str, list[str]] = field(default_factory=dict)

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.

cfc property

cfc: int | None

CFC from Channel frequency class, else from the code.

info

info(key: str, default: str = '') -> str

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

header: dict[str, list[str]]

Entries of the .mme file (key -> values in order; Comments and other repeated keys keep every value).

channels instance-attribute

channels: dict[str, Channel]

Channels by channel code, in file order.

info

info(key: str, default: str = '') -> str

First value of a test header key ("" if missing or NOVALUE).

find

find(pattern: str) -> list[Channel]

Channels whose code matches a pattern with ? (one character) and * wildcards, e.g. "11HEAD??????ACX?".

channel

channel(pattern: str) -> Channel

The one channel matching a code or pattern.

summary

summary() -> str

Short text description of the test.

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 .mme file, or a .zip containing the test folder.

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 <directory>/<test_number> is created.

required
test_number str

Test number, used for the folder and file names.

required
channels Mapping[str, tuple[ArrayLike, ArrayLike]]

Channel code -> (time, values), time in s and uniformly sampled (resample CAE output first, see crashmetrics.signals.resample_uniform).

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 .mme entries, e.g. {"Test type": "Virtual testing", "Comments": ["...", "..."]}.

None
data_source str

Data source of every channel (calculated for simulations).

'calculated'

Returns:

Type Description
Path

The test folder.