Skip to content

About

Read Altair FluxMotor and Flux export files in Python, with a reverse-engineered format reference and a field guide to their scripting traps. Unofficial.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

fluxmotor-io

Read Altair® FluxMotor™ and Flux™ export files in Python.

CI Python License

English | 中文

An unofficial community project — not affiliated with Altair Engineering Inc.

🚧 Pre-release. The v0.1.0 API is still settling.


Why

FluxMotor's "Export to text" files are self-describing — each declares its own format, axes, items and units. But the grammar is documented nowhere, so everyone who wants their results in Python writes the same fragile parser again, and hits the same handful of traps:

  • The two axis rows of a 2-D map sit on adjacent lines with no separator, defeating any parser that splits the body on blank lines.
  • Item counts change between FluxMotor versions. A lossMap carries five loss channels in some releases and four in others, so a hardcoded item list silently mis-assigns every one of them.
  • #Table_format=1D does not mean one axis — torquePsiCurve declares two, of different lengths, with items split between them.
  • Working-point keys contain commas, parentheses and dots (Stator_Joule_losses_DC_-_W.A.L._(W)).
  • Torque is reported as a positive magnitude even in generator mode, so summing a duty cycle counts regeneration as propulsion.
  • Some curves end in a spurious repeated point carrying zero, so a raw plot dives to the floor at maximum speed.

This library handles all of that, documents the grammar in docs/FORMATS.md, and ships a field guide to the scripting traps that surround it.

Install

pip install fluxmotor-io            # zero dependencies
pip install "fluxmotor-io[numpy]"   # adds .to_numpy() convenience

Python 3.10+. No Altair installation required — this reads files, it does not drive the software.

Quickstart

Plot an efficiency map in five lines:

import matplotlib.pyplot as plt
import fluxmotor_io as fmio

t = fmio.read("Efficiency map_efficiency_map.txt")
plt.contourf(t.axis1.values, t.axis2.values, t.to_numpy())
plt.xlabel(f"{t.axis1.name} ({t.axis1.unit})")
plt.ylabel(f"{t.axis2.name} ({t.axis2.unit})")
plt.colorbar(label=f"{t.items[0].name} ({t.items[0].unit})")
plt.show()

Unreachable operating points come through as NaN, so matplotlib draws the operating envelope for you.

Loss channels by name, read from the file rather than assumed:

loss = fmio.read_2d("Efficiency map_loss_map.txt")
print(loss.item_names)          # ('Total machine', 'Joule', 'Rotor iron', ...)
print(loss.interp(4500, 30, "Joule"))   # NaN outside the envelope, never extrapolated

Working-point results, with the generator sign trap handled explicitly:

wp = fmio.read("WorkingPointTest2_working_point_data.txt")
print(wp.operating_mode)                  # 'Generator'
print(wp["Mechanical_torque_(N.m)"])      # +20.08  <- as FluxMotor reports it
print(wp.signed_torque())                 # -20.08  <- motor-positive convention

Catalog XML, which is the only fully scriptable route to results because runTest() never writes the text exports:

m = fmio.read_map_xml(".../simulations/MAP_TORQUE_SPEED_<uuid>.xml")
power = m.grid("ELEMENT_POWER_USEFUL")    # flat list reshaped correctly
speed_rpm = [fmio.rad_s_to_rpm(v) for v in m.axis1]   # XML is rad/s, not rpm

→ Full walkthrough: docs/USAGE.md — where FluxMotor writes your files, every format with worked examples, batch reading, interpolation, and what to do when something will not parse.

Command line

fluxmotor-io info "Efficiency map_loss_map.txt"     # what is this file?
fluxmotor-io sweep "C:\Users\you\FluxMotor\Results" # parse everything, report failures

sweep exits non-zero if anything fails to parse, and prints the file, the exception and the line. If you hit a variant this library gets wrong, that output is the ideal bug report.

Format support

Format Produced by v0.1
Export-to-text 2D — efficiency, loss, current, voltage, power maps GUI Export to text ✅
Export-to-text 1D — curves, spectra, harmonics, multi-axis tables GUI Export to text ✅
Export-to-text KeyValue — working point, inputs, settings GUI Export to text ✅
CURVE_*.xml, SPECTRUM_*.xml catalog simulations/ ✅
MAP_*.xml catalog simulations/ ✅
testResults.xml catalog simulations/ planned
TEST_ISOLINE_*.xml, TEST_ISOVALUE_*.xml catalog simulations/ planned
Flux 2D solver .TXT, CURVE_*.txt, data.txt Flux 2D planned

Field guide

Practical notes on scripting FluxMotor and Flux 2D — the traps, not the manual. saveMotor() and the 27 minutes of silently discarded solving; why your try/except does not catch Flux errors; which error codes are meaningless wrappers and where the real cause hides; how to discover the PyFlux API from Flux's own log.

English · 中文

Validation

Verified against 1,360 real export files and 683 catalog XML files from FluxMotor 2025 — all 2,043 parse. Cross-checked independently against two hand-written parsers on the same files, matching to the last bit across 2,310 grid cells including NaN placement.

The multi-axis 1D variant above was found only by sweeping that corpus, which is why the same sweep tool ships with the library. Check it against your own exports:

fluxmotor-io sweep "C:\Users\you\FluxMotor\Results" --xml-root "C:\Users\you\FluxMotor\FluxMotor2025\UserCatalog"

Roadmap

  • v0.2 — testResults.xml, mesh field data, Flux 2D file formats
  • Separate future projects: a Jython batch-campaign runner, and an MCP server for driving Flux and FluxMotor from AI agents

Contributing

Bug reports about format variants are especially welcome — see CONTRIBUTING.md.

Licence and trademarks

MIT — see LICENSE.

Altair, Flux and FluxMotor are trademarks of Altair Engineering Inc. This project is not affiliated with, endorsed by, or supported by Altair. Those names are used only nominatively, to identify the file formats this library reads. No Altair source code, documentation text, or sample data is included; every test fixture is synthetic.

About

Read Altair FluxMotor and Flux export files in Python, with a reverse-engineered format reference and a field guide to their scripting traps. Unofficial.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages