What makes me happy

I have said for a long time that

“If I’m thinking, I’m happy.”

Today changed my mind a bit. Thinking does make me happy, but I realized something (perhaps very simple) today: that idea may be a sufficient but not a necessary condition.

I had an email this morning from a collaborator in Europe who needed help with a particular tool. I volunteered to help. We’re on Linux systems and GNU screen is a terminal extension program I have used frequently during training or teaching sessions. I can make several windows and collaborators can watch what I do or I can open an in-terminal editor (read vim, emacs or nano etc.) and we can chat. The text file can then be saved for later review. This is a very helpful framework that I have used often.

After a few failed attempts, we figured it out and went on with our days. It was as simple as a configuration file being inappropriate and the associated error message being less than useless because it was distracting. However, the utility and craft of good and bad error messages might be a different post altogether.

The problem presented was a variant of something I had seen before. It was a challenge, but I realized that the challenge wasn’t the aspect of what I truly enjoyed about my morning. I think I’ve often been of this mindset, but I think I’ve only just accepted that my desire to have useful contributions may supersede my desire to be challenged.

I have also said for some time, that I have found myself very naturally making tools that help everyone be successful. This phrase may be too long. I think I will start saying:

‘If I’m helping, I’m happy.’

What do you think?

After I was done, I got to talking to a man named Thomas in the place where I was sitting. He said to me that I am a resource in search of an opportunity. I will be thinking about that phrase as well.

One Day Build (House Hunting)

We’re in the middle of house hunting in Nashville (which is booming).

So, I wanted a tool that would help me vet addresses as they pop-up in my feed from our realtor.
We wanted to be able to walk to some things in our neighborhood and fortunately that criterion a pretty easy thing to map out by hand in inkscape with screenshots from Google maps. I was able to produce a png map that had those regions clearly identified. For those that remember the 2010 floods, water ways are something to be wary of. So I pulled a map from FEMA (maps.nashville.gov) and overlayed that with a transparency by hand, easy enough. I could also have tried to overlay crime maps and offender registries, but this was sufficient for triage.

Now I just needed a converter(mapper) between the x,y in inkscape and gps coordinates.
I used PIL (python image library, aka pillow) to draw on the picture I had created.
The converter looks like this:

def mapper(lat,long):
#scale = [4528.104575164487, -162821.9551111503, 3633.747495444875, 315924.9870280141]
#return(long*scale[2]+scale[3],flip-( lat*scale[0]+scale[1]))
scale = [-5228.758169935899, 189234.5555556009, 4041.34431458903, 351362.65809204464]
return(long*scale[2]+scale[3],lat*scale[0]+scale[1])

There are two attempts here because a conversion from GPS coordinates to inkscape coordinates is unfortunately not the same as GPS to pillow.

I derived this via two “calibration” points on my map and the respective coordinates in pillow.

given = [[36.039065, -86.782672],[36.042890, -86.606493]]
res = [[644, 795],[1356,775]]
a = (given[1][0] – given[0][0]) / (res[1][1] – res[0][1])
b = -a * res[0][1] + given[0][0]
c = (given[1][1] – given[0][1]) / (res[1][0] – res[0][0])
d = -c * res[0][0] + given[0][1]
scale = [1/a, -b/a, 1/c, -d/c]

This finds slope and offset for two categories , latitude and longitude, based off of four points and is exact (those potentially off by a little depending on the accuracy of my calibration points). I should’ve picked points better, because 36.039 is not very different from 36.042. Oh well. In the end it worked.
Then I just hardcoded the values of the variable scale into the function mapper.

I have my x,y coordinates from latitude and longitude. Now I want to draw on my map.

def drawer(coords):
im = Image.open(“pillow.png”)
draw = ImageDraw.ImageDraw(im)
flip = im.size[-1]
for pair in coords:
vec = [mapper(pair[0]+0.001,pair[1]-0.001,flip),
mapper(pair[0]-0.001,pair[1]+0.001,flip)]
print(vec)
draw.ellipse(vec,fill=100)
im.show()

It makes all the points the same color which makes it difficult to judge multiple new points on a figure, but this was sufficient for my purposes.
The plus and minus 0.001 was found by trial and error to make the correct sized dots on the map.

The tool was just for me but my wife also appreciated that we could use this to quickly go through the initial barrage of home listings
and weed out the listings that were for sure not going to be of interest.

Not too bad for a few hours of work and most of that was just deciding and drawing out the regions of interest.