Tuesday, September 30, 2008

AquaInkscape

With Aqua, Apple provides its customers with an intuitive graphical user interface (gui) and an appealing desktop display. Apple's OS X, also known as Darwin, is a UNIX-based operating system. This permits frugal users to run free open-source software on their Apple computers. The main obstacle that needed to be overcome was that much open source software is developed for operating systems that use the X11 window system, whereas Apple uses its own Quartz Compositor. Apple solved this problem with developing X11.app. This application consists of a command line terminal that is run from an X11 window server. Open-source applications that were compiled for Apple computers and use X11 can be run from this terminal. A number of such applications can be found under the Unix & Open Source tab on Apple's Mac OS X Software downloads site.

The X11 windows system does not take fullest advantage of Aqua's capabilities. The X11 project develops very rapidly, progressing faster than the three-year release cycle of Apple's OS X. Incompatibilities may result. Hence, I decided to adapt available open source software that scientists commonly use, e.g. desktop publishing and graphics applications, to run with the Quartz Compositor as back end. The applications take advantage of Aqua and do not need X11.app. They are compiled for Tiger (OS X 10.4) and, more recently, Leopard (OS X 10.5) on the intel (i386) architecture. The applications can be downloaded from my project site on sourceforge.net called "Software for Small Budget Science".

Last week, I completed my first Aqua-build of Inkscape for Tiger. I named it AquaInkscape. A version for Leopard is in preparation. Inkscape is a versatile vector graphics application with a great number of tools and options similar to Adobe's Photoshop®
and Illustrator® CS4
or the open source application GIMP. These applications feature freely-floating tool bar, control and navigation windows that are detached from the main window with the canvas. This is great when you have two monitors attached to your computer and are able to reserve one for the tools, control and navigation, leaving the view of your work unobstructed on the other. However, if work needs to be done on a small display like a PDA, clutter ensues and free-floating windows quickly finish unretrievable in the stack of open windows.

By contrast, in Inkscape the tool bar is integrated into the main window. This may seem old-fashioned. But I found it truly helpful when working in a confined space. Detached popup windows provide further options. But these windows are task-specific and do not need to be left open. This design profoundly enhances the user's experience of an uncluttered workspace.

To software engineers, Inkscape offers the advantage of an application that can be accessed by and integrated into programs written in Python, a programming language widely used in science and for internet applications (e.g. the Google App Engine).

Below,  I briefly summarize my experience with a number of issues pertinent to building AquaInkscape.
  • I compiled 35 packages to build this application. The needed packages were identified using configure --help, beginning with Inkscape and proceeding through the packages required subsequently. I used the latest stable releases for most packages and developmental versions for gtk+-2.0 and cairo
  • For compilation, I followed GNU standard procedures, that is the commands aclocal, autoconfig, autoheader, and automake, if the package was unconfigured. Sometimes, packages provide an autogen script that can be used instead. Then, I execute configure, make, make test and, if all goes well, make install. I install into the default location, that is /usr/local
  • In order to be able to run the packages with Aqua, the compiles have to be configured without X11 and with quartz, if configure --help indicates these options. The packages gtk+-2.0 and cairo are instrumental for rendering Inkscape's gui. They can be built for quartz. 
  • The demos in gtk+-2.0 and tests in cairo instruct about the potential performance of these packages with Aqua. In the demos for gtk-2.0, not all options worked because the default collection of theme icons known as hicolor icon theme was incomplete. I found a full set that fulfilled the necessary requirements in the Mac4Lin Leopard gtk icon theme package. 
  • With my cairo build (version 1.7.4) a third of the tests failed. Most failures involved tests with very large font and some svg options. Only few failures were associated with quartz. I decided that the chances were good for a functional version of Inkscape for Aqua.
  • It is important to configure the font usage accurately, because faulty instructions may result in ugly font output and Inkscape crashes. I use fontconfig and freetype2 for font management. On my system, the path to the default fonts needed in the configuration of fontconfig is /usr/local/etc/fonts.  You may furnish additional font with ghostscript or gutenprint. Both packages will install fonts in /usr/local/share by default.
After all required packages had eventually been installed, I was prepared to compile the inkscape binary with the MacOSX build script provided in Inkscape's packaging folder. I specified the options openoffice files, internal perl, LittleCms, Inkboard, Poppler-Cairo, ImageMagick/Magick++, Libwpg, as well as with and without internal python. For Python, I compiled and installed version 2.5 on my system. Precompiled MacOS X binaries of Python 2.5 cannot be used because they are incompatible with the Numpy package that Inkscape requires. Therefore, the python version of AquaInkscape contains Python 2.5 modules.

Finally, I had to edit the scripts for packaging so that AquaInkscape would launch without asking for X11. The resulting application seems in good working order. I have not tested all possibilities. The only shortcoming I found so far and have been unable to resolve is that the program does not respond to the quit button in the application menu once inkscape-bin is running. The application can be quit, however, with the button in the pulldown menu under File and with the button in the icon menu on the dock. Clicks with the mouse expand the compressed tool icons in the side bar. Have a try and be patient at start up! The application takes some time to launch.
Apple iTunes


Friday, September 26, 2008

Subprime Lending: Truthiness & Delusion of Mind



After Citigroup collapsed late last year, I wondered whether the underestimation of risk in securitized investments was the result of a failure in using scientific methods of risk assessment. Read my post dated Dec. 5, 2007. Soon, I learned that such methods were widely employed in investment banking and insurance. Apparently, misconception prevailed about the reliability of the predictions that these methods provide.

A year on, we find out that the statistical software did not fail. Any scientific method will provide a realistic prognosis only, if the entered data are correct. We presume that a loan is approved with the assurance that the applicant is going to be able to service the payments through the loan period, provided that the applicant's financial situation does not change dramatically. This good practice seemed to have been widely ignored in the subprime and prime ARM (adjustable rate mortgage) loan market of the past eight years. Too often, applicant naivety and lender carelessness took sway over prudence.

In hindsight, the considerate risk analyst would have welcomed an additional column in the input spreadsheet with a truthiness factor weighting each loan. That is, the loan agent is asked to assign a score estimating the applicant's ability to service the loan once the interest rate resets. The agent could be rewarded for good judgment and the improvement in the quality of loans issued. Perhaps such estimates from the field would have helped to predict the risks with the ensuing securities more accurately.

In the absence of such information, the analyst is left to look at the foreclosures on the loans to examine risk retrospectively in the hope that forward projections gain accuracy. Paul Jackson reports on housingwire.com in a post dated Sep. 5, 2008, that the Mortgage Bankers Association (MBA) announced in early September that more than 9 percent of U.S. mortgages were delinquent or in foreclosure at the end of the second quarter of this year. “Subprime ARM loans accounted for 36 percent of all foreclosures started and prime ARMs, which include option ARMs, represented 23 percent,” Jackson quotes MBA's chief economist Brinkmann.

Addendum
  • As The New York Times reports today, I am not far off with my assessment. Listen to this incredible story (11/5/08).