コード例 #1
0
ファイル: reflections.py プロジェクト: ConorFWild/mdc3
def new_reflections_from_reflections_at_res(reflections: Reflections,
                                            resolution: float,
                                            ) -> Reflections:
    new_hkl_info = clipper_python.HKL_info(reflections.hkl_info.spacegroup,
                                           reflections.hkl_info.cell,
                                           clipper_python.Resolution(resolution),
                                           True,
                                           )

    # new_hkl_data = clipper_python.data32.HKL_data_F_phi_float(new_hkl_info)
    new_hkl_data = clipper_python.HKL_data_F_phi(new_hkl_info)


    index = new_hkl_info.first
    print(index)
    while not index.last():
        try:
            new_hkl_data[index.hkl] = reflections.hkl_data[index.hkl]
        except:
            pass
        index.next()

    return Reflections(new_hkl_info,
                       new_hkl_data,
                       )
コード例 #2
0
ファイル: real_space.py プロジェクト: ConorFWild/mdc3
def xmap_from_path(
    path,
    structure_factors,
) -> MCDXMap:
    mtz_file = clipper_python.CCP4MTZfile()

    mtz_file.open_read(str(path))

    hkl_info = clipper_python.HKL_info()
    mtz_file.import_hkl_info(hkl_info)

    # hkl_data = clipper_python.HKL_data_F_phi(hkl_info)
    hkl_data = clipper_python.data32.HKL_data_F_phi_float(hkl_info)
    # mtz_file.import_hkl_data(hkl_data,
    #                          "*/*/[{}]".format(structure_factors),
    #                          )

    mtz_file.import_hkl_data(hkl_data, "*/*/[2FOFCWT,PH2FOFCWT]")

    mtz_file.close_read()

    spacegroup = hkl_info.spacegroup
    cell = hkl_info.cell
    resolution = hkl_info.resolution

    hkl_data = hkl_data

    return MCDXMap.xmap_from_clipper_res(spacegroup, cell, resolution,
                                         hkl_data)
コード例 #3
0
def load_mtz(mtz_path):
    mtz = clipper.CCP4MTZfile()
    mtz.open_read(mtz_path)
    hkl_info = clipper.HKL_info()
    hkl_data = clipper.data32.HKL_data_F_phi_float(hkl_info)
    mtz.import_hkl_info(hkl_info)
    mtz.import_hkl_data(hkl_data, "*/*/[FWT,PHWT]")
    mtz.close_read()

    return hkl_info, hkl_data
コード例 #4
0
ファイル: reflections.py プロジェクト: ConorFWild/mdc3
 def __setstate__(self, state):
     spacegroup = spacegroup_from_state(state["spacegroup"])
     cell = cell_from_state(state["cell"])
     resolution = resolution_from_state(state["resolution"])
     self.hkl_info = clipper_python.HKL_info(spacegroup,
                                             cell,
                                             resolution,
                                             )
     self.hkl_data = clipper_python.HKL_data_F_phi(self.hkl_info)
     # print(state["data"])
     # print(np.std(state["data"]))
     self.hkl_data._getDataNumpy(state["data"])
コード例 #5
0
ファイル: reflections.py プロジェクト: ConorFWild/mdc3
def reflections_from_mtz(mtz_file: MTZFile) -> Reflections:

    mtz_file.mtz.open_read(str(mtz_file.path))

    hkl_info = clipper_python.HKL_info()
    mtz_file.mtz.import_hkl_info(hkl_info)

    hkl_data = clipper_python.HKL_data_F_phi(hkl_info)
    # hkl_data = clipper_python.data32.HKL_data_F_phi_float(hkl_info)
    mtz_file.mtz.import_hkl_data(hkl_data, "*/*/[FWT,PHWT]")

    mtz_file.mtz.close_read()

    return Reflections(hkl_info,
                       hkl_data,
                       )
コード例 #6
0
 def __setstate__(self, state):
     spacegroup = spacegroup_from_state(state["spacegroup"])
     cell = cell_from_state(state["cell"])
     resolution = resolution_from_state(state["resolution"])
     self.hkl_info = clipper_python.HKL_info(
         spacegroup,
         cell,
         resolution,
         True,
     )
     self.hkl_data = clipper_python.data32.HKL_data_F_phi_float(
         self.hkl_info)
     # print(state["data"])
     # print(np.std(state["data"]))
     self.hkl_data.set_data(
         state["data"][0],
         state["data"][1],
     )
コード例 #7
0
ファイル: reflections.py プロジェクト: ConorFWild/mdc3
def new_reflections_from_reflections(reflections: Reflections) -> Reflections:
    new_hkl_info = clipper_python.HKL_info(reflections.hkl_info.spacegroup,
                                           reflections.hkl_info.cell,
                                           reflections.hkl_info.resolution,
                                           True,
                                           )

    new_hkl_data = clipper_python.HKL_data_F_phi(reflections.hkl_data)
    # new_hkl_data = clipper_python.data32.HKL_data_F_phi_float(reflections.hkl_data)

    old_hkl_array, old_data_array = reflections.hkl_data.data

    new_hkl_data.set_data(old_hkl_array,
                          old_data_array,
                          )

    return Reflections(new_hkl_info,
                       new_hkl_data,
                       )