コード例 #1
0
    def export(self):
        '''
    Export the files

    '''
        from dials.util import export_json
        from scitbx.array_family import flex

        if self.experiments is not None and len(self.experiments) > 0:
            imagesets = [expt.imageset for expt in self.experiments]
        else:
            imagesets = []
            for datablock in self.datablocks:
                imagesets.extend(datablock.extract_imagesets())

        reflections = None
        assert len(self.reflections) == len(imagesets), (len(self.reflections),
                                                         len(imagesets))
        for i, (refl, imgset) in enumerate(zip(self.reflections, imagesets)):
            refl['imageset_id'] = flex.size_t(refl.size(), i)
            if reflections is None:
                reflections = refl
            else:
                reflections.extend(refl)

        settings = self.params
        settings.__inject__('beam_centre', None)
        settings.__inject__('reverse_phi', None)

        exporter = export_json.ReciprocalLatticeJson(settings=self.params)
        exporter.load_models(imagesets, reflections)
        exporter.as_json(filename=params.json.filename,
                         compact=params.json.compact,
                         n_digits=params.json.n_digits,
                         datablocks=datablocks)
コード例 #2
0
    def export(self):
        """
        Export the files

        """
        from dials.util import export_json
        from scitbx.array_family import flex

        imagesets = [expt.imageset for expt in self.experiments]

        reflections = None
        assert len(self.reflections) == len(imagesets), (
            len(self.reflections),
            len(imagesets),
        )
        for i, refl in enumerate(self.reflections):
            refl["imageset_id"] = flex.size_t(refl.size(), i)
            if reflections is None:
                reflections = refl
            else:
                reflections.extend(refl)

        exporter = export_json.ReciprocalLatticeJson(self.experiments,
                                                     reflections)
        exporter.as_json(
            filename=params.json.filename,
            compact=params.json.compact,
            n_digits=params.json.n_digits,
            experiments=self.experiments,
        )
コード例 #3
0
ファイル: export.py プロジェクト: jmp1985/dials
def export_json(params, experiments, reflections):
    """
    Export reflections in json format

    :param params: The phil parameters
    :param experiments: The experiment list
    :param reflections: The reflection tables
    """

    # Check the input
    _check_input(experiments, [None])
    if not reflections:
        raise ValueError("json exporter requires a reflection table")

    from scitbx.array_family import flex

    from dials.util import export_json

    imagesets = [expt.imageset for expt in experiments]

    if len(reflections) != len(imagesets):
        raise ValueError(
            "Mismatch between %d reflections lists and %d imagesets"
            % (len(reflections), len(imagesets))
        )
    selected_reflections = None
    for i, refl in enumerate(reflections):
        refl["imageset_id"] = flex.size_t(refl.size(), i)
        if selected_reflections is None:
            selected_reflections = refl
        else:
            selected_reflections.extend(refl)

    exporter = export_json.ReciprocalLatticeJson(experiments, selected_reflections)
    exporter.as_json(
        filename=params.json.filename,
        compact=params.json.compact,
        n_digits=params.json.n_digits,
        experiments=experiments,
    )