本文整理匯總了Python中xia2.Handlers.Flags.Flags.get_parallel方法的典型用法代碼示例。如果您正苦於以下問題:Python Flags.get_parallel方法的具體用法?Python Flags.get_parallel怎麽用?Python Flags.get_parallel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xia2.Handlers.Flags.Flags
的用法示例。
在下文中一共展示了Flags.get_parallel方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: run
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_parallel [as 別名]
def run(self):
from xia2.Handlers.Streams import Debug
Debug.write('Running %s' %self.get_executable())
self.clear_command_line()
self.add_command_line(self._sweep_filename)
self.add_command_line(self._spot_filename)
nproc = Flags.get_parallel()
self.set_cpu_threads(nproc)
self.add_command_line('nproc=%i' % nproc)
for scan_range in self._scan_ranges:
self.add_command_line('scan_range=%d,%d' % scan_range)
if self._phil_file is not None:
self.add_command_line("%s" %self._phil_file)
self._optimized_filename = os.path.join(
self.get_working_directory(), '%d_optimized_datablock.json' %self.get_xpid())
self.add_command_line("output.datablock=%s" %self._optimized_filename)
self.start()
self.close_wait()
self.check_for_errors()
records = self.get_all_output()
assert os.path.exists(self._optimized_filename), self._optimized_filename
return
示例2: __init__
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_parallel [as 別名]
def __init__(self):
# set up the object ancestors...
DriverInstance.__class__.__init__(self)
# now set myself up...
self._parallel = Flags.get_parallel()
if self._parallel <= 1:
self.set_executable('xscale')
else:
self.set_executable('xscale_par')
self._version = 'new'
# overall information
self._resolution_shells = ''
self._cell = None
self._spacegroup_number = None
self._reindex_matrix = None
# corrections to apply - N.B. default values come from the
# factory function default arguments...
self._correct_decay = correct_decay
self._correct_absorption = correct_absorption
self._correct_modulation = correct_modulation
# input reflections information - including grouping information
# in the same way as the .xinfo files - through the wavelength
# names, which will be used for the output files.
self._input_reflection_files = []
self._input_reflection_wavelength_names = []
self._input_resolution_ranges = []
# these are generated at the run time
self._transposed_input = { }
self._transposed_input_keys = []
# output
self._output_reflection_files = { }
self._remove = []
# decisions about the scaling
self._crystal = None
self._zero_dose = False
self._anomalous = True
self._merge = False
# scale factor output
self._scale_factor = 1.0
# Rmerge values - for the scale model analysis - N.B. get
# one for each data set, obviously...
self._rmerges = { }
return
示例3: __init__
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_parallel [as 別名]
def __init__(self, params=None):
super(XDSIntegrateWrapper, self).__init__()
# phil parameters
if not params:
from xia2.Handlers.Phil import master_phil
params = master_phil.extract().xds.integrate
self._params = params
# now set myself up...
self._parallel = Flags.get_parallel()
self.set_cpu_threads(self._parallel)
if self._parallel <= 1:
self.set_executable('xds')
else:
self.set_executable('xds_par')
# generic bits
self._data_range = (0, 0)
self._input_data_files = { }
self._output_data_files = { }
self._input_data_files_list = ['X-CORRECTIONS.cbf',
'Y-CORRECTIONS.cbf',
'BLANK.cbf',
'BKGPIX.cbf',
'GAIN.cbf',
'XPARM.XDS']
self._output_data_files_list = ['FRAME.cbf']
self._refined_xparm = False
self._updates = { }
# note well - INTEGRATE.HKL is not included in this list
# because it is likely to be very large - this is treated
# separately...
self._integrate_hkl = None
# FIXME these will also be wanted by the full integrater
# interface I guess?
self._mean_mosaic = None
self._min_mosaic = None
self._max_mosaic = None
return
示例4: run
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_parallel [as 別名]
def run(self):
from xia2.Handlers.Streams import Debug
Debug.write('Running dials.find_spots')
self.clear_command_line()
self.add_command_line('input.datablock="%s"' % self._input_sweep_filename)
if self._output_sweep_filename is not None:
self.add_command_line(
'output.datablock="%s"' % self._output_sweep_filename)
self.add_command_line('output.reflections="%s"' % self._input_spot_filename)
nproc = Flags.get_parallel()
self.set_cpu_threads(nproc)
self.add_command_line('nproc=%i' % nproc)
for scan_range in self._scan_ranges:
self.add_command_line('spotfinder.scan_range=%d,%d' % scan_range)
if self._min_spot_size is not None:
self.add_command_line('min_spot_size=%i' % self._min_spot_size)
if self._min_local is not None:
self.add_command_line('min_local=%i' % self._min_local)
if self._kernel_size is not None:
self.add_command_line('kernel_size=%i %i' % \
(self._kernel_size, self._kernel_size))
if self._global_threshold is not None:
self.add_command_line('global_threshold=%s' % self._global_threshold)
if self._sigma_strong is not None:
self.add_command_line('sigma_strong=%i' % self._sigma_strong)
if self._filter_ice_rings:
self.add_command_line('ice_rings.filter=%s' % self._filter_ice_rings)
if self._phil_file is not None:
self.add_command_line("%s" % self._phil_file)
if self._write_hot_mask:
self.add_command_line("write_hot_mask=true")
if self._gain:
self.add_command_line("gain=%f" % self._gain)
self.start()
self.close_wait()
self.check_for_errors()
for record in self.get_all_output():
if record.startswith('Saved') and 'reflections to' in record:
self._nspots = int(record.split()[1])
return
示例5: __init__
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_parallel [as 別名]
def __init__(self, params=None):
super(XDSColspotWrapper, self).__init__()
# phil parameters
if not params:
from xia2.Handlers.Phil import master_phil
params = master_phil.extract().xds.colspot
self._params = params
# now set myself up...
self._parallel = Flags.get_parallel()
self.set_cpu_threads(self._parallel)
if self._parallel <= 1:
self.set_executable('xds')
else:
self.set_executable('xds_par')
# generic bits
self._data_range = (0, 0)
self._spot_range = []
self._background_range = (0, 0)
self._resolution_range = (0, 0)
self._input_data_files = { }
self._output_data_files = { }
self._input_data_files_list = ['X-CORRECTIONS.cbf',
'Y-CORRECTIONS.cbf',
'BLANK.cbf',
'BKGINIT.cbf',
'GAIN.cbf']
self._output_data_files_list = ['SPOT.XDS']
return
示例6: __init__
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_parallel [as 別名]
def __init__(self, params=None):
super(XDSIdxrefWrapper, self).__init__()
# phil parameters
if not params:
from xia2.Handlers.Phil import master_phil
params = master_phil.extract().xds.index
self._params = params
# now set myself up...
self._parallel = Flags.get_parallel()
self.set_cpu_threads(self._parallel)
if self._parallel <= 1:
self.set_executable('xds')
else:
self.set_executable('xds_par')
# generic bits
self._data_range = (0, 0)
self._spot_range = []
self._background_range = (0, 0)
self._resolution_range = (0, 0)
self._org = [0.0, 0.0]
self._refined_origin = None
self._refined_beam_vector = None
self._refined_rotation_axis = None
self._starting_angle = 0.0
self._starting_frame = 0
self._cell = None
self._symm = 0
self._a_axis = None
self._b_axis = None
self._c_axis = None
# results
self._refined_beam = (0, 0)
self._refined_distance = 0
self._indexing_solutions = { }
self._indxr_input_lattice = None
self._indxr_input_cell = None
self._indxr_user_input_lattice = False
self._indxr_lattice = None
self._indxr_cell = None
self._indxr_mosaic = None
self._input_data_files = { }
self._output_data_files = { }
self._input_data_files_list = ['SPOT.XDS']
self._output_data_files_list = ['SPOT.XDS',
'XPARM.XDS']
self._index_tree_problem = False
self._fraction_rmsd_rmsphi = None
return
示例7: __init__
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_parallel [as 別名]
def __init__(self, params=None):
super(XDSCorrectWrapper, self).__init__()
# phil parameters
if not params:
from xia2.Handlers.Phil import master_phil
params = master_phil.extract().xds.correct
self._params = params
# now set myself up...
self._parallel = Flags.get_parallel()
self.set_cpu_threads(self._parallel)
if self._parallel <= 1:
self.set_executable('xds')
else:
self.set_executable('xds_par')
# generic bits
self._data_range = (0, 0)
self._spot_range = []
self._background_range = (0, 0)
self._resolution_range = (0, 0)
self._resolution_high = 0.0
self._resolution_low = 40.0
# specific information
self._cell = None
self._spacegroup_number = None
self._anomalous = False
self._polarization = 0.0
self._reindex_matrix = None
self._reindex_used = None
self._input_data_files = { }
self._output_data_files = { }
self._input_data_files_list = []
self._output_data_files_list = ['GXPARM.XDS']
self._ice = 0
self._excluded_regions = []
# the following input files are also required:
#
# INTEGRATE.HKL
# REMOVE.HKL
#
# and XDS_ASCII.HKL is produced.
# in
self._integrate_hkl = None
self._remove_hkl = None
# out
self._xds_ascii_hkl = None
self._results = None
self._remove = []
return
示例8: run
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_parallel [as 別名]
def run(self, method):
from xia2.Handlers.Streams import Debug
Debug.write('Running dials.index')
self.clear_command_line()
for f in self._sweep_filenames:
self.add_command_line(f)
for f in self._spot_filenames:
self.add_command_line(f)
self.add_command_line('indexing.method=%s' % method)
nproc = Flags.get_parallel()
self.set_cpu_threads(nproc)
self.add_command_line('indexing.nproc=%i' % nproc)
if Flags.get_small_molecule():
self.add_command_line('filter_ice=false')
if self._reflections_per_degree is not None:
self.add_command_line(
'reflections_per_degree=%i' %self._reflections_per_degree)
if self._fft3d_n_points is not None:
self.add_command_line(
'fft3d.reciprocal_space_grid.n_points=%i' %self._fft3d_n_points)
if self._close_to_spindle_cutoff is not None:
self.add_command_line(
'close_to_spindle_cutoff=%f' %self._close_to_spindle_cutoff)
if self._outlier_algorithm:
self.add_command_line('outlier.algorithm=%s' % self._outlier_algorithm)
if self._max_cell:
self.add_command_line('max_cell=%d' % self._max_cell)
if self._min_cell:
self.add_command_line('min_cell=%d' % self._min_cell)
if self._d_min_start:
self.add_command_line('d_min_start=%f' % self._d_min_start)
if self._indxr_input_lattice is not None:
from xia2.Experts.SymmetryExpert import lattice_to_spacegroup_number
self._symm = lattice_to_spacegroup_number(
self._indxr_input_lattice)
self.add_command_line('known_symmetry.space_group=%s' % self._symm)
if self._indxr_input_cell is not None:
self.add_command_line(
'known_symmetry.unit_cell="%s,%s,%s,%s,%s,%s"' %self._indxr_input_cell)
if self._maximum_spot_error:
self.add_command_line('maximum_spot_error=%.f' %
self._maximum_spot_error)
if self._detector_fix:
self.add_command_line('detector.fix=%s' % self._detector_fix)
if self._beam_fix:
self.add_command_line('beam.fix=%s' % self._beam_fix)
if self._phil_file is not None:
self.add_command_line("%s" %self._phil_file)
self._experiment_filename = os.path.join(
self.get_working_directory(), '%d_experiments.json' %self.get_xpid())
self._indexed_filename = os.path.join(
self.get_working_directory(), '%d_indexed.pickle' %self.get_xpid())
self.add_command_line("output.experiments=%s" %self._experiment_filename)
self.add_command_line("output.reflections=%s" %self._indexed_filename)
self.start()
self.close_wait()
self.check_for_errors()
records = self.get_all_output()
for i, record in enumerate(records):
if 'Unit cell:' in record:
self._p1_cell = map(float, record.replace('(', '').replace(
')', '').replace(',', '').split()[-6:])
if 'Final RMSDs by experiment' in record:
values = records[i+6].strip().strip('|').split('|')
if len(values):
values = [float(v) for v in values]
if values[0] == 0:
self._nref = int(values[1])
self._rmsd_x = values[2]
self._rmsd_y = values[3]
self._rmsd_z = values[4]
return
示例9: scale
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_parallel [as 別名]
def scale(self):
'''Actually perform the scaling.'''
self.check_hklin()
self.check_hklout()
if self._chef_unmerged and self._scalepack:
raise RuntimeError, 'CHEF and scalepack incompatible'
if self._onlymerge:
raise RuntimeError, 'use merge() method'
if not self._scalepack:
self.set_task('Scaling reflections from %s => %s' % \
(os.path.split(self.get_hklin())[-1],
os.path.split(self.get_hklout())[-1]))
else:
self.set_task('Scaling reflections from %s => scalepack %s' % \
(os.path.split(self.get_hklin())[-1],
os.path.split(self.get_hklout())[-1]))
self._xmlout = os.path.join(self.get_working_directory(),
'%d_aimless.xml' % self.get_xpid())
self.start()
nproc = Flags.get_parallel()
if nproc > 1:
self.set_working_environment('OMP_NUM_THREADS', '%d' %nproc)
self.input('refine parallel')
self.input('xmlout %d_aimless.xml' % self.get_xpid())
if not Flags.get_small_molecule():
self.input('bins 20')
self.input('intensities %s' %self._intensities)
if self._new_scales_file:
self.input('dump %s' % self._new_scales_file)
run_number = 0
for run in self._runs:
run_number += 1
if not run[5]:
self.input('run %d batch %d to %d' % (run_number,
run[0], run[1]))
if run[6] != 0.0 and not run[5]:
self.input('resolution run %d high %f' % \
(run_number, run[6]))
run_number = 0
for run in self._runs:
run_number += 1
if run[7]:
Debug.write('Run %d corresponds to sweep %s' % \
(run_number, run[7]))
if run[5]:
continue
self.input('sdcorrection same')
# FIXME this is a bit of a hack - should be better determined
# than this...
if Flags.get_small_molecule():
#self.input('sdcorrection tie sdfac 0.707 0.3 tie sdadd 0.01 0.05')
#self.input('reject all 30')
self.input('sdcorrection fixsdb')
if self._secondary and self._surface_tie:
self.input('tie surface %.4f' % self._surface_tie)
if not self._surface_link:
self.input('unlink all')
# assemble the scales command
if self._mode == 'rotation':
scale_command = 'scales rotation spacing %f' % self._spacing
if self._secondary:
nterm = int(self._secondary)
if self._fixed_secondary_lmax:
scale_command += ' secondary %d %d absorption %d %d' % \
(nterm, nterm - 1, nterm, nterm - 1)
else:
scale_command += ' secondary %d absorption %d' % \
(nterm, nterm)
if self._bfactor:
scale_command += ' bfactor on'
if self._brotation:
scale_command += ' brotation %f' % \
self._brotation
else:
scale_command += ' bfactor off'
if self._tails:
scale_command += ' tails'
#.........這裏部分代碼省略.........
示例10: run
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_parallel [as 別名]
def run(self):
from xia2.Handlers.Streams import Debug
Debug.write('Running dials.integrate')
self.clear_command_line()
self.add_command_line('input.experiments=%s' % self._experiments_filename)
nproc = Flags.get_parallel()
self.set_cpu_threads(nproc)
if self._use_threading:
self.add_command_line('nthreads=%i' %nproc)
nproc = 1
self.add_command_line('nproc=%i' % nproc)
self.add_command_line(('input.reflections=%s' % self._reflections_filename))
self._integrated_reflections = os.path.join(
self.get_working_directory(), '%d_integrated.pickle' %self.get_xpid())
self._integrated_experiments = os.path.join(
self.get_working_directory(), '%d_integrated_experiments.json' %self.get_xpid())
self._integration_report_filename = os.path.join(
self.get_working_directory(), '%d_integration_report.json' %self.get_xpid())
self.add_command_line('output.experiments=%s' % self._integrated_experiments)
self.add_command_line('output.reflections=%s' % self._integrated_reflections)
self.add_command_line('output.report=%s' % self._integration_report_filename)
self.add_command_line('output.include_bad_reference=True')
self.add_command_line(
'profile.fitting=%s' % self._profile_fitting)
if self._outlier_algorithm is not None:
self.add_command_line(
'outlier.algorithm=%s' % self._outlier_algorithm)
if self._background_algorithm is not None:
self.add_command_line(
'background.algorithm=%s' % self._background_algorithm)
if self._phil_file is not None:
self.add_command_line('%s' % self._phil_file)
if self._d_max is not None:
self.add_command_line('prediction.d_max=%f' % self._d_max)
if self._d_min is not None and self._d_min > 0.0:
self.add_command_line('prediction.d_min=%f' % self._d_min)
for scan_range in self._scan_range:
self.add_command_line('scan_range=%d,%d' %scan_range)
if self._reflections_per_degree is not None:
self.add_command_line('reflections_per_degree=%d' %self._reflections_per_degree)
self.add_command_line('integrate_all_reflections=False')
self.start()
self.close_wait()
for record in self.get_all_output():
if 'There was a problem allocating memory for shoeboxes' in record:
raise RuntimeError(
'''dials.integrate requires more memory than is available.
Try using a machine with more memory or using fewer processor.''')
self.check_for_errors()
# save some of the output for future reference - the per-image
# results
import json
self._integration_report = json.load(
open(self._integration_report_filename, 'rb'))
import math
self._per_image_statistics = {}
table = self._integration_report['tables']['integration.image.summary']
rows = table['rows']
for row in table['rows']:
n_ref = float(row['n_prf'])
if n_ref > 0:
ios = float(row['ios_prf'])
else:
ios = float(row['ios_sum'])
n_ref = float(row['n_sum'])
# XXX this +1 might need changing if James changes what is output in report.json
self._per_image_statistics[int(row['image'])+1] = {
'isigi': ios,
'isig_tot': ios * math.sqrt(n_ref),
'rmsd_pixel': float(row['rmsd_xy']),
'strong': n_ref,
}
return