コード例 #1
0
    def test_entry(self):
        """
        Test non recursive link list of entry
        """

        l = nexus.get_links(self.instrument)
        self.assertEqual(len(l),4)
        for link in nexus.get_links(self.instrument):
            self.assertEqual(link.status,nexus.nxlink_status.VALID)
            self.assertEqual(link.type,nexus.nxlink_type.HARD)
コード例 #2
0
 def reopen(self):
     """ reopen field
     """
     lks = nx.get_links(self._tparent.h5object)
     try:
         lk = [e for e in lks if e.name == self.name][0]
         self._h5object = lk
     except:
         self._h5object = None
     filewriter.FTLink.reopen(self)
コード例 #3
0
def get_links(parent):
    """ get links

    :param parent: parent object
    :type parent: :class:`FTObject`
    :returns: list of link objects
    :returns: link object
    :rtype: :obj: `list` <:class:`PNILink`>
    """
    lks = nx.get_links(parent.h5object)
    links = [PNILink(e, parent) for e in lks]
    return links
コード例 #4
0
    def test_nxdata(self):
        data_group = nexus.get_object(self.root,"/:NXentry/:NXdata")
        links = nexus.get_links(data_group)

        self.assertEqual(links[0].status,nexus.nxlink_status.VALID)
        self.assertEqual(links[0].type,nexus.nxlink_type.SOFT)

        self.assertEqual(links[1].status,nexus.nxlink_status.INVALID)
        self.assertEqual(links[1].type,nexus.nxlink_type.SOFT)

        data =  links[0].resolve()
        self.assertTrue(isinstance(data,nexus.nxfield))
        self.assertEqual(data.size,0)
        self.assertEqual(data.dtype,"uint16")
コード例 #5
0
def link(target, parent, name):
    """ create link

    :param target: file name
    :type target: :obj:`str`
    :param parent: parent object
    :type parent: :class:`FTObject`
    :param name: link name
    :type name: :obj:`str`
    :returns: link object
    :rtype: :class:`PNILink`
    """
    nx.link(target, parent.h5object, name)
    lks = nx.get_links(parent.h5object)
    lk = [e for e in lks if e.name == name][0]
    el = PNILink(lk, parent)
    return el