Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
rv.append(c)
offset += o
if itype == "a":
rv = "".join(rv)
else:
t, offset = _miriad.hread_init(h)
assert t == "b"
for t in itype:
v, o = _miriad.hread(h, offset, t)
rv.append(v)
offset += o
_miriad.hdaccess(h)
if len(rv) == 1:
return rv[0]
elif type(rv) == str:
return rv
else:
return np.array(rv)
def _wrhd_special(self, name, val):
"""Provide write access to special header items of type '?' to _wrhd."""
if name == "freqs":
h = self.haccess(name, "write")
_miriad.hwrite(h, 0, val[0], "i")
offset = 8
for i, v in enumerate(val[1:]):
if i % 3 == 0:
_miriad.hwrite(h, offset, v, "i")
else:
_miriad.hwrite(h, offset, v, "d")
offset += 8
_miriad.hdaccess(h)
else:
raise ValueError("Unknown special header: " + name)
try:
c, o = _miriad.hread(h, offset, "i")
rv.append(c)
offset += 8
c, o = _miriad.hread(h, offset, "d")
rv.append(c)
offset += 8
c, o = _miriad.hread(h, offset, "d")
rv.append(c)
offset += 8
except IOError:
break
_miriad.hdaccess(h)
return rv
else:
raise ValueError("Unknown special header: " + name)
def items(self):
"""
Get the list of available header items.
Returns
-------
list of str
list of available header items
"""
items = []
for i in itemtable:
try:
_miriad.hdaccess(self.haccess(i, "read"))
items.append(i)
except IOError:
pass
return items