Learn Python with Talk Python's 270 hours of courses

#393: Space Science with Python Transcript

Recorded on Wednesday, Nov 30, 2022.

00:00 Space science is one of the few sciences that can spark wonder and imagining in almost anyone.

00:05 It also happens to be the domain of Python, with many missions, telescopes, and analysis

00:11 happening with Python playing a major role.

00:14 On this episode, we have Thomas Alvin, who has worked on several recent space missions.

00:18 He's also created a delightful YouTube channel called Space Science with Python.

00:23 It's approachable and yet concrete and realistic.

00:26 We're going to dive into some of his videos and see how Python can model things like asteroid flybys and render comets in 3D.

00:33 This is Talk Python to Me, episode 393, recorded November 30th, 2022.

00:39 Welcome to Talk Python to Me, a weekly podcast on Python.

00:55 This is your host, Michael Kennedy.

00:57 Follow me on Mastodon, where I'm @mkennedy, and follow the podcast using @talkpython, both on fosstodon.org.

01:05 Be careful with impersonating accounts on other instances.

01:07 There are many.

01:08 Keep up with the show and listen to over seven years of past episodes at talkpython.fm.

01:13 We've started streaming most of our episodes live on YouTube.

01:17 Subscribe to our YouTube channel over at talkpython.fm/youtube to get notified about upcoming shows and be part of that episode.

01:25 This episode of Talk Python to Me is brought to you by Compiler from Red Hat.

01:30 Listen to an episode of their podcast to demystify the tech industry over at talkpython.fm/compiler and the AWS Insiders podcast.

01:40 AWS is changing fast.

01:42 Listen in to keep up over at talkpython.fm/AWS Insiders.

01:47 It's also brought to you by Microsoft for Startups Founders Hub.

01:50 Get early stage support for your startup without the requirement to be VC backed or verified at talkpython.fm/foundershub.

01:58 Transcripts for this episode are sponsored by Assembly AI, the API platform for state of the art AI models that automatically transcribe and understand audio data at a large scale.

02:11 To learn more, visit talkpython.fm/assemblyai.

02:15 Thomas, welcome to talkpython.fm.

02:18 Thanks for inviting me, Michael.

02:19 I'm looking forward to this conversation here today and spread astronomy and Python a little bit around.

02:26 Ah, two things that are so amazing.

02:28 Obviously, people know that I love Python, but I really love maybe three angles here.

02:33 I love astronomy and I just love how it allows us to just dream so big, right?

02:39 And so much of science fiction is about space and interplanetary travel.

02:43 And I mean, obviously, we're not there, but thinking about space is just so amazing.

02:48 And also, all of your work on YouTube is really nice.

02:51 And we're going to talk a little bit about that.

02:53 So, super exciting topics that we got lined up here.

02:56 Yeah, thank you very much.

02:57 Indeed, space is really also one of my passions since I'm a child, right?

03:02 So, I worked on some stuff, still doing this as a hobby, as a side project, as a freelancer and so on.

03:08 So, I think we have some topics to talk in the next 60 minutes or so.

03:11 Yes, we do.

03:13 So, before we get into that, though, let's just set the stage with a little bit of background for yourself.

03:19 And what's your story?

03:20 How did you get into programming in Python?

03:22 And how do you find yourself doing all these live stream Python space science stuff on YouTube?

03:28 Yeah, sure.

03:29 So, as I just said, astronomy is part of my passion since I'm a kid, right?

03:32 But it's more about Python.

03:34 And back in 2009, I started studying physics.

03:37 And then I did my bachelor thesis in 2012 at the European Space Agency in Nordvalk in the Netherlands.

03:43 And I had the task to create some kind of simulation software to determine the detectability of so-called near-Earth objects.

03:53 So, objects that are, let's say, coming sometimes quite close to Earth.

03:56 And you want to observe them.

03:58 You want to detect them.

03:59 You have your telescopes.

04:00 But you don't want to waste resources.

04:02 You want to see, where do I have to look with what kind of settings?

04:06 So, this was my very first project and also my very first touching point or contact point with Python.

04:11 Afterwards, I did my master thesis in Göttingen, so in the middle of Germany, where I was also a student at the Max Planck Institute for Solar System Research.

04:22 And there I was part for three years, a little bit more than three years, on the Fiele mission.

04:27 So, part of the Rosetta mission, which flew to the comet Churyumov-Gerasimenko.

04:32 So, maybe some of the listeners know this ESA mission that was landing on the comet.

04:38 And there I was part of a small instrument called the Dust Impact Monitor, where we used Python for data analytics and so on.

04:45 So, if you read a paper about this mission from 2014 or so, Python is involved.

04:51 You can believe me that.

04:52 Afterwards, PhD, I was part of the Cassini mission of the so-called Cosmic Dust Analyzer.

04:59 You see asteroids, dust, you know.

05:01 The cosmos is big, but I was always interested in the small stuff.

05:05 And there I used Python for numerical simulations and also machine learning.

05:10 And this machine learning task is something that I'm still continuing because since three years I left academia.

05:16 I joined the automotive industry here in Stuttgart.

05:19 There are only two candidates and it's one of them.

05:22 It's Mercedes-Benz, where I work as a senior machine learning engineer.

05:25 But in my free time, I'm still doing these tutorial videos to share my knowledge.

05:29 I gathered over the last couple of years and I'm doing also freelance work at the Free University of Berlin,

05:36 continuing to develop some machine learning models for the Cassini mission.

05:41 Yeah.

05:42 So, this is my short story.

05:45 What a cool story.

05:46 I mean, you got to be on not just one, but two space missions, which is really, really fascinating.

05:53 Yeah.

05:54 So, people work on these for a long time, right?

05:56 Like, I know some of the people, I think it was Cassini, the people who were on the project when it was getting planned and then built and then oversaw.

06:03 That was many years, right?

06:05 And so, did you drop into it while it was kind of already going a little bit?

06:10 Or were you there from the start for some of these?

06:12 That's a very good question.

06:13 That's a very good question.

06:14 Of course, there's always this cliche saying of saying these missions are generation projects.

06:19 And I just can confirm it.

06:20 Totally right.

06:21 Like, the proposal for Cassini was, I think, a year or so, a few years before I was born.

06:28 And I'm now 32.

06:29 So, it is indeed a generation project.

06:32 Yeah.

06:33 I had a full head of black hair when it started and then I was bald when it landed.

06:36 You know, something like that, right?

06:38 That's going to be a totally reasonable statement.

06:39 Yeah, absolutely.

06:41 I mean, these missions, they take a long time to prepare, to build and test.

06:45 And then you have to fly there and get the data, derive conclusions.

06:49 And I mean, still now, Cassini is gone since, like, I think, five years now.

06:53 And there's still tons and tons of data that needs to be analyzed.

06:57 And the same thing applies also for the Rosetta mission.

06:59 Right.

07:00 Once the either the mission is over because the spacecraft was destroyed on purpose, like Cassini was crashed into Saturn.

07:08 So, it wouldn't potentially end up on one of the moons that could potentially have life and corrupt it.

07:13 Right.

07:14 Which is pretty, you have a lot of forethought or foresight there.

07:17 Or it just, the mission is over, it returns.

07:19 There's still, maybe the work almost just starts then, right?

07:22 If you're trying to understand all of this data and trying to tease out all the things that might be discovered.

07:28 Yep.

07:28 So, one example, I mean, Cassini, when it was launched in 1997, I think, machine learning was not really a big topic, right?

07:35 I mean, for example, support vector machines were invented in the 90s.

07:38 And then the last couple of years, you had now deep learning and other new methods and more computation power.

07:44 And now you have more and new ways of analyzing data.

07:49 And this was, nobody was thinking about this when the mission started, right?

07:53 So, of course, with new methods on Earth, you can analyze the data from the past.

07:58 And this applies for many other missions as well.

08:00 So, this is amazing times.

08:02 So, if anybody is interested in astronomy and Python, I mean, you can work with heritage data.

08:07 It's pretty cool.

08:08 And a lot of that data is public, right?

08:10 I don't know about ESA, but I know that NASA basically makes all of their data public.

08:15 How about ESA?

08:15 Yes, that's right.

08:16 So, NASA has a very good policy on this.

08:20 ESA also, they have also their data.

08:23 I'm not 100% sure they have like this.

08:25 I think NASA has this PDS, Planetary Data System or so, where all the data are public.

08:30 But I have to admit, I do not know the exact ESA policy.

08:35 So, I knew that our data.

08:38 We're public quite fast.

