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 […]
Archive for the ‘python’ Category
Python script to extract citation keys from latex files
By thomas 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= […]
Python search path
By thomas in pythonIt seems like that the search path that python searches for modules can be retrieved from sys.path
Tags: python, search path
installation of pygame for python3
By thomas in pythonThe 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: 2ti3, checkinstall, pygame, python3
notes on building and installing pyqt
By thomas in checkinstall, pythonTo 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 […]