We're a little crazy, about science!

Fun with coding!

Yesterday I worked and worked, then I worked some more. By the time I called it quits it was well past my normal stopping time. The problem was that nothing was going right yesterday. When I finally gave up I had gotten exactly nothing done. It was one of those days as a collogue said sometimes you just have to power through it. The problem is I don’t have the time to just power through. Which reminded me of how I normally deal with stress, which is funny and I recommend others do this too.

There’s a long to-do list that I’m trying to get done before tomorrow. My main-PI expects that I will have everything he wants done by then and the amount of work I’m going to have to squeeze in today is ungodly. It’s not the first time I’ve had no luck with getting something to work, it’s just the most inconvenient time for this to happen. I’m working on getting it taken care of for tomorrow, but currently there has been zero forward progress and it’s killing me slowly.

Okay, let’s take the story from the top since there may be new people here (welcome! Enjoy the stay). The story goes like this, my main-PI (I have two and refer to them as main-PI and co-PI) has been punishing me for the past month or so by forcing me to present my work to the rest of the lab. Each week I present what I got done and afterwards I’m given a set of new tasks to get done for the following weeks meeting. This week was week four of this and I’m tired, overworked, and overtired. Next week my main-PI is giving a talk during our normally scheduled class/lab meeting. That’s all fine and you would think it means I would have an extra week to do the work this time. Nope, now this list of stuff to do is due Monday instead of Wednesday.

Yesterday was the first day I had a chance to actually work on getting this done. I was hoping that since I had some of the basic code written it would be a simple edit and go situation. It wasn’t, it’s not, and I don’t know how I’m going to get myself out of this hole. I’m doing a new (to me) type of analysis on some EEG data I collected a while back (post on that project) (post explaining EEG). Well last week I attempted the analysis and got it mostly right, I just left some stuff out that I didn’t know needed to be included, mostly because I had never done this before (more).

Yesterday I couldn’t get code to run, at all. When I did get it to run it gave me nonsense back. The most frustrating part is that I can’t find a good workaround for it. The internet is failing me! EEGLAB, the software we rely on and is a add-on to the main software we use MATLAB, has a lot (and I mean A LOT!) of documentation. That would be good news if I could find some straight documentation on how to use the command line for a lot of the stuff I’m being asked to do and not the GUI interface that I can’t stand and don’t want anything to do with. It’s a personal preference, the GUI is nice and all, but it’s much easier (for me anyway) to do everything through the command line.

This isn’t the first time I’ve run into walls like this. The thing is I name my code and add in little comments that remind me that things suck. It’s funny to go back and read through some of them after the fact. That’s how I ended up with code I affectionately named “FUCKEVERYTHINGSPECTROGRAM.m” which makes me laugh (now that it works) every time I see it and makes for a fun conversation when someone else catches the name.

Yeah I was having a day…

Oh screw it, let’s look at some other snarky examples of things I’ve commented into my code when I was having a rough time, shall we? Here’s the deal life gets hard and you want to remember it so you can laugh about it later, right? Most of the code (all) is just for me anyway, so it’s fun to catch little things I write from time to time like when I couldn’t get more complex code to work so I went with the general case

It’s the industry standard technical term I promise.

That would be from the FUCKEVERYTHINGSPECTROGRAM.m code I wrote.

Ever write code and have no clear idea what the code is even supposed to do? Why not memorialize that feeling in a few lines of comments?

A whole existential crisis in just a few short lines of code!

Somedays you really need more graph.

Academic zombie

Other days you need to remind yourself that with great code comes great responsibility, except it’s not great code…

It was a lot of code… I mean several thousand lines.

Code wouldn’t be code if it didn’t give you error messages that were helpful and informative when you mess something up. You know what you need when nothing is working and you have to fight the urge to throw your computer across the room? That’s right a good laugh.

One of the error messages my code throws when I hit a problem

Sometimes code relies on you preloading something to the workspace, it’s okay my code will remind you gently that you didn’t do it.

Why didn’t you load all the things!?

Useful code has several different toggle options. I know mine does! Don’t feel like having the code put everything it just did into a nicely organized file structure for you? Well it’s important to let you know that you forgot to do that… right?

Alternate title to the Philip K. Dick novel…

Of course you want your data to be nicely organized, why not make sure your code reminds you it’s doing all the work!


It’s important to be polite to your code, but if you forget maybe a reminder wouldn’t hurt.

At least your code is polite… you jerk.

Lastly, it’s important to give your code all of your lack of confidence, because let’s face it, you pour your heart and soul into your code and you want that to come through when you hit the run button.

You did it little buddy!

Okay well that wasn’t at all where I planned to go with this post, somedays are like that. If you thought this was funny, you should see how I organize the files on my computer. Maybe I’ll show off my amazing organization abilities some other day. But seriously, it’s okay to write funny things into your code, I wouldn’t mind sharing some of this professionally. Everyone needs a good laugh and I think we all take ourselves a little too seriously when we write code and what not. Yes, it’s important to add comments to code that make life easier for someone else (or more often than not, you two weeks from when you wrote it), but there’s nothing wrong with adding a few lines to remind yourself that you struggled.

Maybe it’s just me, but getting to look back at it makes me laugh and it reminds me that I got through it. I think it’s worth the extra lines to make sure your personality comes through.


But enough about us, what about you?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.