modifyHeader: Modify and edit comments and 'keyword-value' pairs in FITS...

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Functions to modify and edit keyword = value pairs in FITS header: newKwv creates keyword = value / comment line for header; addKwv adds keyword = value / comment to header; delKwv deletes keyword = value / comment from header; modVal modifies value in keyword = value / comment in header; addComment adds COMMENT line to header; addHistory adds HISTORY line to header.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
newKwv(keyw, val, note)

addKwv(keyw, val, note, headerName)

delKwv(keyw, headerName)

modVal(keyw, val, note, headerName)

addComment(comment, headerName)

addHistory(history, headerName)

Arguments

keyw

Keyword, 8 character limit (FITS specification)

val

Value for keyword

note

Optional descriptive note following keyword = value

comment

Comment text string

history

History text string

headerName

Header card images (vector)

Details

All keywords will be converted to upper case (FITS convention) and truncated to 8 characters. There is no checking for duplicate keywords. The default numerical format for values is 20.14g; if other formats are needed, format separately and write the text string as the value (see examples). Similar work-arounds may be necessary for long note strings (see examples).

Value

New card image for newKwv, otherwise modified header card images.

Note

It is also possible to operate directly on the vector of header card images. These functions are simply for convenience in maintaining the correct header formatting. No END card is needed in the header card images; that is added by closeHdr, which must be run to complete the header formatting.

Author(s)

A. Harris

See Also

readFITS, readFITSheader, closeHdr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Make header from scratch, then add, modify, delete card images.
header <- newKwv('KEYWORD', 'VALUE', 'NOTE')
header <- addKwv('test1', 'plot size', header=header)
header <- addKwv('test2', 4294.95397809807, 'number', header=header)
header <- addKwv('test3', 4.29495397809807e50, 'big number', header=header)
header <- addKwv('test4', -4.29495397809807e50, 'big number', header=header)
header <- addKwv('test5', 'this is a very long value', 'number', header=header)
header <- addKwv('test6',
   'this is a very very very very very very very very long value',
   'note', header=header)
header <- addKwv('test7', 'value',
   'very very very very very very very very very very long comment',
   header=header)
header <- addKwv('test8', '0123456789112345678921234567893123456',
   'format long number as string', header=header)
header <- addKwv('apostrophe', 'o\'\'malley',
   'apostrophes are doubled in value strings', header=header)
for (i in 1:4) {
   header <- addKwv(paste('test', 100+i, sep=''), 100+i, header=header)
}
header <- delKwv('test103', header=header)
header <- addComment('TEST103 should be missing from header', header=header)
header <- addHistory('This header generated by modifyHeader example',
   header=header)

# show header
header

FITSio documentation built on May 29, 2017, 1:07 p.m.