andres marrugo

Attending LAOP

Last week I attended the OSA Latin America Optics and Photonics Conference in Lima, Peru. I had a great time, but above all, this was my first conference, since I started my lab, in which I didn’t feel so out of place. Let me elaborate. I knew several people that were attending the conference, I knew the work of some of them, and I was also comfortable talking to old and new acquaintances. What I felt was more reassuring, was presenting some of the work we’ve been doing in our lab for the past two years. I was proud to be presenting the work of my students, what we have accomplished with the available resources.

After starting from scratch about three years ago, we are now at a position to start contributing to the greater conversation in science and technology. During the conference, I took the time to finish a revision on a paper we had submitted to Applied Optics from the first results of my Ph.D. student. It is his first journal paper, and it is my first paper as a Ph.D. advisor. Exciting times! The day before traveling back to Colombia we found out it was accepted. An accepted paper is always something nice to celebrate, but each acceptance has a unique story, which only the authors know. We know.

At the conference, I met many colleagues working in different fields of optics, but I had the pleasure of meeting Dr. Arti Agrawal from the University of Technology Sidney. She is a theoretical physicist working on modeling and simulation in photonics. Amazing stuff. However, we met at a lunch organized by the conference for early career professionals and Ph.D. students about preparing presentations. I was amazed by the involvement of the OSA embassadors which were basically young professionals as well. Dr. Arti was overseeing the session and made insightful comments from time to time. I remembered when I was preparing for my Ph.D. defense several years ago. It seemed quite a challenge back then. I read many books about presentations and was quite mesmerized by the many ways one could go about producing a rich and entertaining presentation. But it takes time and practice. Actually, this is something I’ve written about before here.

I later had the opportunity to talk again with Dr. Arti. This time about a work I was presenting. She was inquiring about the type of optimization approach we had used, and why did we think it was the right one. As it often is the case, we had not explored other optimization approaches, and we used this one because we knew it and we thought it could give us the results we wanted. It mostly did, but we are now looking into doing something more general that avoids optimization loops. Let’s see how it goes.

Notes

Overall I had a great time in Lima. The food was fantastic and the organization of the event went quite well. Mostly, I enjoyed the networking possibilities that these events offer, as well as presenting our work and getting feedback from the community. My second presentation was the last day of the conference in the last session. In the photo, the final presenters in the session for 3D imaging.

I came back to Cartagena and talked with my students about the fascinating new topics being presented at LAOP, like Deep Learning in Optics, and also about several people working in optical metrology in the region. Exciting times for Latin America.

How I Do Presentations

Notes

I like to do presentations. I really do. It’s not my favorite thing, but I sure love inspiring others from the work I do.

Ever since I learned of many creative ways to prepare a presentation, I’ve liked to undertake the task with a sense of commitment and a great dose of creativity.

I read the Presentation Zen book. The The Non-Designer’s Design Book. I learned about Sketchnotes, I also read about academic presentations and cooking ideas, and many other things. Not in a single stretch, but as a constant search for getting better at something I value. So I’ve come to realize a couple of things. A presentation is definitely not prepared in the computer or presentation software. A computer per se is not good for the creative endeavor, but paper and pen are.

One plans a narrative because people like to hear stories; even about how you deconvolved an image using total variation regularization. If you tell it right, they’ll listen.

Three things

However, I like to include my own things. Give it a personal touch. When I prepare the presentation, I doodle and draw to get an idea of the picture or image I’d like to include in my slide. But I’ve often found that my doodle is even better at getting the message through than a picture I can download from the internet. So I draw it on my phone using paper, and I import it to Keynote. They’re just doodles, but (I think) because it’s different from what everyone does, people pay attention. And they get the idea.




Group Images by Person

These are basically notes for my future self, but it may sort of work out for someone else, so here it is. I’m currently working on a project in which we obtain a large number of images all stored within a single folder. However, it would be ideal to store them on separate folders. The file names are like this export0_Lastname_FirstName_1.jpg, and there are several files per person.

What I basically wanted, was to organize the mess of files into something like the following:

├── 01-lastname_firstname
│   ├── export0_lastname_firstname.jpg
│   ├── export0_lastname_firstname_1.jpg
│   ├── export0_lastname_firstname_2.jpg
├── 02-lastname_firstname
...

So I made a Python script to deal with it.

group_by_person.py Link
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Import the necessary packages
import os
import re
import shutil

# Getting the list of people
personList = [f for f in os.listdir('.') if re.match(r'e.*\D\.jpg', f)]
personNames = [f.split("_") for f in personList]

# Getting the list of all jpg images
files = [f for f in os.listdir('.') if re.match(r'e.*\.jpg', f)]

# Getting existing subdirectories
# they start with ./01/
existing_dirs = next(os.walk('.'))[1]
N = len(existing_dirs)

