Python

Zachary Mor, updated by Aakansha Mathur, Shashidhar Pai

3D Modeling in Python

Description

A powerful high level language useful for generating readable, efficient data manipulating scripts. There is a large open source community and libraries around for pretty much everything.

Official Resources

Documentation

Install Pip

Use the command:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

Then, execute the downloaded python file:

python3 get-pip.py

Wait for the installation to finish and there you go!

You can check for the pip version by executing the following command in the command line:

pip3 --version

Useful Commandline Tools

pip is the de facto package installer for Python. When you download Python it gets installed concurrently, so no need to worry about installing it. It can be used in terminal:

pip install package_name

and for for Python3:

pip3 install package_name

Anaconda is a package installer for Python which also manages virtual environments. It’s worth installing when dealing with deprecated software.

Useful Libraries

NumPy is a library for many things such as: a powerful N-dimensional array object; sophisticated (broadcasting) functions; tools for integrating C/C++ and Fortran code; useful linear algebra, Fourier transform, and random number capabilities. Install with pip.

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations. Install with pip. Here is a link to how matplotlib can be used for plotting image data.

cv2 is an open source computer vision and machine learning software library. Install with pip. Here is a link on how cv2 can be used for corner detection

glob finds all the pathnames matching a specified pattern according to the rules used by the Unix shell. It is always available, so no need to install it.

DXchange provides an interface with TomoPy and raw tomographic data collected at different synchrotron facilities including the Data Exchange file format (DXfile), currently in use at the Advanced Photon Source beamline 2-BM and 32-ID, at the Swiss Light Source Tomcat beamline and at the Elettra SYRMEP beamline. Install either from source or using Anaconda.

TomoPy is an open-source Python package for tomographic data processing and image reconstruction. Install with Anaconda.

sys provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is always available, so no need to install it.