コード例 #1
0
    def load_local_connectivity(self, local_connectivity_gid, from_step=None):
        """
        Loads an existing local connectivity.
        """
        lconn_index = load_entity_by_gid(local_connectivity_gid)
        existent_lconn = LocalConnectivityCreatorModel()
        lconn_h5_path = h5.path_for_stored_index(lconn_index)
        with LocalConnectivityH5(lconn_h5_path) as lconn_h5:
            lconn_h5.load_into(existent_lconn)

        existent_lconn.surface = uuid.UUID(lconn_index.fk_surface_gid)

        common.add2session(KEY_LCONN, existent_lconn)
        existent_lconn.display_name = lconn_index.user_tag_1

        if existent_lconn.equation:
            msg = "Successfully loaded existent entity gid=%s" % (
                local_connectivity_gid, )
        else:
            msg = "There is no equation specified for this local connectivity. "
            msg += "The default equation is displayed into the spatial field."
        common.set_message(msg)

        if int(from_step) == 1:
            return self.step_1()
        if int(from_step) == 2:
            return self.step_2()
コード例 #2
0
ファイル: modify_h5_metadata.py プロジェクト: yop0/tvb-root
def update_local_connectivity_metadata(file_path):
    with LocalConnectivityH5(file_path) as f:
        f.storage_manager.set_metadata(
            {
                'Shape': "(16384, 16384)",
                'format': "csc",
                "dtype": "<f8"
            }, "/matrix")
        f.storage_manager.set_metadata(
            {
                'cutoff': 40.0,
                'state': "RAW_DATA",
                'subject': "John Doe",
                'user_tag_1': "srf_16k",
                'user_tag_2': "",
                'user_tag_3': "",
                'user_tag_4': "",
                'user_tag_5': "",
                'type': "",
                'create_date': date2string(datetime.now()),
                'visible': True,
                'is_nan': False,
                'gid': UUID('3e551cbd-47ca-11e4-9f21-3c075431bf56').urn,
                'surface': UUID('10467c4f-d487-4186-afa6-d9b1fd8383d8').urn
            }, )
コード例 #3
0
def test_store_load_local_connectivity(tmph5factory, surface_factory):
    tmp_file = tmph5factory()
    cortical_surface = surface_factory(5, cortical=True)

    local_connectivity = LocalConnectivity(
        surface=cortical_surface,
        matrix=scipy.sparse.csc_matrix(numpy.eye(8) + numpy.eye(8)[:, ::-1]),
        cutoff=12,
    )

    with LocalConnectivityH5(tmp_file) as f:
        f.store(local_connectivity)
        lc = LocalConnectivity()
        f.load_into(lc)
        assert type(lc.equation) == tvb.datatypes.equations.Gaussian