process_mapping.add_sim_timestamp
process_mapping.add_sim_timestamp(
log,
time_col='time',
timestamp_col='timestamp',
sim_start=None,
time_unit='minutes',
warm_up=None,
)Add a pseudo-timestamp column to a simulation event log. This is a helper function for process-mining style outputs.
If the simulation does not have a ‘true’ start time
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| log | pd.DataFrame | Event log with a column containing the simulation-relative time per event. | required |
| time_col | str | Column containing simulation time since model start. Default: “time”. This will be the name of the column if you have made use of Vidigi’s EventLogger defaults. | 'time' |
| timestamp_col | str | Desired name of output timestamp column. Default: “timestamp” | 'timestamp' |
| sim_start | pd.Timestamp, str, or None | Start datetime of the simulation. If None, a fixed pseudo-start of ‘2000-01-01 00:00:00’ is used. | None |
| time_unit | str | Unit of the simulation time. Accepted values are ‘seconds’, ‘minutes’, ‘hours’, ‘days’ or ‘weeks’. Default: “minutes”. | 'minutes' |
| warm_up | float | Discard a warm-up period by dropping rows with time_col <= warm_up, in the same units as time_col. Default is None, which keeps every row. Unlike reshape_for_animations’ warm_up argument, this is a plain time-based filter and needs no other handling: discover_dfg builds each case’s edges from its own consecutive rows, rather than reconstructing who was present at a given moment from arrival and departure rows, so dropping early rows here does not make any case vanish from output it should still appear in. Two consequences worth knowing before relying on this for reporting: a case entirely within the warm-up is dropped completely, and a case that spans the cutoff loses the single edge connecting its last pre-cutoff event to its first post-cutoff event, since one side of that pair is no longer in the log. Both are intentional - they keep warm-up activity from contributing to the transition statistics - but they mean a case’s node counts can undercount its true number of events even where its later transitions are otherwise complete. |
None |
Returns
| Name | Type | Description |
|---|---|---|
| pd.DataFrame | Copy of the provided event log (parameter log) with an added timestamp column. |