本文整理匯總了Python中xia2.Handlers.Flags.Flags.set_parallel方法的典型用法代碼示例。如果您正苦於以下問題:Python Flags.set_parallel方法的具體用法?Python Flags.set_parallel怎麽用?Python Flags.set_parallel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xia2.Handlers.Flags.Flags
的用法示例。
在下文中一共展示了Flags.set_parallel方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: exercise_dials_wrappers
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import set_parallel [as 別名]
def exercise_dials_wrappers(nproc=None):
if not have_dials_regression:
print "Skipping exercise_dials_wrappers(): dials_regression not configured"
return
if nproc is not None:
from xia2.Handlers.Flags import Flags
Flags.set_parallel(nproc)
from xia2.Wrappers.Dials.Import import Import
from xia2.Wrappers.Dials.Spotfinder import Spotfinder
from xia2.Wrappers.Dials.Index import Index
from xia2.Wrappers.Dials.Integrate import Integrate
from xia2.Wrappers.Dials.RefineBravaisSettings import RefineBravaisSettings
from xia2.Wrappers.Dials.Refine import Refine
from xia2.Wrappers.Dials.Reindex import Reindex
from xia2.Wrappers.Dials.ExportMtz import ExportMtz
xia2_demo_data = os.path.join(dials_regression, "xia2_demo_data")
template = os.path.join(xia2_demo_data, "insulin_1_%03i.img")
scan_ranges = [(1, 45)]
image_range = (1, 45)
cwd = os.path.abspath(os.curdir)
tmp_dir = os.path.abspath(open_tmp_directory())
os.chdir(tmp_dir)
print "Begin importing"
importer = Import()
importer.setup_from_image(template %1)
importer.set_image_range(image_range)
importer.run()
print ''.join(importer.get_all_output())
print "Done importing"
print "Begin spotfinding"
spotfinder = Spotfinder()
spotfinder.set_input_sweep_filename(importer.get_sweep_filename())
spotfinder.set_scan_ranges(scan_ranges)
spotfinder.run()
print ''.join(spotfinder.get_all_output())
print "Done spotfinding"
print "Begin indexing"
indexer = Index()
indexer.add_spot_filename(spotfinder.get_spot_filename())
indexer.add_sweep_filename(importer.get_sweep_filename())
indexer.run('fft3d')
print ''.join(indexer.get_all_output())
print "Done indexing"
print "Begin refining"
rbs = RefineBravaisSettings()
rbs.set_experiments_filename(indexer.get_experiments_filename())
rbs.set_indexed_filename(indexer.get_indexed_filename())
rbs.run()
print ''.join(rbs.get_all_output())
print "Done refining"
bravais_setting_22 = rbs.get_bravais_summary()[22]
assert bravais_setting_22['bravais'] == 'cI'
assert bravais_setting_22['cb_op'] == 'b+c,a+c,a+b'
assert approx_equal(bravais_setting_22['unit_cell'],
(78.14,78.14,78.14,90,90,90), eps=1e-1)
bravais_setting_22_json = bravais_setting_22['experiments_file']
assert os.path.exists(bravais_setting_22_json)
print "Begin reindexing"
reindexer = Reindex()
reindexer.set_experiments_filename(indexer.get_experiments_filename())
reindexer.set_indexed_filename(indexer.get_indexed_filename())
reindexer.set_cb_op(bravais_setting_22['cb_op'])
reindexer.run()
assert os.path.exists(reindexer.get_reindexed_experiments_filename())
assert os.path.exists(reindexer.get_reindexed_reflections_filename())
print ''.join(reindexer.get_all_output())
print "Done reindexing"
print "Begin refining"
refiner = Refine()
refiner.set_experiments_filename(bravais_setting_22_json)
refiner.set_indexed_filename(reindexer.get_reindexed_reflections_filename())
refiner.set_scan_varying(True)
refiner.run()
assert os.path.exists(refiner.get_refined_experiments_filename())
print ''.join(refiner.get_all_output())
print "Done refining"
print "Begin integrating"
integrater = Integrate()
integrater.set_experiments_filename(refiner.get_refined_experiments_filename())
integrater.set_reflections_filename(reindexer.get_reindexed_reflections_filename())
integrater.run()
print ''.join(integrater.get_all_output())
print "Done integrating"
print "Begin exporting"
exporter = ExportMtz()
exporter.set_experiments_filename(integrater.get_integrated_experiments())
exporter.set_reflections_filename(integrater.get_integrated_reflections())
exporter.run()
#.........這裏部分代碼省略.........
示例2: exercise_dials_integrater
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import set_parallel [as 別名]
def exercise_dials_integrater(nproc=None):
if not have_dials_regression:
print "Skipping exercise_dials_integrater(): dials_regression not configured"
return
if nproc is not None:
from xia2.Handlers.Flags import Flags
Flags.set_parallel(nproc)
xia2_demo_data = os.path.join(dials_regression, "xia2_demo_data")
template = os.path.join(xia2_demo_data, "insulin_1_###.img")
cwd = os.path.abspath(os.curdir)
tmp_dir = os.path.abspath(open_tmp_directory())
os.chdir(tmp_dir)
from xia2.Modules.Indexer.DialsIndexer import DialsIndexer
from xia2.Modules.Integrater.DialsIntegrater import DialsIntegrater
from dxtbx.datablock import DataBlockTemplateImporter
indexer = DialsIndexer()
indexer.set_working_directory(tmp_dir)
importer = DataBlockTemplateImporter([template])
datablocks = importer.datablocks
imageset = datablocks[0].extract_imagesets()[0]
indexer.add_indexer_imageset(imageset)
from xia2.Schema.XCrystal import XCrystal
from xia2.Schema.XWavelength import XWavelength
from xia2.Schema.XSweep import XSweep
from xia2.Schema.XSample import XSample
cryst = XCrystal("CRYST1", None)
wav = XWavelength("WAVE1", cryst, imageset.get_beam().get_wavelength())
samp = XSample("X1", cryst)
directory, image = os.path.split(imageset.get_path(1))
sweep = XSweep('SWEEP1', wav, samp, directory=directory, image=image)
indexer.set_indexer_sweep(sweep)
from xia2.Modules.Refiner.DialsRefiner import DialsRefiner
refiner = DialsRefiner()
refiner.set_working_directory(tmp_dir)
refiner.add_refiner_indexer(sweep.get_epoch(1), indexer)
#refiner.refine()
integrater = DialsIntegrater()
integrater.set_working_directory(tmp_dir)
integrater.setup_from_image(imageset.get_path(1))
integrater.set_integrater_refiner(refiner)
#integrater.set_integrater_indexer(indexer)
integrater.set_integrater_sweep(sweep)
integrater.integrate()
integrater_intensities = integrater.get_integrater_intensities()
assert os.path.exists(integrater_intensities)
from iotbx.reflection_file_reader import any_reflection_file
reader = any_reflection_file(integrater_intensities)
assert reader.file_type() == "ccp4_mtz"
mtz_object = reader.file_content()
assert abs(mtz_object.n_reflections() - 48117) < 100, mtz_object.n_reflections()
assert mtz_object.column_labels() == [
'H', 'K', 'L', 'M_ISYM', 'BATCH', 'IPR', 'SIGIPR', 'I', 'SIGI',
'FRACTIONCALC', 'XDET', 'YDET', 'ROT', 'LP', 'DQE']
assert integrater.get_integrater_wedge() == (1, 45)
assert approx_equal(integrater.get_integrater_cell(),
(78.14, 78.14, 78.14, 90, 90, 90), eps=1e-1)
# test serialization of integrater
json_str = integrater.as_json()
#print json_str
integrater2 = DialsIntegrater.from_json(string=json_str)
integrater2.set_integrater_sweep(sweep, reset=False)
integrater2_intensities = integrater.get_integrater_intensities()
assert integrater2_intensities == integrater_intensities
integrater2.set_integrater_finish_done(False)
integrater2_intensities = integrater2.get_integrater_intensities()
assert os.path.exists(integrater2_intensities)
reader = any_reflection_file(integrater2_intensities)
assert reader.file_type() == "ccp4_mtz"
mtz_object = reader.file_content()
assert abs(mtz_object.n_reflections() - 48117) < 100, mtz_object.n_reflections()
integrater2.set_integrater_done(False)
integrater2_intensities = integrater2.get_integrater_intensities()
assert os.path.exists(integrater2_intensities)
reader = any_reflection_file(integrater2_intensities)
assert reader.file_type() == "ccp4_mtz"
mtz_object = reader.file_content()
assert abs(mtz_object.n_reflections() - 48117) < 100, mtz_object.n_reflections()
integrater2.set_integrater_prepare_done(False)
integrater2_intensities = integrater2.get_integrater_intensities()
assert os.path.exists(integrater2_intensities)
reader = any_reflection_file(integrater2_intensities)
assert reader.file_type() == "ccp4_mtz"
mtz_object = reader.file_content()
assert abs(mtz_object.n_reflections() - 48117) < 100, mtz_object.n_reflections()
示例3: exercise_ccp4_scaler
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import set_parallel [as 別名]
def exercise_ccp4_scaler(nproc=None):
if not have_dials_regression:
print "Skipping exercise_ccp4_scaler(): dials_regression not configured"
return
if nproc is not None:
from xia2.Handlers.Flags import Flags
Flags.set_parallel(nproc)
xia2_demo_data = os.path.join(dials_regression, "xia2_demo_data")
template = os.path.join(xia2_demo_data, "insulin_1_###.img")
cwd = os.path.abspath(os.curdir)
tmp_dir = os.path.abspath(open_tmp_directory())
os.chdir(tmp_dir)
from xia2.Modules.Indexer.DialsIndexer import DialsIndexer
from xia2.Modules.Refiner.DialsRefiner import DialsRefiner
from xia2.Modules.Integrater.DialsIntegrater import DialsIntegrater
from xia2.Modules.Scaler.CCP4ScalerA import CCP4ScalerA
indexer = DialsIndexer()
indexer.set_working_directory(tmp_dir)
from dxtbx.datablock import DataBlockTemplateImporter
importer = DataBlockTemplateImporter([template])
datablocks = importer.datablocks
imageset = datablocks[0].extract_imagesets()[0]
indexer.add_indexer_imageset(imageset)
from xia2.Schema.XCrystal import XCrystal
from xia2.Schema.XWavelength import XWavelength
from xia2.Schema.XSweep import XSweep
from xia2.Schema.XSample import XSample
cryst = XCrystal("CRYST1", None)
wav = XWavelength("WAVE1", cryst, imageset.get_beam().get_wavelength())
samp = XSample("X1", cryst)
directory, image = os.path.split(imageset.get_path(1))
sweep = XSweep('SWEEP1', wav, samp, directory=directory, image=image)
indexer.set_indexer_sweep(sweep)
refiner = DialsRefiner()
refiner.set_working_directory(tmp_dir)
refiner.add_refiner_indexer(sweep.get_epoch(1), indexer)
integrater = DialsIntegrater()
integrater.set_working_directory(tmp_dir)
integrater.setup_from_image(imageset.get_path(1))
integrater.set_integrater_refiner(refiner)
#integrater.set_integrater_indexer(indexer)
integrater.set_integrater_sweep(sweep)
integrater.set_integrater_sweep_name('SWEEP1')
integrater.set_integrater_project_info('CRYST1', 'WAVE1', 'SWEEP1')
scaler = CCP4ScalerA()
scaler.add_scaler_integrater(integrater)
scaler.set_scaler_xcrystal(cryst)
scaler.set_scaler_project_info('CRYST1', 'WAVE1')
check_scaler_files_exist(scaler)
# test serialization of scaler
json_str = scaler.as_json()
#print json_str
scaler2 = CCP4ScalerA.from_json(string=json_str)
scaler2.set_scaler_xcrystal(cryst)
check_scaler_files_exist(scaler2)
scaler2.set_scaler_finish_done(False)
check_scaler_files_exist(scaler2)
scaler2.set_scaler_done(False)
check_scaler_files_exist(scaler2)
scaler2._scalr_integraters = {} # XXX
scaler2.add_scaler_integrater(integrater)
scaler2.set_scaler_prepare_done(False)
check_scaler_files_exist(scaler2)
示例4: exercise_mosflm_integrate
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import set_parallel [as 別名]
def exercise_mosflm_integrate(nproc):
if not have_dials_regression:
raise RuntimeError, 'dials_regression not available'
xia2_demo_data = os.path.join(dials_regression, "xia2_demo_data")
template = os.path.join(xia2_demo_data, "insulin_1_%03i.img")
from xia2.Schema.XCrystal import XCrystal
from xia2.Schema.XWavelength import XWavelength
from xia2.Schema.XSweep import XSweep
from xia2.Schema.XSample import XSample
from xia2.Handlers.Flags import Flags
Flags.set_parallel(nproc)
cwd = os.path.abspath(os.curdir)
tmp_dir1 = os.path.abspath(open_tmp_directory())
os.chdir(tmp_dir1)
from xia2.Modules.Integrater.MosflmIntegrater import MosflmIntegrater
from xia2.Modules.Refiner.MosflmRefiner import MosflmRefiner
from xia2.Modules.Indexer.MosflmIndexer import MosflmIndexer
indexer = MosflmIndexer()
indexer.set_working_directory(tmp_dir1)
indexer.setup_from_image(template % 1)
refiner = MosflmRefiner()
refiner.add_refiner_indexer(1, indexer)
m1 = MosflmIntegrater()
m1.set_working_directory(tmp_dir1)
m1.setup_from_image(template % 1)
cryst = XCrystal("CRYST1", None)
wav = XWavelength("WAVE1", cryst, m1.get_wavelength())
samp = XSample("X1", cryst)
directory, image = os.path.split(template %1)
sweep = XSweep('SWEEP1', wav, samp, directory=directory, image=image)
indexer.set_indexer_sweep(sweep)
m1.set_integrater_sweep(sweep)
m1.set_integrater_refiner(refiner)
m1.set_frame_wedge(1, 45)
m1.set_integrater_wedge(1, 45)
m1.integrate()
os.chdir(cwd)
tmp_dir2 = os.path.abspath(open_tmp_directory())
os.chdir(tmp_dir2)
from Original import Mosflm
m2 = Mosflm()
m2.set_working_directory(tmp_dir2)
m2.setup_from_image(template % 1)
m2.set_integrater_indexer(m2)
m2.set_integrater_sweep(sweep)
m2.set_frame_wedge(1, 45)
m2.set_integrater_wedge(1, 45)
m2.integrate()
from libtbx.test_utils import approx_equal
assert approx_equal(m1.get_integrater_cell(), m2.get_integrater_cell(),
eps=0.02)
assert approx_equal(indexer.get_indexer_distance(), m2.get_indexer_distance(),
eps=0.2)
assert approx_equal(m1.get_integrater_cell(),
m2.get_integrater_cell(), eps=0.02)
assert indexer.get_indexer_lattice() == m2.get_indexer_lattice()
assert approx_equal(indexer.get_indexer_mosaic(), m2.get_indexer_mosaic(),
eps=0.01)
m1_mtz = m1.get_integrater_intensities()
m2_mtz = m2.get_integrater_intensities()
from iotbx.reflection_file_reader import any_reflection_file
mas_1 = any_reflection_file(m1_mtz).as_miller_arrays()
mas_2 = any_reflection_file(m2_mtz).as_miller_arrays()
assert len(mas_1) == len(mas_2)
for ma1, ma2 in zip(mas_1, mas_2):
assert ma1.size() == ma2.size()
assert ma1.space_group() == ma2.space_group()
assert ma1.unit_cell().parameters() == ma2.unit_cell().parameters()
assert ma1.indices() == ma2.indices()
assert ma1.data() == ma2.data()
assert ma1.sigmas() == ma2.sigmas()
return
示例5: exercise_dials_refiner
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import set_parallel [as 別名]
def exercise_dials_refiner(nproc=None):
if not have_xia2_regression:
print "Skipping exercise_dials_refiner(): xia2_regression not configured"
return
if nproc is not None:
from xia2.Handlers.Flags import Flags
Flags.set_parallel(nproc)
xia2_demo_data = os.path.join(xia2_regression, "test_data", "mad_example")
template = os.path.join(xia2_demo_data, "12287_1_E%i_%03i.img")
cwd = os.path.abspath(os.curdir)
tmp_dir = os.path.abspath(open_tmp_directory())
os.chdir(tmp_dir)
from xia2.Modules.Indexer.DialsIndexer import DialsIndexer
from xia2.Modules.Refiner.DialsRefiner import DialsRefiner
from xia2.Modules.Integrater.DialsIntegrater import DialsIntegrater
indexer1 = DialsIndexer()
indexer1.set_working_directory(tmp_dir)
indexer1.setup_from_image(template %(1,1))
from xia2.Schema.XCrystal import XCrystal
from xia2.Schema.XWavelength import XWavelength
from xia2.Schema.XSweep import XSweep
from xia2.Schema.XSample import XSample
cryst = XCrystal("CRYST1", None)
wav1 = XWavelength("WAVE1", cryst, indexer1.get_wavelength())
samp1 = XSample("X1", cryst)
directory, image = os.path.split(template %(1,1))
sweep1 = XSweep('SWEEP1', wav1, samp1, directory=directory, image=image)
indexer1.set_indexer_sweep(sweep1)
indexer2 = DialsIndexer()
indexer2.set_working_directory(tmp_dir)
indexer2.setup_from_image(template %(2,1))
wav2 = XWavelength("WAVE2", cryst, indexer2.get_wavelength())
samp2 = XSample("X2", cryst)
directory, image = os.path.split(template %(2,1))
sweep2 = XSweep('SWEEP2', wav2, samp2, directory=directory, image=image)
indexer2.set_indexer_sweep(sweep2)
refiner = DialsRefiner()
refiner.set_working_directory(tmp_dir)
refiner.add_refiner_indexer(indexer1)
refiner.add_refiner_indexer(indexer2)
refined_experiment_list = refiner.get_refined_experiment_list()
assert refined_experiment_list is not None
assert len(refined_experiment_list.detectors()) == 1
refined_detector = refined_experiment_list[0].detector
# test serialization of refiner
json_str = refiner.as_json()
#print json_str
refiner2 = DialsRefiner.from_json(string=json_str)
refined_expts_2 = refiner2.get_refined_experiment_list()
assert refined_expts_2[0].detector == refined_detector
refiner2.set_refiner_finish_done(False)
refined_expts_2 = refiner2.get_refined_experiment_list()
assert refined_expts_2[0].detector == refined_detector
refiner2.set_refiner_done(False)
refined_expts_2 = refiner2.get_refined_experiment_list()
assert refined_expts_2[0].detector == refined_detector
refiner2.set_refiner_prepare_done(False)
refined_expts_2 = refiner2.get_refined_experiment_list()
assert refined_expts_2[0].detector == refined_detector
assert (indexer1.get_indexer_experiment_list()[0].detector !=
indexer2.get_indexer_experiment_list()[0].detector)
assert (indexer1.get_indexer_experiment_list()[0].beam !=
indexer2.get_indexer_experiment_list()[0].beam)
indexer1.set_indexer_experiment_list(refined_experiment_list[0:1])
indexer2.set_indexer_experiment_list(refined_experiment_list[1:2])
assert (indexer1.get_indexer_experiment_list()[0].detector ==
indexer2.get_indexer_experiment_list()[0].detector)
assert (indexer1.get_indexer_experiment_list()[0].goniometer ==
indexer2.get_indexer_experiment_list()[0].goniometer)
示例6: exercise_dials_indexer
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import set_parallel [as 別名]
def exercise_dials_indexer(nproc=None):
if not have_dials_regression:
print "Skipping exercise_dials_indexer(): dials_regression not configured"
return
if nproc is not None:
from xia2.Handlers.Flags import Flags
Flags.set_parallel(nproc)
xia2_demo_data = os.path.join(dials_regression, "xia2_demo_data")
template = os.path.join(xia2_demo_data, "insulin_1_###.img")
cwd = os.path.abspath(os.curdir)
tmp_dir = os.path.abspath(open_tmp_directory())
os.chdir(tmp_dir)
from xia2.Modules.Indexer.DialsIndexer import DialsIndexer
indexer = DialsIndexer()
indexer.set_working_directory(tmp_dir)
from dxtbx.datablock import DataBlockTemplateImporter
importer = DataBlockTemplateImporter([template])
datablocks = importer.datablocks
imageset = datablocks[0].extract_imagesets()[0]
indexer.add_indexer_imageset(imageset)
from xia2.Schema.XCrystal import XCrystal
from xia2.Schema.XWavelength import XWavelength
from xia2.Schema.XSweep import XSweep
from xia2.Schema.XSample import XSample
cryst = XCrystal("CRYST1", None)
wav = XWavelength("WAVE1", cryst, imageset.get_beam().get_wavelength())
samp = XSample("X1", cryst)
directory, image = os.path.split(imageset.get_path(1))
sweep = XSweep('SWEEP1', wav, samp, directory=directory, image=image)
indexer.set_indexer_sweep(sweep)
indexer.index()
assert approx_equal(indexer.get_indexer_cell(),
(78.14, 78.14, 78.14, 90, 90, 90), eps=1e-1)
solution = indexer.get_solution()
assert approx_equal(solution['rmsd'], 0.041, eps=1e-2)
assert approx_equal(solution['metric'], 0.027, eps=1e-2)
assert solution['number'] == 22
assert solution['lattice'] == 'cI'
beam_centre = indexer.get_indexer_beam_centre()
assert approx_equal(beam_centre, (94.4223, 94.5097), eps=1e-2)
print indexer.get_indexer_experiment_list()[0].crystal
print indexer.get_indexer_experiment_list()[0].detector
# test serialization of indexer
json_str = indexer.as_json()
#print json_str
indexer2 = DialsIndexer.from_json(string=json_str)
indexer2.index()
assert approx_equal(indexer.get_indexer_cell(), indexer2.get_indexer_cell())
assert approx_equal(
indexer.get_indexer_beam_centre(), indexer2.get_indexer_beam_centre())
indexer.eliminate()
indexer2.eliminate()
assert approx_equal(indexer.get_indexer_cell(), indexer2.get_indexer_cell())
assert indexer.get_indexer_lattice() == 'hR'
assert indexer2.get_indexer_lattice() == 'hR'
示例7: exercise_xds_indexer
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import set_parallel [as 別名]
def exercise_xds_indexer(nproc=None):
if not have_dials_regression:
print "Skipping exercise_xds_indexer(): dials_regression not configured"
return
if nproc is not None:
from xia2.Handlers.Flags import Flags
Flags.set_parallel(nproc)
xia2_demo_data = os.path.join(dials_regression, "xia2_demo_data")
template = os.path.join(xia2_demo_data, "insulin_1_###.img")
cwd = os.path.abspath(os.curdir)
tmp_dir = os.path.abspath(open_tmp_directory())
os.chdir(tmp_dir)
from xia2.Modules.Indexer.XDSIndexerII import XDSIndexerII
indexer = XDSIndexerII()
indexer.set_working_directory(tmp_dir)
from dxtbx.datablock import DataBlockTemplateImporter
importer = DataBlockTemplateImporter([template])
datablocks = importer.datablocks
imageset = datablocks[0].extract_imagesets()[0]
indexer.add_indexer_imageset(imageset)
from xia2.Schema.XCrystal import XCrystal
from xia2.Schema.XWavelength import XWavelength
from xia2.Schema.XSweep import XSweep
from xia2.Schema.XSample import XSample
cryst = XCrystal("CRYST1", None)
wav = XWavelength("WAVE1", cryst, imageset.get_beam().get_wavelength())
samp = XSample("X1", cryst)
directory, image = os.path.split(imageset.get_path(1))
sweep = XSweep('SWEEP1', wav, samp, directory=directory, image=image)
indexer.set_indexer_sweep(sweep)
indexer.index()
assert approx_equal(
indexer.get_indexer_cell(), (78.05675, 78.05675, 78.05675, 90, 90, 90),
eps=1e-4), indexer.get_indexer_cell()
experiment = indexer.get_indexer_experiment_list()[0]
sgi = experiment.crystal.get_space_group().info()
assert sgi.type().number() == 197
beam_centre = indexer.get_indexer_beam_centre()
assert approx_equal(beam_centre, (94.4239, 94.5110), eps=1e-3)
assert indexer.get_indexer_images() == [(1, 45)]
print indexer.get_indexer_experiment_list()[0].crystal
print indexer.get_indexer_experiment_list()[0].detector
# test serialization of indexer
json_str = indexer.as_json()
print json_str
indexer2 = XDSIndexerII.from_json(string=json_str)
indexer2.index()
assert approx_equal(indexer.get_indexer_cell(), indexer2.get_indexer_cell())
assert approx_equal(
indexer.get_indexer_beam_centre(), indexer2.get_indexer_beam_centre())
assert approx_equal(
indexer.get_indexer_images(), indexer2.get_indexer_images())
indexer.eliminate()
indexer2.eliminate()
assert approx_equal(indexer.get_indexer_cell(), indexer2.get_indexer_cell())
assert indexer.get_indexer_lattice() == 'hR'
assert indexer2.get_indexer_lattice() == 'hR'