Skip to content
YC.S edited this page Feb 1, 2019 · 66 revisions

spipy : Python tools for XFEL Single-Particle-Imaging analysis and reconstruction


1. Architecture

  • analyse
    • q ------------- tools for pixel transmission between reciprocal space and real space
    • saxs ---------- tools for generating and analyzing averaged intensity profile (SAXS)
    • orientation --- tools for 3D orientation ssampling, analysis and visualization
    • SH_expan ------ (spherical) harmonics analysis
    • criterion ----- metrics for SPI reconstruction
    • rotate -------- 3D matrix rotation and alignment
  • image
    • radp ---------- radial profile tools and spherical/circle shells/solid generation
    • quat ---------- quaternion calculation
    • classify ------ single particle diffraction classification
    • preprocess ---- pretreatment tools for raw data
    • io ------------ read/write data from/to different formats
  • merge
    • emc ----------- orientation recovery and merging using EMC algorithm
    • utils --------- utility functions for merging, such as slices generation and merge, etc
  • phase
    • phase2d ------- 2d phasing algorithms : relaxed averaged alternating reflections, difference map and error reduction
    • phase3d ------- 3d phasing algorithms : relaxed averaged alternating reflections, difference map and error reduction
  • simulate
    • sim ----------- simulate diffraction photon patterns from pdb files, by direct Fourier transformation of density map
    • sim_adu ------- simulate diffraction intensity patterns from pdb files, by atom scattering simulation

Example :

from spipy.analyse import saxs
import spipy.image as spiimage

2. Install

The package need Anaconda python2.7 version installed in advance. Download here

2.1 Download

git clone https://github.com/LiuLab-CSRC/spipy.git

2.2 Make file

[Firstly]

To compile EMC module of the program, MPI, openmp and gsl are required. Fully compiling is only support on LINUX machine:

# Only for LINUX
# After putting the downloaded package to somewhere you want, 'cd' into the 'spipy' directory and run
./make_all.sh

But, if you don't need to use spipy.merge.emc (module) and spipy.simulation.sim (module), you can skip the compiling of these two parts and use other functions of this package, which is the only choice for MacOS:

# For both LINUX and MacOS
# After putting the downloaded package to somewhere you want, 'cd' into the 'spipy' directory and run
./make_all.sh -x

[You should know]

If you are using Linux, notice that mpicc version in Anaconda maybe lower than 2.0.0 and can not be used to compile this program, you need to install independent openmpi (version >= 2.0.0) in your computer.

[How to install dependencies on Linux ?]

1. Check gcc
# You can install new version gcc or just use the default one in LINUX kernel
>> gcc --version

2. install openmpi
# build openmpi from source
>> wget https://www.open-mpi.org/software/ompi/v3.1/downloads/openmpi-3.1.0.tar.gz
# then follow the installation instructions in openmpi document
>> ...
# add installation path to your ~/.bashrc (or ~/.bash_profile)
>> vim ~/.bashrc
# export PATH="/Your-Install-path/bin:$PATH"
# export LD_LIBRARY_PATH="/Your-Install_path/lib/:$LD_LIBRARY_PATH"
>> source ~/.bashrc

3. install gsl
# ubnutu
>> apt-get install libgsl0-dev libgsl0-bin
# Centos
>> yum install gsl-devel
# other ...

2.3 Appendix Info

All dependencies for clean Python 2.7

numpy , scipy , scikit-learn , matplotlib , h5py , numexpr , psutil , mpi4py , mrcfile


3. Help and examples

You can refer to help function of spipy or its modules to get immediate help. For example :

"Anaconda Ipython 2.7"
>> import spipy
>> spipy.help()
>> spipy.phase.help()
>> spipy.phase.phase2d.help("function_name")

In the test_spipy directory, you can find examples about how to use functions in every modules. For example :

cd ./test_spipy/image
# read file
vim test_classify.py
# run file
python test_classify.py   #some scripts need command line parameters

Other basic information can be found in 'info' module, for example:

>> import spipy
>> spipy.info.VERSION
# if the package is compiled with openmpi, then there will be
>> spipy.info.EMC_MPI
Clone this wiki locally