The iconic and first-ever image of a black hole was recently released.
It took over a decade of work and is a major achievement for astronomy
and broadens our understanding of the universe for all of us.
Would it surprise you to know that Python played a major part in this discovery?
Of course it did, and Dr. Sarah Eisen is here to give us the full story.
This is Talk Python to Me, episode 398, recorded December 12, 2022.
Welcome to Talk Python to Me, a weekly podcast on Python.
This is your host, Michael Kennedy.
Follow me on Mastodon, where I'm @mkennedy,
and follow the podcast using @talkpython, both on fosstodon.org.
Be careful with impersonating accounts on other instances.
There are many.
Keep up with the show and listen to over seven years of past episodes at talkpython.fm.
We've started streaming most of our episodes live on YouTube.
Subscribe to our YouTube channel over at talkpython.fm/youtube
to get notified about upcoming shows and be part of that episode.
This episode is brought to you by Cox Automotive.
Use your technical skills to transform the way the world buys,
sells, and owns cars at talkpython.fm/cox and by Sentry.
Don't let those errors go unnoticed.
Get started at talkpython.fm/sentry.
Sarah, welcome to Talk Python to me.
Thank you so much.
Thank you for having me.
Yeah, I'm very excited to have you on the show.
Ever since I saw that first picture of the black hole and heard the news,
I didn't know, but I thought, oh, there has to be some Python going on here, huh?
Oh, yeah, definitely.
We got a lot of traction from our Matplotlib press.
That's soon to catch the eye of many developers.
Oh, I see.
It is.
It is Python.
I see.
Look, there it is.
I know that theme.
That's right.
Yeah.
Yeah, absolutely.
So there's just many fascinating aspects of this.
The amount of data, the different data sources, the Earth scale telescope that you all created,
the processing with the pipeline, Python, and just seeing stuff 55 million light years away
at all, which is dark, is kind of crazy.
But before we get to all those fun topics, let's just hear your story.
How do you get into programming and into the Python side of these things?
And how do you get going to black holes, too?
Just to introduce myself.
Hello, everyone.
My name is Sarah.
I'm currently a member of the Event Horizon Telescope Project, the team that makes images
of black holes.
I've been interested in astronomy since I was a little kid.
Since I was eight years old, I got to, in second grade, I got to build a cardboard forward
system.
I'm sure everybody has kind of had similar experiences.
That was really my first kind of introduction into a world outside of our planet.
And I was just so fascinated by planets that I kind of binged through all of the astronomy
books I could find at my local library and fell in love with astronomy.
And so I ended up studying kind of the physical sciences.
I did a bachelor's in physics.
And because I was doing a bachelor's in physics, I didn't have astronomy courses as part of my
program.
So that was something that was pretty disappointing to me because I really wanted to do astronomy,
but I couldn't quite do that yet.
So as an undergrad, I decided to do a summer project in astronomy.
So I emailed a professor or a number of professors working in astronomy in the Netherlands.
And this professor responded a few minutes later to my email, which I sent during Christmas
holidays.
So I was very surprised that he'd respond.
And it turns out he said it was unusual for him to get emails from students wanting to do
work in the summer.
So he thought, oh, come on by.
I'll tell you about my project.
And he told me he was one of the big leads of this amazing adventure to take an image of
a black horse.
And I thought that was the coolest thing I'd ever heard.
And I kind of jumped right in and undergrad and then continued my master's and PhD with the project.
And I've been here ever since.
And so Python, I got introduced to Python in undergrad for programming, simple data analysis.
Although most of my undergrad was spent on C programming and MATLAB because it was very much
on the physics side.
And this is mostly what physicists use.
But then when I transitioned into an astronomy program in my master's and PhD, it was really
almost all Python.
And so that kind of was kind of learned by doing kind of training that I had to do.
I had to learn how to write.
I didn't take any Python classes, really.
Just kind of learn as I go with data processing analysis.
Ended up playing a big part in the EHT results.
And it really plays a big part in most astronomy data analysis lately.
It seems like it's just taken over that world recently, at least for the analysis side, right?
Maybe not running on devices, right?
There's probably, I don't think there's any Python running on, say, JWST.
But maybe some of the earthbound telescopes have some in play.
I don't know.
Yeah, a lot of the data processing and analysis is done in Python.
A lot of visualizations are also done in Pythons.
So it's become a very kind of versatile and flexible tool for us to quickly kind of make figures
for papers, as many people have noticed in our papers, our kind of major kind of matplotlib tools
that we use to display our data.
Exactly.
I think it's just completely taken over that space, which is really neat.
And I think the Python world is much better for having all of these scientists and folks
with other backgrounds using it for whatever they're interested in, right?
It's not just, well, here's how Instagram uses it.
And here's how this other API company uses it, right?
There's a much more diverse mosaic of interests and things people want from the language.
Absolutely.
I think one of the big strengths that we drew from Python was really the open source community.
There are many open source codes available that we were able to make use of in astronomy that
were not necessarily designed for astronomy data science purposes.
But that just happened to be really useful for what we were trying to do with the data.
And so it ended up saving us an enormous amount of time.
And so whenever we speak about our project, I tried to make a big point of saying that we do rely a lot on the open source
development community, which I think is a part of the developer community that is often overlooked.
And that is really important to support open source work because a lot of it is done by students and postdocs who are in the sciences, who just happen to need code to do a certain thing.
And they make it available.
And it turns out to have many different uses in other people's science.
And so we really build on the shoulders of all these people.
And it saves so much time.
Yeah.
Like Matplotlib or Pandas or a lot of these are general purpose, right?
Yeah.
So you gave a really great presentation, a keynote at PyCon 2022.
And I'll be sure to link that and we'll pull some ideas out of there.
Before we get to really into the programming and Python side of things, give us maybe just a little bit of history of black holes.
You know, a lot of this starts with Einstein, right?
And as soon as you see that dip, well, if there's enough gravity here, but what have you put more?
And what have you put more?
Like how steep can that curve get until it, then stuff falls into it and it gets steeper, right?
Like give us the history.
History starts, I think in the 1700s, even before Einstein.
There was this runner, Reverend Mitchell, who thought about this idea of, say, when you have kind of something trying to leave the Earth's gravity,
it has a specific escape speed in order to leave the Earth's gravity.
And no matter the size and weight of the object trying to leave, it always has the same escape speed because it depends on the gravity of the Earth.
So he thought what would happen if you would kind of make the Earth so heavy, so compact that the escape speed would become higher than the speed of light.
And so he thought he made this thought experiment and he found out that by having the speed being higher than the speed of light,
this star that you collapse ends up being dark because all of the light that is at its surface cannot escape.
So you can't see it anymore.
If it doesn't get to your eye, you cannot see it.
So you end up with a dark star.
And that was this kind of thought experiment that led to being a black hole.
This dark star is actually a black hole.
So even in the 1700s, you know, philosophers, you know, religious people like Reverend Mitchell thought about these ideas,
about what it could look like if you had such an object.
And these objects often seemed, well, this was just a thought experiment.
And then when Einstein came along, he tried to describe space and time and gravity in a single unifying theory and ended up the theory of general relativity.
That was in 1915 when he showed that light was actually affected by gravity so that light would bend around heavy objects because of this bend in the space time.
And then a year later, Carl Schwarzschild found the first kind of real solution to Einstein's theory, to Einstein's equations,
which ended up in what we call the singularity, which showed that there is this object that is kind of a hole in the space time.
And this object has a horizon, which we call the event horizon.
And the size of the horizon, the radius is called now the Schwarzschild radius after Carl Schwarzschild.
And it showed that anything that goes beyond this horizon can never come back because the escape speed at the horizon is the speed of light.
So anything that goes beyond would need an escape speed higher than the speed of light.
So, and light is the fastest thing that goes.
So nothing.
Circle around and just kind of just somehow, probably still move, but still be trapped within that space.
Exactly.
So you can never, once you cross that point, you can never come back.
And at that time, so people thought a lot about the theory of Einstein and this mathematical object that we call the singularity.
At the time they thought, okay, black holes are a mathematical object, but there's no way they could be real, right?
So people thought, okay, mathematically, that's so interesting, but these things can't exist in the universe.
And then in the 1930s, Chandrasekhar, famous Indian astronomer, he thought about the mass of stars.
So they're, you know, stars when they die, they become white dwarfs.
And so they die in these kind of stellar dead stars.
But then he thought, what about more massive stars?
Stars are much heavier.
It turns out that he calculated it and white dwarfs have a maximum mass.
So there are certain classes of heavier stars that could never end up as white dwarfs because they would collapse to something more massive than a white dwarf.
So it could not be a white dwarf.
And it turns out what they collapsed into is a black hole.
And this was the very first evidence that black holes could exist in reality, in the universe.
But they're kind of an inevitable endpoint for hemi stars.
But since then, people have been thinking about where to find them.
And people have been detecting these powerful streams of gas coming from centers of galaxies that could only be powered by a black hole.
And the galaxy M87, that's 55 million light years away from us, does have one of these big streams.
So that and that was the very first stream of gas from a center of a galaxy ever observed by humanity in 1980.
Didn't know that it was going to be a black hole at the time.
But then there was more and more evidence that the only thing that could really power this really powerful process had to be a black hole.
So we started then the story of trying to understand what they would look like from an observer point of view.
How big does the black hole have to be for us to be able to see it from Earth?
How big do we design a telescope that could see it?
And it turns out there are only two black holes in the sky that are reachable with the telescope the size of the Earth.
That's our maximum size that we could go.
And one is this black hole in M87, which we imaged in 2019.
And then the second one is our very own black hole in our Milky Way, Sagittarius star, which we imaged in 2022, just last May.
Oh, do you have pictures published of that?
Yeah, that's right.
It came out on May 12, 2022.
Yeah, just two weeks after my PyCon talk.
Oh, that's what I mean.
Yeah, it was frustrating not to be able to say anything.
So I kept telling people, you know, oh, please watch Earth news.
And we have exciting stuff coming.
But I couldn't say anything.
We have more pictures.
I'm sure.
I know.
I've seen them.
Yeah.
It's also worth pointing out this whole project that you were on.
It's a long running project.
Yes.
It went from when did it start?
I know.
Yeah.
Kind of the technology part started in the late 90s and then actually starting to add more and more
telescopes started in 2007.
So it is about a 10 year process between the first telescopes that joined and then the 2017 campaign in which we had finally enough telescopes to take the data to make images.
So about 10 years of building.
And we're still building.
We're still adding more telescopes.
We've added three more since then.
Yeah.
So this is called the Event Horizon Telescope.
And it's a planet scale telescope.
I mean, I just saw a whole bunch of news and cool pictures from JWST, James Webb Space Telescope.
Yeah.
It's huge, but it's only like 30, how many meters across?
30 feet?
Some number of meters?
12 meters?
I don't know.
It's not planet sized.
No.
How do you build a planet sized one?
We use a very clever trick that is called interferometry that actually won the Nobel Prize back in the 70s by Martin Ryle, who designed this technique.
And what we do is, in fact, it would be great to have a telescope the size of the Earth that we could build, like a giant Death Star in space that we could look at.
It would save us so much trouble.
But it turns out convincing funding agencies to give us that kind of money wasn't really possible.
So we had to use this clever technique of interferometry.
And what we do with our technique is we sync up telescopes that are at strategic locations around the Earth.
They have to observe at the exact same time.
And they're timed accurately by atomic clocks that are so precise, they lose about a second every million years.
And so these clocks time-
They're big too, right?
They're like-
They're not the size of a mini fridge.
Yeah.
Wow, okay.
Yeah.
They're big and they're very expensive.
So we have to take really good care of them.
So there's one at each of our telescopes that time-tags the data as it arrives at each site.
And then we record that data onto hard drives.
And then we ship those hard drives to a central computer in which all of the data from all the telescopes are combined and aligned together to synthesize a virtual telescope that finds the Earth.
So that's how we do it.
The telescope is not physically the size of the Earth, but we synthesize it using telescopes that span-
the size of the Earth.
Right.
So kind of like little different sensors at 10, 15 locations.
Yeah, exactly.
But you have to keep them in sync.
That's the big problem, right?
Yeah.
And timing is everything for what we do.
Yeah.
And you think about how off can you be.
And you're talking the speed of light.
A little, a microsecond, you cover a lot of distance in that time and the speed of light, right?
That's right.
Yeah.
We have to be extremely accurate because any shift in time between signals means that we're no longer in the reference frame of the black hole.
Everything that we see has to be in the reference frame of the black hole.
So it all has to be exactly aligned at the same time.
And there are many, many different aspects in the instrumentation of each telescope that needs to be measured very accurately and corrected at the time of combining the signals.
And then we also go through a very lengthy data processing step in which we correct all the additional effects.
We also have to deal with the earth atmosphere because we observe such a high frequency in the radio, which is 230 gigahertz, dealing with very high frequency radio waves.
And they're very affected by the atmosphere.
So water vapor and instability in the atmosphere can scramble and destroy our signal.
So we have to correct it after the fact and kind of model the atmosphere at each site, remove it.
And then we can average our data down and build signal that way, build signal to noise.
And then finally, at the end of that, all that processing is where imaging comes in.
And then we can combine the data with our imaging softwares and then reconstruct images that best fit the data.
Yeah, you had a really cool visualization showing how obviously the earth is curved.
I liked how you tried to reinforce that with folks.
I really hope now that the earth is round.
Otherwise, it would make our job very weird.
This portion of Talk Python to Me is brought to you by Cox Automotive.
Cox Automotive isn't a car company.
It's a technology company that's transforming the automotive industry.
The team at Cox Automotive understands the future of car buying and ownership.
And they're looking for software developers, data engineers, scrum masters, and other experts to help make that happen.
If you're interested in innovating with brands like Kelly Blue Book, Auto Traders, and others, then you should check out Cox Automotive.
Just visit talkpython.fm/cox to find out more.
Thank you to Cox Automotive for sponsoring the show.
Yeah, we definitely have to take into account the curvature of the earth because of this delay in curvature.
Two telescopes far enough apart have to deal with the earth's curvature because then the signal doesn't arrive at the same time at each place.
It arrives down here earlier than arrives here.
And so we have to take into account this curvature difference to make the signal be at the exact same time.
And we do that at the simple computer stage.
Yeah. So maybe let's follow the data for a minute because I think that that's pretty interesting.
So it starts by things hit the different telescopes.
How many did you say were involved at the time?
Yeah. Eight.
Eight telescopes at six different locations.
Yeah, you got these eight different telescopes and they're all at different points on the earth.
So the signal's hitting them at different times just because it's not a lot of time difference,
but it's enough to make a difference in the light waves or the radio waves.
But then the next step gets pretty interesting.
Because it's not like we're using our fiber, our gigabit connection to upload the data.
You record it to a huge block of hard drives and you physically send the hard drives, right?
Yes, that's right.
Yeah, they're basically just standard kind of helium drives that we use just stacked together,
the kinds that are in laptops.
And then we record our data onto these hard drives.
They're kind of split into random folders with some names that I can't decipher,
people who work at their computer supercomputers do.
And then we pack them up.
We drive them down each mountain and then ship them, usually via FedEx or UPS,
to our two central correlation facilities where we combine the data.
One is at MIT Haystack in Boston, right here.
And then one is in Bonn, Germany at the Max Planck Institute for Radiostromy.
So they get half the data and they get half the data.
Yeah.
And there's one guy who used to be a police officer who is now in charge of logistics of
the data.
That's right.
Right?
Yeah.
I always like telling the story of Don because Don Souza used to be a police officer for the
state of Massachusetts.
And then since then, for the last 20 years, he's been dealing with the shipments for MIT
Haystack Observatory.
And all of the data goes for him, including the ones that go to Bonn.
And he's been doing this for years.
And he is our main shipping guy for the EHT.
And he's never lost a single package.
That's incredible.
Yeah.
There was just one, I think, funny mishap that happened once where we had a package
incoming from the South Pole that was meant to be our South Pole equipment.
And then he opened it and it was just a bunch of fabric.
That was a little bit of an issue.
Silk?
Yeah.
I don't remember if it was silk, but I think it's just regular fabric.
But then luckily, the help of the shipping company, the mishap was found.
And then the fabric went to the rightful owner.
And then the equipment got returned to us.
So everything went well.
Yeah.
You're like, they didn't get what they expected and we definitely didn't.
That's right.
How bad would it have been if you had lost it?
Would it have been catastrophic or would it have been just...
So it wasn't data.
It was just a piece of equipment.
It would have been expensive to get another one and go through the test.
And they would have probably delayed a couple of things.
But other than that, it would not have been catastrophic.
Yeah.
The other thing I think is interesting, as you said, the color code, the hard drives with green
ready to record and empty and red being awful.
And they got to be processed.
Yeah.
We have little round stickers on our modules that have the hard drives that color code.
Yeah.
I mean, why not, right?
You want to look over and see like, oh, that pile, that pile is going out, not coming in.
Exactly.
Yeah.
And often at the sites, we have spare modules that we have just in case we have issues recording
onto certain ones.
So it's good to know which ones we've recorded on and which ones are spare.
Yeah.
So there's a lot of data here, which is why you ship the hard drives.
Yeah.
If you had a couple of gigabytes, nobody wants to ship hard drives, right?
That's, they can break, they can get lost.
It's relatively slow unless you have petabytes of data.
Yeah.
And then all of a sudden you realize this is actually a problem.
I've been just doing some backups of all the podcast episodes and stuff that I did.
And they're like 20 gigs per episode and there's hundreds of, you know, 700.
I've been uploading for days, for four or five days.
I'm only through one of the podcasts for part of the time.
I'm like, this is insane.
And I'm so excited to appreciate just like, how hard is it to send this much data?
So when you're talking petabytes, and these are remote locations as well for the satellites
often, right?
So maybe not the best connection.
Yeah.
And I think it would be pretty much unfeasible to send data from our site, especially the
South Pole is our most remote location.
And during the South Pole winter, the internet is not very good.
So we have to rely on some satellite connections that happen twice a day.
And so the connections are about fast enough that it would take about 40 years to get all
the data from the South Pole that we take during our campaign.
So it's really just not feasible.
Our founding director always says that you cannot beat the bandwidth of a 747 sold with
hard drives.
So shipping is always the best.
Yeah, that's incredible.
But apparently, apparently true.
Yeah.
So we have a picture, right?
We have this amazing picture of the black hole.
We'll talk about the story about how we get it, but maybe just describe it for people.
I'm sure everyone has seen it, but it's maybe been a couple of years.
Yeah.
So this is a picture of the M87 black hole, what we call the first image of a black hole.
We released this picture in April 2019.
So three years ago now.
And this picture comes from our 2017 observing campaign.
And it is of the central black hole inside the galaxy M87, which is 55 million light years
away from us.
So the light you're looking at in this picture is 55 million years old, which is pretty cool.
And when it left the black hole, the first mammals were starting to appear on planet Earth.
Wow.
That's amazing.
That's pretty cool.
Yeah.
So what we're seeing in the middle is this kind of dark patch, which we call the black hole shadow.
And there's this big ring of light around it.
And the dark patch is where the black hole is inside.
And the reason why it's dark is because inside there's the black hole event horizon, which is actually a little bit smaller than the shadow.
And the path of the light rays that are around the event horizon makes the darkness in which the light can no longer escape and makes it puff up.
And so the light rays kind of graze a bigger area, which is why the shadow is actually bigger than the event horizon.
And then this ring of light around it is very, very hot gas.
So we're talking billions of degrees, a hot gas swirling around in the black holes, either accretion disk or bottom of the famous jet.
And this gas is swirling around so much that it's glowing.
And it emits light in the radio, which are those radio waves that we observe.
And so this is light that hasn't crossed the event horizon.
It's not close enough to be purled in into the darkness and not being able to come out.
But it's just close enough to show us this shadow of the black hole.
It illuminates the darkness.
So there's all this mass that's been attracted, but it's like whipping around, kind of like a toilet bowl, right?
The water is not just shooting through the hole.
It's kind of spinning, but it's spinning near the speed of light.
And there's lots of friction and stuff, which makes it glow, right?
That's right.
Yeah.
And what about the jet?
Does the jet come from this accretion disk or does it somehow come out of the black hole or where does it come from?
I mean, it can't, right?
Yeah.
It doesn't come out of the black hole, but it does come pretty close to the black hole.
So this image in particular didn't teach us too much about the jet other than we can't see it in our image because at the time we didn't have enough telescopes to see the jet because it's very, very faint at the frequency we're looking at.
But our polarization image, which came out in 2021, which showed kind of a more spiral structure on top that trace magnetic field around the black hole, showed us that the magnetic fields around the black hole are kind of in a spiral shape that twist enough and are ordered enough to be able to launch the jet.
So they're coming from the rotation speed of the black hole that makes the kind of the space time twist and the magnetic fields twist.
And that is launching the jet.
Okay.
Amazing.
I was just thinking last night, getting ready for this and doing some of the research, you know, the black hole, the lights and light and all that stuff goes into it.
All this matter.
And it's completely dark.
But inside, it must have an insane amount of light and energy somehow in there, right?
Like if you could get into it, it must be really bright.
If none of the light ever created can ever leave, it must just be building up in there.
It's hard to tell.
It would be hard to explain what you would see inside.
Once you fall in, space time is getting stretched like crazy.
The more in you go, the more stretch it gets because it inevitably should end up in the singularity in which all of space and time is compressed into a single point.
So everything is kind of shifted and spaghettified.
And so even the light ahead of you, you wouldn't be able to see it because it can never travel back in the direction where you are.
So whenever you're falling, whatever's in front of you, you cannot see because it cannot go out.
It can only go in.
And so...
Yeah, maybe more like time stops and there's nothing.
Maybe it's not that bright, huh?
Yeah.
If you look back behind you at the horizon and at the outside, you would see the entire history of the universe.
Yeah.
It's kind of a...
It's a very mind-boggling place.
And I think people do get very creative about what could happen inside a black hole, what you would see.
There are a lot of thought experiments around it.
But obviously, because of the physical boundary that is the event horizon, we can never know what is beyond.
I often get this question in talks like, well, what you show us is just the shadow of the black hole.
It's not the actual black hole itself, which I think is not a true question because I don't think the statement is true because this is everything we can see of the black hole.
It is the black hole in the only way we can see it.
Whatever is inside, we can never see.
So this is always a picture of a black hole.
This is it.
This is absolutely it.
Yeah, this is as far as you can go.
You cannot go further.
Mellie in the audience says, whoa, that is weird.
I agree.
It definitely is weird.
I think we get a lot of very emotional reactions whenever we talk about kind of the whole aspect of looking at this image and what it represents, this end of space and time, this kind of point of no return and this whole kind of world of what is beyond it, what is outside of it.
Yeah, very strange.
All right. So back to following the data along, we've got petabytes of data collected to these hard drives on site at these six different locations.
They get shipped to the two places in Cambridge, in the U.S. and in Bonn, Germany.
And then what happens?
Yeah. And then once all of the disks arrive, they get plugged into the kind of readout machines that kind of read out all the data from all the different sites.
And then we have supercomputers that align the data using a bunch of it's a very complicated machine, but it takes into account the Earth's curvature, a model of the Earth, the positions of the telescopes, different instrumentation effects that we measure at the sites that get put into this big model.
So that we record at the telescope is kind of all of the signal the telescope receives, which includes signal from the black hole, but also the atmosphere, the surroundings, the air, the instrument and stuff.
But because the only thing the telescopes have in common is the black hole signal, the rest of the data doesn't what we call doesn't correlate.
So it is not seen in common.
So at that point, a lot of the data that's noise can we can get rid of because we only care about what the telescopes see in common, which is what comes from space.
And so then we can reduce the data from petabytes to like the kind of hundreds of gigabytes level, terabyte, gigabyte level.
And then at that point, after the correlation, the data are ready to move on to the data calibration stage.
So we end up with kind of data files per observing day of about maybe 100 gigabytes, 300 gigabytes, kind of manageable for software.
Right.
Yeah.
You could transfer it over the Internet sort of levels of data.
Kind of.
Yeah.
So usually we can put it on a common archive.
That's where we have it stored, the correlated data.
And then the data teams go in and get the data and then process them through their software.
And we use cloud computing facilities to do data processing as well.
It really speeds up things.
I bet.
These are like big supercomputers in those two locations, not like AWS or Azure, is it?
No, they're at the locations.
That's right.
Yeah.
They're basically computer clusters.
Are these shared computers?
Are they dedicated especially for this job or are they more general?
They're dedicated especially for dealing with radio interferometry data.
Necessarily, they're not used all the time by us.
They're also used a lot by geodesy experiments.
So geodesy is the science of studying tectonic plates on Earth.
So they basically do the exact opposite to us.
They use telescopes at different locations on Earth, looking at a common source that doesn't change.
And then that way they can track the movement of the locations of the telescopes on Earth.
And they do these observations many, many times.
And that's where they get all combined.
And in fact, through geodesy, that's how they get the model of the Earth that we use in our experiment to correct for this movement of the telescope.
So there's a kind of very nice cycle that happens at the same location.
Yeah.
Yeah, that is a sympathetic cycle.
That's great.
This portion of Talk Python To Me is brought to you by Sentry.
How would you like to remove a little stress from your life?
Do you worry that users may be encountering errors, slowdowns, or crashes with your app right now?
Would you even know it until they sent you that support email?
How much better would it be to have the error or performance details immediately sent to you,
including the call stack and values of local variables and the active user recorded in the report?
With Sentry, this is not only possible, it's simple.
In fact, we use Sentry on all the Talk Python web properties.
We've actually fixed a bug triggered by a user and had the upgrade ready to roll out as we got the support email.
That was a great email to write back.
Hey, we already saw your error and have already rolled out the fix.
Imagine their surprise.
Surprise and delight your users.
Create your Sentry account at talkpython.fm/sentry.
And if you sign up with the code talkpython, all one word, it's good for two free months of Sentry's business plan,
which will give you up to 20 times as many monthly events as well as other features.
Create better software, delight your users, and support the podcast.
Visit talkpython.fm/sentry and use the coupon code talkpython.
It's in this calibration stage where Python starts to make its appearance, right?
Yeah.
So we have our data processing softwares are, I think, mostly built in, let's see, Fortran and C code.
So more of the kind of heavier data crunching parts.
And then there are a number of kind of post-processing tasks that do use Python.
Especially we have a kind of suite of post-processing tasks that make use of pandas a lot.
Because it offers a very neat data structure that allows us to organize data correction across, you know, kind of different columns of types of data.
And that's been very helpful for us.
Yeah.
You also get a lot of the matrix multiplication, vector math type of features from there, right?
Yeah.
It's very helpful.
And it has made our data processing a lot cleaner to do it through that data structure.
Now, this cycle where you take the data, you factor out the atmosphere and other interference, and then you add in all the good parts of the signal, the positive parts of the signal from the different telescopes.
You analyze it.
You said that this cycle goes around a couple of times and takes like a year and a half or something, right?
Yeah.
So from the time we took the data, which was in April 2017, to the time we released this image in April 2019, about one and a half years of that time was spent on the data processing.
And the feedback loop between our correlation centers and the data processing team.
I was part of the data processing team.
We're quite a small team working kind of around the clock on a pretty fast turnaround, just because we had kind of a lot of data issues identified at each site that needed to be run down and then going back upstream and then back down.
And we also had a feedback cycle with the imaging team that looked at early versions of the data and then discovered issues and then again going back upstream.
So there was a long process of really trying to fix all of the instrumentation parts that would contaminate the black hole data.
And then eventually we finally had a data set mature enough that would allow for actual imaging.
And then once that was done, we were dealing with data files in the kind of 100 megabyte sizes.
After data processing, we could really average our data down.
So we're dealing with complex numbers.
The data we get from the black hole are complex visibilities.
They have an amplitude and a phase.
Like 7 plus 2i, complex in that sense?
Exactly.
Yes.
Yeah.
And so because we have complex numbers, if we try to average numbers in which the phase part don't align, we end up destroying our signal because of destructive interference.
So we needed to align the phases in order to average down our signal to have constructive interference and build up signal.
And that's really the key part of the data processing.
That's what we do in order for the imaging teams to have the best data possible.
And then in the kind of 100 megabytes data, then we move on to our imaging software.
Indeed.
Quick question from the audience.
What sort of wait times do you experience when you're iterating this step when you're sort of working in, say, a Jupyter Notebook and you press run?
How long until you see the results?
I guess.
What's the experience of working like this?
Is it a lot of batch processing and you walk away for lunch?
Or is it small enough that you're getting immediate responses?
Yeah.
So I think outside of the Python packages is where we run most of the big data crunching.
I think in those parts, it would take a couple of days to run through our calibration pipeline.
And the Python parts would take maybe a couple hours.
Then when we're running diagnostic Jupyter Notebooks, it would take maybe not long because then at that point, we're basically in the 100 megabyte parts just doing data checks in which we make use a lot of Jupyter Notebooks, in fact.
And math plot will have to plot through our entire data steps and cross-check every part.
We have all these diagnostic notebooks that look at our data.
And those don't take much time to generate.
I would say maybe 20 minutes would generate kind of a single switch from a Jupyter Notebook.
Sure.
Very interesting.
So most of the work is done by this supercomputer and seeing Fortran.
And then you kind of are working with the raw answers in just numerical form, but you want them visualated.
You want them correlated or things like that.
Yeah.
And then when we're really looking to diagnose our data to find instrumentation errors, then visual representations are extremely useful.
And we've made a lot of use of kind of Jupyter Notebooks, especially in our data processing checks, to make sure everything looks good at each step of the pipeline.
All right.
One more audience question, then I'll move on.
Mellie asks, do you do logging or any staging to keep track of the stages they're at and not in a loop?
Yeah.
So each data pipeline has multiple stages in which we have kind of checkpoints at each stage where we have a suite of kind of Jupyter Notebooks or our suite of plots generated so that we can go back.
If there's an issue, we can go back in each stage and look at the outputs and make sure that we can generate or we can identify where the issue has happened or when the failure has occurred.
We have logs also of every process that comes in.
We also do very strict version control of each kind of software version.
Every time we run something, we do have a kind of version control package of all the software within one single pipeline run that we keep track of as well.
That's really interesting because you want to have reproducibility, right?
Absolutely.
Maybe something minor changed about the way Pandas does floating point operations.
I'm just making this up.
But, you know, theoretically over versions and give you a slightly different answer, right?
So you want to have a really clear snapshot of the entire system, right?
That's right.
And this was also very important for us when we released the papers for this image.
We also released the version controlled pipelines, both on the data side and on the imaging side that contained, you know, the exact version and kind of container form of the software that we use and the scripts that we used to generate these exact results.
Oh, awesome.
So this won the Nobel Prize, right?
It did not.
It did not?
No.
I'm sorry.
I don't know why I thought I did.
No, we won the breakthrough prize in physics in 2019.
It won the heart and the minds though.
So you did point out in your talk about how much this made a splash among people who are not scientists.
Yeah, that was something that was very shocking for us because when we building up the project, obviously we had talked about the projects in various media forums and it was interesting in the astronomy community.
So we knew there was some traction about the project that people would be interested in the results.
But we did not expect the magnitude at which this image would really go into pop culture.
Especially the fact that the next day after this release, it was on front pages of newspapers around the world.
Just really unusual for science results, especially around times around these times when 19 was not, you know, the most happy of years.
There was plenty of other stuff to occupy the news.
So it's definitely unusual.
And, you know, it ended up kind of trending number one on Twitter, which is, again, really surprising for science news.
We did not have a trending campaign, really.
We didn't prepare a hashtag.
It was not something we were not really social media savvy kind of people.
So it was it was not planned.
It just kind of organically happened.
And then there were so many memes and references.
And we were kind of referenced on talk shows and documentaries and news segments.
So it was really beyond anything we had expected.
And there was a lot of demand also to hear from us, not just from astronomy or physics, you know, academics,
but also a lot of demand from planetariums and science camps and even museums.
We did a bunch of talks at museums, which was really enjoyable and kind of reached to a different audience.
And that was all really cool.
I think really nice experience to kind of reach out to the community and make sure that people are part of it,
because these science results happen in very big teams.
And not just that, our teams are funded by taxpayer dollars.
They build on resources from various communities, including, you know, the developer community in programming and instrumentation community.
And, you know, all the giants and physics that came before us.
So it's really not just kind of a personal victory as a member of our team.
It's kind of a global effort.
And we want to make sure that we send a signal that teamwork is really a global thing and that big science happens in big teams.
And not everybody's playing a part in this in some way.
Are you familiar with the Mars rover GitHub?
Not the rover itself, but the Mars, the badge, I guess it's called.
No, I don't think so.
People got this for the people who worked on.
Where is this?
Oh, somebody show me the badge.
So for people who worked on the Mars lander, they got a special badge.
I don't know where it is.
Oh, really?
Oh.
I feel like there should be one of these as well.
That would be cool.
Right?
For the people that worked on this project.
Yeah.
There should be like a little black hole badge.
So I don't have it.
That would be very cool.
But, you know, it's like a little badge, like here's the Arctic contributor one.
There's a Mars rover one.
So people in GitHub out there, let's make a black hole badge.
Because there's so many of these open source projects that are indirectly used and contributors
to it.
And they could have a black hole badge.
And that would be awesome, I think.
That's a great idea.
I would be happy to reach out to people and try to see if I can make that happen.
I think that would be really awesome.
Yeah.
Indeed.
I don't know.
I think I don't know the username enough people to search for it.
But anyway, I think that would be really cool.
I think there should be a badge.
But let's go and talk Matplotlib for a minute.
So here you are presenting this keynote.
Yeah, my favorite.
Yeah, yeah.
Tell us about this picture that you got here.
And then we can maybe dive into how you know the picture that we see is actually the picture.
Yeah.
This is my physics process, which is kind of underwhelming when you show it to most people.
But people who are radio astronomers like me would be extremely excited seeing this.
And this is really the first kind of depiction of M87 I saw after we finished the data processing
pipeline.
This is before anyone made any image, by the way.
It was in May 2018 when we actually finished the very first run of the full pipeline in
data calibration.
And this was the end point, this plot.
And what this plot shows is kind of on the y-axis, there's a flux density, which is basically
the brightness of signal seen by pairs of telescopes.
And then on the x-axis, there is baseline length, which tells us kind of the separation between
pairs of telescopes.
So telescopes close together see a lot of signal in common.
Telescopes far apart see kind of smaller signal in common.
And depending on their location, they probe different sections of the image.
And so what we see here is this kind of, how would I say that, this kind of bump, double
bump in the image.
And what this double bump actually tells us in the plot is if you look at the dashed line,
this is what we would expect if the image on the sky was a uniform ring.
Uniform as in the brightness along the ring is the same everywhere.
So it's just a closed ring and the brightness is the same everywhere.
And so it turned out that this bump structure looked really close to a uniform ring.
And this is already really exciting because we were already trying to imagine what does
the ring look like and how this plot also tells us how big it is.
It tells us it was actually 42 microseconds wide, this ring, without any image.
And what was also really cool is that if you look at the first dip location, you will see
that the data actually split into two levels.
There is a lower level and an upper level.
And these correspond to two different directions on the sky that the stations are looking at.
The lower level are looking at the source in the east-west direction, so across, and they're
seeing a kind of dip.
And the other ones are looking at it in the north-south and they're seeing more signal.
And what this difference tells us is that the ring is not uniform, but it's actually asymmetrical
in the north-south.
There's one part that is brighter, either north or south, that is brighter than the other
side.
And if you look at our final image, it is brighter on the bottom than it is at the top.
Whereas if you were to slice across, you will see it's the same, right?
If you were to slice across, it's the same.
But if you were to slice like this, you have less signal up here and more signal down here.
Already the plot told us so much about what we're looking at.
Yeah.
So before we hit a picture, you're like, oh, we think we're onto something here, right?
Yes.
It was super exciting.
But then we were very careful because we thought, okay, there's a lot we can talk from this plot,
but let's not try to get ahead of ourselves.
Because there are a lot of types of images that could be tweaked to mimic this kind of structure.
And so that was kind of part of the next stages in which we wanted to split our teams into our big
imaging team into four independent teams.
And each team works independently for about seven weeks on analyzing the data in any means they wanted,
with any software they wanted, any decision they wanted.
And we came together after seven weeks at a workshop to compare the images.
And each team submitted a single image.
And it turns out that the images between the four teams were very, very similar to each other.
And so that was really exciting.
And everybody got a ring of the same size, 42 micrach seconds and brighter on the bottom.
Even though there were kind of some small differences across the images that came from the user-based
choices in the software, the main structure was there for everyone.
And I think that was one of my favorite days in the collaboration because we had so much fun that day.
It was such a big relief because we were using so many different techniques,
kind of imaging software that we weren't sure we would all get the same answer.
So we were really relieved that we did.
And then, you know, at the end of the day, we all went drinking at a bar and turned out it was karaoke night.
So we all sang karaoke together.
It was such a lovely day.
Were there any space-themed songs like Hello Major Tom or any of these things?
We sang Gua Tum San.
Oh, there you go.
Yeah.
That was a must.
Perfect.
Yeah.
But we changed the lyrics to Blackpool Shadow.
If you're taking petabytes of data and running them through a bunch of algorithms until they come down to megabytes,
or you said the final picture is actually like less than one meg.
Yeah.
Then, you know, what you're seeing, is that actually what you're seeing?
Or is that artifacts built up along the way, right?
So this must have been really comforting to try these different algorithms and go, they all come up with the same picture.
Yeah.
I think we were confident about what the data were telling us, but we wanted to make sure that we understood how our software were responding to the data.
So, you know, from kind of objective perspective, when we looked at the data plots, we knew what it was telling us.
But we wanted to make sure that we looked through every avenue of possible ways of creating images that look similar to the data.
And in fact, it's really very hard to create images that don't look like what we have.
And so no matter how much we tweaked our software, we would always end up with something very similar to the final image.
But we still wanted to put our software through this test and do a kind of process in which we would test it.
And in the end, the final stage ended up being trying to find what is the best kind of combinations of our software choices that gave us the best image.
Because we generated so many images with user-based choices, and they ended up pretty similar to each other with the base structure.
But how do you pick one image?
So that was kind of the dilemma we had at the final.
We didn't know how to pick a single image.
So we decided to create these kind of fake data sets that mimicked our data in which we knew the real truth images.
And they looked like rings or disks or double sources.
And then we made our softwares go through thousands of combinations of these parameters and kind of tested how well they could reproduce all four of them, all four images.
And then the ones that were kind of, we ranked them.
And then number one was the best image for each software.
And then the final image, you know, the famous image of a black hole is actually just the average of the three software images, the three best images from the software.
And this is also only one image of the black hole.
This is only April 11.
We observed M87 for four days in 2017.
So we have four images of this black hole from 2017.
And they all look the same.
And they all went through separate day observing, kind of separate processing, and always giving the same answer.
So you all are pretty sure that this is the picture.
Absolutely.
At least this is the radio astronomy picture.
Yeah, this is the picture at 230 gigahertz.
Yeah, exactly.
There's also pictures of that general space with Hubble and some other things that you laid out.
Yes, this is a really fun part of our campaign also, because obviously we're trying, the purpose of our experiment is to learn about black holes.
We want, I mean, these objects are super fascinating.
They're kind of mind boggling in how they exist and what they do to galactic environments.
These jets are enormous and they're pierced through entire galaxies.
And yet they come from a very tiny part of the galaxy itself.
And so in really understanding black holes, it's obviously really useful to look at one up close.
But we need to combine that knowledge with how it looks across all colors, all wavelengths.
And so we had a big multi-wavelength campaign at the same time as these observations across lots of different instruments.
So we had instruments in the high energy, in the X-ray, infrared, in optical, and also other radio wavelengths.
So we had a lot of partnerships with other observatories too, to make that happen.
And we learned a great deal about the black hole and its jet through that process.
Yeah.
It seems that black holes, supermassive black holes are a fundamental part of galaxies almost, right?
Absolutely.
They live in the centers of most galaxies.
M87 is one of the special ones because it has this big jet coming out of it.
So it's very nice to get a look at one that has a jet up close.
And actually, our Milky Way black hole, Sagittarius A star, is one of the very common, boring ones.
And so the fact that we can have both of them and look at both of them is kind of special because it gives us kind of two very different classes of black holes.
That end up looking very much the same.
Sagittarius A star's image looks a lot like M87.
This is really just because even though they're totally different black holes, they differ in mass by a factor of about 1500.
And our Milky Way is a spiral galaxy, right?
But M87's galaxy is elliptical and it's much older and much bigger than our Milky Way.
And M87 has a jet and Sagittarius A star doesn't seem to have one.
So there are two very different black holes.
And yet, once you get up close, it's really just the effects of gravity is so strong that it's really all you see.
And it's so cool that they look the same.
Yeah, it is amazing.
I guess it's worth just pointing out just how large the M87 black hole is.
Oh, yes.
The shadow of the M87 black hole could fit our entire solar system very easily.
It could, you know, the orbit of Pluto would be about in the middle, in the kind of mid-range inside the shadow.
And Voyager 1, which is the furthest human-made object, would be just at the edge of the shadow right now.
Yeah, that's incredible.
Very, very big.
If it were there, it would get sucked back in.
But if it were unaffected, it would be at the edge.
Yeah, so also 6.5 billion solar masses.
That's right.
Yeah.
That's really large.
That's a lot of mass.
It's actually one of the heaviest black holes in our universe.
I think the current heaviest is about 10, I think 10 billion solar masses, maybe a little more.
Wow, so that's not that much larger, yeah.
Yeah, it was one of the pretty larger ones.
Yeah.
All right, well, we're getting a little short on time.
So let me close this out with a bit of a future-looking question, and I'll give it to the IkuVu from the audience.
So what's next for EHT?
I'll ask it that way.
Yeah.
What now?
Since our 2017 campaign, we've kept observing.
We observed in 2018, where we added one telescope and increased our bandwidths, where we can have more sensitivity and cooler observations of magnetic fields.
We also observed in 2021, which was a kind of mid-COVID observation, which was a very strange one.
And in 2022, we added two new stations after that.
So we're now up to 11 with the EHT.
And we're trying to expand our array to have more telescopes.
So there's currently an effort called the Next Generation Event Horizon Telescope.
So the EHT so far only borrowed telescopes that just happened to be at the right locations that were actually built for completely different science programs, just radio telescopes that were able to observe at the frequency we wanted and at the right place.
So we didn't have much of a control over the locations of the telescopes.
And so in order to see more of our image, for example, to see the jet in MA-7, we need a lot more telescopes.
So the Next Generation EHT plans to have more control over where telescopes are going to be put.
So we're planning to get smaller dishes because we have the sensitivity now with the current EHT.
Smaller dishes at the locations where we need them, where we have holes in our virtual mirror to recover the structure.
And eventually, we'd like to observe more often.
So now we only observe two weeks a year.
We want to be able to observe every two weeks or every month.
And eventually, we could make movies of M-87.
And also, if we have enough telescopes, we would be able to make movies of Sagittarius A-Star as well.
And that will really show us the connection between the black holes, the gas swirling around it, and its jet and magnetic fields.
I think we could learn so much about black holes through that.
It would be so exciting.
You could get precise speed of the accretion disk and how it evolves.
Yeah.
And that's about a 10-year time scale.
In the far future, in kind of 20 to 30 years, members of our team are currently actively thinking about putting satellites into space.
Since we're running out of Earth's diameter to make a bigger telescope, there's only two ways to make your telescope bigger.
Either make the separation bigger or go to higher frequency so we have higher resolution.
And because of the Earth's atmosphere and the size of the Earth, we're limited in both.
But by going into space, we'd go above the atmosphere so you can go to higher frequency and you could have larger distances.
So by putting satellites into space, we could have enough resolution to maybe see up to 10 or even 50 more shadows of black holes, which would be really cool.
And then we'd have amazing sharp images of the two that we know and love to really test theories of gravity, which would be terribly exciting.
But of course, the technology to do that is not there yet, but it is moving forward.
And it's something we're thinking actively about.
Getting there.
Another thing you pointed out was all the results you got from this so far still back up the general theory of relativity, right?
That's right.
Yeah.
Einstein seems to be still correct.
Our black hole shadows are still very circular, which is what Einstein's theory predicts.
But we need much sharper images to see bigger differences.
We were able to rule out some theories, but there are still some theories that survive.
So we need to get to sharper and sharper images and a stronger and stronger test.
But I think we're moving in that direction.
Our first image has really just opened this new laboratory of images of black holes.
So it's going to be an exciting new field.
Yeah, this is possible.
Now let's build on it, right?
Yeah, absolutely.
Awesome.
All right.
Well, I think we'll leave it there for the black holes, but congratulations to you.
And I know that all the other people, often you point out that you're just the representative for this great big team.
Yeah.
I only play a small part.
It's really a big team effort and a community effort, and everybody is part of it.
Yeah, indeed.
Now, before we get out of here, let me ask you the final two questions.
I always ask, if you're going to write some Python code, what editor do you use these days?
What editor?
Oh, my God.
Super boring.
I use de-edit.
Oh, perfect.
Awesome.
Yeah, very boring.
If there's any Python package library you want to give a shout out to, maybe that was central to this work.
I know you already mentioned pandas and matplotlib.
Anything else that was really useful here?
Yeah, there was a really cool nested sampling algorithm that was developed by a Harvard grad student called Dynasty that was super useful for her modeling work and really kicked off a lot of that analysis.
So I'd like to shout that out, too.
And it's open source.
Yeah.
I'll put a link to it in the show notes for people.
All right.
Well, Sarah, thank you so much for coming on the show, for sharing your work.
As you saw, it's been an inspiration to everyone around the world.
So thank you.
Yeah, thank you for having me.
Yeah, you bet.
Bye.
This has been another episode of Talk Python to Me.
Thank you to our sponsors.
Be sure to check out what they're offering.
It really helps support the show.
Join Cox Automotive and use your technical skills to transform the way the world buys, sells, and owns cars.
Find an exciting position that's right for you at talkpython.fm/cox.
Take some stress out of your life.
Get notified immediately about errors and performance issues in your web or mobile applications with Sentry.
Just visit talkpython.fm/sentry and get started for free.
And be sure to use the promo code talkpython, all one word.
Want to level up your Python?
We have one of the largest catalogs of Python video courses over at Talk Python.
Our content ranges from true beginners to deeply advanced topics like memory and async.
And best of all, there's not a subscription in sight.
Check it out for yourself at training.talkpython.fm.
Be sure to subscribe to the show, open your favorite podcast app, and search for Python.
We should be right at the top.
You can also find the iTunes feed at /itunes, the Google Play feed at /play,
and the direct RSS feed at /rss on talkpython.fm.
We're live streaming most of our recordings these days.
If you want to be part of the show and have your comments featured on the air,
be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
This is your host, Michael Kennedy.
Thanks so much for listening.
I really appreciate it.
Now get out there and write some Python code.
Thank you.
Bye.
you
Thank you.