How to use the nexusformat.nexus.NXentry function in nexusformat

To help you get started, we’ve selected a few nexusformat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nexpy / nexpy / src / nexpy / examples / scripts / spefix.py View on Github external
def fix_spe(spe_file):

    entry = NXentry()
    entry.title = spe_file.nxname
    entry.incident_energy = spe_file['data/NXSPE_info/fixed_energy']
    entry.data = spe_file.data.data
    entry.data.error.rename('errors')

    s = raw_input("Emin Emax Phimin Phimax dPhi: ")
    xmin, xmax, ymin, ymax, dy = [float(i) for i in s.split(' ')]    
    mfit(entry.data, xmin, xmax, ymin, ymax, dy)
    
    return entry
github nexpy / nexpy / src / nexpy / gui / treeview.py View on Github external
def add(self, node):
        if isinstance(node, NXgroup):
            shell_names = self.get_shell_names(node)
            if shell_names:
                node.nxname = shell_names[0]
            if isinstance(node, NXroot):
                self[node.nxname] = node
                self[node.nxname]._file_modified = False
            elif isinstance(node, NXentry):
                group = NXroot(node)
                name = self.get_new_name()
                self[name] = group
                print("NeXpy: '%s' added to tree in '%s'" % (node.nxname,
                                                             group.nxname))
            else:
                group = NXroot(NXentry(node))
                name = self.get_new_name()
                self[name] = group
                print("NeXpy: '%s' added to tree in '%s%s'" % 
                    (node.nxname, group.nxname, node.nxgroup.nxpath))
        else:
            raise NeXusError("Only an NXgroup can be added to the tree")
github nexpy / nexpy / src / nexpy / gui / treeview.py View on Github external
def add(self, node):
        if isinstance(node, NXgroup):
            shell_names = self.get_shell_names(node)
            if shell_names:
                node.nxname = shell_names[0]
            if isinstance(node, NXroot):
                self[node.nxname] = node
                self[node.nxname]._file_modified = False
            elif isinstance(node, NXentry):
                group = NXroot(node)
                name = self.get_new_name()
                self[name] = group
                print("NeXpy: '%s' added to tree in '%s'" % (node.nxname,
                                                             group.nxname))
            else:
                group = NXroot(NXentry(node))
                name = self.get_new_name()
                self[name] = group
                print("NeXpy: '%s' added to tree in '%s%s'" % 
                    (node.nxname, group.nxname, node.nxgroup.nxpath))
        else:
            raise NeXusError("Only an NXgroup can be added to the tree")