Saturday, May 9, 2009

Backpacking!

I went backpacking two weekends ago.  A 2-day, 2-night (Friday evening --> Sunday afternoon) hiking/camping expedition along a 16-mile loop through the backcountry of George Washington National Forest, in western Virginia, carrying everything I would need to survive on my back.  (Clearly living up to the heritage of, and making proud, I'm sure, my alma mater.)  A trip, the likes of which I've been looking forward to for ages.  I have had very little camping experience (until this trip, I had only been car-camping thrice before), and I find it extremely difficult to pack light when I travel (I was never a Boy Scout, but I've always strongly felt the need to be prepared for any circumstance that comes my way, which means that almost anywhere I go, I carry around with me half a bookbag's worth of assorted toolkit gadgetry), but the idea of being able to survive out in the wilderness with just the barest of equipment --- a knife, a compass, something with which to make fire, a rope... --- has always called strongly to me.  (As it has to many others, too, I'm sure.  But this story is about me.)  Pop culture and the romance stories I read as a youth no doubt had a strong influence in this --- Rambo, Tarzan, Robinson Crusoe, the Swiss Family Robinson, Crocodile Dundee, stories of "Injuns" and the as-yet-untamed American frontier... Ah!  No man can live as an island, and yet we strive towards self-reliance, to give free rein to the independent spirit within us!  Like one of my favourite quotations by Robert Heinlein (author of the excellent *book*, "Starship Troopers") proclaims, "a human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly."  The ideal human being is, quite clearly, a walking, talking Swiss Army Knife.

So last summer, after I had successfully defended my dissertation, and could emerge from my cave and once again have a life, I decided that camping would be my next big Thing.  (Dancing/practicing with my new partner and preparing for the DCDI and Ohio Star dance competitions was what *really* became my Big Thing for the latter half of 2008, taking up all my non-working time and sweetly, but firmly, shoving all my other hobbies out of the way.  Not that I'm complaining in any way --- it was the experience of a lifetime.)  So I bought myself a tent (an REI Halfdome 2 HC), and a sleeping bag (a Lafuma Yellowstone), and a sleeping pad (a Therm-a-rest Z-Lite), and a stove (a Primus Yellowstone Classic) and camp-cookware (a GSI Pinnacle Soloist Cookset and the REI Campware Mess Kit), and a headlamp (a Princeton Tec Fuel), and various other gear, bit by bit building up my pile of equipment as and when I found the items on sale, and I did a trial run of all my gear by camping out in my cousins' backyard (10--20 times the size of my own) one night in August, and made plans to go camping with the siblings/cousins/aunts/uncles, but we could never get the schedules to agree, and the plans never came to fruition, and the summer came to an end, and people's schedules got even more tight, and the weather started to get colder, and the Dancing Thing became more important, and the Camping Thing never happened.  A camping trip with dancing friends did get planned for the Thanksgiving weekend, in the Dolly Sods wilderness area of Monongahela National Forest, West Virginia (as a trial run for a hiking trip along the Inca Trail in Peru that said dancing friends would be going for during the coming January), but frigid temperatures and humongous dumpings of snow in MNF that weekend put that plan on ice.  Literally.  

No camping.

Meanwhile, I sat at home and looked wistfully at my squeaky-clean pile of gear, and read their instruction manuals/pamphlets over and over again, and practiced tieing knots, and flicking my knife open and closed with one hand.  I got to use my sleeping bag during my Christmas trip to Toronto, and during another trip down south to Charlotte for a weekend about a month later, but that was it.

Then I bought a backpack.  REI came out with a new model --- the Flash 65 --- that got rave reviews, including being chosen as a Backpacker Magazine Editors' Choice for 2009, and it was incredibly inexpensive (just $150, compared to $250 and up for most decent brands/models), and I Had To Have It.  Plus, I had just gotten by REI dividend, along with a 20%-off coupon, which meant the price came down to a measly $40 or so.  The stars rarely align so beautifully!  I had been debating whether to get myself a snowboard (after having had Snowboarding be my Big Thing for the winter), since snowboards would then be on sale at the end of the season, or a backpack, and I decided on the latter since I figured it was something I'd be able to use more often, year-round instead of just during the three-month winter-sport season.

Tent: check.  Sleeping bag+pad: check.  Backpack: check.  Stove, cookware, med-kit, snake-bite-kit, various other gear: check, check, check.  Experience to go it alone if I couldn't get anyone to go with me: errr.... Damn.

Meanwhile, with the start of the Spring semester, more and more trips were being announced over the list-serv of the Terrapin Trail Club, the outdoor recreation student organization at UMCP, including several backpacking trips.  So I renewed my membership (which I had allowed to lapse during the dark days of the dissertation dungeon), and signed up for one, meant (so the announcement said) both for experienced  backpackers as well as beginners like myself, along Ramsey's Draft in GWNF.  It sounded perfect!

Two weeks before the trip, the trip leader announced that he might have to cancel it, because he had injured his leg, and would not be up to traipsing around the backcountry with 30--40 lbs on his back.  Unless somebody else stepped up to lead it.  I would gladly have done so myself ---- I really really wanted to go on this trip! --- except I had no backpacking experience whatsoever, and I told him as such.  Luckily, one other person also volunteered, and this other person --- Dave --- had eight years of backpacking experience under his belt, and so between the two of us, we made it happen.  I took care of the administrative stuff (emailing people, taking their money, getting the gear from the TTC storage locker, planning the drive/directions), and Dave took care of deciding what food we needed to take, and making pretty much every command decision once we got to the trailhead.  It worked out well.

The original plan had been to get to the trailhead well before dark, and, even though there was a small campground right there at the trailhead, to hike along the trail for about a mile or so and then find a place to bivouac for the night.  However, what with leaving late from campus, stopping to get the special Lithium batteries required for my Steripen water purifier, Friday-evening I-495/I-66 commuter traffic, and stopping for dinner at a Cracker Barrel, we only got to the trailhead at around 9:30pm.  And even if we had preferred to bed down for the night at the campground there, we couldn't, because it was filled with camping Boy Scouts.  So we picked up our packs, tightened down the straps, and headed off into the forest, headlamps bobbing in the darkness, singing as we single-filed along the switchbacks.  Not "heigh-ho, heigh-ho", but "American Pie".  Or rather, the disjointed parts of it that we could remember.  Not at all what would have been my first thought on being asked to select a hiking song.  Back at the trailhead, before we entered the forest, the sky had stretched above us in a vast, unbroken, inky-black canopy, the stars so huge and bright, they literally looked like diamonds.  It was spell-bindingly gorgeous.  We had been in such a rush to get moving, so that we could find a place to set up camp as soon as possible, that there had been no time to take any photographs.  I really wish I had, though, because we never got to see that sight again that weekend.  Now, inside the forest, the tree-tops closed above our heads until we could hardly see any sky at all (thank goodness for the headlamps/flashlights!!), and clouds covered up the stars the following night.

Among the various equipment that I had bought was a pair of trekking poles.  I've seen people with them on numerous occasions, and I'd always scoffed at them, because it seemed to me that they would be more of a hindrance than a help --- at least on the trails where I've seen people with them: the Billy Goat Trail at Great Falls, MD (Link 1, Link 2), and the trail up Old Rag Mountain in Shenandoah National Park.  Both of these trails involve a lot of boulder-hopping and rock-scrambling, where you'd need to get down on all fours and crawl or shimmy up/down/around rock faces and crevasses and cracks, and if you've got your hands full clinging onto these glorified sticks, then they're going be little more than a nuisance!  But on long hikes on mostly-level-ish terrain, with a heavy load on your back, they're supposed to be quite helpful, so I sprung for a pair.  And yes, they sure did help.  I'm fairly good at keeping my balance, even while moving on uneven terrain, and I probably would have been alright without them, but they did offer some reprieve, giving me two more points of support between which to balance the load I was carrying (which was about 30 lbs --- I weighed it before I left the house).  But where they came in most useful was during ascents, when I'd begin to tire, or if I needed to move faster (Dave was setting a pretty mean pace!): with the poles, I was now able to use all four limbs and my entire torso to propel myself, just like using an elliptical machine in a gym (I'd imagine --- I've never actually used one), and the acceleration I was able to achieve that way was stunning!  Oh, and my knees were probably very grateful for the assistance, too --- on a number of occasions in the past, after (or during) particularly strenuous hikes, my knees have gotten inflamed with mild (but still painful), temporary cases of bursitis.  After this weekend, however, even with the much heavier load, I had no problems whatsoever.  It could be that I'm in better shape now, but I think the poles had something to do with it too.  Granted, I didn't really use them all that much for the majority of the hike, either carrying them or loosely resting them on the ground as I walked, but I did use them every now and then when I needed a little extra oomph to ascend a rise, and sparing my knees that extra effort is probably what saved them.

Back to the narration: 
Two and a half miles later, and 750 ft higher up on the western ridge of the Shenandoah Mountains, just past the end of the Road Hollow Trail, we finally found a place flat enough to pitch our several tents (5, + Dave's hammock); it was 1:00am.  The previous night, in my living room at home, I had practiced putting up and taking down my tent (Bagheera was most interested, of course, and eventually I had to lock him in my bedroom so that he wouldn't accidentally tear the cloth) and now, setting it up this late at night, tired and sleepy, amidst rocks and stones and tree-roots and creepy-crawlies, I was really, really glad I had!  What took me 10--15 minutes (not counting the time taken to figure out which was the most level section of the ground from which I could also clear away tent-floor-piercing stones and twigs, and to clear away said hazards) would otherwise have taken me two to three times as long.  The tent and sleeping bag/pad were, of course, at the bottom of my pack, so I first had to unpack everything else from on top to get to them.  And then we had to collect all the food/toothpaste/scented toiletries into bear-bags (for which we used the sleeping-bag stuff-sacks), and find a suitable tree from which to hang them.  It was 2:00 am by the time I got to actually switch off my light and lie down.  It wasn't very restful, that first night.  The ground on which I had pitched it wasn't completely level, so I kept rolling into one wall of my tent.  And I kept getting up, initially, to check that no scorpions or centipedes or spiders had managed to get into the tent --- either during the few seconds while I had the doors unzipped to enter myself, or somehow through a small hole somewhere --- and were hiding behind my pack or under my sleeping bag, lurking and waiting to bite me while I slept.  And at some point during the night, some animal came shuffling and sniffing around my tent, and of course, my first thought was --- bear!!  And I reached for my headlamp and slowed my breathing and tried to be as still as I could.  But the sounds were too "small" to have been made by a large animal, so I figured that it was probably a mouse or a squirrel or something, but it was still exciting.  

... Oh, and it was cold.  The weather forecast was upper 70s / low 80s during the days, mid 50s during the night, and, in trying to keep the weight of my gear down, I had erred in not bringing a warm enough insulating layer.  All I had were an Under Armor ColdGear base layer, which I was saving for the second night, when my cotton undershirts would be soaked with sweat, and a thin rain jacket.  When we got out of the cars, at the trailhead, I was cold!!  And scolding myself for being an idiot.  15 minutes into the trail, though, the exertion of the uphill climb and the rapid pace that Dave was setting meant that nobody was cold any more, and everybody was stopping to unbutton and peel off layers.  Once we stopped, though, we got cold again, of course.  My sleeping bag was supposedly rated to 30F, so I figured that once I was in it, I'd be warm enough, but I wasn't --- it got chilly enough in the early morning that I woke up often and found it hard to fall back asleep.  Yet somehow, when I finally woke up for good at around 0830, I was fairly well rested, if just slightly woozy, and didn't have any problems staying up or keeping up for the rest of the day.  Breakfast was a couple of packets of oatmeal and half a bagel with cream cheese.  Bear-bags down, tents collapsed, packs packed, and troop was under way again at 1000.  

We made pretty good time, and reached the midway point of the hike (Hiner Spring) by lunchtime, where I got to use my nifty little Steripen UV-zapper water purifier.  The spring itself was a tiny little thing, less than a foot wide, emerging suddenly from the mud and trickling through a few pebbly pools, between larger, moss-encrusted rocks, before spreading out into a soggy, muddy mini-floodplain.  (Further down, though, it collected itself again, and grew into the Right Prong of Ramsey's Draft.)  If I hadn't been with more experienced backpackers, I'd never have known that this puny little trickle could be a source of drinking water (after purification, of course) --- I had imagined something larger!  Now I know, though.  And that's what this trip was all about for me, really --- to get the experience and learn all these things.  I'd have preferred a slightly slower hiking pace, so that I could look around me and enjoy the sights and sounds of being out in the wilderness, and stop to take photographs, but I didn't mind --- when the time comes that I go out on my own, I'll be able to set my own pace.

The Steripen worked like a charm.  Because of its two-stage approach (first pre-filter the water to remove particulates, then insert the UV bulb for a minute and a half and zap all the wicked microbes), and because I had to use a cup to collect a few tablespoons of water at a time from the shallow puddles, it took longer to purify the water than did the pump-action filters that the others were using, but it took a *lot* less effort!  Of course, I couldn't tell right then whether or not it had really worked or not, but it's now two weeks later, and I haven't fallen in the slightest bit ill, so it does seem that it does!  I did, though, forget to take a backup means of purifying water, in case the Steripen doesn't work, so that's something else I need to acquire.  I won't get a filter --- those are just about as expensive as the Steripen, and are bulky, and don't kill/remove viruses like the Steripen does.  Iodine tablets kill everything except giardia, so chlorine tablets seem to be the best bet.  I did read somewhere that regular household bleach can also be used ---- heavily diluted, of course.

Other things to remember to take, for future backpacking trips: better insulation for chilly weather; bug-repellent spray; a stronger rope for bear-bagging (the one I had taken was little more than a clothes-line); a trowel, for digging the LNT-regulated 5-inch deep holes for when you need to go potty in the backcountry.

The Hiner Spring area is the perfect place to set up camp, with lots of flat ground and a source of water, and, being at the midway point on the loop, is usually where hikers doing this trail spend the night.   But since we were making such good time, and preferred to get back home as soon as possible on Sunday, we continued on down the Draft, having decided to go as far as we could that day.  There were plenty of viable campsites along the way, and we finally settled down at a spot just a little north/upstream of the confluence of the Right and Left Prongs.  While we set up the tents and purified more water (much faster for me now, because the Draft was deep enough that I could submerge my entire bottle in it to fill it up, instead of having to pour in a tenth of a cup at a time), Dave started to get dinner ready: mac-and-cheese, tuna, and fruit cups.  I had brought along a couple of packets of Taco Bell hot sauce, expecting the food to be really bland, but I didn't need it at all ---- the food was delicious!  However, one other personal indulgence that I had brought along with me really did turn out to be worth bringing: tea-bags (and coffee-bags), some dessicated milk in a zip-loc bag, and packets of sugar.  At the end of the day, after a long hike, after all the non-stop work has been completed, the tents pitched, dinner prepared and eaten, the cooking and eating utensils washed and put away, the bear-bags hoisted, and nothing left to do but crawl into your sleeping bag and fall asleep under the trees and stars, nothing seals the day more perfectly than a hot cup of tea.  

And similarly, nothing starts the day better than a hot cup of coffee.  I slept much better that night, too --- I was warmer, having worn my UA shirt, and the ground was level this time, so I didn't keep rolling over and waking up.  My only concern for this night was that I may have pitched my tent right on top of an outcropping of poison ivy --- I kept finding three-leaved plants everywhere as I was setting it up, and so, just to be on the safe side, I had coated my arms liberally with a poison-ivy-blocking lotion that I had brought along.  Either I needn't have worried, or it worked, because I never itched.  Oh, and I left my shoes outside the tent that night, to dry off, because they had gotten wet from the couple of stream-crossings that we had done, and I was afraid I'd wake up and find that spiders had made their home in them.  Happily, that did not happen.

FYI, I don't like spiders.  They bite.  And they're venomous.  Some of them, dangerously venomous.  And frighteningly fast.  Heck, they're carnivorous predators!  Hence, my extreme wariness where they are concerned.

We broke camp just as quickly that morning, and headed out at the same brisk pace.  Crossed through Ramsey's Draft a couple of dozen more times, and I don't think any of us was left with dry feet at the end of it all.  A couple of times, there were handy tree-trunks that had fallen across the stream and which provided natural bridges, and sometimes the rocks in the stream were large enough that they protruded above the water level, but most often, we had to just plunge into the slightly-higher-than-ankle-deep (at these fording points, at least) water and wade through.  My hiking boots were Gore-Tex lined, and therefore waterproof, but they only extended as high as my ankles, so I had bought a pair of gaiters to extend the protection higher.  The gaiters worked beautifully.  It was my boots that failed!  I'm not sure how the hull breach occurred, but I think it happened somewhere near the toe box, so I need to check that out before my next hiking trip.  The wool socks that I was wearing saved me from any water-induced discomfort, though --- I could _feel_ the wetness between my toes, and around my foot, but it didn't bother me in the least.  I did not at all feel like I was walking around in soggy, water-logged shoes.  I wonder if that's what diving wet-suits feel like...  Most, if not all, of the others changed into dry socks/shoes when we reached the cars, almost exactly at noon, but I felt no need to, not being uncomfortable at all, and I stayed in those same socks and shoes all the way back home (a 4-hour drive, including a stop for lunch), and even for a little while after, while Dave and I unpacked all the TTC gear to air out.

The one uncomfortable/painful outcome of the trip was my hips:  they were covered in bruises from the chafing of the backpack's waistbelt.  A couple of weeks before this trip, I had loaded up all my gear into my backpack and gone for a short day-hike in Gunpowder Falls State Park, to see how the pack felt, and I did notice then that the pack cut into my hip bones not a little.  Unfathomably, even though it's a well-known fact that at least 70--75% of the weight of the pack is *meant* to be supported by the pelvic bones rather than by the shoulders, I noticed that my pack had substantial padding in the shoulder straps, and almost none in the waistbelt!  Sure enough, after a couple of miles into this weekend trip, my hips started to hurt again.  After a while, I was able to ignore the pain for the most part, but it was always there as a background nuisance.  I was pretty sure I was wearing the pack correctly, so I didn't know if I simply needed to grow calluses on my hips or not.  Anyway, since then, I've bought another backpack, a Gregory Z65, which seems to fit me like a dream!  I'll load it up tomorrow with all my gear and walk around to try it out and find out for sure which pack is better, but I have a feeling that it may end up being the Gregory that I keep.  I'm not entirely happy about the "upgrade", though, because the REI Flash 65 has a few features that the Gregory doesn't, though, like an emergency whistle built into the chest strap, a few extra pockets to help organize the contents of the pack, and a big catch-all "shove-it" pocket on the outside of the pack, good for things like gaiters and rain shells.  And it looks a little nicer too, I think, with its orange accents (the Gregory is just uniformly gray.  Bo-ring!).

So that's it!  My first ever backpacking trip!  May there be many, many more!

Sunday, March 8, 2009

Renaissance Man

I have a love-hate relationship with libraries. I love them, because they are so full of such a wide variety of books that are so full of the most interesting things, and I hate them, because they depress me, because they always remind me of all the information and knowledge that is out there that I will never know --- that I *can* never know. (Bookstores have a similar effect on me, but libraries are worse, because in libraries I can read all those books for *free*! (Relatively speaking.) There's no cost-benefit, guilt-flavoured argument to overcome.) When, oh when, will I have the time to read all that I want to read, to learn all that I want to learn? The printed word is my "Ooh, shiny!" --- if there's writing on it, I have to read it, and if there's the remotest chance that I may enjoy reading it or need to read/refer to it again, I will hoard it. My own bookshelves at home are full of books that I have picked up over the years (mostly for free or at bargain prices) but which I haven't yet read. To say nothing of the steadily growing stacks of newspapers and magazines. I can't wait to retire, and finally have time to read them all!

PS: Okay, fine, I don't really hate libraries. They are wonderful entities, and not at all deserving of such intense negative regard. Rather, it's the way they make me feel that I hate.

Life is skittles, and life is beer!

Spring is here, suh-puh-ring is here! And, as much as I haven't gotten in all the snowboarding that I wanted this winter (yes, I have been *several* times this season, and I did venture onto the black diamonds, still, I haven't completely mastered the blues yet, and I haven't yet gotten any air --- while my skiing friend Brandon has! --- and that bothers me no little amount), I'm happy for the arrival of warm weather. The birds are singing in the trees, squirrels are bounding about, Bagheera is going hyper in the windows and chafing at being confined indoors (I so would love to take him out and let him run free, but I have little enthusiasm for the prospect of chasing him myself over hill and dale and up a tree to bring him back. I could put him on an extended leash, as I did when I gave him his first taste of The Great Outdoors a few weeks ago, but he'd probably choke himself to death in a mad dash to the end of the clothesline.), the women-folk are shedding their winter coats for skirts, shorts and spaghetti-strap tops... ahh, life is good.

Post-doctoral perks

As much as I consider my current employment situation as a post-doctoral Research Associate as simply something temporary, to last only until I find myself a `real' job, there do exist certain perks to the position, an example of which I experienced about a week ago. I was driving onto campus for some late-night work in the lab, and slowed down at the entrance to campus for the usual ID-card check --- when the semester is in session, and [undergrad] students are occupying the residence halls, the campus police close off all entrances to campus, except three, between roughly the hours of 10 pm and 4 am, and check the identities of the drivers of all vehicles entering campus through those remaining three entrances. Only those vehicles that have an occupant affiliated with the university --- student, faculty, or staff --- are allowed in. And, unless you have a university/campus parking permit, your name, vehicle license number and on-campus destination are logged. I don't have a permit (I typically cycle to campus); consequently, my entrances are always logged. So, that night, expecting the usual 30--40-second wait while my particulars are noted down, I approached the single-file checkpoint as I always do: headlights switched off (`dimmed'), window rolled down, left arm out the window holding out my ID card ready for the police auxiliary to inspect. My new ID card. My new ID card, which now says "Faculty/Staff" instead of "Graduate Student". And the young undergrad police auxiliary kid looked briefly at my card, and without skipping a beat waved me on, with a very respectful "You're good, sir."

I couldn't stop chuckling, all the rest of the way to my lab.

Saturday, January 26, 2008

On importing MatLAB figures into papers and presentations

[2008.02.01: I've had to substantially re-write this post, after I realized that my first attempt at it was horrendously convoluted and confusing. Which, in all fairness, is exactly what my own state of mind was at the time, after the hours – days! – of wrestling with the subject matter of this post.]

As a [graduate] student in engineering, I have, of course, had to write innumerable papers and reports, and deliver just as many presentations. Since most --- almost all, in fact --- of the work described in those papers and presentations was performed using MATLAB, the issue of how best to import figures created in that software package into a different software suite, meant for creating said papers and presentations, is a very important one. One that, thanks to the different ways in which MATLAB, Microsoft Office (the most-prevalent choice for creating documents today) and Adobe's PDF standard handle image data (not to mention all the various `standalone' image formats --- [Windows] bitmap, [Windows] Enhanced Metafile (EMF), Compuserve GIF, JPEG, TIFF, PNG... the list could go on forever), usually results in hours upon hours of exasperating, infuriating, hair-rending, cerebro-circuit-overloading trial and error. (MS Word's own quirks when handling non-text objects and/or relatively complex documents only add to the pain, which is why I, like many others, have switched to using LaTeX --- but that's another story.) It sure did for me, and I know it has for many others too. (See, for example, "Matlab copy-and-paste: Still broken after all these years" by Frinkytown, "How do I import MATLAB graphics into Microsoft Office 97?" by the MathWorks, this Matlab script to create a Word document from a Matlab figure, by James Lynch, and yet more search results returned from googling "matlab figures Word".) So, to save any others the ordeal of re-inventing my wheel, here is what I have learned:

(Note: The following discussion applies to figures with `line' plots. For figures with shaded plot elements, like those created with surf, mesh or pcolor, see the last paragraph of this post. Also, my system is WinXP Home / SP2, MS Office 2000 and MATLAB v6.5 (R13).)

First off, MATLAB’s own display format: figures on-screen are created at a resolution of 96 dpi, at a default size of 560x420 pixels (4.375”x5.833”). I’m not quite sure how this happens, since my laptop screen itself seems to have a resolution of 117 dpi (1400x1050 pixels, 12”x9”). Maximized, the figure becomes 1400x944 pixels, but still at 96 dpi.

If the figure is exported as a png file – or any other bitmapped (raster) format, I’m assuming – the resolution gets increased to 150 dpi. The size of the image in inches is set by the Page Setup settings of the figure window (default: 8”x6”). The size in pixels adjusts accordingly (default: 1200x900). Similarly, other Page Setup settings also apply, such as Recomputing vs. Keeping screen limits and ticks. Linewidths remain about the same, but the sizes of the text fonts and the line markers become smaller in proportion to the rest of the image. The dotted gridlines (which are actually very tiny dashes in the original MATLAB figure, with a default linewidth of 0.5) become true dotted lines – which is nice.

The results are probably the same with other bitmap-format filetypes, I’d imagine. With a tif it’s the same, except that the filesizes (in bytes) are an order of magnitude larger (two orders of magnitude larger for an uncompressed tif), with no improvement in quality (that I can observe). Jpgs are about five times larger than the pngs, again with no improvement in quality (possibly even a slight deterioration, depending on the degree of `lossiness’ chosen). Gifs are the same as pngs, and we’re not supposed to use those any more. So, in fact, with the exception of eps files (and I’ll come back to those later), pngs really are the smallest filesize format out there, smaller even than the emfs.

If the figure is exported as an emf file (which is a vector format, I think), the [relative] sizes of all the figure objects remain the same, so the image looks *exactly* like the original figure in MATLAB. The size of the image in pixels is the same as the size of the original figure on the screen at the time it was exported. However, the resolution increases to 120 dpi (so the quality improves), and the size in inches therefore gets proportionately reduced. Strangely enough, if this emf file is imported/inserted into MS Word, the resolution of the inserted image falls back to 96 dpi (and the size in inches therefore increases back to that of the original MATLAB figure). Similarly, and similarly strangely, if the emf image is converted into the png format (which is easily done using a program like Irfanview), the resolution falls to 94 dpi. And, for some still further strangeness: if this emf2png file is inserted/imported into MS Word, the resolution once again returns to the original 96 dpi!

Coming now to the quality of the various image formats when imported into the various document formats:

In a MS Word .doc file:
png: image quality is good (still at 150 dpi?), but fontsizes and markersizes need to be increased to look the same as the original MATLAB figure. The true-dotted gridlines are almost invisible – which is nice.
emf2png: quality is not as good (96 dpi) as the imported pngs, although the sizes of the objects are `authentic’. Pretty sorry-looking, in fact – everything in the image is pixelated and `choppy’ – but just about passable in a pinch.
emf: quality is the best, even though the resolution is only at 96 dpi, and the image looks exactly like the original figure. Much better than the emf2png, and also slightly better than a png even when it’s had the font/markersizes increased. _This_ is the best of the three choices, when working with Word documents.
Coloured lines in imported pngs are slightly faded (when printed out on a B/W printer), but those in imported emfs and emf2pngs are still quite visible.
In addition to importing an external image file, when working with Word you also have the option of copying-and-pasting the figure image directly from MATLAB, via the [Windows] Clipboard. Using this method, a figure that is copied in metafile-format (“Preserve information; metafile if possible”), and with the “match screen-size” option, results in an image that has an increased resolution of 120 dpi (like an emf file before it is imported), and looks exactly like the imported emf-file image (96 dpi). If the image is copied in bitmap-format, it comes in at 96 dpi and looks just like the imported emf2png image.
One final word (no, pun not intended): “direct-copying” in metafile format is sometimes preferable to importing an emf file, even though they look the same, because in some versions of Word (Word 2000, for example, but not Word 2003), the latter method can result in the individual letters of the y-axis-label --- but not the entire label as a single unit --- getting rotated 90deg clockwise, resulting in a vertical stack of horizontally-aligned letters.

.doc --> .pdf, using the Adobe pdfmaker macro:
pngs: look terrible, whether font/markersizes have been increased or not. The quality deteriorates very badly in the conversion from doc to pdf.
emf2png: quality deteriorates slightly, not as much as the `true’ pngs; so they look a little better, but not by very much. They’re passable, but just barely so.
emfs (and metafile-format direct-copies): look the best, although the little dashes of the gridlines get converted into big dashes, which is not very pretty at all. (Increasing the linewidth of the gridlines from in the original figure from 0.5 to 1.0 may help – I’m not sure; I haven’t tried it yet.)
For all three formats, coloured lines are almost completely invisible when printed out on a B/W printer.
(All this is with the default pdfmaker settings. Maybe tweaking those will help; I've never tried it, so I don't know. Not sure if using Distiller instead of pdfmaker makes any difference, either.)

.tex --> .pdf:
pdflatex only recognizes images in jpg, gif, png and pdf formats, so now it’s not possible to import those good-quality emfs or even directly copy from MATLAB via the Clipboard. So we’re stuck with pngs. On the other hand, we can now use figures that have been exported as EPS – Encapsulated PostScript – files, and which can be converted to pdf, either on the fly during `texification’ by Heiko Oberdiek’s epstopdf package, or previously by some other method.
png: looks decent, like it looks in a doc before it’s converted to pdf.
emf2png: also looks like it does in a doc before conversion to pdf.
Therefore, of the two, png is better. Font- and markersizes need to be increased, though, of course.
eps: the best of the lot. Quality is better than that of png. (I don’t know what the resolution of these images is – it seems to be between 110 and 120 dpi.) Here too, though, font/markersizes need to be increased prior to exporting from MATLAB, by possibly the same amount as for the pngs. The gridlines are true dotted lines. Also, the postscript `bounding box' is drawn tighter around the axes/plot, so that, for the same overall figure width, the graph/image is larger --- unless you specify the -loose option while using the MATLAB print command.
Coloured lines in all three formats are faded as much as, or even more than, in doc2pdfs.

The -loose option tells the postscript driver to use the figure's PaperPosition property value as the Bounding Box. This is important because, when multiple figures are to be aligned side-by-side in the final document, it is the bounding boxes that get aligned, and, if the different figures have axis labels with different sizes or positions, then not using the -loose option results in differently-sized bounding boxes, with the result that the axes of the different graphs don't line up with each other.

Thus, in shorthand, for each of the three document formats, the order of preference for the image formats would be:

doc: emf /direct-copy > png (sizes increased) > emf2png
doc2pdf: emf/direct-copy > emf2png > png (whatever the size)
tex2pdf: eps2pdf > png (sizes increased) > emf2png

Finally, coming to the scaling of the various image objects (and the images themselves), these are the settings that I have found to work for me:

For a presentation (Powerpoint), using emfs:
Resize figure window to 600 x 450 for 2 graphs per slide
(For 1 graph per slide, magnify --- in Ppt --- to 125%)
Line thickness - 3
Arrow thickness - 2
Arrow text - 16, bold
Axes labels - 14 or 16, bold
Tick labels - 14, bold
Marker size - 10 (15 for x)

For a paper (doc, doc2pdf), using emfs:
Resize (in Matlab) to 600 x 450
Resize (in Word) to 65% (width = 3.17") for double-column size
Inline with text (not floating over)
Line thickness - 2
Legend font - 10 point, normal (default)
Axes labels - 14, bold
Tick labels - 12, normal
Marker size - 6 (10 for asterisks, pentagrams and hexagrams)

For a paper (tex2pdf), using pngs:
(To fit two images side-by-side on a single-column page)
Either don't resize in Matlab (default = 560 x 420), and then scale the width in TeX to 0.5\linewidth, or resize in Matlab to 600x450 and then scale in TeX to 0.45\linewidth.
Line thickness - 1
Legend font - 14 point, normal
Axes labels - 18, normal
Tick labels - 14, normal
Marker size - 8 (12 for asterisks, pentagrams and hexagrams)

For a paper (tex2pdf), using eps2pdfs:
Same figure scaling as above, and:
Line thickness - 1
Legend font - 10 point, normal
Axes labels - 14, normal
Tick labels - 11, normal
Marker size - 6 (10 for asterisks, pentagrams and hexagrams)

For figures involving shading (pcolor, surf, mesh plots, etc.), there are still more things to consider, like the way in which MATLAB renders the image (Painters vs. Zbuffer vs. OpenGL), the colour of the background (transparent -- which doesn't always work out that way -- vs. white vs. `figure-color'), and, again, the method for copying/exporting the image (bitmap vs. metafile)... Oh, and the version of Word or Powerpoint that you're importing into. And each choice interacts with each other choice in completely unpredictable ways. (Of course.) I'll get to these another day.

------------------------------------------------------------------

2008.08.15 (Another Day):

For figures without shading, MATLAB's default renderer is Painters, which is a vector format. For figures with shading, the default renderer seems to be either ZBuffer or OpenGL, which are bitmap/raster formats. (On my computer, it's ZBuffer.)

According to MATLAB, when exporting figures to image files (this includes using the "print" command), the default output resolution of the image is:
- 150 dpi for (figures in image formats and when using the ZBuffer or OpenGL renderers)
- screen resolution for metafiles
- 864 dpi otherwise (eg: eps figures and using the Painters renderer)

Since figures, whether shaded or not, come out at 150 dpi when exported as a png/bitmap-file, this would imply that MATLAB always uses the ZBuffer/OpenGL renderer instead of Painters for this export option.

Now, the method I've been using for my tex-->pdf documents, for images with shading, is to export the images as png files, with all the default options/settings. This means, in the Page Setup options, to:
- Use manual size and position (8"x6" => 1200x900 pixels @ 150dpi)
- Force white background
- Use the default figure rendering method (which is ZBuffer on my computer)

But:
- Keep screen limits and ticks (instead of the default "Re-compute")

The same method can also be used for importing the figures into MS Word (and on to pdf), but now there's also the option of directly copying and pasting from MATLAB into Word.

If the figure is copied in metafile format, or "Preserve information (metafile if possible)" (found under Copy Options), the text comes out looking nice, but the shading becomes blocky --- i.e., the "facecolor" property of the shaded surface gets set to the default "flat" (faceted) before the copy occurs. (This can also be set by Matlab's "shading" command. I usually use the "interp" --- for interpolated --- option, because it gives a smoother, nicer look.) This can be remedied, to an extent, by decreasing the step size of the surface matrix.

If the image is copied in bitmap format, then the interpolation of the shading, if set, is retained, but now the text gets pixelated and choppy. This can be fixed, to an extent, by increasing the text fontsize and changing the fontweight to "bold".

The third option --- importing a 150-dpi png image into Word --- seems to be the best compromise solution for this trade-off: interpolated shading is retained, and the text, while not as flawless as in the pure-vectorized metafile (or emf), is still better than in the bitmap-format copy.

When the .doc file is converted to .pdf, all three formats suffer a slight, and roughly equal, deterioration. The imported-png image remains the best option, in my opinion.

A fourth option (for tex-->pdf users), is exporting the shaded figure as an eps file, but this results in ugliness, and is not an option I would consider.

Wednesday, January 16, 2008

Haute couture, graduate-student style

East met West in my attire today. Spurning my usual engineering-graduate-student garb of grubby jeans and a white T-shirt (typically obtained for free at some point during my collegiate career) for something more formal, and more appropriate for the American Helicopter Society dinner meeting that I'm attending tonight, I stepped out of the house nattily dressed in a Nehru jacket, trench coat and cowboy hat.

Yes, you read that right. Nehru jacket. Cowboy hat. Oh, and a tie elegantly patterned with a flotilla of little B-52s.

The Nehru jacket because I wanted to try something different from my usual double-breasted blazer --- and lo and behold, it actually did look pretty damn good! The trench coat because my winter jacket is a bit too technical-looking for a formal dinner event (and also because it's fun to wear something I've never worn before). And, topping it all (ha ha!), the Western broad-brim because it's winter, and it's cold, and I need to keep my mostly keratin-free noggin warm somehow, and a woolly touk (`beanie', or `winter hat' for anyone not Canadian) would have been just waaay too incongruous with the rest of my attire. So, in the absence of any other formal-looking hat (maybe I should get myself one. And some leather gloves too, while I'm about it.), my very warm --- 100% wool --- and very stylish cowboy hat it had to be.

I'm quite stoked about it --- am grinning away idiotically just thinking about it, and the reactions of people who encountered me on my way to work. Dressing up is fun! And, if you're going to try out something bizarre, a college campus is the best place to do it. I'm never going to be able to walk around with one side of my face clean-shaven and other side with a week's growth of facial hair again, once I get a real job. *sigh*

;)

Tuesday, December 18, 2007

Fred and Ginger

I finally saw my first Fred-Astaire-and-Ginger-Rogers movie last night. Yes, I know what you're thinking -- I call myself a ballroom afficionado, but had not yet seen a single one of their movies?! Sadly, yes, such was the case. But last night, my friend Liz invited me over to her new apartment for dinner, and after chowing down on cinnamon chicken, overdosing on Ghirardeli-chocolate brownies and ice cream, setting up her Christmas-village train set under her *gorgeously* decorated (yet, happily, not at all garishly over-decorated) tree, and spending a not insignificant amount of time flipping through her complete DVD set of Fred-and-Ginger movies and trying to decide on which one I wanted to start my F&G experience with, we settled down to watch "Top Hat" [IMDB link, Wikipedia link].

It was lovely, of course. To be quite honest, I didn't even really have a good idea of what Astaire looked like, and had always pictured Frank Sinatra in my mind when I thought of him... and so I was a little surprised to see how slightly-built a man he was. I guess I had the impression that the more-famous, Hollywood leading men of the day were were all cut, more or less, from the Cary-Grant mold. I was also quite surprised at the comic-ness (is that a word?) of his character, and the motility of his facial expressions --- I never knew him to be a master of physical comedy as well! (Think Jim Carrey, or Matthew Perry, but without the buffoonery and far more refined.) In fact, I kept marveling the whole while that the person he reminded me most of --- vis-a-vis his facial expressions, at least (and long, waggly fingers, too) --- was Stan Laurel! Again, without the slapstick, but with all the innocent sweetness and charm. Really, all I knew of him was that he could dance, and dance his audience off their feet. And that, of course, he did: I'm having a Foxtrot day today (my earlier post on the Viennese Waltz notwithstanding), with Irving Berlin's delightful compositions looping non-stop through my head. Have hunted down and bookmarked YouTube videos showing my favourite dance sequences from the movie: "No strings", "Isn't it a lovely day", "Top hat, white tie and tails" and "Dancing cheek to cheek", although you really do need to watch the entire movie, and on a larger screen, to obtain the full pleasure of watching Astaire's *face* dance as he woos Rogers. Can't wait to see the rest of their movies now.

PS: Found these, too --- also worth watching: a recording of a Kennedy Center tribute to Astaire in 1978, and a clip of Astaire dancing with imaginary props, in an episode from "An Evening with Fred Astaire". (There are links to clips from other episodes there, too, in one of which --- in which he sings "Changing Partners", while dancing with Barrie Chase --- his expressions remind me of Hugh Laurie!)

PPS: I was having a hard time deciding whether to direct my hyperlinks to the corresponding entries in Wikipedia or those in the Internet Movie Database --- and including both in the text, citation-style, completely messed up the readability/flow of article. The Wikipedia entries are easier to read, while the IMDB ones, I would imagine, are more thorough and authoritative, and perhaps more permanent, although they do require a subscription for some of the information. Besides, the Wikipedia ones do link to the IMDB ones, but not vice versa. I finally decided to go with the Wiki-option, but here are all the corresponding IMDB ones as well: Fred Astaire, Frank Sinatra, Cary Grant, Jim Carrey, Matthew Perry, Stan Laurel, Irving Berlin, Hugh Laurie.