
Introduction MassMotion's timetables are incredibly powerful, but can be time-consuming to pull together by hand. On the other hand, simple programs can do much of the donkey work, converting files such as Origin/Destination Matrices (OD Matrices) or train schedules into a form that MassMotion can read. In this article I will be looking at converting an OD Matrix into a timetable schedule file using a programming language called Python.
Python Python is a free scripting language that is simple to use, powerful, and importantly for us great for working with comma separated value (.csv) files, which are a typical output from Excel.
Python comes in two slightly different versions: Python2x and Python3x. The x refers to the particular build: I am currently using Python3.4.3. You may find a certain amount of controversy online regarding which it is best to use, as Python3x cannot read libraries written in 2x. This is mostly academic now, as over the last few years the majority of libraries have now been updated. My recommendation is that you should use Python3x, and only use Python2x if you have a definite need to work with legacy systems.
You can download the main version of Python from www.python.org, including the IDLE shell, which is a programming environment aimed to help you write and run the programs. There are other Python shells out there out there that might offer some advantages to you, and there will be lots of online discussions extoling the various merits of each. You can even write your scripts in Notepad or Notepad++ and run them with a Windows command line if you wish.
Coding with Python There is lots of guidance available on how to write Python programs, including much which is free on the web (https://docs.python.org/3/tutorial/ is a good place to start). Here I will go through a few key points, but I do recommend that you do one of the many excellent courses or books that are out there.
If you are used to programming in other languages, you may note that a main difference between it and other languages is that loops and other relationships are shown by indenting. For example, a FOR/NEXT loop does not include a NEXT, but instead looks something like this:
for row in input_file: input_rows.append(row) Comments always start with a #, so Python will ignore anything you write after one.
Rather than creating Arrays, Python uses Lists, and allows an item in a List to also be a List. In the script below I create a List, where each item is a line from the OD matrix csv. As items in a List are separated by commas, each line becomes its own list, allowing me to pluck individual values out. For example, to retrieve the value from the second column in the third row of the csv I might ask for (as Python always has the first item as zero):
row[2][1] While Python has many commands that you can use, there are modules and libraries available to make your life easier. In our case, we will import the csv module, which enables us to read and write such files without having to do so much coding. We do this with:
import csv Commands using this module start with csv. , such as csv.reader and csv.writer.
Note that for a general program you might want to add in browse dialogs to grab the files and locations, but for something like this I suggest that you just edit the names directly into the script and save the script into the same folder as the files you want to work on.
The Data For this exercise I have created a very simple OD matrix, but the program will work with one of any size:
OD Matrix ExitPortal1 ExitPortal2 ExitPortal3 ExitPortal4 ExitPortal5 ExitPortal6 ExitPortal7
EntryPortal1 0 80 51 0 19 81 7
EntryPortal2 51 10 70 40 110 0 12
EntryPortal3 99 26 20 47 58 39 3
EntryPortal4 39 16 119 0 5 4 75
EntryPortal5 11 44 0 35 10 108 0
EntryPortal6 0 1 115 77 0 21 47
And the end result will look like this:
From To Population Time offset Curve Avatar Profile Init Action Give Tokens
EntryPortal1 ExitPortal2 80 00:00:00 Arrival_curve Orange_LowPoly DefaultProfile Action1 Token1
EntryPortal1 ExitPortal3 51 00:00:00 Arrival_curve Orange_LowPoly DefaultProfile Action1 Token1
EntryPortal1 ExitPortal5 19 00:00:00 Arrival_curve Orange_LowPoly DefaultProfile Action1 Token1
EntryPortal1 ExitPortal6 81 00:00:00 Arrival_curve Orange_LowPoly DefaultProfile Action1 Token1
EntryPortal1 ExitPortal7 7 00:00:00 Arrival_curve Orange_LowPoly DefaultProfile Action1 Token1
EntryPortal2 ExitPortal1 51 00:00:00 Arrival_curve Orange_LowPoly DefaultProfile Action1 Token1
I have only shown the first few lines, just enough to show how it works. The end result has one line per non-zero value in the OD matrix plus the headers. Some items are optional, so for example you might leave the Action column blank if you are not applying any to the agents when they spawn.
As these are csv files the OD matrix (OD_matrix.csv) actually looks like this:
OD Matrix,ExitPortal1,ExitPortal2,ExitPortal3,ExitPortal4,ExitPortal5,ExitPortal6,ExitPortal7 EntryPortal1,0,80,51,0,19,81,7 EntryPortal2,51,10,70,40,110,0,12 EntryPortal3,99,26,20,47,58,39,3 EntryPortal4,39,16,119,0,5,4,75 EntryPortal5,11,44,0,35,10,108,0 EntryPortal6,0,1,115,77,0,21,47 And the results look similar.
The program As you will see, the resultant Python script (OD-schedule.py) is not long and hopefully easy to follow.
# OD matrix to MassMotion Timetable # read OD matrix csv and write Schedule csv import csv # enable the use of csv commands # set up standard values - adjust to suit: offset = 00:00:00 # from start of simulation for start of arrivals (optional) curve = Arrival_curve # defined in Timetable_curve.csv (optional) avatar = Orange_LowPoly # defaul
Most recent headlines
05/01/2027
Worlds first 802.15.4ab-UWB chip verified by Calterah and Rohde & Schwarz to be ...
07/10/2026
Dalet, a leading technology and service provider for media-rich organizations, today announced the latest Long-Term Supported (LTS) release of Dalet Flex. Build...
06/09/2026
June 9 2026, 23:00 (PDT) Dolby and MagentaTV Bring Fans Closer to the FIFA Worl...
04/08/2026
Dalet, a leading technology and service provider for media-rich organizations, t...
15/07/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
15/07/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
14/07/2026
South end zone videoboard, cloud-based control system will be ready for 2026 football season...
14/07/2026
Redesigned website, enhanced mobile app unify content, ticketing, and personalized fan engagement...
14/07/2026
Agreement spans sponsorship sales, digital monetization, radio production, and new practice facility naming rights...
14/07/2026
Independent league adds 14 regional sports network affiliates, growing distribut...
14/07/2026
New strategy aims to unify competitions, content, fan engagement, and commercial...
14/07/2026
ESPN and Disney+ become exclusive home of PFL events in key international MMA market...
14/07/2026
Gill will oversee engineering, technology, and sports operations across the company's 64 local television stations...
14/07/2026
Submitted by North American Broadcasters Association (NABA)
As broadcasters con...
14/07/2026
Modernized mobile unit combines HOME Apps, mc 56 console, and IP infrastructure ...
14/07/2026
Every match of the 32-team tournament will air across ION and Scripps Sports platforms in English and Spanish...
14/07/2026
FloHockey to stream every game of the annual international tournament under four...
14/07/2026
Victory+ telecasts to be simulcast on TEGNA-owned station, expanding free local distribution...
14/07/2026
Plug-ins for heavy music
Avalanche Tones is the brainchild of Ava Toton, a 17-year-old musician and developer who says her goal is to make the lives of gui...
14/07/2026
Launched alongside new Singer Showcase purchase model
IK Multimedia's innovative vocal-synthesis software has just gained its latest voice add-on, the R...
14/07/2026
Registration open until 1 September 2026
The MIDI Association have revealed that the registration deadline for this year's MIDI Innovation Awards has no...
14/07/2026
88-note model completes MK4 range
Novation have just introduced the final model in their flagship MIDI controller keyboard range, the Launchkey MK4 88. Roun...
14/07/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
14/07/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
14/07/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
14/07/2026
IBC2026 has unveiled a powerful Conference programme bringing together global media leaders, technology innovators, creators, sports organisations, broadcasters...
14/07/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
14/07/2026
Broadcast Solutions, a leading systems integrator and provider of innovative solutions for the broadcast media industry, has delivered two highly capable outsid...
14/07/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
14/07/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
14/07/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
14/07/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
14/07/2026
Editor's note: This post is part of the Nemotron Labs blog series, which exp...
14/07/2026
Techtel Successfully Relocates AICD Broadcast Studio to New Sydney Headquarters
BroadcastBroadcast EquipmentLive StreamingBroadcast Studio2026
14 July Writ...
14/07/2026
Tuesday 14 July 2026
First look revealed for Friday the 13th prequel, Crystal ...
14/07/2026
When immersive audio dominates industry headlines, it's easy to assume that every broadcaster is preparing for an Atmos future. The reality is quite differ...
14/07/2026
Emma and Sophie from ICG's marketing team joined thousands of fellow marketers, brands and agencies at MAD//Fest London 2026, one of the UK's biggest ma...
14/07/2026
Why Trusted and Secure Media Operations Matter In this series, we explore the technologies, architectures and operational realities shaping modern media operati...
14/07/2026
Pilot Project Shows How Retailers Are Prepared for the Next Step in the Evolution of Digital Commerce
Arvato Systems Drives Agentic Commerce Forward
G terslo...
14/07/2026
As part of this commitment, weve joined the SME Climate Hub, publicly pledging to:
measure our greenhouse gas emissions
reduce them in line with a net zero p...
14/07/2026
Power is AI infrastructure's inescapable constraint. How many tokens an AI factory can generate within a fixed power budget determines its revenue and profi...
13/07/2026
The Braves opted to keep production in-house rather than hand it off to MLB...
13/07/2026
Behind The Mic provides a roundup of recent news regarding on-air talent, including new deals, departures, and assignments compiled from press releases and repo...
13/07/2026
Eurovision Sport is making live athletics more accessible to fans than ever befo...
13/07/2026
The Milwaukee Bucks will return to full-season over-the-air television for the 2...
13/07/2026
SMPTE has announced an expanded education pathway for media technology professio...
13/07/2026
Vizrt has announced that its graphics technology was used by broadcast design agency Girraphic for Netflix's debut MVP MMA event, broadcast live from the In...
13/07/2026
ARRI has announced an agreement to sell its global rental activities in Europe, the United Kingdom, and North America to H2 Equity Partners through a management...
13/07/2026
DAZN has announced a partnership with Premier Boxing Champions (PBC) to bring PBC fight nights to DAZN subscribers globally. The partnership begins Saturday, Ju...
13/07/2026
TikTok and WSC Sports have announced a strategic partnership that gives sports r...