Archive for the ‘python’ Category

July 17, 2014 0

convert png image read using PIL to numpy array

By in python

Beware that conversion of an image with a non-standard format using np.array(Image.open(‘imagefile.png’)) can result in strange behavior. If eg the loaded image have a mode of LA the resulting numpy array are not initiated correctly. Use PIL Image convert function to get a format that you can convert (I expect single and triple channel image […]

Tags: , , ,

May 10, 2014 0

Python script to extract citation keys from latex files

By in latex, python

”’ Created on May 10, 2014 @author: thomas ”’ import fnmatch import os”’ Created on May 10, 2014 @author: thomas ”’ import fnmatch import os import re if __name__ == ‘__main__’: directory = ‘/home/thomas/Ph.D/Projekter/057 2014-03-10 Database paper/latex-version/databasepaper’ matches = [] for root, dirnames, filenames in os.walk(directory): for filename in fnmatch.filter(filenames, ‘*.tex’): matches.append(os.path.join(root, filename)) print(matches) pattern= […]

Tags: , ,

January 20, 2014 0

Python search path

By in python

It seems like that the search path that python searches for modules can be retrieved from sys.path

Tags: ,

January 20, 2014 0

installation of pygame for python3

By in python

The installation process that worked consisted of the following steps: #install dependencies sudo apt-get install mercurial python3-dev python3-numpy ffmpeg \ libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev \ libsdl1.2-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev Download the latest pygame from repository: https://bitbucket.org/pygame/pygame/wiki/VersionControl run: python3 config.py run: 2to3 setup.py -w run: python3 setup.py build run: sudo checkinstall python3 setup.py install

Tags: , , ,

January 9, 2013 0

notes on building and installing pyqt

By in checkinstall, python

To install pyqt sip needs to be installed first. downloading the tarball from riberbank sip is installed by saying python configure.py make make install / or checkinstall –install=no dpkq -i sip_xxx Building pyqt follows the same procedure. BEWARE: if you get the Error: Unable to create the C++ code.” then check that your current path does […]

Tags: ,