Download latest PDF - Read the Docs
Transcript
PyFITS Documentation, Release 3.4.dev count(keyword) Returns the count of the given keyword in the header, similar to list.count if the Header object is treated as a list of keywords. Parameters keyword : str The keyword to count instances of in the header extend(cards, strip=True, unique=False, update=False, update_first=False, useblanks=True, bottom=False, end=False) Appends multiple keyword+value cards to the end of the header, similar to list.extend. Parameters cards : iterable An iterable of (keyword, value, [comment]) tuples; see Header.append. strip : bool, optional Remove any keywords that have meaning only to specific types of HDUs, so that only more general keywords are added from extension Header or Card list (default: True). unique : bool, optional If True, ensures that no duplicate keywords are appended; keywords already in this header are simply discarded. The exception is commentary keywords (COMMENT, HISTORY, etc.): they are only treated as duplicates if their values match. update : bool, optional If True, update the current header with the values and comments from duplicate keywords in the input header. This supercedes the unique argument. Commentary keywords are treated the same as if unique=True. update_first : bool, optional If the first keyword in the header is ‘SIMPLE’, and the first keyword in the input header is ‘XTENSION’, the ‘SIMPLE’ keyword is replaced by the ‘XTENSION’ keyword. Likewise if the first keyword in the header is ‘XTENSION’ and the first keyword in the input header is ‘SIMPLE’, the ‘XTENSION’ keyword is replaced by the ‘SIMPLE’ keyword. This behavior is otherwise dumb as to whether or not the resulting header is a valid primary or extension header. This is mostly provided to support backwards compatibility with the old Header.fromTxtFile() method, and only applies if update=True. useblanks, bottom, end : bool, optional These arguments are passed to Header.append() while appending new cards to the header. fromTxtFile(*args, **kwargs) Deprecated since version 3.1: This is equivalent to self.extend(Header.fromtextfile(fileobj), update=True, update_first=True). Note that there there is no direct equivalent to the replace=True option since Header.fromtextfile() returns a new Header instance. Input the header parameters from an ASCII file. The input header cards will be used to update the current header. Therefore, when an input card key matches a card key that already exists in the header, that card will be updated in place. Any input cards that do not already exist in the header will be added. Cards will not be deleted from the header. Parameters fileobj : file path, file object or file-like object 1.9. Reference/API 135