HDF5Header¶
- class baseband_tasks.io.hdf5.HDF5Header(*, verify=True, mutable=True, **kwargs)[source] [edit on github]¶
Bases:
dict
HDF5 format header.
The type of header is decided by the presence of
bps
. If present, the payload will be assumed to be encoded; if not, it will be assumed to be raw data with a givendtype
(or optionally a ‘<c4’ type for complex data with ‘<f2’ half-precision real and imaginary parts).- Parameters
- verifybool, optional
Whether to do minimal verification that the header is consistent with what is needed to interpret HDF5 payloads. Default:
True
.- mutablebool, optional
Whether to allow the header to be changed after initialisation. Default:
True
.- **kwargs
Header keywords to be set. If this includes
bps
, then this will be taken to be a header for encoded data.
Attributes Summary
Methods Summary
clear
()copy
()fromfile
(fh[, verify])Create a header from a yaml-encoded 'header' extension.
fromkeys
(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
fromvalues
(template[, whole, verify])Initialise a header from a template and/or values.
get
(key[, default])Return the value for key if key is in the dictionary, else default.
items
()keys
()pop
(k[,d])If key is not found, d is returned if given, otherwise KeyError is raised
popitem
()2-tuple; but raise KeyError if D is empty.
setdefault
(key[, default])Insert key with a value of default if key is not in the dictionary.
tofile
(fh)Write the header as a yaml-encoded 'header' extension.
update
(*[, verify])Update the header with new values.
values
()verify
()Attributes Documentation
- frequency¶
- polarization¶
- sample_rate¶
- sample_shape¶
- samples_per_frame¶
- shape¶
- sideband¶
- time¶
Methods Documentation
- clear() None. Remove all items from D. ¶
- copy() a shallow copy of D [source] [edit on github]¶
- classmethod fromfile(fh, verify=True)[source] [edit on github]¶
Create a header from a yaml-encoded ‘header’ extension.
- fromkeys(iterable, value=None, /)¶
Create a new dictionary with keys from iterable and values set to value.
- classmethod fromvalues(template, whole=None, verify=True, **kwargs)[source] [edit on github]¶
Initialise a header from a template and/or values.
- Parameters
- templateheader or stream template, optional
Must have attributes that define a header (‘sample_shape’, ‘samples_per_frame’, ‘sample_rate’, ‘time’, and either ‘dtype’ or ‘bps’ and ‘complex_data’).
- wholebool, optional
If
True
, assume a header for the complete stream is wanted, and use ‘start_time’ for the ‘time’ and the total number of samples for ‘samples_per_frame’. Default:True
if the template has both ‘start_time’ and ‘shape’ (i.e., for streams).- verifybool, optional
Whether to do basic verification. Default:
True
.- **kwargs
Any additional values. These will override values inferred from the template.
- get(key, default=None, /)¶
Return the value for key if key is in the dictionary, else default.
- items() a set-like object providing a view on D's items ¶
- keys() a set-like object providing a view on D's keys ¶
- pop(k[, d]) v, remove specified key and return the corresponding value. ¶
If key is not found, d is returned if given, otherwise KeyError is raised
- popitem() (k, v), remove and return some (key, value) pair as a ¶
2-tuple; but raise KeyError if D is empty.
- setdefault(key, default=None, /)¶
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- tofile(fh)[source] [edit on github]¶
Write the header as a yaml-encoded ‘header’ extension.
- update(*, verify=True, **kwargs)[source] [edit on github]¶
Update the header with new values.
Here, any keywords matching properties are processed as well, in the order set by the class (in
_properties
), and after all other keywords have been processed.- Parameters
- verifybool, optional
If
True
(default), verify integrity after updating.- **kwargs
Arguments used to set keywords and properties.
- values() an object providing a view on D's values ¶
- verify()[source] [edit on github]¶