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.1.tar.gz
.
File metadata
- Download URL: simio_lisa-1.1.1.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 | fa159716fa245405a12f01b8b3359e9a24a1a0e94367eadf3dee6b4c3805e6dc |
|
MD5 | 8ed97b548729129b41731bb295074d85 |
|
BLAKE2b-256 | 46ec097f92c555d8965211fe665c5cf0a13ed9eb88fd122d9d8b028bf95633de |
File details
Details for the file simio_lisa-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: simio_lisa-1.1.1-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 | e370d7f9e5f171c51e14e520b83e4456a9bfd5994374fa34120b73bc9e285845 |
|
MD5 | 2462ddc46c4228a0220e7a096d75cbc0 |
|
BLAKE2b-256 | bd1e7e0009ef976882c6f41fc7a58b49d8479c9ca5971282408364fb1e8d1046 |