September 2, 2010

Syntax Highlighting in Nano

Being an astronomer my life at work quite often involves me using a commandline text editor. I'm a big fan of nano/pico and overwhelming prefer them to vi (I know this topic is easy the start a flame war - I'm just not one for vi, never could remember the commands etc). Now today my other half (being the geek that she is) wondered if I knew how todo syntax highlighting in nano since vi by default on her system does this and people were suggesting she did that. Me, I'm not one for syntax highlighting on the commandline (if I want that I just open up gedit/emacs)... but I thought this would be interesting to see if nano can, and indeed it can... so here is simply how to do it:

Put the following into ~/.nanorc

# Colour setup
include "/usr/share/nano/asm.nanorc" # Assembler
include "/usr/share/nano/sh.nanorc" # Bourne shell scripts
include "/usr/share/nano/c.nanorc" #C/C++
include "/usr/share/nano/groff.nanorc" # Groff
include "/usr/share/nano/html.nanorc" #HTML
include "/usr/share/nano/java.nanorc" # Java
include "/usr/share/nano/man.nanorc" # Manpages
include "/usr/share/nano/nanorc.nanorc" #Nanorc
include "/usr/share/nano/perl.nanorc" # Perl
include "/usr/share/nano/python.nanorc" # Python
include "/usr/share/nano/ruby.nanorc"# Ruby
include "/usr/share/nano/tex.nanorc" # TeX

and it is that simple!

Oh and some other useful settings to include:

set mouse # Enable mouse support, i.e. set the marker!
set boldtext

August 28, 2010

My most useful scripts... so far

Over time I've wrote quite a few scripts todo lots of different things, from making [videos work on my PSP] to [astronomical coordinate system transformations]. A lot of these have been documented on my blog, lots more sit on my computer ready to go online (I will eventually put more online) either way things are a mess and I decided it would be a good idea if I put them in one place, so over on my research pages I did - so go take a look at my [most useful tools page]. Definitely one for geeks.

August 26, 2010

Talking GALFACTS Calibration

I gave a talk at the GALFACTS/POSSUM meeting last week on the calibration of the GALFACTS dataset. In essence I talked about how we are going about the calibration and applying it to the main data. I also discussed recent releases of the initial data products: GALFACTS Calibration & Data Quality - Samuel J George + GALFACTS Technical Team (talk at [GALFACTS/POSSUM 2010])

In this talk we discuss the calibration observations undertaken with the [ALFA instrument on the Arecibo Observatory] as part of the [GALFACTS survey]. A description of the observations and the calibration pipeline is given with specifics on the determination of the beam gains and the polarization leakage. The recent release of data to the [GALFA Continuum Consortium] is discussed and an assessment of the data quality is given. In short we have made substantial progress with the calibration and imaging pipelines however their is room for improvement. [PDF Version of talk] - given on 24/08/2010

August 14, 2010

Awk sexigesimal to decimal

Ages ago I put on here some awk scripts to convert between decimal numbers and sexigesimal (i.e. very useful with astronomical catalogues) and I think I've also gone the other way... anyway here is an updated and a more useful bash script todo this, still using awk at the heart of it (this goes from sexigesimal to decimal):


#!/bin/bash
filein=$1
fileout=$2

cat $filein | awk '{if ($4>= 0) {h=($1*15)+($2/60)*15+($3/3600)*15; h2=$4+($5/60)+($6/3600); print h,h2,$7,$8,$9}; if ($4< 0) {h=($1*15)+($2/60)*15+($3/3600)*15; h2=$4-($5/60)-($6/3600); print h,h2,$7,$8,$9,$10} }' > $fileout

put this in whateveryoulike.sh and there you go.

August 2, 2010

Make grids of images

Ever need to create subplots (or a nice mosaic of images) and can't be bothered to figure out how todo it in what ever programming language, or have to open up photoshop or gimp and have to manually reposition everything? Well Imagemagik (like always) can solve this(!) and a friend of mine wanted to do this automatically the other day so I created a little bash script to do the job: combine_intogrid.sh

