Preparing for Bayesian Mathematics in Python

Preparing for Bayesian Mathematics in Python

In which I run through setting up a Python environment on Windows...

I'm going to preface this post by saying I'm not breaking any new ground here. As is often the case, though, a beginner wanting to set-up an environment to do this will have to go to multiple websites to collect this info so I'm going to distil it into one post.

I am going to talk about Python 2.7 as currently it has the most support for libraries. This method should work equally well for Python 3 but I have not tested this.

Fancy Thesis Tables in LaTeX: An Idiots Guide

Fancy Thesis Tables in LaTeX: An Idiots Guide

In which I provide a template for generating fancy, production quality tables for theses...

LaTeX as I've mentioned previously, is a document preparation system well known for its brilliant equations and can also be utilised to make very nice looking diagrams. The tables it generates, however, while neat are a little lacklustre.  This is aimed as a very simple guide to editing tables (regular LaTeX users may find this tutorial very basic).

Word 2010: Footnotes and Mendeley

Word 2010: Footnotes and Mendeley

In which I discuss getting footnotes and Mendeley references to look nice in Word...

I may not have mentioned it before on this blog but I am a Mendeley advisor and a strong advocate of this free reference manager. In fact I cover the pros and cons of it in this video:

Proper Gradients for MetaPost Pulse Sequences

Proper Gradients for MetaPost Pulse Sequences

In which I improve upon the previous post...

In yesterday's post I talked about using MetaPost to generate Pulse Sequence Diagrams for MRI documents. I have been using this to make nice diagrams for my Thesis. There is one problem, however, with the pulse sequence file provided on Mark's website - it generates square gradients.

Pulse Sequence Diagrams Using Metapost

Pulse Sequence Diagrams Using Metapost

In which I use MetaPost to generate publication quality pulse sequence diagrams...

Pulse sequences are the series of radio-frequency pulses required to generate an MR image. If you are an MR Physicist you will see these a lot and probably wondered how can I generate nice pulse sequences for my thesis, papers etc. Well handily using MetaPost and these files you can!

Word 2010: How to Insert Numbered Equations Properly

Word 2010: How to Insert Numbered Equations Properly

In which I run through a useful tip that Microsoft managed to just miss explaining...

The Problem

If you, like me, are in the process of writing a long scientific document which requires multiple reviewers to be able to view changes you may sadly be saddled with using Microsoft Word.* Now, in defence of Microsoft, they have definitely improved the way Word works. Using track changes, Mendeley and with a little bit of tinkering you can have a passable writing experience and be able to send documents out for review by your supervisors. They've even included an equation editor that allows you to put equations in your document and save them for later use.

Sadly in formal scientific writing we often like things to look nice, pretty and numbered like this...

(Just over) A fortnight of Windows 8

In which I review the Windows 8 experience so far...

So I installed Windows 8 about two and a half weeks ago. In brief - it's a slightly improved version of Windows 7 with a few quirks and a start-up screen that require getting used to. In more detail:

LaTeX: Document Details

In which I perfect a macro for listing document details in LaTeX.

The Problem

I've been using $latex LaTeX$ to typeset my MRI Glossary (see previous PhD post). I really wanted an Appendix which listed system info and $latex LaTeX$ version.*

* supports native $latex LaTeX$ - which is awesome


After much googling I couldn't figure out how to do this so I asked the kind folks at and Heiko Oberdiek & Ivan Griffin responded with two macros which I've now combined as follows†: usepackage{hologo} usepackage{ifluatex} usepackage{ifxetex} usepackage{ifvtex}


newcommand{ShowOsVersion}{% immediatewrite18{systeminfo | findstr /B /C:"OS Version" > OSv.tex}% input{OSv}immediatewrite18{rm OSv.tex}% }

newcommand{ShowOsName}{% immediatewrite18{systeminfo | findstr /B /C:"OS Name"> OSn.tex}% input{OSn}immediatewrite18{rm OSn.tex}% }

newcommand*{InfoLaTeX}{% hologo{fmtname} textlessfmtversiontextgreater } newcommand*{InfoTeX}{% ifxetex hologo{XeTeX}-% theXeTeXversionXeTeXrevision else ifluatex hologo{LuaTeX}-% begingroup count@=luatexversion dividecount@ by 100 % edefx{thecount@}% count@=-xrelax multiplycount@ by 100 % advancecount@ by luatexversion x.thecount@.luatexrevision endgroup else @ifundefined{pdftexversion}{% ifvtex hologo{VTeX}% @ifundefined{VTeXversion}{% }{% begingroup count@VTeXversion dividecount@ 100 % space vthecount@ multiplycount@ -100 % advancecount@VTeXversion .two@digitscount@ endgroup }% else hologo{TeX}% fi }{% hologo{pdfTeX}-% ifnumpdftexversion thepdftexversion.pdftexrevision else ifnumpdftexversion expandafter@carthepdftexversion@empty@nil.% expandafter@cdrthepdftexversion@empty@nil pdftexrevision else expandafter@carthepdftexversion@empty@nil.% expandafter@cdrthepdftexversion@empty@nil.% pdftexrevision fi fi }% fi fi }

I then call this at the end of my document with:

appendix chapter{Document Details}

Compiled by: InfoTeX hologo{LaTeX} version: InfoLaTeX ShowOsName ShowOsVersion


This produces the following output:

Compiled by: pdf $latex TeX$-1.40.13 $latex LaTeX$ version: $latex LaTeX$2e OS Name: Microsoft Windows 7 Professional OS Version: 6.1.7601 Service Pack 1 Build 7601

†This requires you to use the -shell-escape option when compiling

Tom Out!


I have a GUI

So following my post earlier today I now have a working xorg.conf and KDE 4.8.3 is running smoothly. Turns out there is an easy to use utility called nvidia-xconfig which I had overlooked and did the job perfectly. Also importantly I now have Chromium (Chrome for Linux if you didn't know) installed :) Time to start tinkering!

I've provided my xorg.conf here in-case it is useful to anyone. This works with a Nvidia GTS 450 linked by HDMI to a Panasonic 42" TX-P42U30B Plasma TV:

# nvidia-xconfig: X configuration file generated by nvidia-xconfig

# nvidia-xconfig: version 295.71 ( Thu Aug 2 20:28:32 PDT 2012

Section "ServerLayout" Identifier "Layout0" Screen 0 "Screen0" 0 0 InputDevice "Mouse0" "CorePointer" InputDevice "Keyboard0" "CoreKeyboard" EndSection

Section "Module" Load "glx" EndSection

Section "InputDevice" # generated from data in "/etc/conf.d/gpm" Identifier "Mouse0" Driver "mouse" Option "Protocol" Option "Device" "/dev/input/mice" Option "Emulate3Buttons" "no" Option "ZAxisMapping" "4 5" EndSection

Section "InputDevice" Identifier "Keyboard0" Driver "kbd" EndSection

Section "Modes" Identifier "Modes0" ModeLine "1920x1080@60" 182.28 1920 1952 2640 2672 1080 1102 1113 1135 EndSection

Section "Monitor" Identifier "Monitor0" VendorName "Unkown" ModelName "Unknown" UseModes "Modes0" HorizSync 28.0 - 33.0 VertRefresh 43.0 - 72.0 EndSection

Section "Device" Identifier "GTS450" Driver "nvidia" VendorName "NVIDIA Corporation" EndSection Section "Screen" Identifier "Screen0" Device "GTS450" Monitor "Monitor0" DefaultDepth 24 Option "ConnectedMonitor" "DEP-0" Option "DPMS" "false" SubSection "Display" Depth 24 EndSubSection EndSection

Tom out!