08:40 So, we publish everything on the PDS system with description and documentation.

08:43 But I can only speak for my team and not the others.

08:46 I do not know what the general policy is, though.

08:49 Yeah, pretty interesting and fortuitous because it's the inputs for a lot of your work that at

08:55 least we're discussing today.

08:55 Absolutely.

08:56 Yeah.

08:57 Question from the audience real quick.

08:58 Kim out there asks, as a ballpark, how much data does a mission like Cassini generate?

09:02 That's a good question.

09:03 I think there was a poster a few years back, I think in 2017.

09:07 And it was, let's say, in total, a large three-digit gigabyte number.

09:13 So, like hundreds of gigabytes.

09:15 Of course, one would say, I don't care.

09:18 There's no big data for me.

09:20 But you have to think that this is like really raw data, binary data.

09:23 If you are decompressing the data, it's way, way more.

09:26 So, for example, I was working on one instrument, the Cosmic Dust Analyzer.

09:30 And after decompressing all the data and put them into an SQL database, we had like, I don't

09:36 know, like 200 gigabytes of data, right?

09:39 Compressed, it was only a fraction of it.

09:40 So, it's really large number.

09:43 And especially also the images take a lot of space.

09:46 The other thing you got to think about is we don't have fiber from us to the spaceships,

09:51 right?

09:51 It's like a 2600 baud modem.

09:53 Not actually, but in terms of the bandwidth all the way out to Saturn.

09:57 That is not a high bandwidth connection, right?

10:00 Absolutely.

10:00 I mean, if I remember correctly, the Rosetta spacecraft had like, I think, 26k, like a 26k modem.

10:08 So, it was before my time when the internet was created, let's say.

10:12 And this underlines the importance of having good algorithms to compress the data and also

10:17 send the data in a smart way and also to analyze the data already on board, right?

10:22 So, for example, our instrument.

10:24 Right.

10:25 There's probably one level of filtering.

10:26 Yeah.

10:27 Yeah.

10:27 Like our instrument on Fila.

10:29 In fact, we would like to have all the signals, you know, every dimensionality and everything.

10:34 But at the end, we were only able to extract certain attributes of the signals to derive

10:39 our scientific conclusions.

10:40 So, yeah, there's always a caveat.

10:42 Yeah.

10:43 Well, even terrestrially, you know, on Earth, like CERN and Large Hadron Collider, they do

10:48 a bunch of processing right on those devices.

10:50 Because even when you have fiber, it's still completely the amount of raw data blows it away.

10:55 So, it's got to be trimmed down to something like, okay, well, we'll take 1% of the interesting

10:59 data and then look at that, which is still some tremendous number.

11:02 Yeah.

11:02 Final question, final follow-up on this, I suppose, before we move on.

11:05 I saw some conversations or some write-ups about the Deep Space Network.

11:11 Is that what it's called?

11:11 Where they passed the data around and reworking that to be higher bandwidth.

11:15 Do you know anything about this?

11:17 I did not work on any network topics.

11:19 But I remember as I saw these huge dishes and it's, I really can't say anything about the

11:25 bandwidth.

11:25 It depends on the mission, right?

11:27 If you have a mission close to the sun or at moon, you can get megabytes of data within

11:33 minutes.

11:33 But if you compare it, for example, with the Voyager missions that are really far beyond,

11:38 like it takes hours, the radio waves, it takes hours to get there and to come back.

11:42 We are talking there about really bytes or bits per second, right?

11:46 Although you have a dish of 80 meters, like for example, in Australia or so.

11:50 Improving this would probably improve the signal to noise ratio and everything to communicate

11:56 better with instruments that are far away.

11:58 Like also New Horizons that is also now beyond Pluto.

12:02 Yeah.

12:02 Amazing.

12:02 All right.

12:03 Let's make our way over towards the YouTube side of things.

12:07 So I ran across you over on Mastodon and what an interesting time it is that like there's

12:14 a new social network and people are kind of like finding a new way to do this thing we've

12:18 done for a long time.

12:19 So I saw your profile like, okay.

12:21 So it says former space scientists, ML engineer, creating Python and space and machine learning

12:27 tutorials on YouTube.

12:28 I'm like, all right, I got to go watch these.

12:29 And so I ended up on your YouTube channel and thinking just, you know, what a, what a

12:33 really cool project that you got going on there.

12:35 And I wanted to share that with everyone, especially the data science folks.

12:39 But even if you're just interested in a little bit of these data science tools, or, you know,

12:45 I can see this being really interesting for teachers, maybe high school and college who

12:50 want something slightly more interesting to show their students.

12:52 Then we're going to load up the New York city taxi cab tipping data once again.

12:57 And you're going to like, see that, you know, there's really a lot of cool possibilities

13:02 for things that are both pretty approachable, you know, not tons of code, but the results

13:06 are cool.

13:07 And it's sort of inspiring in the sense that we talked about with space at the opening.

13:10 Now, before we get into this, like specifically one thing I just want to get your thoughts on,

13:16 because this is really interesting.

13:17 I mean, you hear people talk about how social media is really bad and there's filter bubbles

13:22 and there's like misinformation and absolutely acknowledging all those things are true.

13:27 You know, places like YouTube, they just for all of their problems and all of their like

13:32 fail videos and memes of the day, there's a whole bunch of really, really incredible information.

13:38 So for example, I had Dr. Becky on and she's got a, an incredible YouTube channel over there,

13:43 like half a million subscribers.

13:45 You know, she does such a good job of being very real about talking about what she does

13:51 and as an astronomer and also sharing, you know, she does stuff where she's like sharing

13:54 notebooks on screen and whatnot, but it's still pretty informational.

13:57 Another one that I really like is Astrum with Alex McCaugen.

14:01 Just really, if you're just going to kick back and relax and watch something inspiring,

14:05 like this is a fantastic channel that people can check out.

14:08 But what caught my attention about your work is just, it's so concrete, right?

14:14 It has this sort of inspirational, amazing things, but then you're like, now let me pull up the Cassini data

14:18 and let me throw that into pandas.

14:20 And then there's a bunch of cool tools we'll talk about that used to visualize it.

14:24 So maybe what are your thoughts on this YouTube as an educational resource compared to say like

14:29 discovery channel or history channel or these other places you think these are great pro documentaries.

14:33 Like actually these are way crappier than these YouTube channels.

14:35 It's amazing.

14:36 Yeah, I think there are a lot of different channels out there for, let's say, different levels of knowledge, right?

14:41 I mean, like what you showed other channels, they would like to do something like public outreach.

14:46 So they explain science maybe on the basic level.

14:48 And it's pretty good and fair, right?

14:50 Because you reach more people, you reach a larger audience and make science more accessible to these people, right?

14:56 This applies for a lot of different science channels.

15:00 Like we've also like Vsauce or so who made also science quite popular, you know, with his funny videos, with his funny beginnings and so on.

15:08 And the thing I wanted to do is to introduce, let's say, this Python character to really work on the data.

15:15 And I know that I will never reach the audience like the others, right?

15:19 Because the others, they, let's say, they have a different goal, right?

15:23 They want to make, let's say, popular science, so to speak, right?

15:26 To make it accessible.

15:26 Here you have more requirements to understand that they have videos, like, for example, Python and so on.

15:32 Yeah.

15:32 So this is more like really for the people who are really into coding and so on.

15:37 But I was thinking, and I just checked YouTube and I was thinking, well, there are coding videos out there.

15:42 But this particular small spot, astronomy and Python, it was not, it was a gap.

15:48 Nobody was filling it.

15:48 And I was thinking, well, let's try it out and see how the response is.

15:52 And I was writing on Reddit, on Twitter and so on with some people.

15:55 And you talked about high school teachers.

15:57 Actually, some teachers were writing me and said, hey, Thomas, this is pretty cool.

16:01 Can I use your code?

16:02 And so I said, of course, everything is open source, right?

16:04 So you reach a different audience.

16:07 We do not reach thousands or hundreds of thousands of people, but people who like to interact with you, talk with you and have ideas and so on.

16:13 This is pretty cool.

16:14 And I like it.

16:15 This portion of Talk Python to me is sponsored by the Compiler podcast from Red Hat.

16:21 Just like you, I'm a big fan of podcasts.

16:24 And I'm happy to share a new one from a highly respected open source company.

16:28 Compiler, an original podcast from Red Hat.

16:30 Do you want to stay on top of tech without dedicating tons of time to it?

16:34 Compiler presents perspectives, topics and insights from the tech industry,

