Code for the Stars: Programming the world's largest telescope
The Universe is cloaked in mystery. Galaxies collide and Stars form and die, oblivious to human existence. Our attempts to understand it require pushing the boundaries of what our science is capable of. Scientific achievements and technological innovations tend to come to the fore of the public consciousness on their culmination. The process and the hundreds of smaller innovations made along the way often go unnoticed - humanity wouldn't be where it is today without those small innovations
That's why this isn't so much a story about the Thirty Meter Telescope - an event that astronomers around the world wait for with baited breath - as the technology that's helping build it: software and hardware with a distinctively Indian flavour. But first a look at how Science research depends on Engineering, a field many scientists have been keen to distance themselves from, in the past.
The Start
At first glance, Mushtaq Ahmed isn't the type to work on telescopes. The self-described 'Mr. Scala' at ThoughtWorks, a global technology company, got himself hired at the company as a Business Analyst in Pune in 2008, before shifting to work full-time on evangelising his pet project. Scala is a high-level programming language that combines functional and object-oriented concepts and occupies a small niche in the market with those dissatisfied by its behemoth competitor, Java.
The Chicago based tech consultancy inspired by the NAE's (National Academy of Engineering) 14 Grand Challenges of Engineering, decided it would work towards progressing the efforts needed to overcome these challenges. Revealingly, the challenge they chose to focus on was possibly the least ostentatious, yet equally crucial: Challenge 14 - Engineer the Tools of Scientific Discovery.
The relationship between Science and Engineering hasn't always been chummy. In the popular imagination, they have had distinct job descriptions - Scientists explore, experiment, and discover; engineers create, design, and build. Their own views of each other's work have been less charitable - Scientists spend time and resources in fruitless endeavours, basking in the illusion of 'peer-reviewed' glory for negligible progress; Engineers sell their souls to Corporate in pursuit of short term, blinkered goals, lacking integrity or ethics. This stare-off has been forced into changing.
Science has found progress difficult when lacking the engineering expertise to design the instruments and systems required. Space has been the one bastion where, from the word go, collaboration was key. Both literally and metaphorically, the focus of greatest interest tends to be at the outer edges of scientific knowledge - here, the boundaries of the visible universe. Understanding star and planet formation require a lot more data than we currently are capable of collecting. So what do you do? You build the world's biggest telescope.
The Pitch
ThoughtWorks' initiative, called Engineering for Research, or E4R, rolled along to its Pune offices, where Mr Ahmed is based, coinciding with developments occurring a little further away in Pasadena. The Thirty Meter Telescope project wanted a new kind of future-proof telescope - one capable of running for several decades, something almost inconceivable at a 21st-century rate of technological progress. A TMT executive, on the lookout for new technologies, attended a symposium on Scala, that ThoughtWorks happened to be presenting at.
Concurrently, scientists across India were gearing up for a new era - one of India's involvement as a critical partner in global science, preparing to take the lead in a changing world. At the Indian Institute of Astrophysics (IIA) in Bangalore in particular, the TMT was at the forefront of everyone's minds.
Global science projects are expensive; projects on space, even more so. Many developed economies, facing flagging growth rates and a populace highly resistant to a change in their standard of living, have begun disinvesting in science.
Conceptualised way back in 2000, progress began picking up only after India and China joined as observer states in 2010. Two years later after talks among a consortium including the governments of the United States, Canada, Japan and China, India came to the forefront of the project, pledging along with the Chinese to fund the entire construction costs of over $1.4 billion. The ITCC - India-TMT Coordination Centre - was set up with IIA Bangalore and IUCAA in Pune, to coordinate with vendors for the ludicrous amounts of hardware and software required.
Fast forward to 2016, and after the chance meeting at the symposium, ThoughtWorks submitted a Proof of Concept on the intricate software that would be necessary to run the Telescope and the observatory. Uncharted territory for the company, but they pitched the strengths of their unconventional digital solutions that had helped numerous industry clients transition from creaking Legacy systems to operating in the modern age. A contract soon followed, and the recently formed ITCC was in the perfect position to coordinate. The assignment landed up in the letterbox of ThoughtWorks Pune. Mushtaq Ahmed was working on telescopes.
The Telescope
The Thirty Meter Telescope project is ambitious. The 'thirty-meter' in the name refers to its diameter - something that would make it the largest optical reflecting telescope in the world by some distance. The current largest in the world is the LBT (Large Binocular Telescope) in Arizona, with an effective aperture of 11.9 m.
It is designed to operate in the near-ultraviolet to mid-infrared region (0.31 to 28 μm wavelengths) (that is, the light waves you can see with your eyes, but on steroids). Big telescope, big potential for future discoveries - it will play a huge role in understanding star and planet formation and the large scale structure of the universe as we know it. Did we mention black holes? It will help detect and investigate the gargantuan black holes at the centre of distant galaxies, as well as the one at the centre of the Milky Way.
To give an idea of the scale of this thing, the TMT will be housed in an observatory in a 5-acre complex, the dome of which will have a height of 55 metres - that's as tall as an 18 storey building.
The problem is that the technology to build a single reflecting mirror larger than 8.4 metres doesn't exist - it would be too difficult to fabricate. The ingenuity is in using 492 smaller hexagonal segments of 1.4 m each. The complexity is in making all these segments work together without room for an error - the smallest calibration mistake would result in an erroneous measurement and the loss of hours of data and dollars.
That's not all - integrated is also a new Multi-Conjugate Adaptive Optics (MCAO) system that will measure atmospheric turbulence. Based on these measurements, a pair of deformable mirrors would adjust many times per second to correct optical distortions caused by the turbulence.
Given this, it's no surprise the software needed to help the TMT function is as sophisticated as the hardware itself.
The Software
In October of 2019, it was revealed that the Common Software (CSW) for the telescope, developed by ThoughtWorks Pune, had passed the pre-shipment review stage. I reached out to Mr Ahmed, Tech Lead of the TMT project to find out more. I was directed to speak to two of the women at the forefront of this project: Chhaya Yadav, Project Manager (delivery) and Poorva Gokhale, a senior engineer on the team.
"There are 4 main packages that the TMT needs:
1. the CSW that is the communications backbone, connecting all 500 components; 2. the Executive Software, the frontend that provides the UI and functionality for operational users in the observatory to interact with; 3. the Data Management System to handle the storage, retrieval, collection and archival of the data; 4. the Embedded systems. ThoughtWorks has been awarded the contracts for the first 3, and that's what we are working on", Chhaya explains, in an interview.
Before delving into the specifics of the Software Architecture, I find out a little more about why the software development process is so important, and what makes it difficult - and interesting. Two key factors:
Ms Chhaya says, "Most of our clients require software for a particular use case over a duration of say 6 months - for an application like this, it would be more like 10 years. Not only that but since the telescope is going to run for 40-50 years, the software we provide must be able to adapt accordingly". Technology in the 21st century has always been made obsolete faster than we imagine it will. Software like this needs to be able to plug and play with newer technology with minimal hassle.
Second is the fact that this client is one very different from the corporate houses the company frequents. "Working with scientists is not like with a typical client at all", she says. "The relationship feels more collaborative than transactional, and rather than giving us a prototype with vague design requirements, they are able to tell us exactly what they want".
Both these facets - more collaboration and longevity - lend themselves well to something ThoughtWorks helped pioneer: a process called the 'Agile Methodology". Based on an iterative method, something that's been around since the 1950s, the approach was crystallised by a manifesto written by 17 elite software developers at a Utah resort in 2001.
In essence, it boils down to continuous integration of functions and ideas, rather than a strictly chronological dev cycle - development and testing are concurrent. The project is broken into smaller chunks and continuously delivered in short 2 week cycles. Thanks to the continuous feedback they receive from the scientists, Poorva and her team are able to integrate those changes into the overall program, without the flaw being uncovered only after a lengthy delivery process, only to go back to the drawing board for ver 2.0.
Poorva Gokhale sits down to explain to me- what software exactly does a telescope need? It helps to imagine the architecture as a layer of skin with 4 levels.
Level 0: The outer layer is the observatory hardware itself; the sensors and instruments receiving the input from the Great Beyond of deep space
Level 1: The Hardware Control Layer (HCD) - this consists of actuators that, you guessed it, control the hardware. Commands are given from sequencers to rotate instruments and control motion - this is how the 492 mirrors in the honeycomb are positioned with incredible precision. That's not all. The developers created a UI to view the state of the sequencer, as well as an HCD writer.
An interesting requirement here: since the scientists on the ground are no programmers, a domain-specific language (DSL) was written, to interact with the machines that are part of their life's work
Level 2: Assembly Layer - before the mirrors can be moved wholesale, a lot of fine-tuning is required. This allows control over the assemblies of filters and gratings that make up the telescope
Level 3: Sequencing Layer - here's where things get complicated. This layer acts as the brain of the sequencers that provide sequential steps for the commands that are given to the actuators in the HCD layer.
Level 4: Monitoring and Control - these are the applications that take in the input data and process it. These require several astronomy specific tools, including some by the ICRAR (International Centre for Radio Astronomy Research). Astro map is an R tool for generating sky projection maps for astronomical surveys; ProSpect works on star formation histories; Simspin on galaxy simulation.
The Future
While work has been progressing well, the TMT's future is far from rosy. Even before the COVID-19 pandemic, bound to introduce funding doubts into each of the member states, as they rush to deal with more pressing issues, the project ran into trouble regarding its proposed location.
With the summit of the dormant volcano, Mauna Kea in Hawaii, considered the ideal location (it would make TMT the biggest and highest altitude telescope), native Hawaiians for whom it is a sacred site have come out in protest. Although a stalemate has been in place with the government since December, no construction material has reached the telescope site since July of 2019. The proposed launch date in 2027 is looking more and more unlikely.
Yet this project holds a lot of promise with regards to Indian involvement in global science. Ms Chhaya spoke about the several outreach programs the Department of Science and Technology (DST) has been holding with industry partners. The DST along with the DAE (Department of Atomic Energy) has identified 7 Mega Science Projects for India to be involved in over the next decade. These include the TMT, CERN in Geneva as well as the SKA (Square Kilometer Array telescope, a project under the purview of ICRAR).
The success of this project is crucial for more than the functioning of the telescope alone - something that by itself holds huge potential for revolutionising our understanding of space. It could prove that academia and industry can be equal partners in tandem with the government. That they can bridge the gap and help mend each other's shortcomings - efficient industry practices applied to the scientific development process, for example. Something that Mr Ahmed's team is demonstrating can be done to create a symbiotic alliance with unlikely bedfellows, given a common goal.
While there may be setbacks along the way, the progress of science is gradual but inevitable. Perhaps the lull this pandemic has brought allows us time to reflect. On what is truly important, laying our differences aside, and learning how to work together to create projects and make discoveries the world has never seen before. India is in a position to truly take the lead, achieving our potential as a global scientific powerhouse. We're taking steps in the right direction, but feedback along the way to iterate and refine our approach, from a few unconventional sources, wouldn't hurt.
The stars are waiting.