Models

Loading a model

After exporting a runtime model from fluxTrainer as a .fluxmdl file, it may be loaded into fluxEngine. fluxEngine supports loading the model directly from disk, as well as parsing a model in memory if the byte sequence of the model was already loaded by the user.

The following example shows how to load a model:

with open('model.fluxmdl', 'rb') as f:
    modelData = f.read()
model = fluxEngine.Model(handle, modelData)

Extracting information from a model

It is possible obtain information about the groups that were defined in a model and obtain both their name and their color. The following snippet will print the names of all groups and their colors:

for group in model.groupInfos():
    print("Group with name {0} has color rgb({1}, {2}, {3})".format(
        group.name, group.redComponent(), group.greenComponent(), group.blueComponent()
        ));