Summary
Using a rendering library can be a difficult task due to dependency issues and complicated APIs. Rohit Pandey wrote PyRay to address these issues in a pure Python library. In this episode he explains how he uses it to gain a more thorough understanding of mathematical models, how it compares to other options, and how you can use it for creating your own videos and GIFs.
Preface
- Hello and welcome to Podcast.__init__, the podcast about Python and the people who make it great.
- I would like to thank everyone who supports us on Patreon. Your contributions help to make the show sustainable.
- When you’re ready to launch your next project you’ll need somewhere to deploy it. Check out Linode at podastinit.com/linode and get a $20 credit to try out their fast and reliable Linux virtual servers for running your awesome app. And now you can deliver your work to your users even faster with the newly upgraded 200 GBit network in all of their datacenters.
- If you’re tired of cobbling together your deployment pipeline then it’s time to try out GoCD, the open source continuous delivery platform built by the people at ThoughtWorks who wrote the book about it. With GoCD you get complete visibility into the life-cycle of your software from one location. To download it now go to podcatinit.com/gocd. Professional support and enterprise plugins are available for added piece of mind.
- Visit the site to subscribe to the show, sign up for the newsletter, and read the show notes. And if you have any questions, comments, or suggestions I would love to hear them. You can reach me on Twitter at @Podcast__init__ or email hosts@podcastinit.com)
- To help other people find the show please leave a review on iTunes, or Google Play Music, tell your friends and co-workers, and share it on social media.
- A few announcements before we start the show:
- There’s still time to get your tickets for PyCon Colombia, happening February 9th and 10th. Go to pycon.co to learn more and register.
- There is also still time to register for the O’Reilly Software Architecture Conference in New York. Use the link podcastinit.com/sacon-new-york to register and save 20%
- If you work with data or want to learn more about how the projects you have heard about on the show get used in the real world then join me at the Open Data Science Conference in Boston from May 1st through the 4th. It has become one of the largest events for data scientists, data engineers, and data driven businesses to get together and learn how to be more effective. To save 60% off your tickets go to podcastinit.com/odsc-east-2018 and register.
- Your host as usual is Tobias Macey and today I’m interviewing Rohit Pandey about PyRay, a 3d rendering library written completely in python
Interview
- Introductions
- How did you get introduced to Python?
- Can you start by explaining what PyRay is and what motivated you to create it?
[rohit] PyRay is an open source library written completely in Python that let’s you render three and higher dimensional objects and scenes. Development on it has been ongoing and new features have so far come about from videos for my Youtube channel. - What does the internal architecture of PyRay look like and how has that design evolved since you first started working on it?
- What capabilities are unlocked by having a pure Python rendering library which would otherwise be impractical or impossible for Python developers to do with existing options?
[rohit] Having a pure Python library makes it accessible with minimal fixed cost to Python users. The tradeoff is you lose on speed, but for many applications that isn’t an issue. I haven’t seen a library coded completely in Python that let’s you manipulate 3d and higher dimensional objects. The core usecase right now is Mathematical artwork. Google geometric gifs and you’ll see some fascinating, mesmerizing results. But those are created for the most part using tools that are not Python. Which is a pity since Python has a very extensive library of Mathematical functions. - What have been some of the most challenging aspects of building and maintaining PyRay?
[rohit] 3d objects – getting mesh plots. I have to develop routines from scratch for almost everything – shading objects, etc. Animated routines for characters. -
What are some of the most interesting or unexpected uses of PyRay that you are aware of?
[rohit] Physical simulations. Ex: Testing if a solid is a fair die, getting lower bounds for space packing efficiencies of solids. Creating interactive demos where a user can draw to provide input. - For someone who wanted to contribute to PyRay are there any particular skills or experience that would be most helpful?
Basic linear algebra and python - What are some of the features or improvements that you have planned for the future of PyRay?
Keep In Touch
pyray repo – https://github.com/ryu577/pyray?utm_source=rss&utm_medium=rss
– Email
– GitHub
– LinkedIn
Picks
- Tobias
- Rohit
Links
- PyRay
- PyRay Youtube Videos
- Microsoft Azure
- Data Science
- Columbia University
- R
- Nielsen
- 3Blue1Brown – Music and Measure Theory
- Manim
- Python Subreddit
- Maya
- Blender
- Panda3D
- POVRay
- Pillow
- NumPy
- SciPy
- Support Vector Machine
- Logistic Regression
- Geometric GIFs
- Vapory
- RGB vs HSL Color Scales
- FFMPEG
- Quaternions
The intro and outro music is from Requiem for a Fish The Freak Fandango Orchestra / CC BY-SA
Hello, and welcome to podcast dot in it, the podcast about Python and the people who make it great. I would like to thank everyone who supports the show on Patreon. Your contributions help to make the show sustainable. When you're ready to launch your next project, you'll need somewhere to deploy it, so you should check out linode@podcast init.com/linode and get a $20 credit to try out their fast and reliable Linux virtual servers for running your app. And now you can deliver your work to your users even faster with the newly upgraded 200 gigabit network in all of their data centers. If you're tired of cobbling together your deployment pipeline, then it's time to try out GoCD, the open source continuous delivery platform built by the people at Thoughtworks who wrote the book about it. With GoCD, you get complete visibility into the life cycle of your software from 1 location. To download it now, go to podcastinit.com/gocd. Professional support and enterprise plug ins are available for added peace of mind. You can visit the site at podcastinnit.com to subscribe to the show, sign up for the newsletter, and read the show notes. And if you have any questions, comments, or suggestions, I would love to hear them. You can reach me on Twitter at podcastinit or email me at host@podcastinit.com.
To help other people find the show, please leave a review on Itunes or Google Play Music. Tell your friends and coworkers and share it on social media. Your host as usual is Tobias Macy. And today, I'm interviewing Rohit Pandey about Pyre, a 3 d rendering library written completely in Python. So, Rohit, could you start by introducing yourself? Sure.
[00:01:33] Unknown:
So, currently for my day job, I work as a data scientist for Microsoft Azure, Azure being the cloud service that, Microsoft offers. Throughout my, professional life, I've been working in statistics and analytics profiles. And, when I was doing while I was doing my master's in operations research at Columbia, I heard of this cool new field called, data science. This was back in 2013, so it was still kind of new at that point. So I was immediately drawn to it. So I I like kind of, applying math to real world problems, and and that's what I've been, doing for a living for a while. As, you mentioned, Tobias, on in my free time, I I like to do some other cool projects that also involve either learning about math in some way or, or or applying it to the real world. So 1 such project was, Py Ray, which which involved, you know, making nice visualizations, and we'll obviously get more into that, in the rest of the podcast. So, yeah, that that's me. And do you remember how you first got introduced to Python?
Yeah. When I first like, my very first language programming language was r, so this was when I was in a, working for for a company called Nielsen, which was a market research company, and that was kind of the, most popular open source language that was used. And then slowly, I started running into the limitations of R R and, you know, the with with the respect to memory and and that kind of stuff and performance. So then I started getting drawn to languages like Java and c sharp, and, at some at some point, I was just introduced to Python. I didn't catch on to it immediately. Like, initially, I was used to the whole, you know, structure of, having the curly brackets and all that stuff and, you know, like, just having indentation and stuff didn't immediately appeal to me. But, you know, later, I found that it was just the perfect mix of, you know, like a scripting like, it was a scripting language, so you didn't have to, like, compile a code every time and you could iterate fast that way. And then with the added benefit that it was actually you know, it wouldn't break if you were handling data that was larger than your computer's memory. So slowly, I got, you know, more and more drawn to it and found that it was just, just perfect for my use case. And, I've, you know, fallen deeper and deeper in love with it since because I later realized that you can do almost, anything in Python, like, right from serving websites to building complex math models, to, you know, creating visualizations and images, and stuff. So and and as we all know, it's gaining in popularity all the time. So, yeah, that's kind of my story of how I got introduced to and warmed up to Python, and it's now definitely my favorite language.
[00:04:33] Unknown:
And now that you've been using it for a while, you mentioned that you started working on Pyray as a hobby project for being able to do 3 d rendering of mathematical models using pure Python. So I'm wondering if you can explain a bit about what Pyray is fundamentally and maybe some of the other tools that it compares to and then what motivated you to create it particularly using pure Python as opposed to some of the other existing libraries that lean more heavily on compiled languages?
[00:05:07] Unknown:
So first, what is, Pyre? And I'd like to invoke this image, first of all. So we we know that, you know, our eyes are basically these 2 dimensional sheets, right, where, we we we we have these kind of planar images that form on them. And so, obviously, we have no trouble grasping, 2 d objects. We kind of grasp them almost immediately. And then when we look at something that's three-dimensional, and imagine, like, holding, like, a complex three-dimensional object in your hand, the first thing you're going to do is you're going to start turning it around, looking at it from different angles, and just kind of visually exploring it. So that's kind of a natural, the natural way that we, we explore, objects that are higher than 2 dimensional. And, right, I mean, obviously, we which is to be just 3 because we live in a three-dimensional world. So that's how I like to fundamentally think about Pi Ray.
Taking 3 or higher dime even higher dimensional objects and, rotating them around, and seeing how these, how how the view of this object changes, and and and in in the process getting a feel for, you know, the properties of the object and getting having our brains kind of process, intricately, what what the object is, like, what what the what what its shape is, etcetera. So, fundamentally, I think of Pyra as a, as a library for doing just that. Instead of doing it physically, you do it on a computer with Python. You, take an object, and you slowly rotate it in, you know, whichever way you want, and, that kind of gives you some insight, into it. And I think kind of that itself is it sounds simple, but you can get lots of very cool visualizations and, also very good insights, with with just a simple, simple approach. So so now okay. So now moving on to the second part, what motivated motivated me to build Pyre and why did I choose Python. So, actually the first inspiration for me was I saw this video by on YouTube, and it was on a channel called, 3 blue 1 brown. And that video was titled music and measure theory. So I was just, really impressed by it. Even before I saw that video, I had been, you know, imagining creating this visual field for mathematics. But, but but when I saw it, I immediately knew that I wanted to do something, similar. And this was by a guy called, Grant Sanderson, and he he had a tool written in Python. So I went and started to try to use his tool, and his tool, by the way, is called manim, m a n I m, and I believe it stands for math animations.
Now when I, tried to get his tool set up, you know, he made it very clear, like, on on GitHub in the readme file that it was primarily for, for his process of making mathematical animations. It wasn't meant to be a tool that, people could kind of pick up and just start using straight away. It uses it used, depended on some libraries that were not being maintained anymore. So this is kind of, in that way, I decided to create a new tool that completely diverged, which was the complete opposite of this man name, which which was Grant's tool, in terms of using kind of the latest libraries and designing it in such a way that users could just pick it up and run it with minimal effort, Python users, which is a substantial proportion of the people who code today, by the way. And, also on a more fundamental level, I kind of like, really enjoy learning about math concepts.
Like, how good I am at math is a different story altogether. But whenever I learn a new math concept, what I would find is that, you know, I would get something I would be struggling with it and something would click in in my head. And then I would kind of get this, like, ephemeral understanding of it, and it it would always be in the form of some visualization, some some image that I would see in my mind. And, then I would kind of I would feel that, yes, I got this. And then I would go do other stuff and then come back to it in, let's say, 2, 3 years. And then I would realize that that ephemeral image that I had in my mind is now gone. And then I would have to start building it up again.
So this at at some point, I felt like, you know, if if I spend a little more effort each time and, you know, make it, like, kind of crystallize that image, It's it's going to help me the next time. I, you know, I I I want to revisit that concept at the at the very minimum. And it might even help, other people because if it's something that helped me understand this concept so, you know, so well, then, maybe it can do the same to some with someone else's it can have the same effect on someone else's mind who's trying who's struggling with the same kind of problem. And why Python. Well, that's, I guess, the easiest, easiest of those those 3 parts.
It it's just, first of all, it's obviously an awesome language. Very, very, you you can start developing with it very fast. It's designed to be as similar to pseudo code as possible. You like, the user community of Python is is awesome. So right now, like, if you just go to Reddit and look at the Python group, subreddit versus looking at the subreddits for any other language, There's far and away more people on the Python subreddit. And not only is it big now, but I can kind of feel that it's it's really growing at a very fast pace. Like, today, like, when I interview people who are fresh out of college, no matter what they studied, computer science or applied math or statistics, whenever you ask them a coding question, they invariably start writing writing the code in, Python.
So and and and the reason for that is, that it's it's so much like pseudo code, and it's, like, really reduces the barrier to entry. So it's more and more becoming the first language people use. And and then they kind of even if they learn more languages, it's kind of something they default to. So if you want to gain some traction, it, you know, Python really helps you with that. Saying that, you know, this is a tool in Python really helps you with that, and you have a high chance that other people are going to pick your tool up, maybe contribute to it. In terms of in terms of some of the other options for for doing, this kind of stuff, like rendering 3 d objects, creating visualizations, etcetera. I haven't looked too much, into alternatives in other languages.
Obviously, there's the well known ones like Maya, etcetera. In Python, there are there are a few options. Blender is 1, that has Python APIs. It's a software for rendering 3 d, objects and, Panda 3 d is another. First 1, which is Blender, is, it's not, like, fundamentally a Python tool. It's it's a 3 d rendering software that happens to have some Python APIs, and so you have to be intricately familiar with with the actual, software first. And Pandas 3D is more more towards developing games. So that's that's the reason I felt that the thing I wanted to do was not addressed by any of these existing tools, and I kind of felt there was a need for a new tool.
[00:12:41] Unknown:
And wondering if you can talk a bit about how Pyray functions and some of the, libraries in the Python ecosystem that you leaned on to simplify some of the development and I'm particularly interested in what you're using for actually displaying the images that are generated from Pyre.
[00:13:01] Unknown:
Yeah. Great question. So first of all, I try to, keep, the dependencies on external libraries to a very minimum. Most of what Pyre does, and I should have actually mentioned this in the, in in in my previous answer for about the alternatives is, is is more or less covered in a program called POV ray, and that's kind of this it it is it it is kind of its own programming language. So, in in terms of, like, what I'm, using, to to do these things in Python, There's there's a library called the Python Imaging Library and it basically, gives you these very primitive primitive functions which is it lets you draw a line, it lets you draw an ellipse, lets you draw a plane, with, you know, if you want to add transparency to the plane, it lets you do that. It lets you do image manipulation, like, change the bytes of an image and and stuff like that. So all, like, really basic image manipulation stuff. So I've been, relying, like, mostly on that 1 library for the most part in terms of actually rendering, the image.
And, I mean, yeah, I feel that I kind of, I I feel I really feel that that's pretty much most covers most of what I need to do. I don't feel a need to take dependencies on other libraries, for most of my use cases. And and then, of course, like, for the more, mathematical aspects of, you you know, Python, obviously, as we all know, has a very rich suite of libraries in NumPy and scipy where you have all you can do all kinds of, you know, mathematical functions, machine learning if you want to, optimization, etcetera.
So, yeah, those I would say the 3 core libraries that I'm depending on right now are NumPy, scipy, and Python imaging library.
[00:14:53] Unknown:
And given the mathematical orientation of Pyre and your work as a data scientist, I'm wondering if you have found any use within your day job of the work that you've been doing with Pyre.
[00:15:06] Unknown:
Yeah. For sure. So many times there are we have discussions within a group of, you know, how we we are tackling this, let's say, classification problem. So I wonder what technique we should use. Should we use support vector machines or logistic regression? Why should we use something complicated like, support vector machines? So then because, Pyre has these, vivid with Pyray, I've been developing these these methods to kind of handle images. 1 example is that I can quickly pull up a quick demo where I let people draw, like, 2 categories, and then I can run a pie run the Python version of whatever the classification techniques are that we are debating.
And, and and and then we can just visualize, you know, how they are behaving. So it's it's we we we no we are no longer playing this guessing game of what would happen if you gave SVM this kind of data, and what would happen if you gave logistic regression that kind of data. You can just draw it on an image and then because I've because I've been going on Pyre, I have the ability to not just the ability, but I can very quickly interpret that image and, you know, visualize the the results very effectively. Yeah. That's definitely and there are many like, this classification example is is just 1 instance. There are a bunch of other examples where we are looking at, you know, survival distributions for machines in Azure. And we're like, okay. If the profile of the survival distribution looks like this, what will happen? So then I can quickly develop an application that will allow people to just draw it out and then show you the results in real time. Are there any particular
[00:16:39] Unknown:
capabilities or use cases that are unlocked or enabled by the fact that Pyre is implemented in pure Python that would otherwise be either impossible or impractical to do as a Python developer with some of the existing options that you mentioned, such as Blender or Maya or something like that? Sure. So Pyra is, like I said, like I said, fundamentally a library for creating these
[00:17:03] Unknown:
mathematical visualizations. So, for example, if you go to just go to Google and type geometric GIFs, Right? Or you can even go to the Byray, GitHub link, and, you'll see some of the cool GIFs there as well. You'll you'll see these really nice, cool GIF files that, you know, you wonder what they are. You're almost drawn into them. People have made some really beautiful, mathematical artwork. But invariably, when you start to dig into how did this person, you know, make this amazing piece of art, it's always in some obscure language with, you know, I've heard of people using, something that's used for web development to create those images, etcetera. And they admit that, you know, it's just something that works for me.
So that's something that I hope to change with Pyra where, you know, here's a cool kind of visualization. And then right here is the Python code If you're a Python user, you don't have to, you probably already have everything that I'm depending on. And you can just paste this 1 line of code in your console, 1 for importing and 1 for actually running the the the method, and and get the same result that I got, that that you see that that you see on your screen. Right? That's, definitely something that, is, I would say, the initial use case of Pyre. I don't intend for Pyre to always be just a library for creating mathematical art. And, there there really is no I I couldn't find any, like, Python library that's just for mathematical art. You can find mathematical library libraries people have put together for creating mathematical art that are not in Python. Then you can find other libraries in Python that are create that are geared towards visualization, but for different use cases. Like I said, Pandas 3d is more for developing games. So it's more of, oh, let me put a panda here, and let me make it walk, and let me rotate my camera in this way. So, you know, a lot of the nitty gritty, stuff is abstracted away. And so, and that obviously limits, the amount the number of things you can actually do with it. I think the closest thing that comes to Pyrene in that, regard are Manheim, which was the library that inspired me, and that's the library that, 3 blue the channel 3 blue 1 Brown uses. But I feel that I, like, I personally had a very hard time getting getting it set up. And then the the, other non Python library is, povray, which is this really old program that, and programming language that people have been using for a very long time, but then it's not Python. You know, you have to learn this it from scratch. If you want some nice mathematical, functions, You know, you either have to code them, from scratch or somehow learn to interface POV ray, with with those languages.
And and on that, topic, there's also there there are also some libraries where, you can actually try to interface POV Ray directly with Python. And 1 such library is called Vapory, v a p o r y. But again, it's, I tried that 1 out too. And again, the limitations there are that first you have to learn this PoE array, which is like a whole different language. And second, it's again a pain to kind of interface it with Python first. You have to get it installed. You have to have the right version installed. Then you have to make your Python installation aware of, the POB installation.
It that kind of it's not it's not trivial. Yeah. That that those are some of the, alternatives and, the use cases that, I'm that Puree is Ray is geared towards.
[00:20:28] Unknown:
And are there any aspects of the work that you've done on POV Ray in terms of building it initially or maintaining or evolving it that that have proven to be particularly challenging?
[00:20:41] Unknown:
So, yeah, it's there have definitely been challenges in terms of building and maintaining library like this. First of all, I have kind of, low background in graphics whatsoever so things like, you know, learning to shade objects in different ways as the lighting, you know, depends on how they're depending on how they're interacting with the ambient lighting, you know, how you change the RGB values. So, for example, until, like, a few weeks ago, I didn't know that there was a HSL scale that that's kind of exactly geared towards, this use case where, the l stands for luminosity.
So you can just hold the h and s values fixed and just change the luminosity depending on how, you know, how how exposed to light your your object is. So I kind of have to learn these things, from scratch, which is always challenging. Then, like, if I want some kind of complex objects. Right? Like, if I want simple objects like cubes or platonic solids, like an octahedron or a dodecahedron, it's kind of, not that hard at all to just code it up. But if I want a more complex 3 d object like, like, let's say, a face, or a port, or something like that, I have to somehow, get this data for, like, a mesh plot, of of the object, which is which I am imagining as just a collection of planes that I can just draw. And, and then with with the rotation capabilities of POV ray, just rotate it around, etcetera, and do what I want with it.
So that that's like, getting that data for these different kinds of objects has been a challenge, so far. Maybe I'm naive and there's just a easy way very easy solution to it, but, I haven't found a good 1, so far. Then, like, if you want to draw some characters, at at 1 point, I wanted to draw, like, a samurai. And then you wanted to move, you want to animate it. That's something that's very difficult to do from first principles, you know, just, animating these kind of characters in a very natural way. And I hope to get, and this is where I might need to interface with some good external libraries, because these kind of things are very hard to, code from scratch.
So, yeah, these these these are, basically the challenges I'm hoping to, I'm facing and, hoping to overcome.
[00:23:08] Unknown:
And when you're building a model or an image in p in, Pyre, is it sort of a live coding interface where you can write the initial line of code to put up a, you know, the first image and then you can add additional code to manipulate it in real time as you're typing the code and manipulating the object or is it more of a sort of read a vile print cycle where you write the code, see what it looks like, and then make another change and then rerender it and see what it looks like?
[00:23:41] Unknown:
Yeah. Currently, it's, it's it's not so much a real time, phenomena. Although I I imagine adding something a functionality like that won't be too hard, but, right now, just to keep things simple, it it's it's just an interface where you have to write your images out. Right now, all it does is write write images, and there are functions to write write a series of images which change according to, you know, the motion you want to see. And then you have to actually use an external library called FFmpeg or whatever you're comfortable with to, actually convert the that set series of images into a v into a video or a GIF file, or something like that.
So currently, I mean, for most of my use cases, I I feel that it's good enough, and it also keeps it keeps the library light free of external dependencies, but it's definitely something I I'll consider some functionality. I'll consider adding in in the future.
[00:24:52] Unknown:
And are there any projects or experiments using Pyray that you're aware of that are particularly interesting or unexpected?
[00:25:02] Unknown:
Sure. So first of all, like I mentioned, I I used it at Microsoft to create these interactive demo demos where you can test out you can get user input in the form of an a drawing they make on an image. Right? So some kind of profile or some kind of data they make on an image, and this could be easily generalized where you have this. Like, I can imagine having this website with all these demos. Things like that already exist, but I think that, like, a lot of different, cool demos can be made that are not necessarily available now, especially with regard to probability.
So, that's the that's the first 1. And then another interesting 1 is, physical simulations. So with Pyray, I've been developing these different kinds of objects. And, for example, let's say you want to get the you you you have a tetrahedron, and you want to get the, you know, bin packing density of a tetrahedron. By by that, I mean, like, with just with with tetrahedrons, can you, you know, fill up 3 d space? And the answer to that is no. Like, there'll always be some gaps if you just, you know, put tetrahedrons, which are these 4 faced solids, which have triangles for each face.
And and, so the question is, what is the maximum percentage of space you can fill with, with a tetrahedron? And, that's something that, you know, since I have all these 3 d objects developed in, Pyre, you can do this simulation. And, people have actually done similar simulations in the past to break previous, like, previously highest known bounds. Right? They they they're like, okay. The current bound is, like, 70%, but, hey. Look. I did the simulation, where I managed to pack 80% of the free space with with with tetrahedrons. So doing those kind of physical simulations, another example along those lines is I was making a YouTube video about, about fair fair dice fair fair dice. Right?
And and that's 1 of the, 1 of the main, use cases that I have for my day right now is to, create these mathematical YouTube videos. So, now you have these kind of different solids. Right? Like, you come up with this kind of new solid, which you're not sure is it a fair dice or not. And it's very hard to tell. So then, like, it's very hard to derive that mathematically. So again, you can do like mathematical simulation where you can just simulate an environment where this object is falling on the ground and bouncing around. And, that way you can you can get the probabilities of all its faces kind of touching the ground. And that will tell you, you know, whether it's, it's fair or not. So those are some kind of unexpected use cases that that you can use this tool for.
[00:28:02] Unknown:
And do you have any particular features or improvements that you have planned for future releases of Pyre? And are there any particular skill sets or areas of help that you're looking for from people who would like to contribute to the project?
[00:28:18] Unknown:
So, in terms of future improvements, I think, it's a movie stuff I talked about earlier in the podcast. So, animated characters, I'd love to have that functionality. I'd love to have a bunch of 3 d models of, different kinds of, you know, cartoon characters and also have the ability to, make them walk around and do stuff, and along those lines, also, like, more complex objects like like, globes so that you can maybe animate things like, you know, eclipses and flight paths, and stuff like that. Right now, as I said, the 4th piece of is, rotations. Right? So it's, it's how to rotate these 3 d objects. So and and that doesn't have to be restricted to just three-dimensional objects. You can also do that with 4 and higher dimensional objects and get a feel for, you know, the different properties of a 4 dimensional cube or a Tesseract, for example. And, I actually have a video of that on my channel. Right now, the the way I rotate these, I have a very rich suite of libraries for of methods for rotating these three-dimensional objects, but I just have this 1 method, for rotating higher 4 like, 4 and higher dimension. So I plan to look into, you know, more interesting ways to rotate a higher dimensional objects as well. Yeah. Those those are some of the things I'm, I'm looking to improve in future versions.
And then the next the the next part was, what skills would someone need to contribute to Pyre? I I don't imagine that there's a very high bar, frankly, as long as people have a basic familiarity with Python and no basic linear algebra. So as I said, Pire is all about rotations, and the way I handle rotations is through rotation matrices. Now if you in the industry, the more common way to go about handling rotation is through, a concept called quarterneons, which is this kind of analog of, complex numbers. And, just using rotation matrices is a much simpler approach, and you can actually extend it to higher to higher dimensions, which is not so trivial with something like, quaternions.
Of course, there are disadvantages to rotation matrices as well. But but you can imagine that that's like, a core part of, understanding these rotation matrices. So it's like I think if someone is, has, like, some surface familiarity with linear algebra and they just read the file, where I have the code that does these rotations, it happens to be called rotation dot pi, I think they'll be able to grasp pretty quickly what's going on. Even if they don't at first understand how exactly it's working, they'll at least know how to use those functions, as black boxes since I've I I feel like I've documented them well enough. Yeah. Basic linear algebra and very basic Python. Nothing fancy is
[00:31:15] Unknown:
is more than enough. And are there any other topics that you think we should cover before we start to close out the show? Well, yeah,
[00:31:23] Unknown:
that I will have this interesting conversation, with my colleagues here about, you know, Python versus, some of the other languages and kind of what's the, quote unquote, best language. So I just want to share some of the insights from the from that discussion. So I'm kind of the odd 1 out in my team in terms of Python being my favorite language. Some of my other teammates are from a more traditional engineering background, and they are used to compile languages like Java and c sharp. In Microsoft, we mostly use c sharp, of course. So and and and they kind of surprisingly were not on the same page in terms of, you know, Python being more awesome than those other languages. And, the re the reason for them, the fundamental difference is that, you know, Python is not strongly typed whereas these other compiled languages like c sharp and and Java are and and that obviously gives you some strengths and weaknesses. Right? There's some pros and cons. For for example, like a pro of not being strongly typed. And by by that, I mean, you don't have to explicitly specify the types of your variables. You could just say a equal to 5. Whereas in c sharp, for example, you would have to say int a equal to 5. So you'd have to specify that it's an integer. So this makes kind of the barrier to entry for Python a lot lower. It makes it very close to pseudocode. And before Microsoft, I was a data scientist at LinkedIn. 1 thing and I was in the growth team, for their mobile app. And 1 thing I realized was that these barriers to entry really matter. Like, you would have a form that users need to fill before they before they sign up for your website. If you put, like, a really trivial step in there that's, you know, you feel that anyone who's come this far will should have no issue at all doing this 1 more thing. Maybe just checking a ticking a checkbox or something. They're they're they're, you know, that's they're definitely not going to kind of, you know, give up just just for that, just for that little extra bit. But in practice, the fact is that when you're dealing with data for, millions of people, every small step, no matter how small it seems, you know, causes causes some drop off. Right? And I like to apply that concept to program languages as well. And I think this is the reason that more and more people are not only using Python but are getting into coding as well. Because Python removes some of these barriers that you by not being strongly typed and by being so close to pseudo code. So you have less and less drop off. Less and less people give up on programming in general. And it's very easy to start projects.
Right? It's it's very easy to kind of as I said, the the you'll find good communities. You'll you can get people on board a lot faster. On the flip side, once a project becomes very large, then some of the advantages of these more strongly typed languages come to the fore. So because c sharp is strongly typed, you can have like this really good development experience where you can just change like, the name of a variable or a class in 1 place, and it's just going to you know, in the editor itself, Visual Studio, it'll change it everywhere. Right? And those kinds of things are much easier.
Those kinds of features are much easier to have in strongly typed languages. And, you know, where you have, like, a large team of, 20 people or more working on a single code base. You have to design all kinds of unit tests. So it just becomes so much easier when your language is strongly typed. When your language is not strongly typed like Python, you have to account for all these. In your unit tests, you have to account for all these other use cases where, you know, data that you're not even expecting, comes up is, you know, is is fed into your method, which, you wouldn't even have to think about because the compiler would take care of that for you in a strongly typed language. So just I I feel that I just feel that was a very interesting conversation, we had. The, takeaway from that was that for really large projects, Like, as projects become larger and larger, they just become easier to manage, in these traditional strongly typed languages. But I feel that that's a good trade off because, you know, it's harder to even get to that mass where, that critical mass where the advantage of a strongly typed language will even start to shine. And that's something that, Python Python shines at. And in general, scripting languages that are not strongly typed shine at. So it's kind of a paradox if you think about it. Right? Because these kind of scripting languages are good if you want to get to a critical mass, but once you get to the critical mass then, you know, these strongly typed languages become become better. So, yeah, that was kind of an insight I wanted to share.
[00:36:00] Unknown:
Yeah. And that's 1 of the areas where the recent additions of the typing module and the type annotations for being able to actually enforce them, you know, in a static analysis phase allows some of these projects to continue to be viable as you do get to these larger code bases because you can maintain that type information throughout the code base without it being as cumbersome as it can be in more statically typed languages such as c sharp or c plus plus and Java.
[00:36:32] Unknown:
Yeah. And that that's something that you you feel will get better and better in a language like Python with time. But, again, like, my teammates, were of the opinion that, yes, it is going to become better and better, but it's never going to be at the same level as as the strongly typed languages because it's these features some of these features are just so much easier, and some of them might even be impossible rendered impossible by the fact that Python is, not strongly typed. But but, yeah, you can kind of rely on good docstrings and get better and better, libraries. And, actually, along that, along that, vein, another interesting aspect is that people don't like about Python is speed.
You can get a really good speed in compiled languages, but since Python is a scripting language, that's a bit of a trade off. And when I kind of posted about Pyre in on on Reddit, then that was something that I got a lot of comments on. People were saying that, you know, it's it's never going to be something that you can render in real time for something like visual game video games or visual effects, and those kinds of use cases. And you have to have, like, bare metal, like, c code to do stuff like that. And I agree that that's kind of the state of things now.
But you can imagine that that's something that's going to get definitely get better and better with time. If you'd compare the speeds of Python 3 with Python 2, you already see a big improvement. So, hopefully, that gap is going to close further and further. And as we know that the Python community is really large, and, and the growth is really accelerating. So that's going to push some of these improvements even you know, they're they're going to hopefully get us these improvements even faster. Yeah. That's kind of interesting to think about some of these, like, trade offs.
[00:38:16] Unknown:
Yeah. Definitely. Alright. Well, for anybody who wants to follow the work that you're up to or get in touch, I'll have you add your preferred contact information to the show notes. And so with that, I'll move us into the picks. And this week, I'm going to choose a series of books that I started recently by Fred Saberhagen who I've mentioned in previous picks for 1 of his other series and this 1 it's a sci fi series called the Berserker series which is set in the sort of distant future where mankind is starting its expansion throughout the galaxy and they've come up against this c you know, these fleets of machines that were craft crafted, you know, in the distant past by this other unknown race that were set with the task of exterminating all life in the galaxy.
And so it's this, series of books about the war between mankind and these emotionless machines that are just going about their task with mechanical efficiency. So it's an interesting set of books so far with, you know, the and Fred Saberhagen is a great author who I've enjoyed in the past. So if sci fi is something that you're interested in, it's definitely a series worth checking out. And so with that, I'll pass it to you, Rohit. Do you have any PIX alerts this week?
[00:39:31] Unknown:
Sure. So I'll start with, something more, related to Pyray, and then I'll transition towards something closer to what you said. So for for my picks, I use Pyre right now for, primarily for creating videos and blogs, putting GIF files into blogs, like I mentioned. For my the videos I create are on, my YouTube channel. It's called Samurai Math. Some of them, because I was just starting out, don't have really good sound quality. But I think the visualizations on some of them, especially the ones with a higher number of views are And and then the channel that kind of inspired me to start, making my videos and creating Pyre was, as I mentioned, 3 blue 1 brown. And that's definitely, like, an awesome channel if you want to learn about math and if you want to be good at maths. That guy is really good at, creating these really rich mathematical animations and getting to the crux of, like, a mathematical topic that you just wouldn't have, you know, otherwise realized even even if you use it day in and day out. And then transitioning to to to the topic that that your sci fi book, was about Tobias. There's a very, awesome channel, by it's the channel has the creator's name on it, which is Isaac Arthur.
So just look him up on YouTube. He talks a lot about how humanity is going to survive in the long term, what strategies we are going to use, how we are going to survive. You know, the sun expanding and engulfing the earth, and all the stars in the universe slowly fading away. You know, in, and and 1 kind of interesting, tidbit is that, you know, when we'll have this state in the universe where there'll be just black holes left, we'll actually be able to prolong our life, if you play our cards, right, to a much longer time span than the the total lifespan of the universe of 8 stars in it. So, you know, the the time of the stars will just be kind of an interesting backwater, and the, like, the true extent of civilization will be realized in this, in this era in this post star era. Definitely something along the vein of sci fi and definitely very thought provoking.
Those those would be my picks.
[00:41:49] Unknown:
Alright. Well, I appreciate you taking the time out of your day to join me and talk about the work you're doing with Piray. It's definitely an interesting project and 1 that I can tell you've put a lot of effort into, and I'm sure a lot of people are going to be able to get some benefit out of that. So thank you for your time and the work that you've been doing, and I hope you enjoy the rest of your evening. Thanks for having me at Avast. It was a pleasure.
Introduction to Rohit Pandey and Pyre
Rohit's Journey with Python
What is Pyre?
Technical Details and Libraries Used in Pyre
Applications of Pyre in Data Science
Unique Capabilities of Pyre
Challenges in Building and Maintaining Pyre
How Pyre Works: Live Coding vs. Batch Processing
Interesting Projects and Experiments with Pyre
Future Plans and Contributions for Pyre
Discussion on Python vs. Other Languages
Closing Thoughts and Picks