16:38 free from jargon and judgment.

16:40 They want to discover where technology is headed beyond the headlines and create a place for new IT professionals to learn, grow and thrive.

16:46 Compiler helps people break through the barriers and challenges turning code into community at all levels of the enterprise.

16:53 One recent and interesting episode is there, the great stack debate.

16:57 I love, love, love talking to people about how they architect their code,

17:00 the trade-offs and conventions they chose, and the costs, challenges and smiles that result.

17:06 This great stack debate episode is like that.

17:09 Check it out and see if software is more like an onion or more like lasagna,

17:13 or maybe even more complicated than that.

17:15 It's the first episode in Compiler's series on software stacks.

17:18 Learn more about Compiler at talkpython.fm/compiler.

17:22 The link is in your podcast player show notes.

17:25 And yes, you could just go search for Compiler and subscribe to it, but follow that link and click on your player's icon to add it.

17:33 That way they know you came from us.

17:34 Our thanks to the Compiler podcast for keeping this podcast going strong.

17:42 It's really amazing.

17:43 And also those people that you reach, many of them have an amplification effect, right?

17:48 Like somebody who watched Astrum probably just really enjoys it, but somebody who watches your video might go do like a college lecture

17:55 or make it part of their course or sort of spread it further.

17:58 So really, really, really cool.

17:59 And so what we're going to do is we're going to go through a couple of your videos

18:04 and highlight some of the ideas.

18:05 I don't know how long is your, you've got a playlist, which I'll link to called Space Science with Python.

18:10 It says how many videos, do you know how long it is?

18:12 About, let's look, roughly.

18:14 Oh, good question.

18:15 I have now over 60 videos.

18:17 So this is like the main playlist.

18:18 I have also near-earth objects and also machine learning.

18:21 So I think in total, I would say each video is between 10 to 25 minutes.

18:26 So in total, it's a few hours, let's say.

18:29 If you're more familiar with Python, you can also, let's say, take only a look at the Jupyter notebooks.

18:34 So yeah, it really depends where you would like to start.

18:37 And just small disclaimer, my very first videos, the audio quality is not so good.

18:42 And I'm really talking like a robot.

18:44 So yeah, it was kind of difficult for me in the beginning, but now it's way easier, let's say.

18:50 Sure.

18:50 Well, I can tell you the ones that I watched further down, perhaps, are, they're really good, really nicely done.

18:56 And I can definitely recommend them.

18:58 And as somebody who has gone on this journey of creating stuff public, right?

19:02 If I go back and listen to episode one, two, or three of my show, there's a bunch of great stuff there.

19:07 I'm just like, it's still a little bit of a cringeworthy type of thing, right?

19:11 So you're like, oh my gosh, listen to audio.

19:13 And that echo, where's that echo?

19:14 Who didn't notice this echo, you know?

19:16 All right.

19:16 So let's, before we dive into this, there's a couple of tools and libraries and stuff that I came across that were really,

19:24 some were new to me and some were really, really powerful.

19:26 So you have all of your code, as you said, on GitHub.

19:29 And we'll link to that.

19:30 Maybe the first one, maybe it was its name, or you just used it a lot on some of the first videos that I watched.

19:36 Spicy Pie.

19:37 I mean, what a cool name.

19:38 So what is this?

19:38 Tell us about Spicy Pie.

19:39 Yeah.

19:40 So Spicy Pie is based on a Python, on a toolkit from NASA.

19:45 So NASA introduced Spice, like, I would say, decades ago, right?

19:49 It's a toolkit based on C, Fortran, I think also Java.

19:53 And Spice is like, let's say, the tool to compute trajectories.

19:59 So the movement, the path of planets, of spacecraft, and so on.

20:03 But not only the movement, also, for example, the orientation of a spacecraft.

20:07 Where is my camera looking on Mars?

20:09 How is my instrument oriented with respect to Saturn and stuff like this?

20:13 So basically, every geometric question you would like to question, you can answer this with Spice.

20:20 There was one caveat, though.

20:22 There is no native support for Python.

20:25 And there's a one, I think he's still a PhD student, Andrew Annex.

20:30 And he was thinking, well, I write, I make a wrapper for the C library for Python.

20:35 So he is doing this.

20:37 And it's like an unofficial library of Spice, which we call now Spicy Pie.

20:43 But it includes everything, really everything.

20:45 And it's a little bit also kind of science.

20:49 It's not easy to approach this toolkit, because if you look at the official NASA documentation, it's sometimes, by all due respect, please, it sometimes looks a little bit older, let's say, you know, like an older HTML site.

21:00 I mean, the advantages that will remain for the next decades as well, right?

21:04 No fancy, no fancy front end stuff.

21:06 I put it in the Wayback Machine and it looks the same.

21:09 Something like that, right?

21:13 Yeah, and I try and Spicy Pie is something I use also my videos and try to help others or my viewers to approach this tool to compute trajectories, the positions of planets and so on, because you can do all these things with Spice.

21:26 And Spicy Pie is the perfect wrapper for it.

21:29 Yeah, it looks really, really easy to use.

21:31 And that's the kind of thing that just, it seems really unapproachable without a little bit of help.

21:37 On this day, at this second, how is Jupyter oriented over to Earth?

21:43 And if this comet is coming through at this angle, what's the distance between, you know, like those kinds of questions over time seem really tricky to answer.

21:50 And it's those kinds of things you can do with Spicy Pie, right?

21:53 Exactly, yes.

21:54 There's one small caveat, though.

21:56 You have to know so-called kernels.

21:58 So huge database with a lot of files where all the information is stored.

22:01 But again, I also put it into my videos and there is some documentation on this.

22:06 It's a, the learning curve is quite steep, but very, let's say, humbling in the beginning.

22:12 I can imagine.

22:14 Let's see.

22:15 Yeah.

22:15 So in a lot of your GitHubs, you'll have these kernel meta.txt.

22:20 What is this here?

22:22 It's just a picture.

22:23 And in here, it's got linked back to these particular files that have all the information that Spicy Pie needs, right?

22:29 So it's not completely standalone.

22:31 You've got to provide it these files to work from, right?

22:33 Exactly.

22:34 So I put these kernels that I use for my tutorials also in the GitHub repository.

22:38 And for example, these three kernels is like the second one.

22:42 You see this 0012.tls.

22:44 It's something that contains time information.

22:47 So you may know every four years you have a leap day, a day you have to add in your calendar, right?

22:52 But there's only half the truth.

22:54 There are also so-called leap seconds and leap milliseconds and what's or not.

22:58 And these crucial information are stored in these files, for example.

23:02 And you need to load them to convert time.

23:04 Well, you know, we don't care that much about a leap second here and there on Earth.

23:09 But if you're traveling for 10 years at 30,000 miles an hour, 50,000 kilometers an hour,

23:14 off by one second might mean you don't make it to the right place, right?

23:18 Exactly.

23:18 I mean, with SPICE, you also compute the orientation, for example, of your dishes to the spacecraft.

23:24 And pointing is very, very crucial.

23:26 I mean, light speed is not instant, right?

23:28 It also takes some time.

23:29 So you have to be really careful and really precise with your scientific work and alignment.

23:35 I suppose you do.

23:36 I was thinking of spaceships, but I wasn't thinking of light.

23:38 But you're right.

23:41 It totally does.

23:41 Another question for the audience.

23:43 Are those kernels effectively enormous tables of data about where Jupyter will be at a given time and stuff like that?

23:48 Basically, yeah, in a way they are.

23:50 But they are also, they are different kernels with different precision.

23:54 So for example, for the solar system, you have very precise kernels that cover a year, for example.

24:00 And you have maybe less precise kernels that cover 50,000 years or so.

24:04 Yeah.

24:04 So there are like really, really different kernels that cover different time ranges with different

24:09 precisions.

24:09 But you're basically right.

24:11 And let's say the art is to create your own kernels with your own methods and so on.

24:16 This is something I did not cover yet.

24:18 But we will get to this in the future.

24:19 Okay.

24:20 More videos to come.

24:21 All right.

24:22 So we spoke about spicy pie.

24:24 Excellent.

24:24 Another one you want to give a shout out to was AstroML.

24:27 AstroML was my first contact point with machine learning, actually.

24:33 So they have this package called AstroML.

24:36 And it's also, if you scroll down a little bit, then you will see also a book, which is called,

24:42 it's a very long title, Data Mining.

24:44 Oh yeah, there are statistics, data mining, machine learning, and astronomy.

24:48 And it's a book that covers space or astronomy, Python, and machine learning.

