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!
@TraneFrancks3 жыл бұрын
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.
@abebuckingham81983 жыл бұрын
If we can convince people to use meaningful variable names we'll have done a great service to all of mankind.
@NoorquackerInd3 жыл бұрын
@@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)
@MasthaX3 жыл бұрын
That one Haskell programmer that has hooked up his entire program in lamda functions with x y z.
@LeonoraTindall3 жыл бұрын
@@MasthaX yeah but then the important thing is function names. Still comes down to naming in the end!
@Pablo-Herrero3 жыл бұрын
This is the kind of channel I like to watch to distract me from my day job: coding...
@wordgirl81003 жыл бұрын
Lol
@justmitz95203 жыл бұрын
@jerryplayz1013 жыл бұрын
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 😭😭😭
@ariochiv3 жыл бұрын
"Learn to code" is pretty good advice for anyone doing anything even remotely technical.
@iamjimgroth3 жыл бұрын
Or anything.
@rogerhuston82873 жыл бұрын
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.
@talideon3 жыл бұрын
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.
@MasthaX3 жыл бұрын
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.
@iamjimgroth3 жыл бұрын
Learning to code is a democratizer.
@theironherder3 жыл бұрын
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."
@Betacak33 жыл бұрын
I know this one as "Computers don't do what you want. They do what you tell them to."
@MichaelBrown-kk6ck3 жыл бұрын
Fellow software developer I used to work with was known to say 2 + 2 = 4 under favorable conditions.
@mr4kids.8663 жыл бұрын
Also known as SISO, Sh*t in, Sh*t out.
@theironherder3 жыл бұрын
@@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_Chiaraviglio3 жыл бұрын
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.
@condorboss33393 жыл бұрын
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.
@RJRJ3 жыл бұрын
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.
@DrBecky3 жыл бұрын
And I am so grateful for those who contribute to stack exchange 😂
@benjaminsmith40583 жыл бұрын
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_haze3 жыл бұрын
It is true also about R. Sometimes there are packages created specially for the very set of data you want to use.
@benjaminsmith40583 жыл бұрын
@@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 "=".
@EnglishMike3 жыл бұрын
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..."
@SylviusTheMad3 жыл бұрын
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.
@papaburger3 жыл бұрын
What are the differences ? Are they "better" than CS students ? Most astrophysics students are doing master and PhD , are they not ?
@melanierhianna3 жыл бұрын
@@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.
@melanierhianna3 жыл бұрын
As someone who is now a tech lead, it was for me.
@paulperkins16153 жыл бұрын
That's a nice way of saying that the job title for someone working in astrophysics with only an undergraduate degree is "grad student".
@Emily-fl6fs3 жыл бұрын
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) 😊
@DrBecky3 жыл бұрын
Nice! Keep at it - I found it hard at first but eventually it all clicked and it max everything so much easier 🤗
@emilyforde54813 жыл бұрын
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
@vihashah59753 жыл бұрын
Wait ur 12 years or in 12 grade?!
@jomana11093 жыл бұрын
@@vihashah5975 year 12 means its his last year of high school
@RJRJ3 жыл бұрын
@@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
@kiarajacob77653 жыл бұрын
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😂)
@DrBecky3 жыл бұрын
Thanks Kiara! Glad I could help :) I'll forgive you if you go to the "other place" - haha!
@ayo67392 жыл бұрын
Saaamee!!
@xjohnny10003 жыл бұрын
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.
@KevinLyda3 жыл бұрын
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.
@ragnkja3 жыл бұрын
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?
@KevinLyda3 жыл бұрын
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.
@paulmillcamp3 жыл бұрын
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!
@DrBecky3 жыл бұрын
Haha! It’s the perfect height what can I say?!
@dyson94223 жыл бұрын
Dyson The Feynman’s Lectures have been my prized possessions, but you can get a free version in MS Word format online.
@Shadow819893 жыл бұрын
@@dyson9422 but how would you use the Word version as a laptop stand!? :-P
@d.t.45233 жыл бұрын
@@Shadow81989 Transfer the doc file to your printer buffer, and set the laptop on the printer.
@Shadow819893 жыл бұрын
@@d.t.4523 that idea just made my day, so thank you! ;-)
@anwyl423 жыл бұрын
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.
@bonkonthetronk18103 жыл бұрын
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.
@brianlhughes3 жыл бұрын
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.
@Videot993 жыл бұрын
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(?)
@SlEasyTarget3 жыл бұрын
@@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.
@brianlhughes3 жыл бұрын
@@Videot99 the instruction set was fairly simple, I've pasted a link to the student guide.
@caw25sha3 жыл бұрын
Did you have a load of macros available for the common tasks or did you have to write everything?
@Videot993 жыл бұрын
@@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.
@2Sheds306193 жыл бұрын
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!
@trevinbeattie48883 жыл бұрын
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.
@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 😌
@heshuimu3 жыл бұрын
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.
@LucasHutyler3 жыл бұрын
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.
@fl4shi2383 жыл бұрын
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.
@richardthurston12083 жыл бұрын
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/
@Hvitserk673 жыл бұрын
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).
@kwanarchive3 жыл бұрын
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.
@bimblinghill3 жыл бұрын
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.
@xonikkiecal2 жыл бұрын
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.
@tscoffey13 жыл бұрын
When your guest mentioned massive supercomputing calculations, I immediately knew that the implementation language was FORTRAN.
@gregf91603 жыл бұрын
C or Assembly will also perform just as robustly. But that lady is a scientist and thinks like an engineer -- so FORTRAN it is.
@666Tomato6663 жыл бұрын
@@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_alnico3 жыл бұрын
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.”
@DrewNorthup3 жыл бұрын
@@megan_alnico That is still true in SQL and PL/SQL today. You can redefine anything which isn't a reserved word.
@melanierhianna3 жыл бұрын
@@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.
@EGraf3 жыл бұрын
print("Hello Universe!") ;-)
@EnglishMike3 жыл бұрын
You young whippersnapper you! All the old timers know the real code is: 10 PRINT "Hello Universe!" 20 GOTO 10
@EGraf3 жыл бұрын
@@EnglishMike In reality I'm more of a All the universe stuff goes inside here kind of guy :P
@Zaluskowsky3 жыл бұрын
@@randylejeune 😮😮
@Mackenz_Tapp11 ай бұрын
#include int main () { std::cout
@RyanSnead3 жыл бұрын
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.
@Rajit_133 жыл бұрын
You're one of the inspirations to become an Astrophysicist! It's very rare in Bangladesh but I hope to work under you someday!
@melanierhianna3 жыл бұрын
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.
@interminas083 жыл бұрын
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!
@ArgoIo3 жыл бұрын
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.
@buddysnackit17583 жыл бұрын
@@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! :)
@ArgoIo3 жыл бұрын
@@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.
@buddysnackit17583 жыл бұрын
@@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!
@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!
@happyhome413 жыл бұрын
Wow, FORTRAN -- that was my main language in 1978. Impressive it's still being used. Wonderful bringing her in on this one.
@DrewNorthup3 жыл бұрын
Heck, COBOL is still in active use…
@michaelogden59583 жыл бұрын
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. :-)
@danielmaxwell66763 жыл бұрын
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-kk6ck3 жыл бұрын
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.
@buddysnackit17583 жыл бұрын
OK boomer. :)
@avalanchas3363 жыл бұрын
"... people us HTML and programming languages like..." you just won the nerds' hearts :D
@no_mnom3 жыл бұрын
Because HTML isn't a programming language?
@Danielbignuts3 жыл бұрын
@@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.
@flabreque3 жыл бұрын
She had already won the nerds a long time ago.
@DanielNyong3 жыл бұрын
JavaScript is barely a programming language lol
@johnklapp90773 жыл бұрын
@@Danielbignuts So ... Apache Pig isn't a programming language?
@juanes31433 жыл бұрын
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.
@DrBecky3 жыл бұрын
Glad I could help! And best of luck with all your studies - Chile is definitely the perfect place to become an astrophysicist
@sschmidtevalue3 жыл бұрын
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!
@DrBecky3 жыл бұрын
Thank you!
@sethsims74143 жыл бұрын
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++.
@DrBecky3 жыл бұрын
Good point - astronomy and astrophysics are all python - astropy is such an incredible resource for us all.
@sethsims74143 жыл бұрын
@@DrBecky Yep the equivalent for Bioinformatics it probably BioPython.
@aaronsebastiancastilloespi74313 жыл бұрын
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😊
@thepom883 жыл бұрын
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.
@drrach13 жыл бұрын
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
@francoistrempe3 жыл бұрын
Hi Dr. Becky, I absolutely love your parsaltogue joke I will have to reuse it.
@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.
@consultant_of_swing21463 жыл бұрын
"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"
@michaellangwaller3 жыл бұрын
Coding and database, Dr. Becky talked about my field! So cool!
@arctic_haze3 жыл бұрын
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.
@caw25sha3 жыл бұрын
But surely you indented blocks of code in C? Formatting in C and Python is pretty similar, just with and without the { and }.
@arctic_haze3 жыл бұрын
@@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.
@michaelsommers23563 жыл бұрын
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).
@RickBoat3 жыл бұрын
@@michaelsommers2356 we learned not to indent when punchcards were only 80 characters wide. Semantically meaningful whitespace broke my mind when i first encountered it.
@michaelsommers23563 жыл бұрын
@@RickBoat Yeah, but there was no excuse for not indenting when we moved away from punch cards.
@jefflsmith6163 жыл бұрын
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!
@pierreabbat61573 жыл бұрын
When coding a universe simulation, be sure to initialize all variables. An uninitialized Cepheid variable can crash the whole system!
@Okie1353 жыл бұрын
Underrated comment
@josephcohen7343 жыл бұрын
When you know someone's making a joke but you don't know what a cepheid variable is
@ragnkja3 жыл бұрын
@@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.
@gnome533 жыл бұрын
Are you certain the crash isn't a problem with your scope? ;-)
@framegrace13 жыл бұрын
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
@aformerogr3 жыл бұрын
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.
@Viewpoint3143 жыл бұрын
I am a math, computer guy and would like to say that your presentation is excellent.
@mina863 жыл бұрын
11:15 - and another person discovered the beauty of free software. Welcome to the Light side. ;)
@mina863 жыл бұрын
@@barryomahony4983, I’m pretty sure you intended to reply in another thread.
@barryomahony49833 жыл бұрын
@@mina86 Oops, yes. danger of trying to do 2 things at once.
@terryhaines83513 жыл бұрын
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.
@bjornmu3 жыл бұрын
So they're still using Fortran, over 60 years after the language was introduced!
@tcumming1233 жыл бұрын
I believe that astlib and slalib are both written in fortran, and are widely used still today. I know :)
@ToadalChaos3 жыл бұрын
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.
@KohuGaly3 жыл бұрын
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.
@michaelsommers23563 жыл бұрын
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'."
@michaelsommers23563 жыл бұрын
@@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.
@danielmaxwell66763 жыл бұрын
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.
@wartupper3 жыл бұрын
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.
@stargaze38944 ай бұрын
as someone doing computer science engineering but actually wanted to do astrophysics- good to see I'm still connected :,)
@lloydfromfar3 жыл бұрын
I am a computer programmer professionally meself. But I prefer the term "computer whisperer" :D
@stephengloor84513 жыл бұрын
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.
@DrBecky3 жыл бұрын
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
@bierrollerful3 жыл бұрын
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.
@EnglishMike3 жыл бұрын
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!)
@tabularasa06063 жыл бұрын
@@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.
@Warhamster553 жыл бұрын
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.
@TheOldBlackCrow3 жыл бұрын
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!
@byrnemeister20083 жыл бұрын
Ambitious project. I learnt it just to get away from bloody Excel!,,
@brianoppenheimer38133 жыл бұрын
as a software engineer I would say find a good friend who knows how to code :D
@scifino13 жыл бұрын
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_3 жыл бұрын
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
@edoardoborsato30693 жыл бұрын
YES
@MechanicaMenace3 жыл бұрын
@@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.
@scifino13 жыл бұрын
@@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.
@ronjon79422 жыл бұрын
Wow, I’ve been looking for your explanation for years. Thank you.
@dianaxd053 жыл бұрын
Me : * sees Becky's notification* Me : Yesss !!! Thanks Becky. It's very interesting 👁️👁️ I love it
@kroo073 жыл бұрын
Good to hear that Fortran is still in use.
@alexanderkusmirek68213 жыл бұрын
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
@throwawayuser99313 жыл бұрын
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.......
@SolitaryPine13 жыл бұрын
“Hot, young, big stars.” Like Dr. Becky?
@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.
@joshuawilkerson37833 жыл бұрын
Oh my. I had no idea Dr. Becky was so in to hot young galaxies 😲
@karlesmcquade28633 жыл бұрын
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!
@Invalid5713 жыл бұрын
Wants: a language that's fast. Suggests: python Me: Hold up python for speed? LOL!
@Xeridanus3 жыл бұрын
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.
@marcusdirk3 жыл бұрын
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!
@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 ^^'
@abbashmuel36353 жыл бұрын
Dr. Becky, you are a total genius.
@abebuckingham81983 жыл бұрын
The command "import antigravity" is an Easter egg in Python.
@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.
@arctic_haze3 жыл бұрын
Let me guess before I watch: writing it. debugging it, compiling it, running it and finally losing it on a failed disk drive?
@ShainAndrews3 жыл бұрын
Version control is utilized. Failed hardware is less likely than human error.
@arctic_haze3 жыл бұрын
@@ShainAndrews Nowadays, yes. But I started in the times when you had to hope the diskette with code is still readable.
@DrBecky3 жыл бұрын
Losing it?! We have GitHub and versioning these days!
@I_Don_t_want_a_handle3 жыл бұрын
@@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_haze3 жыл бұрын
@@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.
@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.
@aaronseet27383 жыл бұрын
When she said "efficiency" I was expecting her to use assembly language :D
@JamesWjRose3 жыл бұрын
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.
@realdragon3 жыл бұрын
Am I the only person who likes C\C++ more than python?
@TinkerGrey3 жыл бұрын
Yes. Yes, you are. ;)
@clickrick3 жыл бұрын
Perhaps, perhaps not, but you're almost certainly the only C/C++ programmer who uses the wrong slash between them.
@abebuckingham81983 жыл бұрын
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.
@mattsadventureswithart57643 жыл бұрын
@@clickrick Wrong? Or just rebellious? :P
@diamondsmasher3 жыл бұрын
Java and C++ :)
@JazzyArtKL Жыл бұрын
Fantastic, Becky! I teach CS and have shared your video with my students on how coding skills can be applied in natural sciences.
@arneysrackangast71403 жыл бұрын
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.
@xtieburn3 жыл бұрын
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.
@kensmith56943 жыл бұрын
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 ....."
@miallo3 жыл бұрын
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!)
@mariamyusufognawala56833 жыл бұрын
Thank you so much @Dr. Becky I was really in search of such video Who are these 13 people who disliked the video You explained it so well🤘🏻
@TheDecguy3 жыл бұрын
I enjoyed this video very much. I got caught up in your discussion of the use of Python in your work. When you introduced the topic of simulations and linked up with Dr. Beckmann I was surprised. As Dr. Beckmann stated that she used two different languages for her work I was trying to guess what language she was using that was fast, efficient, etc. I was thinking of various modern languages. When she stated that FORTRAN was the language I was surprised to say the least. As someone who started out using FORTRAN back in 1967 (when dinosaurs still roamed the earth) I thought it was just a bunch of “old guys and gals” like me who were still using it. It brought a smile to my face. I have to admit however that lately I’ve been messing around with Python a bit. Thanks for the video.
@YourSoulDriver3 жыл бұрын
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.
@prithuldas26523 жыл бұрын
I've been waiting for something like this! Thanks a bunch!
@marysibilsky60143 жыл бұрын
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!
@rorymacdonald752911 ай бұрын
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!
@richallan0013 жыл бұрын
As a python developer, I'm loving your love for python. Part of my work, incidentally, is working with large data sets.
@ahmadniazrahman74613 жыл бұрын
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 💙💙
@vansf34333 жыл бұрын
HLL can certainly be a very useful tool for any scientist helping them organize their work and making a computer do the difficult parts for them in the fastest way If you have studied CS and graduated from from a university in CS , you will have a huge advantage in your pursuing any other natural sciences , no matter whether it is quantum physics or particle physics or chemistry or astronomy
@HuwDeMann3 жыл бұрын
I did my undergrad projects modelling galaxy formation in FORTRAN back in the day (late 90's). Had a lot of fun* getting star formation to work. I now spend my time analysing economic data in Python. The great thing about coding is how transferable it is - both from one language to another and from one field to another. (*it was not fun)
@MichaelBrown-kk6ck3 жыл бұрын
Started out 50 years ago with FORTRAN-66 and have used many languages since then. Current primary languages are Java, JavaScript/Typescript, bash, Perl, HTML, CSS/SASS, SQL, and C#. Have not yet had a need for Python but am considering picking it up just for grins to see what it’s all about. F# and Powershell look interesting as well. Frameworks/libraries important as well and often greatly influence choice of language for a project. I know of an engineering prof at my university who 20 years ago was using Excel for finite element analysis.
@alainmaury59413 жыл бұрын
Very true, with exceptions. I am currently writing code to do real time acquisition (which if you go to an observatory and "take images" you don't have to do, since somebody has already writen that code before for you). And another guy on the team is writing real time detection software, running on powerful PCs equiped with GPU boards. So he codes on the "parallel C" for this type of boards with a language called CUDA and in our case open CL (most people use Cuda or pyCuda by the way). Then you do need to have all this software interacting and running alone at night and that's done with a scripting language. Since there are many people who get a PhD in astronomy and later don't get a job, it's absolutely a must to be proficient at coding with some software if you want to do anything with your life. plus when your software at last runs without bugs :), it's fun.
@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 :')
@abdullakhan4632 Жыл бұрын
I really appreciate your work and knowledge which your giving through your channel and as a space lover I was unable to study astryphysics coz my family was not sufficient to pay and now I do code yeah your right python is great for learning. Huge respect from India.
@canaldofetrentin3 жыл бұрын
i am planning to study computer engineering along with astrophysics. Thank you for the video
@gkcadadr3 жыл бұрын
Coding is invaluable to people from all walks and stages of science. It might be less obvious how it'd be useful in social sciences but as a grad student in linguistics I'm glad that I have a background in programming. A lot of linguistics revolves around corpus work and statistical modeling / testing, a task some rudimentary programming is perfect for. Even in literary studies and history of art people are finding all sort of neat things with the use of computing (a whole field of "digital humanities" is emerging).
@tando62663 жыл бұрын
I'm an ME researcher on 3d printing. 1000x yes to everything you said
@vivian38113 жыл бұрын
Love this! ❤️ Hope there are more contents about astrophysics and coding to come. 💫