Mark4TrackHeader

class baseband.mark4.header.Mark4TrackHeader(words, decade=None, ref_time=None, verify=True)[source] [edit on github]

Bases: VLBIHeaderBase

Decoder/encoder of a Mark 4 Track Header.

See https://www.haystack.mit.edu/tech/vlbi/mark5/docs/230.3.pdf

Parameters:
wordstuple of int, or None

Five 32-bit unsigned int header words. If None, set to a list of zeros for later initialisation.

decadeint or None

Decade in which the observations were taken (needed to remove ambiguity in the Mark 4 time stamp). Can instead pass an approximate ref_time.

ref_timeTime or None

Reference time within 4 years of the observation time, used to infer the full Mark 4 timestamp. Used only if decade is not given.

verifybool, optional

Whether to do basic verification of integrity. Default: True.

Returns:
headerMark4TrackHeader

Attributes Summary

decade

Decade of year, to complement 'bcd_unit_year' from header.

fraction

Fractional seconds (decoded from 'bcd_fraction').

mutable

Whether the header can be modified.

nbytes

Size of the header in bytes.

time

Convert BCD time code to Time object.

track_id

Track identifier (decoded from 'bcd_track_id').

Methods Summary

copy(**kwargs)

Create a mutable and independent copy of the header.

fromfile(fh, *args, **kwargs)

Read VLBI Header from file.

fromkeys(*args, **kwargs)

Initialise a header from parsed values.

fromvalues(*args, **kwargs)

Initialise a header from parsed values.

get_time()

Convert BCD time code to Time object.

infer_decade(ref_time)

Uses a reference time to set a header's decade.

invariant_pattern([invariants])

Pattern and mask shared between headers of a type or stream.

invariants()

Set of keys of invariant header parts.

keys()

All keys defined for this header.

set_time(time)

Convert Time object to BCD timestamp elements.

tofile(fh)

Write VLBI frame header to filehandle.

update(*[, verify])

Update the header by setting keywords or properties.

verify()

Verify header integrity.

Attributes Documentation

decade = None

Decade of year, to complement ‘bcd_unit_year’ from header.

fraction

Fractional seconds (decoded from ‘bcd_fraction’).

mutable

Whether the header can be modified.

nbytes

Size of the header in bytes.

time

Convert BCD time code to Time object.

Calculate time using bcd-encoded ‘bcd_unit_year’, ‘bcd_day’, ‘bcd_hour’, ‘bcd_minute’, ‘bcd_second’ header items, as well as the fraction property (inferred from ‘bcd_fraction’) and decade from the initialisation. See See https://www.haystack.mit.edu/tech/vlbi/mark5/docs/230.3.pdf

track_id

Track identifier (decoded from ‘bcd_track_id’).

Methods Documentation

copy(**kwargs) [edit on github]

Create a mutable and independent copy of the header.

Keyword arguments can be passed on as needed by possible subclasses.

classmethod fromfile(fh, *args, **kwargs) [edit on github]

Read VLBI Header from file.

Arguments are the same as for class initialisation. The header constructed will be immutable.

classmethod fromkeys(*args, **kwargs) [edit on github]

Initialise a header from parsed values.

Like fromvalues, but without any interpretation of keywords.

Raises:
KeyErrorif not all keys required are present in kwargs
classmethod fromvalues(*args, **kwargs) [edit on github]

Initialise a header from parsed values.

Here, the parsed values must be given as keyword arguments, i.e., for any header = cls(<words>), cls.fromvalues(**header) == header.

However, unlike for the fromkeys class method, data can also be set using arguments named after header methods, such as time.

Parameters:
*args

Possible arguments required to initialize an empty header.

**kwargs

Values used to initialize header keys or methods.

get_time()[source] [edit on github]

Convert BCD time code to Time object.

Calculate time using bcd-encoded ‘bcd_unit_year’, ‘bcd_day’, ‘bcd_hour’, ‘bcd_minute’, ‘bcd_second’ header items, as well as the fraction property (inferred from ‘bcd_fraction’) and decade from the initialisation. See See https://www.haystack.mit.edu/tech/vlbi/mark5/docs/230.3.pdf

infer_decade(ref_time)[source] [edit on github]

Uses a reference time to set a header’s decade.

Parameters:
ref_timeTime

Reference time within 5 years of the observation time.

classmethod invariant_pattern(invariants=None, **kwargs) [edit on github]

Pattern and mask shared between headers of a type or stream.

This is mostly for use inside locate_frames().

Parameters:
invariantsset of str, optional

Set of keys to header parts that are shared between all headers of a given type or within a given stream/file. Default: from invariants().

**kwargs

Keyword arguments needed to instantiate an empty header. (Mostly for Mark 4).

Returns:
patternlist of int

The pattern that is shared between headers. If called on an instance, just the header words; if called on a class, words with defaults for the relevant parts set.

masklist of int

For each entry in pattern a bit mask with bits set for the parts that are invariant.

classmethod invariants() [edit on github]

Set of keys of invariant header parts.

On the class, this returns keys of parts that are shared by all headers for the type, on an instance, those that are shared with other headers in the same file.

If neither are defined, returns ‘sync_pattern’ if the header containts that key.

keys() [edit on github]

All keys defined for this header.

set_time(time)[source] [edit on github]

Convert Time object to BCD timestamp elements.

Parameters:
timeTime

The time to use for this header.

tofile(fh) [edit on github]

Write VLBI frame header to filehandle.

update(*, verify=True, **kwargs) [edit on github]

Update the header by setting keywords or properties.

Here, any keywords matching header keys are applied first, and any remaining ones are used to set header properties, in the order set by the class (in _properties).

Parameters:
verifybool, optional

If True (default), verify integrity after updating.

**kwargs

Arguments used to set keywords and properties.

verify()[source] [edit on github]

Verify header integrity.