24:52 And this is like, I like this book.

24:55 I mean, I'm not getting paid for the advertisement or so.

24:57 I really read through it.

24:59 I went through the tutorials and so on.

25:00 The tutorials, some notebooks are for free.

25:03 And this is an extreme good resource to also get in touch with machine learning, Python, and

25:08 astronomy.

25:08 And it covers a lot of topics.

25:10 So if you have nothing to do for Christmas time, just take the book a few hours per day

25:16 and go through it.

25:17 Yeah.

25:18 Okay.

25:18 Fantastic.

25:19 And what kind of questions do you answer with AstroML?

25:21 Like when would you use it?

25:22 So AstroML has, for example, they have a lot of examples of star data and also extragalactical

25:29 data.

25:30 So for example, spectra, so-called spectra of galaxies, like a galaxy has a certain color.

25:36 Yeah.

25:36 So the color is like in physics, it's like a spectrum, different wavelengths or also active

25:41 galaxies and so on.

25:43 And then with AstroML, you can, for example, identify clusters.

25:46 Yeah.

25:46 You can classify the galaxies into different categories.

25:50 For example, you have also the galaxy scattered all over the sky.

25:54 They're using, for example, clustering algorithms to identify certain structures in the night sky.

26:00 So we have like huge so-called groups or so of galaxies.

26:03 And of course you can make your own empirical models, or you can also, for example, use

26:09 unsupervised machine learning methods to identify these huge clusters of galaxies.

26:13 And these are like one or two examples they cover with this book.

26:16 Cool.

26:17 Yeah.

26:17 You can understand things like based on the general color of the galaxy, it might be a

26:23 different age because the stars are older and the older stars burn in a different light

26:27 than like a bright new blue star, right?

26:30 Correct.

26:30 Yes.

26:30 Yeah.

26:31 Excellent.

26:31 And then one thing, I don't think I pulled it up.

26:33 Is it VizViz with a Z or VizViz with an S?

26:37 It's with an S.

26:38 We're going to find out.

26:39 Let's see how well.

26:40 Yeah.

26:40 Now you got to be careful when you search live for things.

26:42 Yeah.

26:43 Here we go.

26:44 On the top.

26:45 Yes.

26:45 Oh yeah.

26:46 It's all good.

26:47 It's all fine.

26:47 Perfect.

26:48 So you'll see this make an appearance as well.

26:52 And you tell us about VizViz because it's not, as you pointed out, it's not particularly popular

26:57 in terms of use.

26:58 It's got like right now, 198 stars.

27:01 But wow, it looks really incredible for exploring data.

27:04 Tell us about this.

27:05 I'm still wondering why it only has 200 stars.

27:07 So...

27:08 Well, we're going to double it today.

27:09 Let's say, let's go a little bit to the history.

27:11 Let's push it.

27:12 So maybe a little bit of history, why I found this.

27:14 What I liked at the beginning or retrospectively, what I liked when I started using Python, I had

27:19 no ideas about libraries, right?

27:21 I was completely unbiased.

27:22 What is NumPy?

27:23 What is Pandas?

27:24 I don't care.

27:24 I don't know.

27:25 So I was really searching in an unbiased way for a visualization tool for 3D rendering.

27:30 And I found this VizViz.

27:31 At this point, I had like 30 stars or so.

27:34 And I was like, huh, this looks really nice to make some animations of videos, for example,

27:38 of asteroids.

27:39 And I was also writing a little bit with the author and saying, hey, I would like to...

27:43 I have some questions.

27:44 Can you help me?

27:45 He helped me also because I was a beginner.

27:46 And over the last...

27:48 Over the years, I've always used it for my animations.

27:50 Also on my YouTube channel, you'll find like two videos of the Rosetta space for like a trajectory

27:55 and so on.

27:55 No fancy animation, just simple and easy.

27:58 And you can also use it, for example, to read in shape data of, for example, comets or

28:03 asteroids, really like the 3D things and then render them in OpenGL, play around and have

28:08 a feeling.

28:09 Yeah.

28:09 How does a comet look like?

28:11 And this package supports it out of the box.

28:13 And I'm extremely impressed.

28:14 And I'm also, let's say, negatively impressed that it's still 200 stars.

28:19 So shout out to Alma Klein and his VizViz package.

28:22 This is something that I use now since the beginning, since 10 years now.

28:26 Yeah.

28:27 It's what I saw you doing that was really, really cool.

28:30 We'll maybe see this in one of the videos, but you create a...

28:33 Take a 3D shape of the comet, a very high resolution one, lots of polygons.

28:38 Render that in a way that you can rotate and zoom in and explore it.

28:42 And then on top of that, you said, well, let's plot the path of the Phileas lander that landed

28:47 on it that you worked on and how it moved around in this like 3D space.

28:52 And you can rotate it and look at the elevation.

28:54 We have in Python, we have such a treasure, so many choices of visualization libraries.

29:01 I think that partly might be having some to do with it because it's just like, well,

29:05 there's these 400 things to choose from to visualize my data.

29:09 Where do I start?

29:10 So maybe people stick more to the most common ones, you know?

29:13 Exactly.

29:13 I mean, matplotlib, I mean, it's super fair, right?

29:16 Also for scientific plotting and so on.

29:18 But especially 3D rendering and so on, it's quite rare to find something impressive, easy

29:24 to use and something that has good performance, right?

29:27 Right.

29:27 And is interactive.

29:28 Yeah.

29:28 Absolutely.

29:29 Yeah.

29:29 All right.

29:30 Let's start.

29:31 This first video, I asked you to pull out a couple of videos that you thought were interesting.

29:35 And the first one is the asteroid flyby.

29:38 So maybe tell us a bit about this particular video, what you were trying to demonstrate.

29:44 And I'll pull up maybe this JPL small body database and look at the source code a little

29:49 bit too.

29:50 Yeah, sure.

29:50 So some of you of the viewers or listeners may have some science feeds, right?

29:56 Like you have some news, like for example, I don't know, killer asteroid is flying towards

30:01 earth or something like that.

30:02 And then you read the article and it's...

30:04 I saw a movie about that once.

30:05 People had to run.

30:05 It created this giant tsunami.

30:08 In golf, New York.

30:09 Yeah, exactly.

30:10 And then you read the article and it's put it into a perspective.

30:13 Ah, it's not dangerous at all.

30:14 And it's like X, Y, Z kilometers or miles passes by.

30:18 And well, you cannot really grasp this as a reader, right?

30:22 What is 50 million kilometers?

30:23 Is it a lot?

30:24 Is it not a lot?

30:25 You know, you don't get really a feeling.

30:27 And I was thinking, well, let's take a particular example like this one here, 2021 WP.

30:33 What a nice name.

30:34 And let's see how many miles or kilometers it has a flyby, right?

30:39 And this applies not only for this object, it applies for several other objects.

30:42 And if you know how to compute these things, if you know your, for example, Matplotlib routines

30:47 and so on, then you get a maybe better feeling and understanding that sometimes a close flyby,

30:53 let's say it's not that close, right?

30:55 So you know that, for example, it has like, I don't know, certain distance.

30:59 And then you convert it, for example, to a factor of the distance between moon and earth.

31:04 And then it says, yeah, it's the distance 100 times between earth and moon.

31:08 And you think like, well, in my world, that's not a close flyby.

31:11 Of course, astronomical scale it is, but it's not comparable to a flyby of, let's say, 2000 kilometers,

31:17 right?

31:17 Right.

31:18 So this helps a little bit to understand the data, to understand what's going on there.

31:22 And then also to visualize it and see, okay, what does it mean close flyby, right?

31:27 So I think that's quite helpful to understand that.

31:30 I think it is.

31:31 And one of the things you did here a lot was you said, okay, well, let's look at this.

31:35 And when you get the answers, you would say, well, we're going to not necessarily talk about

31:39 it in miles, but you would divide it by one LD.

31:43 What is that distance to the moon?

31:45 Yes.

31:45 The lunar distance, for example.

31:47 Yeah.

31:47 Yeah.

31:47 Lunar distance.

31:48 That's right.

31:48 So we have like two metrics.

31:50 Yeah.

31:50 The lunar distance and the so-called sphere of influence.

31:53 That's something else.

31:54 It's a larger sphere, virtual sphere.

31:56 Yeah.

31:56 So if people want to go through this one, this one, I would say really takes advantage of

32:01 spicy pie, right?

32:02 You do a couple of things.

32:04 You say, we're going to load up all the data about this asteroid.

