Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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")
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")