Skip to main content
Version: Next

Example scripts

The examples/ folder of the repository has one script per area of the library. Each script generates its own synthetic data and runs without input files:

python examples/quality_events_demo.py

Some scripts use optional extras; install them with pip install "ts-shape[all]" or pip install -e ".[dev]" in a clone.

Detectors by pack​

ScriptShows
quality_events_demo.pyOutlier detection, SPC rules and tolerance deviation
production_events_demo.pyMachine state, throughput, changeover, flow constraints, OEE, alarms, batches, downtime and shift reports
production_tracking_demo.pyParts, cycle times, downtime, quality and shift reports
line_flow_analytics_demo.pyLine balancing and takt, flow metrics and Little's law
unit_runtime_demo.pyUnit conversion (needs ts-shape[units]) and operating-hours accounting
setpoint_events_advanced_usage.pySetpoint changes on simulated control loops: noise filtering, percentage and derivative settling, overshoot, control-quality KPIs, a before/after tuning comparison
maintenance_events_demo.pyDegradation, failure prediction and vibration analysis
energy_events_demo.pyEnergy consumption and efficiency
correlation_events_demo.pySignal correlation and anomaly correlation
supplychain_events_demo.pyInventory, lead time and demand patterns

Loading, transforms and features​

ScriptShows
loader_usage_demo.pyTimeseries and metadata from parquet and JSON, combined on uuid
transform_operations_demo.pyFilters, calculations and time-zone shifts
features_statistics_demo.pyNumeric, string, boolean and timestamp statistics (including missing values), feature tables, time-grouped statistics and cycle processing
cycle_extractor_enhancements_demo.pyCycle extraction, method suggestion and validation
context_enricher_demo.pyEnriching signals with descriptions, units, limits and value mappings
pipeline_demo.pyTransforms and detectors chained in a Pipeline

Event log​

ScriptShows
eventlog_demo.pyDetector output as an OCEL 2.0 event log, exported XES-style and as OCEL tables
object_detection_demo.pyOCEL objects (batches, serials) derived from id signals
lambda_rules_demo.pyDetectors declared as lambda rules (with lambda_rules_demo.yaml)