32:06 We're going to load up the data about the earth and the moon and the sun and try to put

32:11 all these things together using spicy pie, right?

32:14 Exactly.

32:14 So most or some people who know a little bit about physics here, they say, well, you need

32:20 always this multi-body simulation.

32:22 You need to know the gravitational influence of the sun, the moon, of Mars and earth and so

32:28 on.

32:28 But sometimes, and this is also something I show here, you can reduce it to a simple two-body

32:32 problem.

32:33 You just assume that the earth has a certain gravitational influence up to a certain range.

32:38 And then you check if the asteroid is, for example, passing or crossing the so-called

32:46 sphere of influence.

32:47 I think for earth, it's like, I don't want to lie, 600,000 miles, respectively, a million

32:52 kilometers or so, something like that.

32:54 Is it three or four lunar distances?

32:56 Yeah.

32:56 Something like this.

32:57 Yeah.

32:57 2.4 or something.

32:59 Yeah.

32:59 It's even written there, right?

33:00 Yeah.

33:00 And this is, and then you switch, for example, between different coordinate systems and you

33:04 ignore the sun and then you only consider the earth and so on.

33:07 And of course, it's not as precise as an embodied simulation, but it helps to understand

33:12 what is the influence of each individual body in the solar system.

33:15 This portion of Talk Python is brought to you by the AWS Insiders podcast.

33:22 When was the last time you ordered a physical server to host your functions as a service, your

33:28 latest API, or your most recent web app?

33:30 I remember the last time I did.

33:32 That was around the year 2001.

33:33 And yes, it was quite the odyssey.

33:36 Of course, we don't do that anymore.

33:38 We run our code in the cloud with near instant provisioning and unparalleled data centers.

33:43 And the most popular cloud provider is AWS.

33:47 But for all the ways that AWS has made our lives easier, it has also opened a massive box of choices.

33:54 Should you choose platform as a service, or maybe it's still VMs with IaaS?

33:58 What about your database?

34:00 Maybe you should choose a managed service like RDS with Postgres?

34:03 Or is DynamoDB better?

34:05 Maybe Aurora?

34:06 No, wait.

34:07 I hear good things about Amazon DocumentDB too.

34:09 And that's where the AWS Insider podcast comes in.

34:13 This podcast helps technology leaders stay ahead of Amazon's constant pace of change and innovation.

34:19 Some relevant recent episodes include Storage Wars Database Edition, Microservices or Macro Disaster, and exploring computer vision at the edge with AWS Panorama.

34:30 They bring on guests to debate the options, and the episodes are vibrant and fun.

34:35 So if you want to have fun and make sense of AWS, head on over to talkpython.fm/AWS Insiders.

34:42 Yes, I know you probably already have a podcast player, and you can just search for it there.

34:47 But please use the link so that they know you came from us.

34:50 Thank you to the AWS Insider podcast for keeping this podcast going strong.

34:58 Yeah, so another thing you did on this one is you went through and said, let's figure out when this 2021 WP asteroid enters the Earth's sphere of influence and see how much it will be affected.

35:10 How much will its trajectory be altered through there, right?

35:13 Yes, so there are also books of astrodynamical theories where you can use some equations and, yeah, for example, predict the changes a little bit.

35:23 But here with this example, with this particular example, you get really a feeling and understanding how is the orbit altered, right?

35:30 And of course, if it's closer to the Earth, it's more severe than outside.

35:34 Also the dwell time.

35:36 So how long is the object in the sphere of influence with what kind of velocity, inclination angle, and so on.

35:42 So it's a very multidimensional problem.

35:44 It's not trivial.

35:45 You really have to have a feeling, understanding, and simulate this a little bit.

35:49 And then you see how Earth affects its cosmic vicinity, right?

35:54 Especially the smaller objects like the small asteroids and comets.

35:57 Yeah.

35:58 And just for people listening and not seeing this at the moment, the code that you wrote to figure out when will the thing enter the sphere of influence, given it starts way back when it was detected or whatever.

36:11 It's only like 11 or 12 lines of code.

36:13 It's not super complicated stuff.

36:15 Putting together things like Panda and SpicyPy and some simple Python.

36:19 And that includes two lines of reporting, I suppose, as well, doesn't it?

36:22 So it's pretty approachable, I think.

36:24 It's not obvious at first because SpicyPy has weird functions you got to call.

36:28 But once you know, like, this is the one I need, then it's not hard at all.

36:30 Exactly right.

36:31 I mean, this is how everybody of us started programming in a way, right?

36:34 We made maybe some overkill functions and for loops and what's or not, right?

36:39 And after time, you get a better feeling and understanding.

36:41 And of course, even this code, you could probably improve even more.

36:45 But I try to find a balance between, let's say, length of the code and also if the reader can comprehend it or not, right?

36:52 I mean, I could put everything in one line.

36:54 Nobody would understand it.

36:55 And I could say, well, it looks elegant.

36:57 Yeah.

36:58 But I try to make it explainable.

37:00 Yeah, there's definitely a balance of like, just don't use things too fancy.

37:03 Just make it approachable.

37:04 I think along these lines, there's a question from Martin.

37:06 It says, is there a primer to understanding trajectories of near-earth objects?

37:11 It's great to have the data, but you might be limited in what you can do if you're not a subject matter expert.

37:16 I think this video actually is not a bad start, but what would you say?

37:18 Yeah, that's a very good question.

37:20 I'm currently doing a small series on this near-earth object topic because, yeah, the orbital elements,

37:26 you have to understand orbital elements.

37:27 What are orbital elements?

37:28 You can generate a lot of insights in there.

37:31 But this is what I try to approach a little bit and help, right?

37:34 With all the small videos.

37:35 I think you see here, yeah, near-earth objects.

37:37 It's still not finished.

37:38 Yeah, you've got a whole playlist on it with 12 videos, right?

37:41 Yeah.

37:42 I think a new one will follow the next couple of days.

37:45 And the thing is, so the person who asked the question is totally right.

37:49 You have to have some kind of understanding of these concepts.

37:52 I try also to make some concept videos.

37:54 You see on the right hand side.

37:56 It's not related to Python at all.

37:57 And I have to apologize.

37:59 I'm not like a...

38:00 I don't have a million subscribers.

38:01 I don't have the animation skills to do these things.

38:04 Yeah, like good animations.

38:05 And so I really try to make it like a lecture in the university to make it as understandable,

38:11 approachable as possible.

38:12 But yeah, you have to dive also into the physics sometimes to really understand what's going on.

38:18 But the good thing about, especially asteroids and so on, the learning curve is also very steep.

38:23 You get really easily into this topic.

38:25 So just read one hour book about orbital elements or two hours and you can start.

38:30 Yeah.

38:30 And you've got a whole YouTube channel full of recommendations there.

38:33 Awesome.

38:33 Okay.

38:34 And so I guess to wrap this one up, you went through and you...

38:37 There's a bunch of orbital element properties in the JPL database that like the eccentricity,

38:42 and the peri...

38:44 Remind me what peri is?

38:46 Yeah, I can explain maybe one, two values.

38:48 So to demystify these numbers, right?

38:51 I mean, these numbers are really complex.

38:53 But for example, the eccentricity, you can say this value is between zero and one.

38:58 Zero means it's a perfect circle and very close to...

39:02 And the more it goes to one, it's more and more an elliptic.

39:05 It's more and more like shaped like an egg.

39:07 And if it's larger than one, then it will just make one revolution around the sun.

39:12 And then it goes au revoir into the outer space.

39:15 A Q, for example, is the closest distance this object will have with the sun.

39:19 And 0.93 means it's 93% of the distance between earth and sun.

39:25 So this is like really just a value.

39:28 It's like very, very close to 140 million kilometers or 80 million miles.

39:35 And the inclination is also another value.

39:37 Let's say this is the last one.

39:38 We have the earth.

39:40 Now imagine you have a table.

39:41 You know, the table.

39:42 So for the listeners, you have a table.

39:44 You put a small ball in the center.

39:46 That's your sun.

39:46 Now you have a second ball rolling around the sun.

39:49 That's the earth.

39:50 And the plane, the table is your so-called ecliptic plane.

39:54 But not every object is moving on this plane.

39:57 Now you have sometimes objects that are a little bit inclined, maybe by a few degrees or even 80 or 90 degrees.

40:03 This inclination is actually called inclination i.

40:07 And here it's, for example, 3.5, 3.8 degrees.

40:10 So these are the three elements you know now.

40:13 And it's quite easy to understand on the meta level.