Here is an example of the output (I used (the top left image) an image I took of M51 and applied some filters to it (see bottom of post for filters):

final

For just one set of images (say you want a 4x1 mosaic you have to run this:


convert \( image1.png image2.png image3.png image4.png +append \) -background none -append final.png

and say for a 2x2 then its just:


convert \( image1.png image2.png +append \) \( image3.png image4.png +append \) -background none -append final.png

The script is essentially designed todo more than one directory at a time and was for astronomical images (hence the use of source in the directories) just replace this and off you go - it will loop through all your directories making nice mosaics of your images.

Filters / process to convert the one image into the 4 used for the mosaic:

convert image1.jpg image1.png
convert image1.png -negate image2.png
convert image2.png -blur 5x2 image3.png
convert image1.png -level 25%,100% image4.png
convert \( image1.png image2.png +append \) \( image3.png image4.png +append \) -background none -append final.png
mogrify -resize 400 final.png


July 31, 2010

WolframAlpha Widgets

Here is a little widget I made to have a play with the wolfram alpha widget builder, it allows you to quickly compare the mass of two celestial objects:

(note: requires javascript)

July 24, 2010

Interesting Astronomical Papers

Most days I index papers, generally on radio astronomy, that interest me - currently these are posted to the cyberska site and they should go to my [twitter page].... but I thought it would be nice to index it on here too, so take a look at the astro papers page.

July 12, 2010

More convolutions

So a friend of mine asked if I could produce the same animation I did the other day of the [convolution of two top hats] but this time of two Gaussians. Pretty straight forward really:

Annimation of Gaussian Convolution

If you want to take a look at the code, see [gauss_convolve.py].

July 11, 2010

Stampede Parade

I am currently experiencing my first [Calgary Stampede] and I have to say what I've seen so far I've thoroughly enjoyed. I still need to properly Cowboy up though, I must do this properly at some point this week. Yesterday I went to the Stampede parade which was a 2 hour long show with the downtown full of people and effectively shut down. It was good fun, lots of marching bands, horses and strange looking floats... I think the highlight was either the [Snowbirds] flying over or a tank doing a burnout! [Here] is a video of some of the things that happened as they went passed us and a couple of pics:

Stampede Parade 2010 - Snowbirds fly over

Stampede Parade 2010 - street cleaning

Stampede Parade 2010 - Tank

Stampede Parade 2010 - Flames

After the show we braved a very packed, it was the third train that turned up that we managed to get on, C-train down to the Stampede grounds to explore what was going on. I managed to get a Stampede pack (dunno quite why I wanted one, but I'm quite pleased with the backpack), saw the [world championship blacksmith competition, some sheep shearing, some giants cows, a crazy dog show ("[Superdogs]" with its own theme music) and miniature horse [chuckwagon] racing (probably the most hilarious type of horse racing I've ever seen). I'm sure we saw lots more too and I'm hoping to go down some point in the next week to experience more of the festivities. Lots of fun and [here] is a video of some of my highlights...

The chuckwagon races in the Saddledome:

Mini chuckwagon races @ Stampede

How to heard ducks:

hearding ducks @Stampede Park

and a Texas Longhorn:

Longhorn @ Stampede Park

July 9, 2010

matplotlib convolution animation

I've recently been doing quite a few convolutions, quite important in the paper I'm working on (hopefully to finish soon, more on that soon I hope), and I thought I'd demonstrate a nice example of how todo a convolution in python with the aid of scipy, numpy and matplotlib (actually this is as much a posting for myself so I don't have to go hunting through my python script directory). It's actually fairly straight forward, but before that I should just recap what a convolution is.

Essentially a convolution is just an integral that expresses the amount of overlap of one function as it is shifted over by another. This is of great importance in radio astronomy. In synthesis imaging (the key to all large interferometer imaging), the measured dirty map is a convolution of the "true" CLEAN map with the dirty beam (this is determined from the Fourier Transform of the uv-data that is taken by the telescope). If you want to know more about this kind of thing, specifically for radio astronomy, take a look at the [NRAO workshop pages] - tons of info. Mathematically the convolution of two functions is (over infinite range):

convolution_inf

Here is an example of the convolution (the green curve) of two rectangular (top hat) functions, there is a slight issue with my plotting that makes them not quite look rectangular (lack of points basically):

Convolution of two tophats

As you can see the final product is a triangle. This is really quite simple to code and I've aimed to make this a nice an accessible program by doing things in a simplistic manner - take a look at [convolve.py]. The animation is produced using imagemagick and the convert task at the end of the script, if you don't have this then just comment it out.

July 1, 2010

FAS Societies Map

As part of my work as the [FAS] (Federation of Astronomical Societies) webmaster I've been updating a few of the functions on the webpages. We now have a [Google map] with accurate society locations (and this now links from the [society diary]) - I think its starting to come together nicely (see below for the map), though I have to say I find that the postcode database not being fully public quite annoying but you can get around it, just got to convert from postcode to Lat/Long.


View FAS Societies in a larger map

Non-Thermal Radio Emission from Late B and Early A-type Magnetically Peculiar Stars

The conference proceedings from High Energy Phenomena in Massive Stars held last year where my colleague, Dr Ian Stevens, presented our results for observations from CU Virgins have now been published. biggrin.gif

"Non-Thermal Radio Emission from Late B and Early A-type Magnetically Peculiar Stars" - Ian R. Stevens, Samuel J George (High Energy Phenomena in Massive Stars)

"The Magnetic Chemically Peculiar star CU Virginis (A0Vp) has shown unusual variations in its rotational period and has also recently been discovered to be radio variable, showing two short period bursts of emission per (0.52 days) rotation period. These bursts have been attributed to electron cyclotron maser emission from the magnetic poles of the star. We present new low-frequency radio observations of CU Virginis taken with the Giant Metrewave Radio Telescope at 610 MHz and 1.2 GHz. We discuss our results and their implications for the the origin of the radio emission from CU Virginis and our general understanding of the magnetosphere and the particle acceleration processes in the stellar magnetosphere. We discuss possible relationships with other high energy phenomena in massive stars. "

Recent Photos

Solar Activity

Sun Latest
Image credit: SOHO/MDI

Get Firefox! Valid XHTML 1.0! Valid CSS! RSS Feed BlogUniverse - listed Powered by Apache Creative Commons License ringsofsaturnrock's Most Interesting Photos on Flickriver

Powered by
Movable Type 3.33