Utilities
The utilities directory contains Python utilities, command-line tools, and Cython extensions for data processing and simulation.
Command-line Tools
The package provides several command-line tools:
dragonfly.init- Initialize new reconstruction
Utilities to simulate data:
dragonfly.utils.make_densities- Generate density mapsdragonfly.utils.make_intensities- Generate intensity mapsdragonfly.utils.make_detector- Create detector filesdragonfly.utils.make_data- Generate simulated datadragonfly.utils.sim_setup- Wrapper to run all utils above
Graphical programs:
dragonfly.autoplot- Progress viewer (Progress Viewer (autoplot))dragonfly.frameviewer- Frame viewer (Frame Viewer)
Simulation Utilities
Module to make simulated data.
This module provides a convenience wrapper that sequentially runs the entire simulation pipeline: make_densities, make_intensities, make_detector, and make_data.
- Functions:
main: Command-line interface to run full simulation pipeline.
- dragonfly.utils.sim_setup.main()[source]
Runs through simulation utilities to generate data.
Sequentially executes the following utilities:
make_densities: Generate electron density from PDB
make_intensities: Generate intensity from density
make_detector: Generate detector geometry
make_data: Generate photon diffraction patterns
Make electron density volume from PDB file and configuration parameters.
This module generates 3D electron density maps from PDB structure files using atomic scattering factors. The density is computed on a cubic grid and optionally filtered to remove high-frequency artifacts.
- Functions:
make_dens: Generate density map from configuration file. main: Command-line interface.
- dragonfly.utils.make_densities.make_dens(config_fname, yes=False, verbose=False)[source]
Generate density map from parameters in config file.
- Parameters:
- Returns:
Outputs binary density file specified in config.
- Return type:
None
- Raises:
configparser.NoOptionError – If required config options are missing.
- dragonfly.utils.make_densities.main()[source]
Parse command line arguments and generate electron density volume with config file
Module to Fourier transform electron densities to generate 3D intensities.
This module takes a 3D electron density map and computes its squared Fourier transform to produce a 3D intensity volume in reciprocal space. The intensity is computed at the appropriate oversampling ratio for EMC reconstruction.
- Functions:
make_intens: Generate intensity volume from density file. main: Command-line interface.
- dragonfly.utils.make_intensities.make_intens(config_fname, yes=False, verbose=False)[source]
Generate intensity volume from config file parameters.
- dragonfly.utils.make_intensities.main()[source]
Parses command line arguments to create 3D intensity file using config file parameters
Module to generate detector file from configuration parameters.
This module creates detector geometry files containing pixel coordinates, correction factors, and masks. The detector is computed based on experimental geometry parameters in the configuration file.
- Functions:
make_detector: Generate detector file from configuration. main: Command-line interface.
- dragonfly.utils.make_detector.make_detector(config_fname, yes=False, verbose=False)[source]
Generate detector file from parameters in config file.
- dragonfly.utils.make_detector.main()[source]
Parses command line arguments and config file to generate detector file
- dragonfly.utils.make_data.main()
Parse command line arguments and generate electron density volume with config file
- dragonfly.utils.make_data.make_data(config_fname, yes=False, verbose=False)
- dragonfly.utils.make_data.rand_quat()
Configuration Parser
Module containing various functions used to parse configuration files
- class dragonfly.utils.py_src.read_config.MyConfigParser(defaults=None, dict_type=<class 'dict'>, allow_no_value=False, *, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section='DEFAULT', interpolation=<object object>, converters=<object object>)[source]
Bases:
ConfigParser- read(filename)[source]
Read and parse a filename or an iterable of filenames.
Files that cannot be opened are silently ignored; this is designed so that you can specify an iterable of potential configuration file locations (e.g. current directory, user’s home directory, systemwide directory), and all existing configuration files in the iterable will be read. A single filename may also be given.
Return list of successfully read files.