Skip to content
YC.S edited this page Oct 5, 2019 · 23 revisions

(1) spipy.simulate.sim_adu

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

The program takes 3~4 seconds to generate a pattern, MPI parallel is highly recommended.

+: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, verbose:bool/True)

+: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, verbose:bool/True)
  • parameters : This function contains all parameters that spipy.simulate.sim has, and three 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.
    • "make_data|poisson" : bool, wether add poisson noise on the final patterns, default is False

--

  • multi_process : simulation in parallel.

  • [NOTICE]: Use mpi which you used to compile spipy 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
    • verbose : whether to show detailed information, default=True
  • 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
    • verbose : whether to show detailed information, default=True

(2) 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(skip_check:bool/False)
  • parameters : refer to Example
    • "parameters|detd" : float, distance between sample and detector [unit : mm]
    • "parameters|lambda" : float, wave length of laser [unit : angstrom]
    • "parameters|detsize" : int, detector size in width and height (square detector) [unit : pixel]
    • "parameters|pixsize" : float, pixel size of detector [unit : mm]
    • "parameters|stoprad" : int, 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 1.0e13 ~ 1.0e16 is reasonable for most situations

--

  • work_dir : directory you project locates

--

  • config_default : default configuration parameters, a dict:
         {'parameters|detd' : 200.0, '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' : 1.0e14}

--

  • 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
    • skip_check : skip checking files' overwriting and unusual oversampling, default = False
Clone this wiki locally