40:15 Yeah.

40:16 Yeah, for sure.

40:17 So when you do all of your math, you come back and say, well, let me check this back against these numbers.

40:23 How close are we?

40:24 You know, how close do we get to predicting what JPL said it was?

40:27 Right.

40:28 So that's kind of a cool way to check.

40:29 Yeah.

40:29 I mean, there's like JPL has the data.

40:31 They've also, the Minor Planet Center has some data.

40:34 So they always deviate a little bit, right?

40:36 If you're, let's say, plus minus 1% or so or 0.1%, you can reach this with very simple Python scripts.

40:43 And I think that's quite fair results, right?

40:46 I mean, you don't have the ambition to write a highly scientific paper.

40:49 At the end, you can live with this.

40:52 And you have to be careful.

40:53 Also, you have like tons of numbers here.

40:55 And it suggests the precision that's not really existing.

40:58 Right.

40:58 Because the precision is limited by the uncertainty.

41:00 So the uncertainty is like really the cap.

41:02 And that's it.

41:03 One final thing I suppose to talk about before we move off this video is you talk about describing

41:10 where this comet, it's an asteroid, right?

41:13 Not a comet.

41:13 Or no, it was a comet or asteroid.

41:15 Which one is it?

41:15 Actually, I don't know.

41:16 It could be one of these things.

41:17 It's nobody written if it's an asteroid or a comet.

41:20 So most likely it's an asteroid, but you don't know.

41:22 Yeah.

41:22 Okay.

41:23 So it comes shooting by and you talk about, okay, well, let's use the solar.

41:27 We're coordinates to talk about it.

41:29 And then when it gets close enough, like gets into the sphere of influence and go, let's

41:33 switch it over to the earth oriented where earth is at the zero, zero point coordinates.

41:37 And we can, as it's closer, as we can talk about it relative to us, and then it shoots

41:41 back out and like switch it back to the solar.

41:43 Maybe talk real quickly about like how you think about that.

41:47 Yeah.

41:47 Those already explained it pretty well.

41:49 I mean, this is how you can compute the change of orbits of asteroids without some heavy

41:55 N-body simulation.

41:56 You just switch between coordinate systems with different centers.

41:59 And Michael, you explained it perfectly.

42:01 It is the way how you described it.

42:03 So it's a very, let's say, simple approach, but you can implement it quickly.

42:07 And it's really nice to see the results.

42:10 And it's great to think of as a human, like how far is it from earth and what direction

42:13 is it?

42:14 Like talking about from the sun, when you're trying to see how it relates to you, it makes

42:18 less sense.

42:18 And the math to do, it's pretty easy.

42:20 You just subtract, you know, do vector subtraction or addition for pandas rays, right?

42:25 Absolutely.

42:25 Yeah, you're right.

42:26 It's basically it.

42:27 Yeah.

42:27 Cool.

42:28 Okay.

42:28 Next one here, a comet in 3D.

42:30 And this is where you talk, where you show vis-vis.

42:33 Let's talk about this comet.

42:34 This is why I was confused whether it's a comet or asteroid or actually, yeah, it says comet.

42:39 It's a comet.

42:39 Yes.

42:40 Yeah.

42:40 Good.

42:40 Okay.

42:41 Got it.

42:41 I got it right.

42:42 So tell us about this thing, this 67P.

42:46 What is this?

42:47 So this was the main, or this was the scientific objective or goal of the Rosetta Fila mission

42:53 by ESA, right?

42:55 So ESA was sending the probe several years ago.

42:57 I think it was 2004, I think.

42:59 And it started to a 10 year journey to this comet.

43:02 And this comet is a so-called periodic comet.

43:05 So it revolves around our sun and the maximum distance from the sun is somewhere around

43:11 Jupyter.

43:12 So it's not like the heli comet, for example, that comes back every 90 or a hundred years.

43:16 It's like a regular visitor, but a very small one.

43:19 And ESA was thinking, well, that's a perfect goal.

43:21 Let's go there and see how this thing looks like.

43:24 And so they were sending the Rosetta spacecraft there and this came closer and closer in 2014

43:31 until the Rosetta spacecraft reached its final orbit, was deploying the lander.

43:35 Everybody was happy.

43:36 But in the meantime, the spacecraft made more and more and more images of this comet from

43:42 different angles.

43:43 So like a huge stereoscopic camera, you can derive 3D information.

43:49 And this 3D information is then going through some algorithms I'm not familiar with.

43:54 And then at the end, you get this shape model, as you said in the beginning of the podcast,

43:59 this polygon shape, right?

44:01 And this polygon shape is free data.

44:03 It's freely accessible.

44:04 And I just downloaded it and do some data crunching.

44:08 And then I used this to visualize it.

44:10 And then you can see really the different structures, how this two ball shape looks like.

44:17 You know, some people describe it as a rubber duck with a small head and a larger body.

44:21 And you will also see in this 3D that there is like a night site that's always in the night.

44:26 So you don't know how it looks like.

44:28 It's very, the 3D model is very smooth because you don't have any information there.

44:31 So it's pretty impressive to see how this model has been derived with data from millions of miles

44:38 away.

44:39 And now you can really reconstruct the comet on your small laptop.

44:43 Yeah, the one that you reconstructed with Python looks not the level of detail of maybe some of

44:49 the very highest resolution pictures here, but it looks pretty believable that those are the

44:53 same things, which is quite amazing.

44:55 Yeah, absolutely.

44:57 I mean, of course, the images are way better.

44:58 You said it's small and it is small, but it's approximately four kilometers.

45:03 It's not just a little pebble in space.

45:06 It's a kind of a thing, right?

45:08 It's somewhat big.

45:09 Yeah, it's, let's say, if this object would hit or fly it towards Earth, we would have a

45:14 problem, let's say, right?

45:16 They really would make a movie about that one.

45:18 Yeah.

45:18 Oh, yeah.

45:20 That's a, I don't know, some heroes can go there and crush the comet.

45:23 Exactly.

45:24 I need to get the old space shuttle out of storage.

45:28 Yep.

45:28 But if you compare, for example, Sharia of Gerasimenko with other comets like the heli

45:34 comet, it's, let's say, it has larger cousins out there, which are also brighter, and you

45:38 see them also in the night sky when they have, they pass by.

45:41 And this comet, you really do not see in the night sky from Earth.

45:45 So this is what, let's say, I would say is small because I cannot really see it with the

45:50 naked eye.

45:50 Yeah, it's still small in terms of planets and stuff.

45:54 But it's not entirely small compared to, say, I don't know.

45:57 If it were to hit us, we would notice.

45:59 All right.

45:59 So let me pull up a little bit of this picture.

46:01 So the first thing that I think is interesting in this video, which is space science with

46:06 Python part 22, comet in 3D, you said a lot of stuff you're doing directly in Visual Studio

46:12 code using the notebook format, which is pretty interesting.

46:15 This one you switched over to Jupyter and you started using Qt, right?

46:20 Qt, PyQt, to bring up this interactive window, which, you know, you create a little window

46:25 and show it and pair that with VizViz, which, you know, maybe, and where's that fit into your

46:31 world?

46:31 Like a lot of people, I think, kind of just stick with notebooks and output, whatever they

46:35 can get into the interactive widget inside the notebook.

46:37 Yeah.

46:38 So I really like VS Code, right?

46:40 I mean, one of the main features I use, especially also at work, is something called remote containers.

46:45 So you have a Docker container with your entire working environment and you can share it with

46:51 people on Windows, Mac, Linux, really doesn't matter, right?

46:53 This was, this is pretty, it's game changer, right?

46:56 But with PyQt, I was somehow not able to create this interactive widget out of the Docker

47:02 container.

47:02 So yeah, of course, but I was really playing around and try these things out, you know,

47:07 but at the end I was saying, you know what, it's fine.

47:10 Let's use a simple virtual environment.

47:12 Let's keep it running on the native JupyterLab environment and it's fine.

47:17 So this is where I was like saying, I cannot do everything, right?

47:22 This was really my nemesis.

47:23 I don't think I'd be able to get that going either.

47:26 So you pull this thing up and it initially doesn't have any shading or anything, but it

47:31 looks quite like what you would expect there.

47:34 Let me eventually get it going with like shadows and light sources.

47:38 It's a pretty cool achievement.

47:40 And this is all that VizViz library, right?

47:42 Exactly.

47:43 Yes.

47:43 So VizViz is doing it.

47:45 Yeah.

47:45 And it also was part of our science paper you see now here.

