As a software engineer who uses a lot of code written by medical researchers - please don't just learn the basics! If you're going to publish your code, it's just as important as the text and figures of your paper. Comments, modularity, good variable and procedure names, and most importantly documentation of how to use the code is critical. Dr. Smethurst, I think this is a great intro to how important software can be. A lot of engineers don't think of it this way, but I definitely think we should be making computers easy for everyone to program - so that writing good code is easy and you can focus on the interesting parts of your science!
@TraneFrancks4 жыл бұрын
One of the biggest aspects is to never assume that you'll even be able to understand what your own code is doing a year or two later. I've got code that I've been maintaining for literally the last 20 years. Excellent readability, commenting and documentation are key to not having to waste hours or even days when it comes to having to maintain the code we write. And key here is that writing the initial code is just the beginning of that code's life cycle.
@abebuckingham81984 жыл бұрын
If we can convince people to use meaningful variable names we'll have done a great service to all of mankind.
@NoorquackerInd4 жыл бұрын
@@TraneFrancks I follow "if it's hard to write, it should be hard to read" and my 5 year old code still looks readable... (This is a joke, don't take this seriously)
@MasthaX4 жыл бұрын
That one Haskell programmer that has hooked up his entire program in lamda functions with x y z.
@LeonoraTindall4 жыл бұрын
@@MasthaX yeah but then the important thing is function names. Still comes down to naming in the end!
@Pablo-Herrero4 жыл бұрын
This is the kind of channel I like to watch to distract me from my day job: coding...
@wordgirl81004 жыл бұрын
Lol
@justmitz95204 жыл бұрын
@jerryplayz1014 жыл бұрын
I wish that I could study everything with physics without requiring the money or the time....
@AnnoyingNewslettersPage63 жыл бұрын
The great courses plus, brilliant, various University programs that are free online...
@aravindsooryakant83183 жыл бұрын
@@jerryplayz101 i wanna do that too 😭😭😭
@ariochiv4 жыл бұрын
"Learn to code" is pretty good advice for anyone doing anything even remotely technical.
@iamjimgroth4 жыл бұрын
Or anything.
@rogerhuston82874 жыл бұрын
But most people know what coding means. I mean if your interested in astrophysics, you probably do. Seems so very basic. Personally, I'd wish she would talk in more detail on how to code to process an image.
@talideon4 жыл бұрын
Yup! Even if you're not coding at anywhere near a professional level, even the basics to get rid of drudgery can be a force multiplier.
@MasthaX4 жыл бұрын
Learn to code for your use in your job is a good thing. Become a (professional) programmer isn't all that great though, you basically need to learn all the jobs you do projects for. That being said though I think in most academia programming is at least on the curriculum may it be in just statistics or more technical aspects.
@iamjimgroth4 жыл бұрын
Learning to code is a democratizer.
@theironherder4 жыл бұрын
I coined a nearly relevant saying: "Computers will always do exactly what you tell them to do, and if you're lucky, they'll also do what you want them to do."
@Betacak34 жыл бұрын
I know this one as "Computers don't do what you want. They do what you tell them to."
@MichaelBrown-kk6ck4 жыл бұрын
Fellow software developer I used to work with was known to say 2 + 2 = 4 under favorable conditions.
@mr4kids.8664 жыл бұрын
Also known as SISO, Sh*t in, Sh*t out.
@theironherder4 жыл бұрын
@@Betacak3 Of course I prefer my phrasing, but it's not surprising that variations of this sentiment exist. I am crestfallen that I'm not as original as I thought -- great minds think alike, after all (not that I would ever claim that I have a great mind).
@Lucius_Chiaraviglio4 жыл бұрын
Seems like you need a bit of luck for computers to do exactly what you tell them to do. This seems to have gotten worse with modern operating systems, but even back in the late 1970s I remember compiling the exact same program 2 times and getting different error message.
@condorboss33394 жыл бұрын
4:18 "Messy, fresh off the telescope images like this:" _Shows fuzzy blob_ 4:23 "Into useful scientific images like this:" _Shows Eye of Sauron_
@shivanshusiyanwal2963 жыл бұрын
The underdog meme.
@RJRJ4 жыл бұрын
The amount of time I've spent on stack exchange for work is unreal. The best thing about coding is that 99.9% of anything you need to code has been coded before and shared online.
@DrBecky4 жыл бұрын
And I am so grateful for those who contribute to stack exchange 😂
@benjaminsmith40584 жыл бұрын
This is so true. When I teach people to code, once they know if, else, for, while, functions and arrays, then I teach them that almost all other coding is looking it up. Usually, the only time I outright code is when I become so comfortable with a language that I already know the optimal solution. In fact, in the most recent data analysis code I wrote I included the weblink for each line of code could have been looked up so I can use it as a future example to show to people how coding actually works.
@arctic_haze4 жыл бұрын
It is true also about R. Sometimes there are packages created specially for the very set of data you want to use.
@benjaminsmith40584 жыл бұрын
@@arctic_haze You should check out Pandas. I used to do most of my plotting and statistical analysis in R, but Pandas made me finally convert to Python. That said, R's standardization of package documentation is very nice, and I still love "->" over "=".
@EnglishMike4 жыл бұрын
I've been lucky enough not to have to go through any technical interviews for programming jobs, but if I had to, I suspect most of my answers would be: "I don't know that off hand, but give me a minute while I look on Stack Exchange..."
@SylviusTheMad4 жыл бұрын
When I was an Astrophysics student, we were told the most likely career for someone with an undergraduate astrophysics degree was computer programmer. There was even a local engineering company that specifically recruited physics and astrophysics students as programmers because they approached problems differently from comp-sci students.
@papaburger4 жыл бұрын
What are the differences ? Are they "better" than CS students ? Most astrophysics students are doing master and PhD , are they not ?
@melanierhianna4 жыл бұрын
@@papaburger in my experience, as a tech lead who was a physicist, we tend to be more practical and less theoretical. Computer Science teaches the science of computing and software, it’s not a training course. Although I do know theory of operating systems and so on, I don’t actually care why something has a big O value of X, just which is algorithm is best for a situation. Also we tend to be building systems. I worked on gravitational wave detectors before moving to the tech industry.
@melanierhianna4 жыл бұрын
As someone who is now a tech lead, it was for me.
@paulperkins16154 жыл бұрын
That's a nice way of saying that the job title for someone working in astrophysics with only an undergraduate degree is "grad student".
@xjohnny10004 жыл бұрын
I wish more scientists shared how much of their work life is coding. A lot of people think coding is for making apps and that's it.
@kiarajacob77654 жыл бұрын
Thank you so much for this! I was confused between pursuing astrophysics and comp sci.(leaning more towards astro ofc) until I watched your day in the life vlog and I realised I could pursue astrophysics and get the best of both worlds! I would have never been able to make the decision if it wasnt for the videos you make! Your such an inspiration!! I hope I can study at oxford one day.(I like cambridge a lil more though😂)
@DrBecky4 жыл бұрын
Thanks Kiara! Glad I could help :) I'll forgive you if you go to the "other place" - haha!
@ayo67393 жыл бұрын
Saaamee!!
@Emily-fl6fs4 жыл бұрын
This is perfectly timed, I started learning python about a week ago because I want to study physics/astrophysics at uni (I’m year 12 rn) 😊
@DrBecky4 жыл бұрын
Nice! Keep at it - I found it hard at first but eventually it all clicked and it max everything so much easier 🤗
@emilyforde54814 жыл бұрын
I'm also learning python its a struggle tbh but also rewarding when you finally get the code to do what you want to do
@vihashah59754 жыл бұрын
Wait ur 12 years or in 12 grade?!
@jomana11094 жыл бұрын
@@vihashah5975 year 12 means its his last year of high school
@RJRJ4 жыл бұрын
@@vihashah5975 age 16/17, 1st year of college in the UK. Year 7-11 (age 11-16) high school, Year 12-13 (age 16-18) college/ sixth form, 18+ university
@anwyl424 жыл бұрын
I love seeing stuff from real astrophysicists working on simulations. I'm a programmer self-teaching astrophysics to make a live simulator, and these kinds of things keep me going.
@trevinbeattie48884 жыл бұрын
About ten years ago a friend asked me to help tutor him in FORTRAN as he was studying climatology in college. As a general computer programmer I’m quite rusty in that language, but we muddled through it. In principle so long as you understand what the capabilities of any computer language are, the rest is just making sure you are using the correct syntax to express your instructions.
@brianlhughes4 жыл бұрын
At my first programming job I got to code in Assembler on the mainframe! I'm retired now but I still code, I find it relaxing.
@Videot994 жыл бұрын
Oof, you gave me a flashback. I did a lot of assembly back in the day myself. That's a rough rode to travel! Very intimate, though, it's just you and the processor, with you speaking its language, one level above raw 1's and 0's with no frills. I never did it on a mainframe, though. I'm guessing the instruction set is huge(?)
@SlEasyTarget4 жыл бұрын
@@Videot99 you might enjoy this: en.wikipedia.org/wiki/Supercomputer_architecture Modern 'supercomputers' are actually clusters of untold thousands of relatively modest processors linked by fast data buses and wrapped in lots of control and cooling equipment.
@brianlhughes4 жыл бұрын
@@Videot99 the instruction set was fairly simple, I've pasted a link to the student guide.
@caw25sha4 жыл бұрын
Did you have a load of macros available for the common tasks or did you have to write everything?
@Videot994 жыл бұрын
@@SlEasyTarget Interesting, thanks. I recently ran into an involuntary use of the networked clustering architecture via internet. I was running Adblock and noticed that my (6 times 2 core Intel) CPU usage would start climbing and get extremely high when I wasn't doing anything. After investigating I learned that Adblock was using people's idle computing power for cryptocurrency mining. Cute scheme! I switched to Ublock.
@bonkonthetronk18104 жыл бұрын
I was using python and LaTeX for school as this notification popped up, really interesting topic!
@jacobm51673 жыл бұрын
Are you using python and LaTeX together or separately? I have never done so, but I heard it's possible to write LaTeX files from python. I have used LaTeX quite a bit over the last two decades but have no idea how python and LaTeX can be combined.
@paulmillcamp4 жыл бұрын
It's great to see that giant book, Feynman's Lectures on Physics, being put to good use as a laptop stand haha :D Keep on coding and sciencing, Dr. Becky!
@DrBecky4 жыл бұрын
Haha! It’s the perfect height what can I say?!
@dyson94224 жыл бұрын
Dyson The Feynman’s Lectures have been my prized possessions, but you can get a free version in MS Word format online.
@Shadow819894 жыл бұрын
@@dyson9422 but how would you use the Word version as a laptop stand!? :-P
@d.t.45234 жыл бұрын
@@Shadow81989 Transfer the doc file to your printer buffer, and set the laptop on the printer.
@Shadow819894 жыл бұрын
@@d.t.4523 that idea just made my day, so thank you! ;-)
@heshuimu4 жыл бұрын
To be clear, much power that Python is known for comes from the libraries that the community accumulated over time. The language itself is not as performant as any other lower-level languages (some python libraries are actually C/C++ binaries with a python wrapper for better performance). Python's strength as a language comes in flexible type system and syntax, making it easy to write some crazy data jugging in Python without dealing with a lot of conventions like other lower-level (or established) languages, thus people can spend time on the actual logic rather than typing semicolons or converting floating point numbers to integers.
@LucasHutyler4 жыл бұрын
Thank you for not having me type this up. Python is commonly used for data science purposes, but that doesn't mean it's the "best" tool for the job. Most all languages can do amazing things. Sometimes the right one is the one you know, or other times the one with the libraries. Other times you need a low level language to eek out the best performance.
@fl4shi2384 жыл бұрын
I was going to comment this :) For example that image processing example from the beginning of the video would be horribly slow if implemented in pure Python.
@richardthurston12084 жыл бұрын
Agreeing with most of what's said here, I've often heard python mentioned as the second best language for anything which makes it a very powerful language. One comment on python's performance. Because of the community support, packages like numpy, and pandas are quite fast if used smartly. Additionally using packages like Numba and their just in time compiler, python can be nearly as fast or faster then C code (hand crafted well optimized C code can still beat Numba but you can get huge performance gains just using Numba). murillogroupmsu.com/numba-versus-c/
@Hvitserk674 жыл бұрын
Sure, but this does not change the fact that it makes sense to learn to code. Most programming languages today do not require in-depth knowledge of structured programming as was the case in the past. As you point out, the actual coding has become easier with, among other things, extensive use of libraries and a minimum of conventions. This in turn has also made coding more efficient in that one can spend much more time on the logic itself than on writing the correct syntax (as you point out).
@kwanarchive4 жыл бұрын
Type systems are there to help prevent errors. Python's flexible type system means errors that could have been caught are not being caught. By errors, I mean errors that arise from things like using incorrect units, incorrect domains and other mathy errors. Type systems are there for you to encode all these kinds of mathematical rules as types so that they are checked at compile time. How many hundreds of millions of dollars have we lost because of "simple" things like the use of correct units and conversions? And how many bad results are there from people not understanding why they need to convert between floating point and integers? "The actual logic" is useless unless it is correct, and the time you spend on the "actual logic" would be significantly reduced if you learned how to use type systems properly to generate code that is correct by construction.
@corriedotdev2 жыл бұрын
Doing a PhD in CS and really looking forward to learning to code. Been doing it for a solid 10 years now.. look forward to figuring it out anyday now 😌
@RyanSnead4 жыл бұрын
Shared this with my math-crazy daughter. She has taken Geometry and is now in Algebra II. In our schools, the very first introduction to formulas in science class is eigth grade, and she attended virtual python day camp this past summer. This was my chance to show her that math is fun, and here are real scientists putting all the foundations she has been learning recently to work at understanding the universe. No real knowledge of Fortran though, so always more to learn.
@xonikkiecal3 жыл бұрын
Thank you I needed this. I’m applying for PhD positions for Astrophysics and Cosmology rn, and other than my research looking for candidate ultra faint dwarf galaxies using Jupyter Notebooks, I’m super intimidated by code. I’ve heard from people in the field that we tend to take bits and pieces from other code to build our own… it’s just scary when we focus on classes in undergrad and are expected to teach ourselves how to code at the same time.
@interminas084 жыл бұрын
Learning how to code is as important as learning a second language nowadays! The great thing about coding (and learning a second language) is that the fundamental principles (algorithms / grammar) repeat and once you're proficient in one programming language, it's so much easier to learn others. :) I really think there's nothing more mind blowing than using a computer to convert analogue signals from sources such as the spin of protons into actual quantitative images! Also, nowadays there is sooo much awesome free content (Python is free) available on the interwebs! Happy coding everyone!
@ArgoIo4 жыл бұрын
A thing most people don't realize is, that modelling, programming and algorithmic thinking is and always has been part of their daily life. Now that computers are ubiquitous and easy to learn programming langauges such as Python exsist, one can effectively practice and put those skills to use.
@buddysnackit17584 жыл бұрын
@@ArgoIo Python is the slow brother of C++. You trade errors is all and for some solutions you have better libraries. But you are ALWAYS slower. I would not hire a Python programmer if that is all they knew. I regularly find articles about how much faster it is to write python code and then I write the same code in C++ and find it is almost the same size. Like within 5 lines and those are declarations. The thing I then learn is that the person critiquing the C++ side of things can't code in C++. :) So obviously its faster in Python when you are a Python guy. I could prove that Python is way slower to code if I was the test subject! :)
@ArgoIo4 жыл бұрын
@@buddysnackit1758 Get off your high horse. It's exactly those declarations which look daunting to any beginner. I do enjoy coding in C++, but I would never use it to explain an algorithm to ie. a family member.
@buddysnackit17584 жыл бұрын
@@ArgoIoTypical answer from someone who can't take their ideas being challenged. I'll let people judge if variable declarations are "hard". Another guy was talking about all those semi-colons. How much darned time you must save in Python by not typing them. He also said you waste time converting floats to integers. Funny stuff!
@KevinLyda4 жыл бұрын
As a CS coder person, your description of code was brilliant, "a language that both you and the computer understand." This is perfect. You're writing something that has two very different audiences. A very dumb, pedantic but very fast savant - the compiler. Most people know that, but the other audience for code, and arguably the most important, are other people. Be it you six months later or someone else tomorrow. You have to communicate ideas to them. Comments are a crutch to that, but the code itself should do that. Really well done video. Love it.
@ragnkja4 жыл бұрын
In other words, don’t bother commenting on the very low-level stuff that anyone who has used the same language recently should be able to figure out by reading it, but _do_ make comments of a more “high-level” nature? Is that correct?
@KevinLyda4 жыл бұрын
Yes. Nowadays I'm more interested in readable code and decent commit messages than comments. I can tie commit messages in with git blame and other history commands.
@2Sheds306194 жыл бұрын
Yay, my area of experience! Well coding in FORTRAN but haven't yet learnt Python. I first learnt FORTRAN at school back in the 1970s and my first job was going to be a simulation engineer in aerospace, but I ended up writing real-time code in assembler instead. PS love the use of "Feynman Lectures on Physics, boxed set" as a laptop riser!
@bimblinghill4 жыл бұрын
Thanks for this! Just the inspiration I need for another day learning Python. I did the Brilliant course & it was a good start, but only takes you so far. I followed with the excellent 'Python Crash Course' book by Eric Matthes. Now working through 'Automate the Boring Stuff in Python' by Al Sweigart which is also very good. Oh, the hours I could've saved over the years if I'd known this stuff before.
@melanierhianna4 жыл бұрын
So I did a physics and astronomy degree. Back when I did it all the maths libraries were FORTRAN. One of the projects was a colliding galaxy simulator. The systems were slow so it was small galaxies and took days to generate the animation. By the time I finished that degree I had learnt FORTRAN, C and Pascal. A few years later I ended up returning to uni, doing a masters in machine vision and becoming research assistant where as I was basically a coder. Now, I”m a tech lead in a embedded device consultancy.
@sschmidtevalue4 жыл бұрын
I'm a retired software engineer and this was a really good high-level description of what code is for. I programmed in 13 different languages in my career and after seeing this, I have decided to take a look at Python for some private system utility needs I have. Thanks for another excellent vlog!
@DrBecky4 жыл бұрын
Thank you!
@juanes31434 жыл бұрын
I look for a video like this for so long, thank you very much, I´m a 17 yo chilean, and I wanna be an astrophysicist, I always wanted to know why and how a scientist use codes and how they actually work, the more I learn about this career the more I fall in love with it. Hope someday I can dedicate my life to science, I think I finally found the youtube channel that I was looking for.
@DrBecky4 жыл бұрын
Glad I could help! And best of luck with all your studies - Chile is definitely the perfect place to become an astrophysicist
@avalanchas3364 жыл бұрын
"... people us HTML and programming languages like..." you just won the nerds' hearts :D
@no_mnom4 жыл бұрын
Because HTML isn't a programming language?
@Danielbignuts4 жыл бұрын
@@no_mnom HTML is a markup language - it looks at data within HTML tags. It doesn't really 'do' that much on its own and doesn't have if/else statements, so technically isn't a programming language.
@flabreque4 жыл бұрын
She had already won the nerds a long time ago.
@DanielNyong4 жыл бұрын
JavaScript is barely a programming language lol
@johnklapp90774 жыл бұрын
@@Danielbignuts So ... Apache Pig isn't a programming language?
@jefflsmith6164 жыл бұрын
Thanks for sharing 5 ways an astrophysicist's uses code. I've coded orbital mechanics (satellite control), image rectification for stereoscopictry, radio direction finding (interferometry) and more using about 9 different coding languages. How the giants of the past did physics without computers really causes admiration for the tenacity. Your encouraging call for new astrophysicist to become coders is spot on!
@michaelogden59584 жыл бұрын
I'm retired now, but I used to LOVE learning code languages and cobbling together commands to take care of otherwise tedious analyses. I always found it challenging to know when to declare it "good enough" and get on with it. There was always a more clever, efficient, quick way to get from A to Z. One can waste gobs of time tweaking code. :-)
@danielmaxwell66764 жыл бұрын
I do not use coding in any part of my current job. Playing with Python keeps my brain both clear and sharp on my own time.
@MichaelBrown-kk6ck4 жыл бұрын
Yep. The first 80% of the job takes the first 80% of your time and the last 20% of the job takes the other 80% of your time.
@buddysnackit17584 жыл бұрын
OK boomer. :)
@karlesmcquade28634 жыл бұрын
What a breath of fresh air! A dialogue between two scientists who know their stuff, are enthusiastic about their stuff, and know how to communicate their stuff to a lay-audience. Thanks to both of you!
@Rajit_134 жыл бұрын
You're one of the inspirations to become an Astrophysicist! It's very rare in Bangladesh but I hope to work under you someday!
@danielmaxwell66764 жыл бұрын
I have been a techy nerd for over 45 years. I love coding and appreciate that you use Python for data analysis. Keep up the good work on these very interesting videos.
@happyhome414 жыл бұрын
Wow, FORTRAN -- that was my main language in 1978. Impressive it's still being used. Wonderful bringing her in on this one.
@DrewNorthup4 жыл бұрын
Heck, COBOL is still in active use…
@framegrace14 жыл бұрын
Fortran still kicking. The king of science no one ever will dethrone. High five to the people who design it 70 years ago, if there's any survivor around. I'm still amazed on how well was it designed for the specific purpose. The first fortran release did a monte-carlo simulation of the code on compile time to find the better memory assignment strategy. Just a detail on how hardcore it is
@tscoffey14 жыл бұрын
When your guest mentioned massive supercomputing calculations, I immediately knew that the implementation language was FORTRAN.
@gregf91604 жыл бұрын
C or Assembly will also perform just as robustly. But that lady is a scientist and thinks like an engineer -- so FORTRAN it is.
@666Tomato6664 жыл бұрын
@@gregf9160 it's mostly related to the fact that those code-bases and libraries they use literally started over half a _century_ ago; before C existed, and when assembly was much, much different
@megan_alnico4 жыл бұрын
One of my favorite software bugs of all time is from FORTRAN. At one point, early in one of the compilers history the constants for the numerals 0-9 were actually just stored in memory like any other variable. So if you weren’t careful you could assign a value to the numeric (not so) “constant”. This means you could assign the value 3 to 1 and then forever after in your program 1+1 would equal 6. I’m not sure but I think this is the origin of the phrase: “2+2=5 for incredibly large values of 2.”
@DrewNorthup4 жыл бұрын
@@megan_alnico That is still true in SQL and PL/SQL today. You can redefine anything which isn't a reserved word.
@melanierhianna4 жыл бұрын
@@gregf9160 These days with modern tools there’s no need for assembler (compilers are damn good at optimisation) but yes, C or FORTRAN. I haven’t coded it since I left uni, but I did leave knowing both languages.
@drrach14 жыл бұрын
I am an amateur visual astronomer and also physics enthusiast. Presently learning JavaScript,newbie in coding . Thanks very much for the video ... 👍👍 It opened my mind of coding applied in physics
@aformerogr4 жыл бұрын
I am currently studying Geology at university and just got started learning Python, I am really excited to see all the possibilities that this language can offer.
@talhazia14013 жыл бұрын
I am working as a research astronomer but then I quickly realized the need of coding in Astrophysics and I learned python and ML algorithms. Enjoying it to its fullest now.
@consultant_of_swing21464 жыл бұрын
"If I can't code it, I don't understand it." ~Professor Phil Moriarty
@cardboardhero99503 жыл бұрын
I think it was " If I can code it, I can understand it"
@Viewpoint3144 жыл бұрын
I am a math, computer guy and would like to say that your presentation is excellent.
@pierreabbat61574 жыл бұрын
When coding a universe simulation, be sure to initialize all variables. An uninitialized Cepheid variable can crash the whole system!
@Okie1354 жыл бұрын
Underrated comment
@josephcohen7344 жыл бұрын
When you know someone's making a joke but you don't know what a cepheid variable is
@ragnkja4 жыл бұрын
@@josephcohen734 It’s “a type of star that pulsates radially, varying in both diameter and temperature and producing changes in brightness with a well-defined stable period and amplitude,” according to Wikipedia.
@gnome534 жыл бұрын
Are you certain the crash isn't a problem with your scope? ;-)
@laolao24 Жыл бұрын
I was a bit lost about the usages of coding for physics related matters until now. Thanks so much! I am a mechatronics/aerospace engineering student, really helped!
@aaronsebastiancastilloespi74314 жыл бұрын
I loved this video! Every week I confirmed that this is what I want to do the rest of my life with your videos and it amazed me that I already do 3 of the 5 things you mentioned so that means that im on the right row to become an astrophysicist, thank so much Dr Becky! P.S. Loved your sweater😊
@sethsims74144 жыл бұрын
As a Computer Scientist/Bioinformatician you can do these things in any language you like. The most important thing is what libraries are easy to use. Python is my main language in biology. It has lots of nice scientific libraries. But I could do any of the things I do in several languages. Python is super nice though, the other language for scientists is often R. You can find some really powerful, cutting edge statistics libraries and plotting libraries in R. Python is actually still behind R in this case. Also if you're doing huuuge dynamics, weather, or orbit simulations, the kind you would usually need a supercomputer for, you would probably use FORTRAN, C, or C++.
@DrBecky4 жыл бұрын
Good point - astronomy and astrophysics are all python - astropy is such an incredible resource for us all.
@sethsims74144 жыл бұрын
@@DrBecky Yep the equivalent for Bioinformatics it probably BioPython.
@arctic_haze4 жыл бұрын
I have been writing code for science tasks for almost 40 years. First Pascal and Fortran then C and recently R. When I had to improve someone's Python code I called my son-in-law to ask him: "Have I got crazy or do they really use whitespace for formatting in Python?" For someone working long in C and C++, it is a heresy.
@caw25sha4 жыл бұрын
But surely you indented blocks of code in C? Formatting in C and Python is pretty similar, just with and without the { and }.
@arctic_haze4 жыл бұрын
@@caw25sha I do. But the code I was supposed to improve has been formatted with a mixture of spaces and tabs with a different lengths than that used by my editor. I lost a lot of time before I realized what the problem is and corrected it replacing all tabs with the correct number of spaces. In C++ such mishap happens often and makes the code look ugly but it still compiles fine.
@michaelsommers23564 жыл бұрын
I have to agree about the semantically-significant whitespace. Badly-indented code can be a pain in other languages, but at least it doesn't affect the meaning of the code. And I have seen professional programmers produce randomly-indented code. And physicists produce not-indented-at-all code (not only in Fortran).
@RickBoat4 жыл бұрын
@@michaelsommers2356 we learned not to indent when punchcards were only 80 characters wide. Semantically meaningful whitespace broke my mind when i first encountered it.
@michaelsommers23564 жыл бұрын
@@RickBoat Yeah, but there was no excuse for not indenting when we moved away from punch cards.
@husainm972 жыл бұрын
As a particle physicist (who really loves this channel filling me in on the other side of physics, that I almost picked, so you know, thanks Becky!), I use code for pretty much the exact same things, swapping out image processing for something like triggers and particle track reconstruction.
@mina864 жыл бұрын
11:15 - and another person discovered the beauty of free software. Welcome to the Light side. ;)
@mina864 жыл бұрын
@@barryomahony4983, I’m pretty sure you intended to reply in another thread.
@barryomahony49834 жыл бұрын
@@mina86 Oops, yes. danger of trying to do 2 things at once.
@thepom884 жыл бұрын
I noticed the big box holding your laptop up with Feynman written on the side. Richard Feynman, another great communicator of science. Check out his lectures and talks. Especially, Los Alamos From Below. A true passionate genius, who was a gentleman and a wonderful human being who changed the face of physics. RIP Prof. Feynman.
@wartupper4 жыл бұрын
To me, coding is like giving a constructive proof of some result, that way of thinking clear the path to write better and thinking better ways of coding something.
@miallo4 жыл бұрын
I studied physics and I went from university directly to a software company and I am pretty happy with it. I also think I have acquired a relatively good understanding of programming practices in my time in university where I used it daily - though I learned most of it in my spare time... I can totally support Becky when she says that you should learn to code if you are in science (and I can only add: do it even if you are not going into science - it is a universal tool to fix problems!)
@francoistrempe4 жыл бұрын
Hi Dr. Becky, I absolutely love your parsaltogue joke I will have to reuse it.
@terryhaines83514 жыл бұрын
In the early 1970s, I began a career as a computer programmer, and I was *very* good at it. BASIC, FORTRAN, COBOL, and to a certain degree assembly language, they all were my bailiwick. They were all linear languages, of course, but who knew anything could replace them? Well, in the 1980s came C, C+, and C++ (and Python), "object-oriented" languages, and I simply could not make the leap from the old to the new. I tried several times, but it was no go. I could handle & got my degree in multimedia languages like HTML & Javascript, but it was not enough. So my career as a computer programmer came to an end. But I started another career as a bus driver and loved it just as much. But kids these days are learning to code! Amazing.
@EGraf4 жыл бұрын
print("Hello Universe!") ;-)
@EnglishMike4 жыл бұрын
You young whippersnapper you! All the old timers know the real code is: 10 PRINT "Hello Universe!" 20 GOTO 10
@EGraf4 жыл бұрын
@@EnglishMike In reality I'm more of a All the universe stuff goes inside here kind of guy :P
@Zaluskowsky3 жыл бұрын
@@randylejeune 😮😮
@Mackenz_Tapp Жыл бұрын
#include int main () { std::cout
@JamesWjRose4 жыл бұрын
Nicely stated. I have been a business dev for 20+ years and you did a nice job of giving an easily understandable way for people to understand how/why to deal with the basics of code.
@bjornmu4 жыл бұрын
So they're still using Fortran, over 60 years after the language was introduced!
@tcumming1234 жыл бұрын
I believe that astlib and slalib are both written in fortran, and are widely used still today. I know :)
@ToadalChaos4 жыл бұрын
Yup. Though for most "new" codes C++ has become the standard, mainly for its object-oriented features. Fortran is now primarily the domain of "dinosaur codes", which were started decades ago and are so massive it would be unthinkable to rewrite them in a more modern language.
@KohuGaly4 жыл бұрын
With close-to-metal languages, there really isn't anything about them that would make you pick one over the other or force you to switch once you picked one. Pretty much the only consideration is compatibility with work of your colleagues. That's why Fortran is alive and well in its niche of science. That's why C is alive and well in its niche of systems. That's why C++ is alive and well in niche of AAA gaming.
@michaelsommers23564 жыл бұрын
There used to be a joke that went, "I don't know what programming language will be used in fifty years, but I know it will be called 'Fortran'."
@michaelsommers23564 жыл бұрын
@@ToadalChaos An advantage Fortran has over C++ is that things like exponentiation and complex numbers are built into the language, instead of being handled by function calls. That can be significant in a large-enough problem.
@williamsribeiro64574 жыл бұрын
As a cosmology student, it is nice to see that astrophysics has a similar methodology. For me, simulations in clusters is the hardest part of the job. Thanks for the video!
@lloydfromfar4 жыл бұрын
I am a computer programmer professionally meself. But I prefer the term "computer whisperer" :D
@marysibilsky60144 жыл бұрын
This is so interesting! I am a plain old software engineer, and I know firsthand it takes time to master the skills to write good software. I didn’t realize astrophysicists write their own code on top of the extensive skill set they already have in their field. Very impressive!
@brianoppenheimer38134 жыл бұрын
as a software engineer I would say find a good friend who knows how to code :D
@scifino14 жыл бұрын
As a developer myself I can only agree. Two sets of eyes see more than one and explaining to someone else how your code works (or is supposed to work) can very well help you realize what you could improve. Code reviews and pair programming are such useful tools for preventing and fixing bugs.
@fanq_4 жыл бұрын
also, just talking to someone who knows what you're talking about can literally let you talk yourself into a solution... some talk to rubber duckies... I prefer a human with a little extra insight
@edoardoborsato30694 жыл бұрын
YES
@MechanicaMenace4 жыл бұрын
@@scifino1 I'm not a fan of pair programming but apart from that agreed. Many hands make light work, many eyes make shallow bugs, but not every way of getting many hands onboard and many eyes looking works well for everyone.
@scifino14 жыл бұрын
@@MechanicaMenace to each their own. Obviously pair programming is a technique that isn't always feasible. At my firm we only use that in certain situations. For example when someone who is new to a certain framework could use help from someone with more experience in working with that framework.
@thomashenegar3 жыл бұрын
My love for space science is why I enrolled in a coding bootcamp, and I just got my Python certification too. I graduate May 28. Soooooo happy I found this video, I was wondering what language would be best for being an astrophysicist.
@dianaxd054 жыл бұрын
Me : * sees Becky's notification* Me : Yesss !!! Thanks Becky. It's very interesting 👁️👁️ I love it
@stephengloor84514 жыл бұрын
Leaning the library pandas in python changed my life. One line to import a .csv of data into a dataframe that I can manipulate is game changing. Pandas dataframes are essentially numpy arrays so they are directly convertible.
@DrBecky4 жыл бұрын
Pandas is cool. Astronomy standard data format is .fits though - it can handle both images and tables in one file, so thankfully the astropy module wrote up a way to handle those like pandas and it's a game changer
@alexanderkusmirek68214 жыл бұрын
Started studying a Master's in Space Science and Technology this year, with a focus on Astrophysics, and I knew Python was coming. I did some tutorials in my own time, some Udemy courses etc. But was I ready? I was not ready. The "buh-ding" noise of my code not working is seared into my eardrums. My desk is falling to bits under the onslaught of my frustrated fists. My software-savvy friends no doubt look at my pleading pathetic requests for help with no more pity, as I have annoyed them beyond their continued caring. Still really good fun though
@marcusdirk4 жыл бұрын
It's lovely the way you manage to transmit enthusiasm along with information: that's a rare gift. Also good to hear FORTRAN being praised for its efficiency!
@bierrollerful4 жыл бұрын
Small tip for all you programming learners out there: *Comment your own code.* Always. Everywhere. Well written code is usually easy and quick to read. But not as easy and quick as a short string at the top of the function. And if the code is a bit on the complicated side (which you should try to avoid), a comment can really help you (and others!) out.
@EnglishMike4 жыл бұрын
Heresy! Real programmers don't need comments. Good code documents itself! (I must have been told that more than a dozen times during my time as the lead on various projects throughout the years. Of course, in reality, most coders just hate writing comments, and worse, keeping them up to date!)
@tabularasa06064 жыл бұрын
@@EnglishMike One should only comment things that are not logical from the context. For example a hack to get around a problem with a library you're using.
@Warhamster554 жыл бұрын
I have been coding for over 30 years. I have written code with and without comments. The problem with comments is they can get out of sync with the code. So you have to read the code to find out if the comments are current. I go with self documenting code these days. Intention declaring method and variable names. Of course hacks are always a good time to document with comments. Especially when some code is counter intuitive.
@JazzyArtKL Жыл бұрын
Fantastic, Becky! I teach CS and have shared your video with my students on how coding skills can be applied in natural sciences.
@Invalid5714 жыл бұрын
Wants: a language that's fast. Suggests: python Me: Hold up python for speed? LOL!
@Xeridanus4 жыл бұрын
Fast to program and iterate in, yeah. And the performance can be tuned up where needed as it's all just written in C/C++ in the end. But as her friend said in the video, they use FORTRAN for the really performance heavy stuff.
@Almost33313 жыл бұрын
NUMPY can process data on a single core faster than most other programming languages since it calls assembly written to be hyper effcent.
@Invalid5713 жыл бұрын
@@Almost3331 So assembly does the work by your own admission. :)
@Almost33313 жыл бұрын
@@Invalid571 yes. The point is kind of lost unless you build the standard library from scratch. Python is used to call libraries from other languages. You don't do anything computationally intensive in python.
@Almost33313 жыл бұрын
@@Invalid571 for example I could say on any compiled langue that "hehehe it is the compiler that does the work" or "hehehe the standard library does the work", but is really just splitting hairs and doesn't really make sense. You use cpp to do a thing it work. You use python to do a thing it works.
@stargaze38948 ай бұрын
as someone doing computer science engineering but actually wanted to do astrophysics- good to see I'm still connected :,)
@SolitaryPine14 жыл бұрын
“Hot, young, big stars.” Like Dr. Becky?
@throwawayuser99314 жыл бұрын
Love your videos..... Kinda gives a perspective for aspiring students who are basically driven for their love of the stars and separate out the ppl who hate the math, or say, coding.......
@1EDSEL33 жыл бұрын
Technically, python is actually very bad at handling large arrays of data. However, you use modules like numpy, pandas and OpenCV to do this, which are written in C, which is muuuch faster than python. And even if you use numpy and the like, you need to reduce the amount of native python as much as possible to keep your code fast. Basic rule: Whenever possible, do not use for loops but numpy/pandas indexing instead! All the heavy lifting in your code should really be done in C, so in numpy. Numpy is mighty. Use it. And for gods sake, don't write your own data tables to textfiles with for loops (I have seen that in simulation code). Pandas is mighty. Use it. So python is basically... usable or at least more accessible C ^^'
@richallan0014 жыл бұрын
As a python developer, I'm loving your love for python. Part of my work, incidentally, is working with large data sets.
@arctic_haze4 жыл бұрын
Let me guess before I watch: writing it. debugging it, compiling it, running it and finally losing it on a failed disk drive?
@ShainAndrews4 жыл бұрын
Version control is utilized. Failed hardware is less likely than human error.
@arctic_haze4 жыл бұрын
@@ShainAndrews Nowadays, yes. But I started in the times when you had to hope the diskette with code is still readable.
@DrBecky4 жыл бұрын
Losing it?! We have GitHub and versioning these days!
@I_Don_t_want_a_handle4 жыл бұрын
@@DrBecky True but then BT come along and put a pickaxe through the cable and your internet is gone for a week. It happens more often than you think. Don't just rely on cloud back-ups, take some hard copies too. If it is important, secure it.
@arctic_haze4 жыл бұрын
@@DrBecky That's true but I've heard my colleagues complaining that they lost their old code that I wonder if they subconsciously want the old code to vanish. After all it is sometimes easier to write it anew than to understand what exactly it was supposed to do.
@gnome534 жыл бұрын
@8:54 "...simulations. This is when you code up all the laws of physics into a program..." Umm... more likely "some" than "all". As Ricarda notes @10:00, "So we very much have to think back to sort of the parts or the components of physics that are relevant in this particular context..." This is when the scientist typically ignores some laws/effects, say, the effect of the masses of the lab assistants on the experimental equipment, to simplify the simulation. (Can I ignore quantum mechanical effects? Can I ignore any imbedded plasma/electrical charges? Can I assume the cow is spherical? But I must not forget my simplifications, nor hide them from others.) And there are also considerations regarding the model and its implementation. If I am modelling gas, do I treat the gas as a fixed number of parcels (each with a uniform set of properties) or as particles passing through a collection of fixed volumes? Am I using data types that have sufficient precision? Do the mathematical routines/algorithms that I am using for my matrix manipulations calculate values with numerical instability for the range of conditions I am modelling? ...OK, that's getting beyond the basics. I'll let myself out.
@joshuawilkerson37834 жыл бұрын
Oh my. I had no idea Dr. Becky was so in to hot young galaxies 😲
@sweetysmart05053 жыл бұрын
I’m a Computer Scientist who actively works every day with Data Scientists; with our two points of view, we use Python to create Machine Learning models. It’s so much fun!
@abebuckingham81984 жыл бұрын
The command "import antigravity" is an Easter egg in Python.
@kroo074 жыл бұрын
Good to hear that Fortran is still in use.
@aaronseet27384 жыл бұрын
When she said "efficiency" I was expecting her to use assembly language :D
@tando62664 жыл бұрын
I'm an ME researcher on 3d printing. 1000x yes to everything you said
@realdragon4 жыл бұрын
Am I the only person who likes C\C++ more than python?
@TinkerGrey4 жыл бұрын
Yes. Yes, you are. ;)
@clickrick4 жыл бұрын
Perhaps, perhaps not, but you're almost certainly the only C/C++ programmer who uses the wrong slash between them.
@abebuckingham81984 жыл бұрын
Yes of course you are. I'm the only person who prefers LISP to any other programming language. I don't know why we are the way we are but it's definitely weird.
@mattsadventureswithart57644 жыл бұрын
@@clickrick Wrong? Or just rebellious? :P
@diamondsmasher4 жыл бұрын
Java and C++ :)
@jchawthorn3 жыл бұрын
Wonderfully informative. I first learned Fortran in 1969, but never thought it might still be used. My last languages were machine code and assembler.
@prithuldas26524 жыл бұрын
I've been waiting for something like this! Thanks a bunch!
@xtieburn4 жыл бұрын
I cant say that this always applies to a given programming task, particularly very simple snippets, but in most instances of substantive code Ive encountered: You can write a pseudo code for what you want. Then write tests (Called unit tests) for what your code should output for a given input. You can then write your code in to that framework, the pseudo code becomes your comments, the unit tests make sure its all behaving. I think a lot of people will tend to do this the exact opposite way round. Write the code, write tests for the code, and then comment it to finish. (With lower, and lower amounts of motivation for each step leading many to not bother with much testing or comments.) It took a long time before I actually considered writing tests first, and it can be surprisingly useful for avoiding rewrites and such later.
@kensmith56944 жыл бұрын
I often write comments first. I don't do it a pseudo code. Comments in basically another language done do a good enough job of saying "why". The first comments are often all about the "why". If units of measure are a thing for the problem at hand, I often state the units I will be using before I start to write any of it. If I write a function to do something, I start by listing the inputs and outputs in comments before it. The next step is often to state what it does in simple english. This I usually put before the inputs and outputs comment. When I write the body of the function, I go back and check the inputs and outputs. I sometimes update a comment about "fails if the ....."
@TheOldBlackCrow4 жыл бұрын
This is an awesome episode! I'm 53yo and just started to learn Python to build a working Star Trek tricorder. It's never too late and it's fun!
@byrnemeister20084 жыл бұрын
Ambitious project. I learnt it just to get away from bloody Excel!,,
@sagnarte60744 жыл бұрын
OMG YES!!! I have been so curious about your code and how you use Python! We can agree, Python is a pretty fire language! I need to get back into it but I am learning Java for school RN lol.
@adenuristiqomah9843 жыл бұрын
Hey Dr. Becky, I just stumbled upon your channel and find it both interesting and hits close to home. I took astrophysics as my major in my undergrad, planning to pursue grad school but have not found a scholarship yet. Watching your videos bring me back to my years as a student where we were usually engaged in discussion about astrophysics, from the science to technical aspect such as finding the best way to do something in python (most of the students use it). My field of interest is studying interstellar matter detected in stellar spectra to trace the Milky Way's large-scale structure. P.S.: Sorry for my bad English :')
@ahmadniazrahman74614 жыл бұрын
Every time I watch your video I'm amazed. The depth of your knowledge is unbelievable. I really hope to be as devoted as you are about science. You are an inspiration 💙💙
@troruaz4 жыл бұрын
great stuff Dr. Becky! great to hear about coding from quite possibly the coolest people slinging it around!
@arneysrackangast71404 жыл бұрын
Dr. Becky. Enjoyed this discussion! As an atmospheric scientist, I have used Fortran to run complex, atmospheric dispersion models. As you may recall, Fortran was the primary language of NASA's space program throughout much of its early years. I didn't hear it mentioned in your discussion. Fortran has evolved A LOT, but now seems rarely taught much anymore. Seems as though Python has sort of supplanted it. But Fortran still "screams" speed and multi-processing capability. But, alas, it's fading in popularity, which has puzzled me, and also sort of makes me sad, because it really is an easy language--and less cryptic--even than python.
@edseltallbert31334 жыл бұрын
This is amazing video. I had no idea astrophysicists use code to this extent.
@michaellangwaller3 жыл бұрын
Coding and database, Dr. Becky talked about my field! So cool!
@grandrapids574 жыл бұрын
I love this channel and as a programmer myself, from long ago, at some point people stopped calling programs "programs" and programmers became "engineers." I have never understood that key shift. "I'm an engineer" doesn't say much as apparently it is common for people to wish to be an "engineer" from "sanitary engineer" to programmers. It is also seems to be a decline in vocabulary usage as people are presently fond of making ambiguous, and frankly false, job descriptions in place of precise and accurate ones.
@YourSoulDriver4 жыл бұрын
Very interesting. As a Chemical Engineer, I learned several programming languages while I was in College, including Fortran and C++. This was a necessity because there were no commercial applications for many of the things that we wanted to do. Now, working as a Process Engineer, the need to write my own code is less and less frequent and is more of a hobby, as there are very powerful simulation and statistical tools commercially available (far more powerful than Excel). Money is an issue, of course, as you need to pay for their licensees. I do want to learn Python, though.
@abbashmuel36353 жыл бұрын
Dr. Becky, you are a total genius.
@ronjon79422 жыл бұрын
Wow, I’ve been looking for your explanation for years. Thank you.
@rverm10003 жыл бұрын
learning to code is a good thing. python is my language of choice. it has catapolted me in a direction that has improved my life. not financially yet. learning new stuff everyday. coding trading bots that have gradually improved over time.
@rufusfenderreid22504 жыл бұрын
Keep up the good work! I want to do joint honours in physics and computer science in a couple of years so this is the perfect video for me.
@rorymacdonald7529 Жыл бұрын
im a computer science and physics dual degree student. the intersection of computers in astrophysics is expressly what I am interested in! Simulations seems like a very cool part of the field!
@KyleCostanza4 жыл бұрын
Thanks you for keeping this information relatively technical instead of general and uninteresting