Model#

class Model(_impl)[source]#

Top-level container in modelx object hierarchy.

Model instances are the top-level objects and directly contain UserSpace objects, which in turn contain other spaces or Cells objects.

A model can be created by new_model() API function.

Model properties#

name

Name of the object.

fullname

Dotted name of the object.

doc

Documentation string

model

The model this object belongs to.

parent

The parent of this object.

allow_none

Whether a cells can have None as its value.

properties

spaces

A mapping of the names of child spaces to the Space objects

refs

Return a mapping of global references.

dataspecs

List of BaseDataSpec objects

tracegraph

A directed graph of cells.

Model operations#

close()

Close the model.

rename(name[, rename_old])

Rename the model itself

set_property(name, value)

Set property name

Saving operations#

write(model_path[, backup, log_input])

Write model to files.

zip(model_path[, backup, log_input, ...])

Archive model to a zip file.

backup(filepath[, datapath])

Back up the model to a file.

save(filepath[, datapath])

Back up the model to a file.

Child Space operations#

cur_space([name])

Set the current space to Space name and return it.

new_space([name, bases, formula, refs])

Create a child space.

clear_all()

Clears Cells and ItemSpace.

import_module([module, recursive])

Create a child space from an module.

new_space_from_csv(filepath[, space, cells, ...])

Create spaces from from a comma-separated values (csv) file.

new_space_from_excel(book, range_[, sheet, ...])

Create a child space from an Excel range.

new_space_from_module(module[, recursive])

Create a child space from an module.

new_space_from_pandas(obj[, space, cells, ...])

Create child spaces from Pandas DataFrame or Series.

Reference operations#

new_excel_range(name, path, range_[, sheet, ...])

Creates a Reference to an Excel range

new_pandas(name, path, data, filetype)

Assigns a pandas object to a Reference associating a new PandasData object

new_module(name, path, module)

Assigns a user module to a Reference associating a new ModuleData object

update_pandas(old_data[, new_data])

Update a pandas object assigned to References

update_module(old_module[, new_module])

Update an user-defined module assigned to References

Run operations#

generate_actions(targets[, step_size])

Generates actions for memory-optimized run

execute_actions(actions)

Performs memory-optimized run