Beautiful Simio: Importing data and powering viz.
Project description
simio-lisa
Python package of processing tools for Simio models saved as .simproj
How to install it
This package has been published in pypi and in order to install it you have
pip install simio-lisa
How to use it
Exporting Output Tables
import os
from simio_lisa.load_simio_project import load_output_tables
if __name__ == '__main__':
env_project_path = "path to project"
env_project_file = "name of .simproj file"
env_model_name = "name of the model containing the output file (usually Model)"
env_export_dir = "directory where output tables are going to be saved"
os.mkdir(env_export_dir)
output_tables = OutputTables(path_to_project=env_project_path,
model_file_name=env_project_file,
model_name=env_model_name)
output_tables.load_output_tables()
for table_name, table_df in output_tables.tables.items():
print(os.path.join(env_export_dir, f'{table_name}.csv'))
try:
for col_name, col_type in table_df.dtypes.items():
if col_type.name == 'datetime64[ns]':
table_df[col_name] = table_df[col_name].dt.strftime('%d-%m-%Y %X')
table_df.to_csv(os.path.join(env_export_dir, f'{table_name}.csv'), index=False, decimal='.')
except AttributeError:
print("This was empty")
Exporting Experiments
import os
from simio_lisa.load_simio_project import load_experiment_results
if __name__ == '__main__':
env_project_path = "path to project"
env_project_file = "name of .simproj file"
env_model_name = "name of the model containing the output file (usually Model)"
experiments_df = load_experiment_results(project_path=env_project_path,
project_filename=env_project_file,
model_name=env_model_name,
agg_function=np.mean)
Plotting Data from tables
Different classes are defined for different kinds of plot. Their parent class is SimioPlotter, and it wants as an input a dictionary with all the tables (e.g. the attribute tables of an object of the class OutputTables). Other possible inputs can be x_axis, y_axis, time_axis, legend_col, object_groups_dict. Each child class must cointain a plot() method. The child classes are: SimioTimeSeries (plot time series), SimioBarPie (bar plots and pie charts), SimioBox (box plot), SimioStackedBars (stacked bars plot).
Examples for the
Initialize OutputTables class object
output_tables = OutputTables(path_to_project,
model_file_name,
model_name)
output_tables.load_output_tables()
Plot time series comparing different columns of the same table
y_axis = 'Utilization'
time_axis = 'DateTime'
simio_time_series_plotter = SimioTimeSeries(
output_tables=output_tables.tables,
logger_level = logging.INFO,
y_axis= y_axis,
time_axis=time_axis)
simio_time_series_plotter.plot(tables='OutputObjectUtilization', kind='time_series_columns')
Plot time series comparing same column from different tables (name of tables as legend)
y_axis = 'Count'
time_axis = 'StatusDate'
simio_time_series_plotter = SimioTimeSeries(
output_tables=output_tables.tables,
logger_level = logging.INFO,
y_axis= y_axis,
time_axis=time_axis)
simio_time_series_plotter.plot(tables=['OutputStatus5A', 'OutputStatus5B', 'OutputStatus6'], kind='time_series_tables')
Plot bars or pie charts, distinguishing plots via object_groups_dict dictionary
x_axis = 'ObjectId'
y_axis = 'Utilization'
object_groups_dict = {'Shuttles': ['DropOffShuttle[1]', 'PickUpShuttle[1]'],
'Retorts': ['Retort1', 'Retort2', 'Retort3', 'Retort4',
'Retort5', 'Retort6', 'Retort7', 'Retort8',
'Retort9', 'Retort10']
}
simio_obj_util_plotter = SimioBarPie(
output_tables=output_tables.tables,
logger_level = logging.INFO,
x_axis = x_axis,
y_axis = y_axis,
objects_dict = object_groups_dict)
simio_obj_util_plotter.plot(tables='OutputObjectUtilization', kind='bars_plot')
simio_obj_util_plotter.plot(tables='OutputObjectUtilization', kind='pie_plot')
Plot bars along time, distinguishing plots via object_groups_dict dictionary (each key should contain all the objects to be compared together)
x_axis = 'ObjectId'
y_axis = 'Utilization'
time_axis = 'DateTime'
object_groups_dict = {'Shuttles': ['DropOffShuttle[1]', 'PickUpShuttle[1]'],
'Retorts': ['Retort1', 'Retort2', 'Retort3', 'Retort4',
'Retort5', 'Retort6', 'Retort7', 'Retort8',
'Retort9', 'Retort10']
}
simio_obj_util_plotter = SimioBarPie(
output_tables=output_tables.tables,
logger_level = logging.INFO,
x_axis = x_axis,
y_axis = y_axis,
time_axis = time_axis,
objects_dict = object_groups_dict)
simio_obj_util_plotter.plot(tables='OutputObjectUtilization', kind='bars_time_series_plot')
Box plot
x_axis = 'ProcessName'
y_axis = 'ProductTimeInSystem'
simio_tis_plotter = SimioBox(
output_tables=output_tables.tables,
logger_level=logging.INFO,
y_axis=y_axis,
x_axis=x_axis)
simio_tis_plotter.plot(tables='OutputProductDeparture', kind='box_plot')
Plot stacked bars, using as a legend the column legend_col
x_axis = 'ObjectID'
y_axis = 'Duration'
legend_col = 'OperationID'
simio_object_processing_plotter = SimioStackedBars(
output_tables=output_tables.tables,
logger_level = logging.INFO,
x_axis = x_axis,
y_axis = y_axis,
legend_col = legend_col)
simio_object_processing_plotter.plot(tables='ObjectProcessingTable', kind='stacked_bars')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file simio_lisa-1.1.0.tar.gz
.
File metadata
- Download URL: simio_lisa-1.1.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0afa5cf79c2f887825ed3463a4dad19c79a1acb8d84a3eed9d6cd0372eb79f4f |
|
MD5 | 65540f7526b82de161437b120b916ae7 |
|
BLAKE2b-256 | 5f638cb0dfbc6fee3d28c309bc33454196e1f6968461e3f1acd9dfda533138f0 |
File details
Details for the file simio_lisa-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: simio_lisa-1.1.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bd0f6ed67cd9de90a0b3e8690d5ff45a1c7309c9bcf3aa149458d907ffa1977 |
|
MD5 | 74b002e5d110a5a7d6eb579d7f300bc8 |
|
BLAKE2b-256 | 8b95e98c09f2638c67f5db2ea0abccf22d8319dcf89b899655f28df6600b86af |