47:48 So for the podcast listeners, there's a key paper at astronomy and astrophysics.

47:53 And it was about the landing of the instrument also with our best instrument.

47:58 And yeah, the analysis you see here also here, figure four was done with matplotlib.

48:02 So Python and space is not only like filling YouTube videos and making tutorials.

48:07 It's really used in science.

48:09 So I know also a lot of other people using Python now and you see it every day now.

48:14 Same tools we all have, right?

48:15 Yeah.

48:15 In the next video, you know, this one, I could tell this really was a personal, like this meant

48:21 a lot to you when you put it out into the world.

48:23 The Philaeus is landing because this is what one of the projects you were directly involved

48:27 in, right?

48:28 Yes, exactly.

48:29 So I was part of the so-called dust impact monitor.

48:32 You can imagine it's a small cube, like a Rubik's cube, and it was detecting dust particles

48:38 or the task was to detect dust particles with something, you know, from your e-guitars.

48:43 Yeah.

48:43 So something called piezo crystals.

48:46 Yeah.

48:46 You're playing your guitar.

48:47 The vibrations go into some kind of crystal and the crystal is translating the vibration

48:51 into an electric signal.

48:52 And we use the same principle here to convert impacts of dust particles on our instrument

48:58 to learn something about their properties, like velocity, size and shape and so on.

49:03 And this was the paper you also saw just one second ago.

49:06 And we were, our instrument was on during the landing process where we also catch some data.

49:12 Yeah.

49:12 Amazing.

49:13 And one of the pictures you got here in this video is of, that's Rosetta, right?

49:18 The lander or no, this is Philaeus, the thing that was sent down.

49:21 Exactly.

49:22 Philaeus, the lander.

49:22 Yeah.

49:23 And it's really high res picture, I guess, taken from Rosetta.

49:26 And it's, you can see it on this rocky cliff.

49:29 It eventually found its way into this little crack where it's kind of, it's kind of stuck

49:32 there, right?

49:32 But what science did you get out of it before it got stuck in that crack and lost its solar

49:37 power?

49:37 That's a good question.

49:38 So a lot of different instruments were involved, right?

49:41 So I can say for our instrument, we had like this dust impact monitor and during the descent

49:46 phase, we had one impact.

49:48 So we detected exactly one particle.

49:51 It's not a lot.

49:52 I know instrument was not big, but at least we detected something because we wanted to have

49:56 main science work on the surface.

49:59 Now, since we landed in this cave or cavity or what's or not, we detect, we were not able

50:04 to detect anything, right?

50:06 We were, a lot of power was low.

50:08 So also other instruments were running there like instruments to generate, to create, get

50:13 out some samples to measure also a little bit the gas environment and so on to extract hopefully

50:20 some organic material and so on.

50:22 So every instrument was running.

50:24 Also a small hammer was hammering on the surface to see how hard is the surface.

50:29 And it was really hard.

50:31 So yeah, FIDO was running for a few days, I think, until the battery eventually ran out

50:36 and you see it was stuck in this shadow.

50:39 So the battery was not able to recharge.

50:41 And this was the end of the mission.

50:42 That's a little too bad that it got in the shadow, but still really cool.

50:46 People might not think there's going to be very much gas to detect, but like a lot of

50:52 comets, it was when it got close to the sun, it was shooting a bunch of gas out of it, right?

50:56 So it didn't have an atmosphere at four kilometers, but it did have gas coming off of it.

51:01 Yeah, exactly.

51:01 You're perfectly right.

51:03 So gas and dust and a lot of activity was going on.

51:06 So of course, as a human, you couldn't breathe this stuff, right?

51:09 It's very, very, it's not the high density, but yeah, there was a lot of stuff going on and

51:14 you can really measure it and you can detect it.

51:17 And I think also Rosetta, if I'm not mistaken, was sometimes hit by some dust particles and

51:22 you see them also in the camera system later.

51:24 So there's a lot of activity going on there on this tiny worlds.

51:28 And it's amazing to see that we were able to get there and measure it and see it in real

51:32 time.

51:33 This is really, really, really cool.

51:34 It's really amazing.

51:35 So if you go toward for this particular video, if you go into one thing, I just want to give

51:41 you credit for.

51:41 I do this with my YouTube videos as well.

51:43 Not the podcast, but the ones that are specifically made for YouTube.

51:47 It's putting chapters in.

51:48 It's really nice to have chapters like, okay, this is the section that I, you know, this

51:51 two minute segment is really nice.

51:52 Like here's where you're computing this thing or you're rendering that thing.

51:55 And it's nice.

51:56 So if you go over to the, the rebounces task section, you can see a really cool little animation

52:03 of you putting that together, you know, drawing the line and maybe tell us about this.

52:07 This goes back to VizViz being pretty neat as well.

52:10 Yeah.

52:10 So this was the information.

52:11 So Fila was supposed to land on some area and stay there, but unfortunately it was really,

52:17 really bouncing, you know, so for a few couple of times, I don't know how many times, two,

52:21 three times.

52:22 We can use now my video to check it.

52:24 And well, the data is quite precise.

52:27 So we have a very precise shape model and we have a very precise reconstruction of the

52:32 trajectory of the lander.

52:33 So path that Fila was taking.

52:35 And yeah, and I was just taking this totally different sources of data sources and merging

52:41 them together.

52:41 And this was using this high QT framework that's under the hood and you see it fitted perfectly.

52:48 The trajectory really is on the surface, you know, bouncing there.

52:51 And then you see at the end, the bottom right now.

52:54 So for the listeners now, there's like the end of the trajectory in the small shadow hills.

52:59 Yeah.

53:00 Where Fila died.

53:01 Or it got into that gavern, went to the cavern.

53:04 Yeah.

53:04 Went to rest.

53:05 Yeah.

53:05 The big sleep.

53:06 Exactly.

53:08 Yes.

53:09 I guess what surprised me about this is just how precisely this 3D model that was

53:13 made of the stereoscopic image data and then the reconstruction of the lander in this 3D

53:21 space, like it lines up perfectly.

53:22 Like you said, you know, even as you rotate it in three dimensions, you're like, I look at

53:26 it from this angle.

53:26 It's like, wow, that really is pretty accurate.

53:29 Yeah, absolutely.

53:30 I'm also always impressed how, I mean, in a science community and also an industry, right?

53:35 Everybody's playing a small part, right?

53:37 But you play a part.

53:38 And at the end to see the end product, it's like, it's amazing, right?

53:42 I mean, in science, it's like this, right?

53:43 It's like, wow, cool.

53:45 We were able to generate the data.

53:47 I mean, I have the same feeling as an industry, right?

53:49 It's like, oh my God, look at the product at the end.

53:51 You know, you're just, you did this very small part, but it's, you're part of it.

53:55 And it's always nice to see how this mosaic puzzle is getting together at the end, right?

54:01 And providing useful insights.

54:02 It's pretty unbelievable.

54:03 Yeah, it really, it really is.

54:05 All right, let's see.

54:06 What else do I want to say about it?

54:08 I guess we're getting kind of short on time here.

54:10 Let's talk about this AI 112, the autoencoder latent space visualization one.

54:16 So this is more close to your current work, right?

54:19 This ML work with space science, right?

54:22 Yeah.

54:22 Yeah.

54:23 I can explain a little bit here.

54:24 It's what I used in this series was a so-called reflectance spectra of asteroids.

54:29 So imagine you have a flashlight and you flash the asteroid.

54:34 You get a reflectance of the asteroid, of course, not a mirror or something, but you get something

54:38 back.

54:38 And based on the difference of your flashlight and what you get back, you can derive conclusions

54:44 about the chemical composition of the asteroid.

54:46 So there are like different spectra that encode different types.

54:51 And I use the spectra and this spectra are classified in certain classes.

54:54 Like some are, let's say, carbon rich.

54:57 Some are, let's say, stony or iron rich.

55:00 And I was thinking, well, we can use autoencoders to check the latent space and see if we can

55:08 see these different classes into a low dimensional space.

55:11 So for all the viewers and listeners who don't know this autoencoder, it is like you have your

55:16 data and you make a regression model on your data itself.

55:20 Like for example, a dog maps to a dog, a cat to a cat.

55:24 And in between in your neural network, you have like only a few attributes, only a few numbers.

55:29 And these numbers, they are like encoded representation of your information, like the information of

55:35 a cat or a dog.

55:36 The same thing you can do also with spectra of the asteroid.

55:39 And of course, I made a compression of, let's say, some spectra with 500 data points to two

55:45 dimensions.

