Skip to content
YC.S edited this page Aug 28, 2018 · 23 revisions

(1) spipy.simulate.sim

Simulation by direct Fourier transform of electron density map, and return photon-count patterns

+ work_dir:str

+ config_default:dict

+ :void = generate_config_files (pbd_file:str, #workdir:str/None, #params:dict/{})

+ :void = run_simulation()
  • parameters : refer to Example
    • "parameters|detd" : distance between sample and detector [unit : mm]
    • "parameters|lambda" : wave length of laser [unit : angstrom]
    • "parameters|detsize" : detector size in width/height [unit : pixel]
    • "parameters|pixsize" : pixel size of detector [unit : mm]
    • "parameters|stoprad" : radius of a circle region at the center of pattern that to be masked out [unit : pixel]
    • "parameters|polarization" : correction due to incident beam polarization, value from 'x', 'y' or 'none'
    • "make_data|num_data" : how many patterns do you want to generate
    • "make_data|fluence" : laser fluence [unit : photons/pulse], usually 1e10 ~ 1e14 is reasonable for most situations

--

  • work_dir : directory you project locates

--

  • config_default : default configuration parameters, a dict:
         {'parameters|detd' : 200, 'parameters|lambda' : 2.5,
         'parameters|detsize' : 128, 'parameters|pixsize' : 0.3,
         'parameters|stoprad' : 0, 'parameters|polarization' : 'x',
         'make_data|num_data' : 100, 'make_data|fluence' : 1e14}

--

  • generate_config_files : configure simulation parameters, make project dir and copy neccessary files to your work_dir, NO return
    • pdb_file : path of your pdb file used in simulation [/..../xx.pdb]
    • #workpath : choose a path to set up your project, ABSOLUTE PATH ! default is current dir
    • #name : give your project a name, default is None, program will choose a name for you
    • #params : parameters dict, { "section_1|param_1": value_1, ... }, for default program will use 'config_default'

--

  • run_simulation : start simulation after configuing, NO return
    • NO input

(2) spipy.simulate.sim_adu

Simulation by atom scattering calculation, and return adu patterns. SLOWER but ACCURATE & FLEXIBLE

We are very sorry that since now the program takes 3~4 seconds to generate a pattern, please be patient and we are working on the acceleration strategies

+:void = multi_process (save_dir:str, pdb_file:str, param:dict, #euler_mode:str/'random', #euler_order:str/'zxz', #euler_range:numpy.2darray/None, #predefined:numpy.2darray/None, #njobs:int/2)

+:dict = single_process (pdb_file:str, param:dict, #euler_mode:str/'random', #euler_order:str/'zxz', #euler_range:numpy.2darray/None, #predefined:numpy.2darray/None, #save_dir:str/None)
  • parameters : This function contains all parameters that spipy.simulate.sim has, and two more. You can refer to Example
    • "make_data|scatter_factor" : bool, whether consider scattering factors of different atoms. default is False
    • "make_data|ram_first" : bool, whether try to save memory while running. As this program is very memory costing, we recommend to enable this attribute, although it may lose some calculation speed when detector size is large. But in most cases, it will save both memory and cpu time. default is True.

--

  • multi_process : simulation in parallel.

  • [NOTICE]: Use '~/anaconda2/bin/mpirun -n [num_proc] python [your_script_name]' to start simulation

    • save_dir : path to save simulation result, a directory path
    • pdb_file : path of your input pdb file
    • param : simulation parameters, the same with 'spipy.simulate.sim' module
    • euler_mode : how to genreate euler angles, str, chosen from 'random', 'helix' and 'predefined', default='random'
    • euler_order : rotation order, such as 'zxz' or 'zyz'..., default='zxz'
    • euler_range : the range of euler angles to rotate object, numpy.array([ [alpha_min,alpha_max], [beta_min,beta_max], [gamma_min,gamma_max] ]), shape=(3,2)), default=None
    • predefined : if euler_mode is 'predefined', then you have to specify all euler angles used for object rotation, shape=(Ne,3), default=None
  • single_process : simulation entrance function, using a single process, return simulated dataset, a dict containing all information and result of the simulation, only if you set 'save_dir=None'

    • pdb_file : path of your input pdb file
    • param : simulation parameters, the same with 'spipy.simulate.sim' module
    • euler_mode : how to genreate euler angles, str, chosen from 'random', 'helix' and 'predefined', default='random'
    • euler_order : rotation order, such as 'zxz' or 'zyz'..., default='zxz'
    • euler_range : the range of euler angles to rotate object, numpy.array([ [alpha_min,alpha_max], [beta_min,beta_max], [gamma_min,gamma_max] ]), shape=(3,2)), default=None
    • predefined : if euler_mode is 'predefined', then you have to specify all euler angles used for object rotation, shape=(Ne,3), default=None
    • save_dir : path to save simulation result, a directory path, default is None and then result will be returned
Clone this wiki locally