Tracking Monte Carlo particles (or in this case, ray traces) through a geometry can be tricky because of the subtlety of edge cases. Today I discovered that my tracking routine failed when given a direction of −0.0 . I never imagined that the existence of signed zeroes in IEEE floating point arithmetic could ever bite me.
23 February 2011
21 February 2011
Starting Terminal.app with multiple tabs in multiple directories
Almost every time I open up Terminal, I've wanted three tabs open with three particular directories. That means using Cmd-Tab a lot and tab completion to change the directory. I finally got fed up with that and invented a solution to take care of that automatically.
The first step is creating a "Window group" in the terminal. Go to the menu item "Windows < Save Windows as Group…", make up a name, and make sure "use this group at startup" is checked.
The second step is to edit your ~/.bash_profile and add something like this, where each "if" statement gets a different command. This is adaptable to changing the base directory, sshing, etc.
# change PWD to python by default
function change_default_directory() {
TTYN=$(tty | sed -e 's/.*ttys\([0-9]*\)/\1/')
if [[ $TTYN == 000 ]]; then
cd ~/_code/pytrt/
elif [[ $TTYN == 001 ]]; then
cd ~/_code/_build/pytrt/
elif [[ $TTYN == 002 ]]; then
cd ~/_code/_build/pytrtDEBUG/
elif [[ $TTYN == 003 ]]; then
cd ~/_research/current/
fi
}
if [ -n "$PS1" ]; then
change_default_directory;
fiAdd more elif blocks if you open five windows, take away more if you open fewer. Enjoy!
12 February 2011
Reflecting on the hard work I've put into my research code
I am still proud of my code to get the angle in a quadrature set reflected across an axis. It's a little crazy.
const AngleT& getReflectedAngle(const AngleT& a, unsigned int axis ) const {
return angles_[ (a.getOctantIndex() ^ (1 + ( axis << 1)) + 1) * numAnglesPerOctant_ - 1 - a.getSubIndex() ];
}
This section of code is copyright © 2011 Seth R Johnson, All rights reserved.
09 December 2010
Tradeoffs everywhere
Among the benefits of being a grad student is the ability to do literature review in one's hot tub.
Among the drawbacks of being in Ann Arbor is waking up to find the ambient temperature outside to be 5 °F.
02 December 2010
MC2011 proceedings bibliography style
In case anyone out there hasn't yet submitted their paper for the upcoming M&C conference, I have cooked up a BibTeX bibliography style file for the International Conference on Mathematics and Computational Methods that accurately reproduces their example references in the provided LaTeX template. Download it to save yourself the trouble of manually formatting your citations.
01 October 2010
New hobby
Combining my love of sailing and English by chuckling delightedly whenever I hear people use nautically originated phrases in everyday speech:
- take aback
- square away
- give leeway
- jump ship
- stem to stern
- etc.
06 August 2010
OED: Star Wars Collector's Edition
As a logophile, I occasionally browse both my copy of the Shorter Oxford English Dictionary and the OED Online. For one reason or another, I was reading the updated draft entry of remember, v.1 sense 5a, and I found the most startlingly nerdy quotation displayed:
G. LUCAS Star Wars Episode I: Phantom Menace 91, I made this for you. So you'd remember me. I carved it out of a japor snippet... It will bring you good fortune.
There you have it. It seems that some lexicographer out there chose to sacrifice literary integrity to make a nerdy allusion. I suppose I should also check the entries for "father," "force," "droid,"
26 July 2010
The Case-book of Linear Transport Theory
There are very few people who, upon glancing at the section titles in their neutron transport theory books, would chuckle because "The Case of Anisotropic Scattering," "The Albedo Problem," and "The X-Function Identities" all read like titles from a collection of mysteries.
22 June 2010
Alcohol isn't allowed at the sailing club
I might suggest a slogan for "designated sailor" awareness out on the lake: don't imbibe and jibe?
18 June 2010
Kids these days
Curse you, the internet, for your abhorrent mangling of the words "epic" and "fail." The Iliad is epic. Typical residents of the internet fail to appreciate the beauty of literate conversation.