u/decelerated_dragon

A single line of code almost undid our publication

We are currently preparing a manuscript for publication. It's me, a postdoc, and the PI on the project. I generated the last batch of data around a week ago and passed it on for processing and visualization to the postdoc, who had the scripts from the previous projects. The results that came out of that were puzzling.

Let's say we have Figures 1 and 2, the types of which are standard in our field. We know from our previous publications that Figure 2 looking a certain way implies Figure 1 looking a certain way. Instead, we got good results in Figure 2, but Figure 1 looked opposite of what you would expect.

My PI was horrified when he first saw it, on the fence about going ahead with the publication and suggesting I go back to the drawing board. We also tried to come up with alternative explanations, but all of them were unsatisfactory. By that point, I spent more than a month on an otherwise promising approach and, frankly, had no better ideas. Today (yes, we're working Sundays), out of desperation, I decided to dig into the data processing scripts. The key part of the script looked like this:

foo = 0.0
for i in range(0,N):
      foo += bar[i]
      foo = pesky_function(foo)

pesky_function() is the only modification from the previous projects for the purposes of data processing. And then I realized...pesky_function() should be outside the for loop:

foo = 0.0
for i in range(0,N):
      foo += bar[i]

foo = pesky_function(foo)

I immediately grabbed my laptop and ran to the postdoc's office. Told him that I think I found the source of our nightmares. We replotted Figure 1 with the fixed code, and...it looks exactly as you would expect from the previous publications! He shook my hand, emailed to the PI that I found a bug, and tomorrow we'll be rewriting the relevant part of the manuscript. My approach vindicated, publication saved, and overall a huge weight off my shoulders. Phew!

reddit.com
u/decelerated_dragon — 10 days ago

A story about how small the world of academia is and the ultimate flex by my professor

First time poster. I checked the rules and hope it's ok to post a personal anecdote.

Few years ago during my senior year of college, I took a class on deep learning, in which we were free to come up with the topic for our final project. Coming from a physics background, I settle on a physics application, do my literature review, and build on those developments. I did not come back to this topic for 3 years, so it got stashed away in my mind with only the recollection of the basics.

Fast forward to my grad school at a different university this semester, I was taking a seminar on the same physics topic, and for one of the sessions we come to the applications of deep learning. The rough outlines of my undergrad project start coming back to my mind, and during the discussion I mention: "Oh, I remember someone did this interesting thing a few years ago". After a few moments of silence, the professor looks me dead in the eye and says: "Yes, I was the one who did it".

Oh my god, I just wanted to fall through the chair and disappear into the void in that moment, although she seemed amused more than anything else. I suppose that is the ultimate flex you can have as an academic. And yes, I dug through my old folders when I came back home, it was her.

reddit.com
u/decelerated_dragon — 5 months ago