Skip to content

Header Class

azcam.header

Contains the Header and System classes.

Header

Bases: object

Defines the Header class which is used to create and manipulate headers contained in many azcam tools.

Attributes:

Name Type Description
self.title str

header title dictionary {index:title_line}

self.keywords dict

header keywords dictionary {keyword:keywordstring}

self.values dict

header values dictionary {keyword:value}

self.comments dict

header comments dictionary {keyword:comment}

self.typestrings dict

header typestrings dictionary {keyword:typestring)

self.items list

list of header objects

__init__(title='', template=None)

Create instance.

Parameters:

Name Type Description Default
title str

title of header to be used in image header

''
template str | None

filename of template file with static header info

None

convert_type(value, pythontype)

Convert a value to a specific type.

copy_all_items(ptr_header)

Copy all items from the specified header object to the current image header.

delete_all_items()

Delete all header items

delete_all_keywords()

Delete all keywords.

delete_keyword(keyword)

Delete a keyword.

get_header()

Returns the header list. Returns: list of header lines: [Header[]]: Each element contains (keyword,value,comment,type).

get_keyword(keyword)

Return a keyword value, its comment string, and type. Comment always returned in double quotes, even if empty. Args: keyword (str): name of keyword Returns: list of [keyword, comment, type]

get_keywords()

Return a list of all keyword names. Returns: keywords: list of all keywords

get_string()

Returns the entire header as a single formatted string.

read_file(filename='')

Read a header file and import the data into the header.

set_header(object_name, order=-1)

Sets object_name in the global header dictionary. order defines how headers are written in image files.

Parameters:

Name Type Description Default
object_name str

name of header object

required
order int

order to be shown in image header (-1 next)

-1

set_keyword(keyword, value, comment=None, typestring=None)

Set a keyword value, comment, and type. Args: keyword: keyword value: value of keyword comment: comment string typestring: one of 'str', 'int', or 'float'

set_keyword_string(keystring)

Set keyword data from a single string.

set_title(title)

Set the title of the header.

update()

Update header.

ObjectHeaderMethods

Bases: object

Header methods for main objects. These are called like "controller.get_keyword()".

define_keywords()

Defines and resets keywords.

delete_keyword(keyword)

Delete a keyword. Args: keyword: keyword

get_keyword(keyword)

Return a keyword value, its comment string, and type. Comment always returned in double quotes, even if empty. Args: keyword: name of keyword Returns: list of [keyword, comment, type]

get_keywords()

Return a list of all keyword names. Returns: keywords: list of all keywords

read_header()

Reads and returns current header data. Returns: list of header lines: [Header[]]: Each element contains (keyword,value,comment,type).

set_keyword(keyword, value, comment='none', typestring='none')

Set a keyword value, comment, and type. Args: keyword: keyword value: value of keyword comment: comment string typestring: one of 'str', 'int', or 'float'

update_header()

Update the header, reading current data. Deletes all keywords if the object is not enabled.

System

Bases: ObjectHeaderMethods

System class.