bundles / astropy latest / astropy / io / fits / header / Header / insert
function
astropy.io.fits.header:Header.insert
source: /astropy/io/fits/header.py :1344
Signature
def insert ( self , key , card , useblanks = True , after = False ) Summary
Inserts a new keyword+value card into the Header at a given location, similar to list.insert.
Extended Summary
New keywords can also be inserted relative to existing keywords using, for example
>>> header = Header({"NAXIS1": 10}) >>> header.insert('NAXIS1', ('NAXIS', 2, 'Number of axes'))
to insert before an existing keyword, or
>>> header.insert('NAXIS1', ('NAXIS2', 4096), after=True)to insert after an existing keyword.
Parameters
key: int, str, or tupleThe index into the list of header keywords before which the new keyword should be inserted, or the name of a keyword before which the new keyword should be inserted. Can also accept a (keyword, index) tuple for inserting around duplicate keywords.
card: str, tupleA keyword or a (keyword, value, [comment]) tuple; see
Header.appenduseblanks: bool, optionalIf there are blank cards at the end of the Header, replace the first blank card so that the total number of cards in the Header does not increase. Otherwise preserve the number of blank cards.
after: bool, optionalIf set to
True, insert after the specified index or keyword, rather than before it. Defaults toFalse.
Aliases
-
astropy.io.fits.Header.insert