def export_mtz(self, filename=None, params=None): if params is None: params = export_phil_scope.extract() if filename is not None: params.mtz.hklout = filename m = export_mtz( self._reflections, self._experiments, params.mtz.hklout, include_partials=params.mtz.include_partials, keep_partials=params.mtz.keep_partials, scale_partials=params.mtz.scale_partials, min_isigi=params.mtz.min_isigi, force_static_model=params.mtz.force_static_model, filter_ice_rings=params.mtz.filter_ice_rings, ignore_profile_fitting=params.mtz.ignore_profile_fitting, apply_scales=params.mtz.apply_scales) m.show_summary() b1 = set(b.num() for b in m.batches()) b2 = set(m.get_column('BATCH').extract_values().as_double().iround()) assert len(b2.difference(b1)) == 0 return params.mtz.hklout
def export_mtz(params, experiments, reflections): """ Export reflections in MTZ format :param params: The phil parameters :param experiments: The experiment list :param reflections: The reflection tables """ _check_input(experiments, reflections) from dials.util.export_mtz import export_mtz # Handle case where user has passed data before integration if ("intensity.sum.value" not in reflections[0] or "intensity.prf.value" not in reflections[0]): sys.exit( "Error: No intensity data in reflections; cannot export un-integrated data to MTZ" ) try: m = export_mtz(reflections[0], experiments, params) except ValueError as e: sys.exit(e) from six.moves import cStringIO as StringIO summary = StringIO() m.show_summary(out=summary) logger.info("") logger.info(summary.getvalue())
def export_mtz(params, experiments, reflections): """ Export reflections in MTZ format :param params: The phil parameters :param experiments: The experiment list :param reflections: The reflection tables """ _check_input(experiments, reflections) from dials.util.export_mtz import export_mtz # Handle case where user has passed data before integration if ( "intensity.sum.value" not in reflections[0] or "intensity.prf.value" not in reflections[0] ): raise ValueError( "Error: No intensity data in reflections; cannot export un-integrated data to MTZ" ) reflection_table = reflections[0] filename = params.mtz.hklout # if mtz filename is auto, then choose scaled.mtz or integrated.mtz if filename in (None, Auto, "auto"): if ("intensity.scale.value" in reflection_table) and ( "intensity.scale.variance" in reflection_table ): filename = "scaled.mtz" logger.info("Data appears to be scaled, setting mtz.hklout = 'scaled.mtz'") else: filename = "integrated.mtz" logger.info( "Data appears to be unscaled, setting mtz.hklout = 'integrated.mtz'" ) m = export_mtz( reflection_table, experiments, intensity_choice=params.intensity, filename=filename, best_unit_cell=params.mtz.best_unit_cell, partiality_threshold=params.mtz.partiality_threshold, combine_partials=params.mtz.combine_partials, min_isigi=params.mtz.min_isigi, filter_ice_rings=params.mtz.filter_ice_rings, d_min=params.mtz.d_min, force_static_model=params.mtz.force_static_model, crystal_name=params.mtz.crystal_name, project_name=params.mtz.project_name, ) summary = StringIO() m.show_summary(out=summary) logger.info("") logger.info(summary.getvalue())
def run(args): from dials.util.nexus import load from dials.util.export_mtz import export_mtz import libtbx.load_env from dials.util.options import OptionParser usage = "%s hklin=hklin.nxs hklout=hklout.mtz [options]" % (libtbx.env.dispatcher_name) parser = OptionParser(usage=usage, phil=phil_scope, epilog=help_message) params, options = parser.parse_args(show_diff_phil=True) # Load the experiments and reflections from the NXmx file experiments, reflections = load(params.hklin) # Export the experiments and reflections to the MTZ file m = export_mtz(reflections, experiments, params.hklout, params.ignore_panels, params.include_partials) m.show_summary()
def export(self): """ Export the files """ from dials.util.export_mtz import export_mtz try: m = export_mtz(self.reflections, self.experiments, self.params) except ValueError as e: raise Sorry(e) from six.moves import cStringIO as StringIO summary = StringIO() m.show_summary(out=summary) logger.info("") logger.info(summary.getvalue())
def export(self): ''' Export the files ''' from dials.util.export_mtz import export_mtz m = export_mtz(self.reflections, self.experiments, self.params.mtz.hklout, ignore_panels=params.mtz.ignore_panels, include_partials=params.mtz.include_partials, keep_partials=params.mtz.keep_partials, min_isigi=params.mtz.min_isigi, force_static_model=params.mtz.force_static_model) from cStringIO import StringIO summary = StringIO() m.show_summary(out=summary) logger.info(summary.getvalue())
def run(args): from dials.util.nexus import load from dials.util.export_mtz import export_mtz import libtbx.load_env from dials.util.options import OptionParser usage = '%s hklin=hklin.nxs hklout=hklout.mtz [options]' % ( libtbx.env.dispatcher_name) parser = OptionParser(usage=usage, phil=phil_scope, epilog=help_message) params, options = parser.parse_args(show_diff_phil=True) # Load the experiments and reflections from the NXmx file experiments, reflections = load(params.hklin) # Export the experiments and reflections to the MTZ file m = export_mtz(reflections, experiments, params.hklout, params.ignore_panels, params.include_partials) m.show_summary()
def export(self): ''' Export the files ''' from dials.util.export_mtz import export_mtz m = export_mtz( self.reflections, self.experiments, self.params.mtz.hklout, ignore_panels=params.mtz.ignore_panels, include_partials=params.mtz.include_partials, keep_partials=params.mtz.keep_partials, min_isigi=params.mtz.min_isigi, force_static_model=params.mtz.force_static_model) from cStringIO import StringIO summary = StringIO() m.show_summary(out=summary) info(summary.getvalue())
def export_mtz(params, experiments, reflections): """ Export reflections in MTZ format :param params: The phil parameters :param experiments: The experiment list :param reflections: The reflection tables """ _check_input(experiments, reflections) from dials.util.export_mtz import export_mtz try: m = export_mtz(reflections[0], experiments, params) except ValueError as e: sys.exit(e) from six.moves import cStringIO as StringIO summary = StringIO() m.show_summary(out=summary) logger.info("") logger.info(summary.getvalue())