# Iterate over all images to sort them per person
# and create a new folder if it does not already exist
for r in personNames:
    N+=1
    for f in files:
        if r[1] in f:
            NewDir = "{:2d}-{}/".format(N,r[1].replace (" ", "_"))
            if not os.path.exists(NewDir):
                os.mkdir(NewDir, 0o777)
            try:
                shutil.move(f, NewDir+f)
            except:
                print("The file does not exist.")

The personList line is done in such a way to get the unique number of people. This is done with the regex. Because there is a file that doesn’t end with a number, matching all files that begin with e, that don’t end with a number and .jpg, it serves as a list of the people for all the images in the directory. In the next line we build a list of the names of each person. This is later used to match and sort each file to its corresponding folder.

Because I had already created some directories, I could have the new directories start at 01. So I use os.walk to get the list and len(N) the number of existing directories. The directories to be created should start at N+1.

The outer-most loop iterates over every single person name, and then matches it the existing image files in the folder. When a match is found it creates a directory, if it does not exist. Then it moves file to the newly created folder. If the file doesn’t exist it prints the error, but it continues. And voilà that’s it. Just a quick tip. Make a copy of your files before starting to manipulate them (you could end with corrupt or no data at all). And also, before moving/renaming files, try printing the variables first to see if that’s what you intend to do.

Get Fridays

So, I was preparing my clases for the upcoming semester and I wanted to produce an outline of the lectures with the corresponding date and topic. For instance I have a class that’s once a week every Friday. I could look up the calendar and write every date, which is what I initially did. But then I though, I could write a script for this. And that’s when I entered the rabbit hole.1

The script I’m showing here went through several iterations. I had several difficulties until I got it to work. I wasn’t pleased with it, so I fiddled a bit more. Later when I saw Dr Drang’s post about formatting multimarkdown tables with tabulate, I knew I had to use that. So I did. Here’s the script.

Grading Lab Reports Workflow

Grades 2 CSV with Python.

Despite all the tools and applications at my disposal, I like to write my comments, feedback and grade the lab reports I get from my students using plain text files. To be precise, markdown formatted plain text files md.

Life Immutable

Life immutable.

We often live worrying about the future and longing for a less troublesome past; like when we were kids. I know that not everyone had a perfect childhood. I certainly did not, but I still had my moments in which my joy was true and worry free. Those moments are precious to me.

Adulthood has many upsides when viewed from a teenager’s perspective; the opposite is also true. If only they could talk to each other.

In Praise of Slow

I have a recurrent discussion with my wife.

She likes to do most things as fast as possible.

I like to pause and think about things, and do them often slowly. At my pace.

I think that if you do things too quickly you might not be fully aware of what you’re doing.

You might feel that you are not really in charge of your life.

You might feel that you can’t really remember things truly.

Like nothing becomes a memorable experience.

You have no time for metacognition and self-awareness.

I wrote these lines before finding out about this book In Praise of Slow by Carl Honoré. It seems this has inspired the slow-movement which tries to raise awareness of how we need to take it easy and enjoy life. Like the saying goes, anything worth doing is worth doing slowly.

It seems I have a new book to read.

On (Re)learning Things

My favorite topic in an introductory differential equations course is mechanical and electrical vibrations. I enjoyed learning about it as a student and I enjoyed teaching it later. (Or more accurately, I enjoyed being exposed to it as a student and really learning it later when I had to teach it.)

John D. Cook on Mechanical vibrations

I’ve always thought that education is about learning, as much as parenting is about maturing and growing up. On the parenting side, you can’t really teach your kids how to live – you can’t even imagine the kind of world they will have to live from the time they’re born – but you can expose them to the best things you know. In doing so, they can at least have the chance to form an opinion on the many matters of life, they’ll surely make mistakes, but I bet they won’t regret much.

Education is a difficult topic. Everyone has something to say about it, yet no one seems to have true answers. I do think that education is much more about being exposed to something, rather than being taught that something. There’s an incredible difference between the two things.

Date Commands

Dr. Drang recently shared two date commands he uses for: i) calculating how many days have passed since a given date, and ii) another that returns the day of the year of the current date.

I was mainly interested in the first one because I often have to do that calculation.1 Because the script can also compute the days remaining until a future date, you can imagine how handy it can be. For instance, if I’d like to know how many days until the day I start my vacations, I just run the script with a future date and it’ll return a negative result in days. Or if I’d like to know how old I am in days.

A CV for My Thesis


A Ph.D. thesis is one of those things that has a life of its own. Last January, I had the opportunity to write a two-page abstract of my thesis for publication in Electronic Letters on Computer Vision and Image Analysis. It has been published and is now available on the web along with the PhD thesis.

The paper is only a glimpse of all the hard work that went into the making of the thesis, but anyone who reads it may get a decent idea of what it is about, and where to find the results I’ve published in different journals. I don’t think anyone wants to go through the process of writing a thesis twice, but most will agree that it is a life changing experience. Many of the best moments of my life so far, happened while working towards the PhD, especially the birth of my two boys.