55:46 This is severe information loss, but I did it here, not for a science paper, but more for

55:51 visualization representation.

55:52 Yeah.

55:52 And I was able then to see, to show that these different classes that were, that are human

55:58 made, they are also underlined by a data scientific approach, by this autoencoder.

56:03 And this autoencoder does not know what is an S-class asteroid, what is C-class.

56:08 It simply sees the spectra.

56:10 And then with this different clusters, you see, okay, there is like intrinsic different information

56:17 in the spectra, right?

56:18 So this is pretty cool.

56:20 And to see, you can improve autoencoders with variational autoencoder and so on.

56:24 But this was the, let's say, very first approach I wanted to show to anybody who's interested

56:29 in this topic.

56:30 Maybe this opens the box just a little bit for people who want to go back and work with

56:35 some of that legacy data or hysterical data, historical data, where people maybe tried to

56:41 figure out these things, just hand it off to grad students and say, yeah, how bright do you

56:45 think this is?

56:45 Is it more like that or more like this?

56:47 And then now you can apply these incredible machine learning models to it and maybe pull

56:52 out more nuanced details or find something new.

56:54 Yeah, exactly.

56:55 So for example, we have also the data from the Cassini spacecraft from the Saturn mission.

57:00 And we have like hundreds, thousands of spectra there.

57:03 And I'm doing currently some, yeah, in my freelance science job, some kind of classification task.

57:09 But at some point when we are finished with the project, I would like to make also this,

57:13 let's say, highly derived data also open, available to anybody, right?

57:17 And show, hey guys, these are the spectra.

57:20 Use other methods to classify, to cluster the spectra.

57:23 Because there are tons of ideas and I don't have all the time, right?

57:27 So I want others to be enabled to work and continue on this heritage data because it's

57:32 not boring just because it's old.

57:34 Yeah.

57:35 Now there's a lot of possibilities, I think, to start applying those things.

57:38 Thomas, I think we might be out of time to go over any more of the videos.

57:42 You have many, many more.

57:44 I definitely want to encourage people to go check out your channel and go through it.

57:49 If they're really interested in actually diving into some interesting but pretty approachable

57:54 science topics.

57:55 You've got all the code there on GitHub.

57:57 You walk through it without taking too many shortcuts.

57:59 And oh, look, I changed it.

58:02 Now it totally looks great.

58:03 You have no idea what I did, right?

58:04 It's pretty much, you can follow along well there.

58:06 So people should check that out.

58:07 Obviously, links in the show notes, right?

58:09 Yeah.

58:09 Thank you very much, Michael, for inviting me and to anybody.

58:12 If you have any questions or would like to know more stuff, just approach me.

58:17 Just message me.

58:18 I'm always open for ideas and feedback and I'm glad to help.

58:21 So just reach out to me.

58:22 Yeah, absolutely.

58:23 But you don't get out of here before I ask you the final two questions.

58:26 If you're going to write some code, I think I know your answer from what you said already,

58:29 but what editor are you using these days?

58:31 Well, I'm using for my daily job VS Code, of course.

58:34 It's very nice.

58:35 It's with remote containers.

58:36 It's a game changer.

58:37 You can even develop Spark locally in a container, which is like really amazing, right?

58:43 I have to say, though, and I say this is a perfect time now to say goodbye to Atom.

58:47 Atom was a very nice editor.

58:49 I use it also for years.

58:50 Now it's time to say goodbye to Atom.

58:53 And yeah, this is something I think we should address here in the podcast now.

58:59 Yeah.

58:59 Well, I feel like VS Code is a little bit like the next, the successor to Atom, right?

59:04 Atom came from GitHub, Microsoft bought GitHub.

59:07 They released Visual Studio Code.

59:09 They're both in a similar style of an editor.

59:12 They're both, I think, electron apps.

59:14 It feels like it's not so much as a goodbye as like a here's the next generation.

59:18 Yeah, exactly.

59:19 It's a very good successor.

59:21 So, of course, you're right.

59:22 It's a good times ahead, I think, with more and more plugins.

59:25 Yeah, cool.

59:26 I'm sure the VS Code people send me a message like, that was not accurate enough.

59:30 But no, conceptually, I think there was a lot of motivation that VS Code probably took

59:35 from Atom.

59:36 All right.

59:37 And then we've given a shout out to a couple of libraries like VizViz.

59:41 What library or tool or whatever you come across that you're like, oh, this is really cool.

59:46 I want to tell people about you.

59:47 What thing you want to give a shout out to?

59:48 I would like to give a shout out to AstroPy.

59:50 And there's also a very huge Python library that contains astronomy information.

59:56 You can extract data from astronomy databases and so on, apply methods and so on.

01:00:00 It is like, let's say, it's not like Spice, but let's say it's also quite complex.

01:00:05 So you have to dive into this, right?

01:00:07 But they're also open for contributions and so on.

01:00:10 So if you are interested in joining astronomy science data, try out AstroPy and see if you

01:00:17 can improve it even because this is a huge community and everybody is grateful for ideas

01:00:23 and contributions.

01:00:23 So a very mighty library in the astronomy community.

01:00:27 Yeah, absolutely.

01:00:28 All right, Thomas, thank you for being here.

01:00:30 Final call to action.

01:00:31 People are interested in this.

01:00:32 You know, what do you tell them?

01:00:33 How do they get started?

01:00:34 Well, yeah, just sounds like a cliche.

01:00:37 Just be curious, right?

01:00:38 But yeah, I mean, astronomy is not only also about Python and so on.

01:00:41 If you just, if you want to approach it differently, start also with public outreach with more public

01:00:46 outreach related YouTube channels.

01:00:49 Also getting a telescope or something really do hands-on stuff.

01:00:53 It's also quite nice.

01:00:54 You know, don't sit all the time in front of your computer.

01:00:56 Just grab binoculars, just grab a camera and so on and do your own stuff.

01:01:00 There's a lot of things.

01:01:01 Remote telescopes are out there for a few bucks a night where you can do your own images.

01:01:06 So yeah, it's not only about Python.

01:01:09 It's about Python.

01:01:10 I love Python, sure.

01:01:11 But also I'd like to tell you guys to approach astronomy from different angles.

01:01:16 Also sometimes going out, observe meteors, count them with your hands, and you can submit

01:01:21 this to some organization and everybody's grateful for that.

01:01:24 Excellent.

01:01:25 Well, we're all grateful for your YouTube work and putting that out there.

01:01:28 So thanks for all your contributions.

01:01:30 Thanks, Michael, for having me.

01:01:31 You bet.

01:01:32 Bye.

01:01:33 This has been another episode of Talk Python to me.

01:01:36 Thank you to our sponsors.

01:01:38 Be sure to check out what they're offering.

01:01:39 It really helps support the show.

01:01:41 Listen to an episode of Compiler, an original podcast from Red Hat.

01:01:45 Compiler unravels industry topics, trends, and things you've always wanted to know about

01:01:50 tech through interviews with the people who know it best.

01:01:53 Subscribe today by following talkpython.fm/compiler.

01:01:58 AWS is the lead cloud for developers.

01:02:00 But with over 250 services, it's an overwhelming set of choices.

01:02:05 That's where the AWS Insiders podcast comes in.

01:02:08 Their job is to help you make sense of all those AWS options.

01:02:12 Listen to an episode at talkpython.fm/AWS Insiders.

01:02:18 Want to level up your Python?

01:02:19 We have one of the largest catalogs of Python video courses over at Talk Python.

01:02:23 Our content ranges from true beginners to deeply advanced topics like memory and async.

01:02:28 And best of all, there's not a subscription in sight.

01:02:31 Check it out for yourself at training.talkpython.fm.

01:02:34 Be sure to subscribe to the show.

01:02:36 Open your favorite podcast app and search for Python.

01:02:38 We should be right at the top.

01:02:40 You can also find the iTunes feed at /itunes, the Google Play feed at /play,

01:02:45 and the direct RSS feed at /rss on talkpython.fm.

01:02:49 We're live streaming most of our recordings these days.

01:02:52 If you want to be part of the show and have your comments featured on the air,

01:02:56 be sure to subscribe to our YouTube channel at talkpython.fm/youtube.

01:03:00 This is your host, Michael Kennedy.

01:03:02 Thanks so much for listening.

01:03:03 I really appreciate it.

01:03:05 Now get out there and write some Python code.

01:03:07 I'll see you next time.

01:03:27 Thank you.

Back to show page
Talk Python's Mastodon Michael Kennedy's Mastodon