Rss Feed
Tweeter button
Facebook button
Technorati button
Reddit button
Myspace button
Linkedin button
Webonews button
Delicious button
Digg button
Flickr button
Stumbleupon button
Newsvine button
Youtube button

Notes:

  • The site will be morphing over the next little while.
  • I am having some issues with tabs/spaces in the Python code. Sometimes they are correct, sometimes they get eaten. I am trying to figure it out.

Please feel free to leave a comment on a post if it interests you or if you have questions

Feb 012010

In a similar vein to reading raw data into Matlab, I created a similar type of function in Python:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
def readraw(filename, shape, intype='int16', byteSwap=False):
        """ readraw - To read in a raw file and reformat it to the right shape """

        #  Read in the file
        if filename.endswith('gz'):
                fp = gzip.open(filename, 'rb')
        else:
                fp = open(filename, 'rb')

        d = fromfile(file=fp, dtype=intype).reshape(shape)

        d.byteswap(byteSwap)

        return d

Leave a Reply

(required)

(required)

Spam Protection by WP-SpamFree

© 2010 Math, Computing and Research Please leave a comment or contact me craig@mri.brechmos.org if you have any questions. Suffusion WordPress theme by Sayontan Sinha