FITSFiles.jl
FITSFiles.jl is a Julia implementation of the Flexible Image Transport System (FITS) file IO standard.
A FITS file is a vector of header-data units (HDUs), where the header of an HDU is a vector of cards, and fits reads the file.
FITSFiles.FITSFiles — Module
FITSFiles.jl is a Julia implementation of the Flexible Image Transport System (FITS) file format.
FITS files are composed of a vector of header-data units (HDUs), where an HDU is a header, which is a vector of cards, followed by data.
Base.getindex — Method
hdus[name]
hdus[name, version]Return the HDU of the vector hdus whose EXTNAME is name, without regard to the case, which is the first HDU of that name if the name is not unique. With a version, return the HDU whose EXTVER is version, where an absent EXTVER is 1 (Sect. 4.4.2.6 of the standard). A KeyError is raised if there is no such HDU.
Base.write — Method
Base.write(io::IO, hdus::AbstractVector{<:HDU})
Base.write(filename::AbstractString, hdus::AbstractVector{<:HDU})Write a vector of header-data units (HDUs), of any type of HDU, e.g., the Vector{HDU{Primary}} of [HDU(data, cards)], to a file, with an error if the first HDU is not a primary HDU or a later one is (Sect. 3.1 of the standard), before anything is written, unless check = false is given, which is a warning (see Base.write(io::IO, hdu::HDU)). A file is written to a file next to it, which replaces it when the HDUs are written, so that a file is not changed by a write that fails. The keyword checksum::Bool=false sets the DATASUM and CHECKSUM keywords of each HDU (see Base.write(io::IO, hdu::HDU)). The data of the HDUs of a file that are not read are copied from the file, so the vector is not written to that file, which is an ArgumentError that leaves the file as it is.
FITSFiles.fits — Method
fits(io::IO; <keywords>)
fits(filename::AbstractString; <keywords>)Open and read a FITS file, returning a vector of header-data units (HDUs). The first HDU is the primary HDU and the others are extensions (Sect. 3.1 of the standard), and a file whose HDUs are not in this order is read with a warning. The special records after the last HDU (Sect. 3.5) are not read, with a warning.
The default data structure for Random and Bintable HDUs is a named tuple of arrays.
A complex value of a binary table that has a NaN as its real or its imaginary part is undefined, and is missing. It is written as a NaN in both parts, so the data that are read (access = :memory) are written with the bytes of that NaN, which may not be those of the file, e.g., NaN + 0im, but the data that are not read, which is the default, are written as they are in the file.
A string of a binary table ends at the first NUL, and does not have the spaces at its end, which fill its field (Sect. 7.3.3.1). The bytes of a string that are not ASCII text characters, i.e., that are not 32 to 126, are read as they are, with a warning for the field, but the data that are read (access = :memory) are not written with them, since the standard has only those characters, unless check = false is given to write, which is so for the characters of an ASCII table too. A string cannot be missing.
The data of the HDUs of a file are not read until they are accessed (hdu.data), so that a file is scanned quickly, e.g., to info its HDUs, and size(hdu) is the size of the data from the header. They are read from the file each time they are accessed, so the file must not have been modified since it was read, which is an ArgumentError, and an HDU that is written is written with the data as they are in the file (see Base.write(io::IO, hdu::HDU)). The keyword access chooses how the data of a file are accessed: :lazy is this default, :memory reads all of the data at once, and :mapped maps the data of the primary HDU, the IMAGE extensions, the conforming HDUs, random groups, and the fixed-width fields of binary tables, so that hdu.data is a read-only array that reads only the values that are indexed (see mapdata and Base.read(io::IO, ::Type{HDU})).
Keywords
checksum::Bool=false: verify the DATASUM and CHECKSUM keywords of each HDU, with a warning if a sum is not the sum of the data or of the HDU (Sect. 4.4.2.7 of the standard)record::Bool=false: structure the data as a list of recordsscale::Bool=true: apply the scale and zero keywords to the data; the data of a BSCALE of 1 and a BZERO of 0 are the stored values, e.g., the integers of an integer image, and the scaled values of 32- and 64-bit integers areFloat64; an image of the offsets of Table 11 of the standard (BSCALE of 1 and BZERO of 2^15, 2^31, or 2^63 for 16-, 32-, or 64-bit integers, or -128 for bytes) is an array ofUInt16,UInt32,UInt64, orInt8, and so is the array of random groups, and a parameter that has the PSCALn of 1 and the PZEROn of the offsets; floating-point data with a scale and a zero that are not 1 and 0 are aFITSFiles.ScaledArray, which has themstrict::Bool=true: numbers with a lower case exponent letter (d or e) are invalid cards, unless falseunits::Union{Bool, Module}=true: the units in the comment of a number are the units of the value (trueis Unitful, or the moduleDynamicQuantitieswhen it is loaded), unless false
FITSFiles.info — Method
info(hdus::AbstractVector{<:HDU})Briefly describe the list of header-data units (HDUs).
FITSFiles.specialrecords — Method
specialrecords(io, n)Return true, with a warning, if the bytes of io that follow the nth HDU are special records (Sect. 3.5 of the standard), and move to the end of io. Special records are the blocks after the last HDU, which do not meet the requirements of a conforming extension, so that the first eight bytes of them are not XTENSION. The first eight bytes of the header of an HDU after the first are XTENSION, and SIMPLE is read as an HDU that is in the wrong place (see verifyposition). The special records are not read, and are not written.
FITSFiles.verifyname — Method
verifyname(hdus)Warn if the last HDU of the vector hdus has the same type, EXTNAME, EXTVER, and EXTLEVEL as an HDU before it. It is recommended that the combination of these keywords is unique in each HDU of a FITS file that has them (Sect. 4.4.2.6 of the standard). The type of an HDU is the value of its XTENSION, and the primary array is equivalent to an IMAGE extension, but random groups are not: their type is GROUPS. An absent EXTVER or EXTLEVEL is 1, and the HDUs that have none of the three keywords are not compared. The HDUs are read and written as they are. Return the HDUs.
FITSFiles.verifyposition — Method
verifyposition(hdu, j)Warn if the jth HDU of a FITS file is not what the standard requires of its position (Sect. 3.1): the first HDU is the primary HDU, whose header begins with SIMPLE, and the HDUs after it are conforming extensions, whose headers begin with XTENSION, and so do not have SIMPLE (Sect. 3.4.3). A file that has HDUs that are not in this order is read and written as it is. Return the HDU. The EXTEND keyword of the primary header is advisory (Sect. 4.4.2.1), so it is not verified.
FITSFiles.HDU — Type
HDU{T}(cards, data)
HDU([data, [cards]]; <keywords>)
HDU(cards; <keywords>)
HDU(type, missing, [cards]; <keywords>)
HDU(type, data, [cards]; <keywords>)Create a header-data unit described by data and cards of type AbstractHDU.
The HDU function tries to determine the HDU type based on the data and cards. If only data is provided, then an array is interpreted as a Primary HDU and a Tuple or NamedTuple as a Bintable. If mandatory cards are provided, then they are used to determine the HDU type. Otherwise, the HDU type must be specified.
HDU types are: Primary, Random, Image, Table, Bintable, and Conform.
Arguments
data::U=missing: the binary or ASCII data, whereU <: Union{AbstractArray, Tuple, NamedTuple, Missing}cards::U=missing: the list of cards, whereU <: Union{Card, Vector{Card}, Vector{Card{<:Any}}, Missing}
Keywords
record::Bool=false: structure the data as a list of recordsscale::Bool=true: apply the scale and zero keywords to the data; floating-point data that have a scale and a zero that are not 1 and 0 are aFITSFiles.ScaledArray, which has them, and is written as the stored valueswcs=nothing: the world-coordinate systems that the HDU has, instead of those that its cards describe: aWCS, or aNamedTuple, a tuple, or a vector of them, whose versions replace those of the cards (seehdu.wcs). Their cards are made when the HDU is written (seewcscards). A table is given the WCSs of its pixel list, and of the images of its columns under the name of the column (seewcscards)variable=nothing: the fields of a binary table that are variable-length arrays, which are stored in the heap, and the type of their array descriptor,'P'(32-bit) or'Q'(64-bit), as aNamedTupleor aDictof the name of the field, or its number, e.g.,variable = (events = 'P', spectra = 'Q'). The keyword has priority over the TFORMn card of the field, which has priority over the data, whose arrays are variable-length if their lengths differ, so that arrays of the same length are variable-length with the keyword or a TFORMn that has aPor aQ(Sect. 7.3.5). The arrays of the field are arrays, strings, or bit arrays, a number is an array of one element, and the rows of a matrix are its arrays. The data are the fields of the table, so a TFORMn or a TFIELDS card that is not the format or the number of the fields of the data is set to it, with a warning, as it is for a table. ATHEAPcard that is past the table leaves a gap of zeros before the heap, whose bytes are inPCOUNTwith those of the arrays (Sect. 7.3.5), which is set when the table is written.heapoffset=nothing: the offset of the heap of a binary table from the start of the table, in bytes (the cardTHEAP, Sect. 7.3.5), which has priority over the card. Aheapoffsetthat is more than the bytes of the table leaves a gap of zeros before the heap, asHDU(Bintable, data; heapoffset = 4096)andHDU(ZTable, data; heapoffset = 4096)do (a compressed table keeps it asZTHEAP).
The following keywords format the cards that are created, and are those of Card, which describes them.
append::Bool=false: append an ampersand to a string that is continued by a CONTINUE cardfixed::Bool=true: create fixed format cardsslash::Integer=32: index of the comment separator (/)lpad::Integer=1: number of spaces before the comment separatorrpad::Integer=1: number of spaces after the comment separatorupad::Integer=1: number of spaces after the unitstruncate::Bool=true: truncate a comment that is longer than the space at the end of the card
Base.findall — Method
findall(key, cards)Return the indexes of all the cards with the keyword key, in the order of the header. The indexes are empty if there is no such card.
Base.get — Method
get(cards, key, default)
get(cards, keys, defaults)Return the value of the first card with the keyword key, or default if there is no such card. With a list of keys, return the tuple of the values of the first cards with the keywords, in the order of the keys, where the default of a keyword that is not found is the default at the same position. The types of the values are the types of the cards, and not the types of the defaults. The value of a continued string is the joined string. See getall for the values of all the cards with a keyword.
Base.read — Method
Base.read(io::IO, ::Type{HDU}; <keywords>)Read the next header-data unit (HDU) from io and return it. The data of an HDU that is read from a file are by default a lazy array, which is read when the data are accessed (access = :lazy), and the data of an HDU that is read from another stream are read at once. The fill of the last data block is zeros, or ASCII spaces for an ASCII table, and a warning says if it is not (see verifyfill).
Keywords
access::Symbol=:lazy: how the data of an HDU that is read from a file are accessed.:lazyis the default: the file is scanned without reading the data, which are read whenhdu.datais accessed, as an ordinary array that can be changed.:memoryreads the data at once.:mappedmaps the data of the primary HDU, an IMAGE extension, a conforming HDU, and random groups that are not records in memory (seemapdata), so thathdu.datais a read-only array (for random groups and binary tables, of arrays) that reads only the values that are indexed from the file, and the data of the other types of HDU are lazy. The fields of arrays of variable length of a binary table are read at once. The file must not be modified while its data are lazy or mapped. A stream that is not a file is read at once, and:mappedis an error for it.type=nothing: the HDU type, e.g.,Image, which is otherwise determined by the mandatory keywords of the headerstrict::Bool=true: numbers with a lower case exponent letter (d or e) are invalid cards, unless falseunits::Union{Bool, Module}=true: the units in the comment of a number are the units of the value (trueis Unitful, or the moduleDynamicQuantitieswhen it is loaded), unless falserecord::Bool=false: structure the data as a list of recordsscale::Bool=true: apply the scale and zero keywords to the data
Base.write — Method
Base.write(io::IO, hdu::HDU; <keywords>)Write a header-data unit (HDU) to io: the header cards, the END card, and blank cards that pad the header to a multiple of 2880 bytes, followed by the data.
The data of an image array that was read with the BSCALE and BZERO applied, or was changed, is written as the stored values, which are (value - BZERO)/BSCALE rounded to the type of BITPIX (Eq. 3 of the standard). A value that is not in the range of the type, or NaN when the data do not have a BLANK, is an error. Data that is of the type of BITPIX is the stored values, and is written as it is, except a FITSFiles.ScaledArray (and ScaledRecords of random groups), which is the physical values of floating-point stored values that were read with a BSCALE and a BZERO (or PSCALn and PZEROn) that are not 1 and 0, with that scale and zero, and the stored values, (value - BZERO)/BSCALE, are written. The BSCALE and BZERO of the header of an HDU that is made from such data are those of the data.
The data of an HDU that is read from a file are not read until they are accessed (see fits), or are mapped (access = :mapped), and are written as they are, with the fill of the type of HDU after them, by copying their bytes from the file, so a file is written as it is read, and the data are not decoded. The header may be changed, e.g., a card is added, but not the size and the type of the data, which is an ArgumentError, and the file must not have been modified since the HDU was read, which is an ArgumentError too. Read the data (hdu.data) to change them.
Keywords
check::Bool=true: the HDU is written strictly: a header that does not satisfy the standard, e.g., keywords that are not in order, a value that is not in fixed format, a value of a reserved keyword that is not of its type, a TNULLn that is not a value of its field, a NAXIS1 that is more than the bytes of the fields (whose bytes after them are zeros in the data that are written from memory), is an error, and so is an HDU in a vector that is not in the order of the standard, since a file is read leniently, with a warning, so that it is always read. If false, they are warnings, and the HDU is written as it is. The check also says that the stored value of each value of the data gives the value again when BSCALE and BZERO are applied to it, and raise an error if it does not, e.g., a value of 11.2 for integer data with a BSCALE of 2.5 and a BZERO of 10, whose nearest stored value is 0 and gives 10.0; if false, the nearest stored value is written. The characters of the strings of a binary table and the characters of an ASCII table are the ASCII text characters (Sects. 7.2.5 and 7.3.3.1), and a string that has others, e.g., one that was read with a warning, is an error unlesscheckis false, where its bytes are written as they are. A value that is notmissingand is stored as the BLANK or the TNULLn, which is read asmissing(Sects. 4.4.2.5 and 7.3.2), is an error too, unlesscheckis false, where it is written and is read asmissing. The stored values of 64-bit data that are scaled (BSCALE and BZERO, TSCALn and TZEROn, or PSCALn and PZEROn) are computed from the physical values, which are rounded, so the HDU that is written from the data that were read may have other stored values in the last bits, and a warning says so, once, unlesscheckis false. Read the data withscale = falseto write the stored values as they arechecksum::Bool=false: set the DATASUM and CHECKSUM keywords to the checksums of the data and of the HDU (Sect. 4.4.2.7 of the standard), which replace the keywords of the header, if it has them
FITSFiles.arrangecards! — Method
arrangecards!(cards, required)Return the cards with the required cards first, in the order of required, and the remaining cards of cards after them. required is a list of key => value pairs. A required card that is in cards is moved to its place, with its comment and layout, and the others are made from the values. The END card is removed, since it is implied and is written by write.
FITSFiles.extname — Method
extname(hdu)
extver(hdu)
extlevel(hdu)Return the value of the EXTNAME, EXTVER, or EXTLEVEL keyword of the header-data unit hdu (Sect. 4.4.2.6 of the standard), which distinguish the extensions of a file. The name is an empty string if the keyword is absent, and the version and the level are 1, as the standard says, if the keyword is absent. The trailing spaces of the name, which are not significant, are removed.
FITSFiles.getall — Method
getall(cards, key)
getall(cards, keys)Return the values of all the cards with the keyword key, in the order of the header, e.g., the values of the COMMENT or HISTORY cards, which are the vector of the values, or an empty vector if there is no such card. With a list of keys, return the tuple of the vectors of the keys. The value of a continued string is the joined string, and the CONTINUE cards of the string are not values.
FITSFiles.info — Function
info(hdu::HDU)Briefly describe the header-data unit.
FITSFiles.joinvalue — Method
joinvalue(cards, j)Return the value of the card at index j. The value of a continued string is the value of the card joined with the CONTINUE cards that follow it.
FITSFiles.mapdata — Method
mapdata(hdu::HDU)The data array of an HDU that is read from a file, memory-mapped, so that the values of the array are read from the file when they are indexed, and the file is not read at once. It is an AbstractArray of the values that hdu.data is, of the same type and with the same scale, and has the same size, e.g., a FITSFiles.ScaledArray of the values of floating-point stored values that have a BSCALE and a BZERO. It is for the primary HDU, the IMAGE extension, and the conforming HDU, i.e., for the data of an array, and for random groups, whose data are a NamedTuple of the mapped parameters and array (for repeated names a matrix of the parameters), which are read by the group and not by the file, and for binary tables, whose data are a NamedTuple of the columns, the fields of a fixed number of elements of which are mapped (numbers, logicals, bits, characters, and complex numbers), by the row and the element of the row, and the fields of arrays of variable length, which are in the heap, are read at once. The type of the mapped logicals and complex numbers has missing (the data would have to be read to know that no value is undefined), and the bytes of a logical that are not T, F, or 0 are read as false without a warning. It is an error for the data of another type of HDU, and for random groups and binary tables that are records. The data of the HDUs of a file are mapped when it is read by the keyword access = :mapped of fits and read(io, HDU), so that hdu.data is the mapped array.
Slices, e.g., array[1:100, 5, :], and collect(array) read the values at once, but each value of an array that is read by value is read with a function call. The array reads the file as it is when it is indexed, so it is not valid if the file is truncated or changed. It is an ArgumentError if the file has changed since the HDU was read, or does not have the data of the header. An HDU whose data are read, e.g., from a buffer, or is made, has its data returned as they are, and an HDU that has no data returns missing.
FITSFiles.readarray — Method
readarray(io, type, shape)Read the array of the values of type and the shape of the data of an HDU, which are in network (big-endian) byte order, into the array, and swap them in place, so that the array is the only copy of the data that is made (readbytes reads the bytes and the swap makes a second array). An error says that the file is shorter than the header says, as readbytes does.
FITSFiles.readbytes — Method
readbytes(io, n)Read the n bytes of the data of an HDU. An error says that the file is shorter than the header says if it has fewer bytes, instead of the data failing to match the shape of the array.
FITSFiles.setvalue! — Method
setvalue!(cards, key, value; <keywords>)Replace the value of the first card with the keyword key. A string that does not fit on a card is split into the cards of a long string, and the CONTINUE cards of a string that is replaced are removed. The keywords, i.e., fixed, append, slash, lpad, rpad, upad, truncate, and splitat, are those of setvalue!(card, value), where the default of a layout keyword is the layout of the card. The cards are always replaced, which is the way to split the value again.
FITSFiles.typeofhdu — Method
typeofhdu(data)
typeofhdu(dict)
typeofhdu(data, dict)Determine the HDU type based on the data structure, the mandatory keywords, or both.
FITSFiles.units — Method
units(card)
units(cards, key)Return the units of a card, or of the first card of a list of cards with the keyword, which are nothing if the value has no units. The units are not part of the value.
FITSFiles.verify! — Method
verify!(type, cards, mankeys, reskeys)Verify the values of the mandatory and reserved keywords of a header, mankeys and reskeys, before the data format is created from them. Return the cards. A verify! method of an HDU type corrects the cards and the mandatory keywords, mankeys, when it is possible, and otherwise raises an error that names the keyword and its value. The generic method raises an error if the value of a keyword that must be an integer is not (see verifyinteger), and warns if the XTENSION value is not padded.
The verify! methods that also have a data format argument are for the HDU types that create the format from data and then correct the header to match the data.
FITSFiles.verifyaxes — Method
verifyaxes(mankeys)Verify the NAXISn keywords of an HDU, from NAXIS1 to NAXIS, in the dictionary mankeys of the mandatory keywords. It is an error, since the size of the data cannot be determined, if NAXISn is missing for an n from 1 to NAXIS, or if it is negative. It is a warning, since the extra keywords are not used, if NAXISn is present for an n greater than NAXIS. A header with no NAXIS is not verified. Random groups, whose NAXIS1 is 0, have their own method (Sects. 4.4.1.1, 7.1.1, 7.2.1, and 7.3.1).
FITSFiles.verifycounts! — Method
verifycounts!(cards, mankeys, format)Correct PCOUNT and GCOUNT of cards to match the data format format, and return the cards.
FITSFiles.verifydate — Method
verifydate(keys, pattern)Warn if the value of a keyword of the dictionary keys that matches pattern is not a date of the form YYYY-MM-DD or YYYY-MM-DDThh:mm:ss[.sss...], or DD/MM/YY for a date before 2000 (Sect. 4.4.2.1 of the standard). The value is read and written as it is.
FITSFiles.verifyfill — Method
verifyfill(io, type, pos, nbytes)Warn if the fill of the last data block after the nbytes bytes of the data of an HDU of the type type, which begin at the position pos of io, is not what the standard says: all bits zero, or ASCII spaces for an ASCII table (Sects. 3.3.2, 6.2, 7.2.3, and 7.3.3). The data are read as they are, but the fill is not kept, and is written as it should be. A last block that is not filled, which is a file that ends after the data, is not verified. The position of io is not kept.
FITSFiles.verifyfixed — Method
verifyfixed(cards, required)Warn if the value of a card of the keywords required is not in fixed format, and return the cards unchanged (see verifyprimary).
FITSFiles.verifyfloat — Method
verifyfloat(keys, pattern)Warn if the value of a keyword of the dictionary keys that matches pattern is an integer, when the standard requires a floating-point number, e.g., DATAMIN = 0. A value that is not a number is not checked (see verifynumber). The value is read as it is.
FITSFiles.verifyinteger — Method
verifyinteger(keys, pattern)Raise an ArgumentError that names the keyword and its value if the value of a keyword of the dictionary keys that matches the regular expression pattern is not an integer, e.g., NAXIS1 = 2.0 or PCOUNT = 'two'. keys is the dictionary of the mandatory keywords, mankeys, or of the reserved keywords, reskeys, of a header (see MANDATORYKEYS and RESERVEDKEYS), and a verify! method calls verifyinteger once for each. A floating-point value, even of a whole number, is not an integer, and the size of the data cannot be determined from it, so the HDU cannot be read. The values of other keywords are not checked.
FITSFiles.verifylogical — Method
verifylogical(keys, pattern)Warn if the value of a keyword of the dictionary keys that matches pattern is not a logical, T or F. The value is read and written as it is.
FITSFiles.verifynumber — Method
verifynumber(keys, pattern)Raise an ArgumentError that names the keyword and its value if the value of a keyword of the dictionary keys that matches pattern is not a real number, e.g., BSCALE = 'two'. A value of an integer type is a number, since a keyword of a floating-point number can be written without a decimal point. The array cannot be scaled by a value that is not a number, so the HDU cannot be read.
FITSFiles.verifyorder — Method
verifyorder(cards, required)Warn at the first of the first cards that is not the keyword in the same place of required, and return the cards unchanged (see verifyprimary). The keywords section and names are the section of the standard and the names of the keywords that the warning gives.
FITSFiles.verifyshape! — Method
verifyshape!(cards, mankeys, format)Correct BITPIX and the NAXIS keywords of cards to match the data format format, and return the cards. The data are described by NAXIS1 and the keywords after it. A keyword that the cards do not have, e.g., NAXIS when they have NAXIS1, is added. Random groups, whose NAXIS1 is 0, have their own method.
FITSFiles.verifystring — Method
verifystring(keys, pattern)Warn if the value of a keyword of the dictionary keys that matches pattern is not a character string. The value is read and written as it is.
FITSFiles.verifyunit — Method
verifyunit(keys, pattern)Warn if the value of a keyword of the dictionary keys that matches pattern is a character string that is not a units string (Sect. 4.3 of the standard). An empty string is not checked. The value is read and written as it is.
FITSFiles.verifyvalue — Method
verifyvalue(keys, key, allowed, requirement)Raise an ArgumentError that names the keyword and its value if the keyword key is in the dictionary keys, of the mandatory keywords, and its value is not in allowed, e.g., a range or a tuple of values. requirement describes the allowed values for the message, e.g., "the integer 0". A keyword that is not in keys is not verified, since the header of an HDU that is created without cards has no keywords. The value is an integer, which verifyinteger verifies first.
FITSFiles.verifyxtension! — Method
verifyxtension!(cards)Warn if the value of the XTENSION card is not padded to 8 characters, as the standard requires, and return the cards unchanged. A file may have the value written without the padding, e.g., 'TABLE', which is read without error, since the trailing spaces of a string are not significant, and the file is written as it was read, so the card is not changed. The width of the value is the width of the string on the card, and not the value.
FITSFiles.leastfloat — Method
leastfloat(real::Union{Real, Nothing})Convert an integer to the smallest float type of Float32, Float64, and BigFloat that holds the integer, i.e., a Float32 for a 32-bit integer, a Float64 for a 64-bit integer, and otherwise a BigFloat. A value that is not an integer is returned as it is.
FITSFiles.scaled — Method
scaled(data, scale, zero)Return zero + scale*data. The type of the result is the promotion of the types of data, scale and zero (a Float32 for 32-bit integer data and a Float32 scale, say), but the operands are converted to at least a Float64 before the multiplication and the addition, which muladd fuses into a single rounding where the hardware allows it. A Float32 product would otherwise round the stored integers to 24 bits (e.g., a UInt32 stored as Int32 with TZERO 2147483648 and a Float32 TSCAL of 1).
FITSFiles.setmissing — Method
setmissing(data, miss)Return data with missing in place of the raw values equal to miss, the value of the BLANK or TNULLn keyword (Sects. 4.4.2.5 and 7.3.2 of the standard). The comparison is made before any scaling. The result has the element type Union{T, Missing}, whether or not a value is equal to miss, and data itself is returned when miss is nothing.
FITSFiles.unsetmissing — Method
unsetmissing(data, miss, type)Return data with miss in place of missing, as raw values of type: the inverse of setmissing. Data of a floating-point type has no BLANK or TNULLn keyword, and the undefined value is NaN (Sect. 4.4.2.5). It is an ArgumentError if data has a missing value but no miss is given for an integer type.
FITSFiles.DataFormat — Type
DataFormat(type, leng, shape, param, group, heap)The generic data format descriptor for HDUs.
FITSFiles.LazyArray — Type
LazyArray(filnam, mtime, begpos, format, fields, keywds)The lazy array file descriptor of the data of an HDU, which is read from the file when the data is accessed. It is the place of the data of an HDU that a file is scanned for, so that the HDUs of the file are read without reading their data, which filnam is the absolute path of, and mtime is the modification time of when the HDU was read. The data are read from the file, or are copied as they are when the HDU is written, only if the file has not changed (see verifylazy).
FITSFiles.verifylazy — Method
verifylazy(data::LazyArray)Return the lazy array data of the data of an HDU, or raise an ArgumentError if the file that the data are read from does not exist, or has been modified since the HDU was read, since the position and the size of the data that the header says are not those of the file then.
FITSFiles.ScaledArray — Type
ScaledArray(values, scale, zero)The physical values of floating-point data that were read with a BSCALE and a BZERO that are not 1 and 0 (Eq. 3 of the standard), or with a PSCALn and a PZEROn (Eq. 5), together with that scale and zero, which have the type of the stored values. The stored values and the physical values of floating-point data have the same type, so the type does not say which of them an array is. The array that is a ScaledArray is the physical values, and is written as the stored values (value - zero)/scale, and the header has the BSCALE and BZERO (or PSCALn and PZEROn) of the array. The array that is made from a ScaledArray by an operation of its values, e.g., a broadcast or a slice, is a plain array, and is the stored values, which are written as they are, and copy is a ScaledArray.
The scale and the zero are numbers, or vectors with a number for each column of a matrix of the parameters of one name of random groups (Sect. 6.1.2). The values are the values of parent.
FITSFiles.MappedArray — Type
MappedArray(values, size, decode; value, probe, source)The data array of an HDU that is read in place from its file, which is memory-mapped, so that only the values that are indexed are read from the file. The values are the values of the array of the file, in the byte order of the file (big-endian) and the order of the array (the first axis varies fastest), whose shape is size, e.g., a memory map of the data of the HDU, and decode is the function of an array of the values that are in the byte order of the machine to the values of the HDU, which are scaled and have missing for the undefined values, as the array that is read is. The keyword value is the function of one value, which is decode of an array of one value if it is not given, and the type of the values is that of the values of the keyword probe, a vector of values of the file. The source is the lazy array of the HDU that the array is read from, which the data are copied from when the HDU is written. The array is read from the file as the file is when it is indexed, so it is not valid if the file is truncated or changed. It is read-only.
A slice of the array, e.g., array[1:100, 5, :], and collect(array) read the values at once, and a value that is indexed is read with the function value.
FITSFiles.Primary — Type
Primary header-data unit (HDU)A Primary HDU consists of a vector of cards and optionally a multidimensional array (<=999 dimensions). The Primary HDU is the first HDU in a vector of HDUs.
FITSFiles.PrimaryField — Type
PrimaryField(type, zero, scale, miss, dmin, dmax)Primary array element descriptor
FITSFiles.verifyprimary — Method
verifyprimary(cards, mankeys)Warn if the header of a primary HDU does not begin with SIMPLE, BITPIX, NAXIS, and the NAXISn keywords, in that order and with no other keyword between them (Sect. 4.4.1.1 of the standard), or if the values of these keywords are not in fixed format (Sect. 4.4.1), and return the cards unchanged. The file is read and written as it is, so the cards are not reordered or reformatted. The NAXIS value of mankeys must be valid, as verifyarray checks.
FITSFiles.ConformField — Type
ConformField()Conforming array element descriptor
Base.size — Method
Base.size(hdu::HDU{Conform})The dimensions of the data array of a conforming HDU, which are the NAXISn of its header, so that the size of an HDU whose data are not read yet (see fits) is known without reading them. An HDU that has no data has no dimensions, (). The data of an HDU that has a heap or groups (PCOUNT and GCOUNT) are a vector, which does not have the size of the NAXISn.
FITSFiles.verifyconform — Method
verifyconform(cards, mankeys)Warn if the header of the primary HDU of a Conform HDU does not begin with SIMPLE, BITPIX, NAXIS, and the NAXISn keywords, in that order and with no other keyword between them (Sect. 4.4.1.1 of the standard), or if the values of these keywords are not in fixed format (Sect. 4.4.1), and return the cards unchanged. The file is read and written as it is, so the cards are not reordered or reformatted. The NAXIS value of mankeys must be valid, as verifyarray checks.
FITSFiles.Random — Type
Random header-data unit (HDU)A Random HDU consists of a vector of cards and optionally a vector of records containing a list of parameters followed by a multidimensional array. The Random HDU is the first HDU in a vector of HDUs.
The data are a named tuple of arrays, or, with record = true, a vector of named tuples, one for each group. The parameters are named by their PTYPEn keywords (or param1, param2, ... if there are none) and the array of a group is named data, so a parameter whose PTYPEn is data is named param<n> (see the warning). The groups are along the first axis of the array. Parameters that have the same name are the columns of one array, whose sum along its columns is the value of the parameter (Sect. 6.1.2 of the standard), so that the parameters are written as they were read, and sum(data.DATE; dims = 2) (sum(record.DATE) in a record) is the value of the parameter DATE. The data are written by position, so the names of the data do not have to be the names of the header.
The parameters and the array have the same type, which is the type of BITPIX (Sect. 6.3). The data are read with PSCALn and PZEROn applied to the parameters and BSCALE and BZERO to the array, unless scale = false is given, and the values that are not of the type of BITPIX are written as the stored values (see Base.write(io::IO, hdu::HDU)). A parameter with the PSCALn of 1 and the PZEROn of the offsets of Table 11 (Sect. 5.2.5, which Sect. 6.3 gives to the parameters), and the array with the BSCALE of 1 and the BZERO of the offsets, are the unsigned integers or the signed bytes: UInt16, UInt32, UInt64, or Int8, for the values of 16-, 32-, or 64-bit integers, or bytes. Data of those types have the PZEROn and BZERO keywords of the offsets when the HDU is made.
A header with an NAXIS of 1 has no axes in the array of a group, and so one value in each group (Eq. 6 of the standard), which is a vector of the groups in the data, and a number in a record. Data of a vector are a table by default, so make them with HDU(Random, data).
The elements of the array of integers that are the stored value of BLANK are missing (Sect. 4.4.2.5), with and without scale = false, and are written as BLANK. The parameters do not have undefined values.
FITSFiles.RandomField — Type
RandomField(name, index, type, slice, leng, shape, zero, scale, miss)Random array element descriptor. miss is the value of BLANK, the stored value of an undefined element, for the array of a group (Sect. 4.4.2.5), and is nothing for a parameter and for an array without a BLANK.
FITSFiles.ScaledRecords — Type
ScaledRecords(records, scales, zeros)The records of random groups (record = true) whose values are the physical values of floating-point stored values (see ScaledArray): the parameters and the array of each record, which have the type of the stored values, and are written as the stored values. The vectors scales and zeros have the PSCALn and PZEROn of the parameters, and the BSCALE and BZERO of the array, in order. The records are the values of parent.
Base.size — Method
Base.size(hdu::HDU{Random})The dimensions of the array of the groups of an HDU of random groups, which are the GCOUNT groups of the first dimension and the NAXISn of the array of a group (NAXIS2 to NAXIS), so that the size of an HDU whose data are not read yet (see fits) is known without reading them. It is the size of the data array of the data. A group that has no axes, which a header with a NAXIS of 1 has, has one value, and the size is the number of groups, (GCOUNT,).
FITSFiles.Image — Type
Image header-data unit (HDU)An Image HDU consists of a vector of cards and optionally a multidimensional array (<=999 dimensions).
FITSFiles.ImageField — Type
ImageField(type, zero, scale, miss, dmin, dmax)Image array element descriptor
FITSFiles.ScaledRows — Type
ScaledRows(records, scales)The records of an ASCII table (record = true) that has fields of floating-point values, or of exact integers, that are scaled by a TSCALn and a TZEROn. The values of those fields are the physical values (see ScaledArray), which the dictionary scales has the scale and the zero of, by the name of the field, and are written as the stored values. The records are the values of parent.
FITSFiles.Table — Type
Table header-data unit (HDU)A Table HDU consists of a vector of cards and optionally a 2-dimensional array of ASCII data, which is a named tuple of the columns of the fields, or a vector of records, a named tuple for each row (record = true), or a vector of the strings of the rows.
The fields of the table that is made from data have the formats TFORMn and the first columns TBCOLn of the cards that are given, and otherwise the format of the values of the field and the column that follows the one space after the previous field. The keywords formats and columns of HDU(Table, data, cards; formats, columns) are vectors that have a format string (Table 15 of the standard, e.g., "F8.3") and a first column (the first column of a row is 1) for each field, and override the cards.
The values of a field of type A are strings, of type I are Int64, and of types F, E, and D are Float64, with missing for an undefined value, which is the TNULLn string of the field (Sect. 7.2.2 of the standard). A blank field is the value 0, as the standard says (Sect. 7.2.5). The values of a field that has a TSCALn and a TZEROn that are not 1 and 0 are the physical values, which are Float64 (Eq. 7), unless scale = false. The values of an integer field whose TSCALn is 1 and TZEROn is an integer are exact integers (Int64, or BigInt if they do not fit), which are a ScaledArray. The integers of an integer field that do not fit an Int64 are a column of BigInt, since the standard has no limit (Sect. 7.2.5). The real numbers of the data are written with the digits that they need if the field has room for them, which is more than the d of the format if they need it (the formats of Table 15 are input formats, Sect. 7.2.1), so that what is read is written again.
The data are matched to the fields by name: a named tuple of columns and the records that are named tuples have a value for each field of its TTYPEn, in any order. The fields without a TTYPEn are named column1, column2, and so on.
FITSFiles.TableField — Type
TableField(name, type, slice, unit, form, disp, zero, scale, null,
dmin, dmax, lmin, lmax)Table array element descriptor
Base.size — Method
Base.size(hdu::HDU{Table})The size of the two-dimensional array of characters of an ASCII table extension, which is the number of characters in a row and the number of rows, the NAXIS1 and the NAXIS2 of its header (Sect. 7.2.3 of the standard), so that the size of an HDU whose data are not read yet (see fits) is known without reading them. The number of rows is also the number of values of each column of the data, and TFIELDS is the number of columns. A header that does not have them has none, (0, 0).
FITSFiles.verifyfields! — Method
verifyfields!(Table, cards, mankeys; created = false)Verify the keywords that describe the fields of an ASCII table extension, and return the cards unchanged (Sect. 7.2.1 of the standard). It is an error, since the fields cannot be read, if TFIELDS is negative, if TFORMn is missing or is not one of the formats of Table 15 (Aw, Iw, Fw.d, Ew.d, or Dw.d, in upper case) for an n from 1 to TFIELDS, if TBCOLn is missing or less than 1, since the first column of a row is numbered 1, or if a field is not within the NAXIS1 characters of a row. A header that is being created (created) does not need TFORMn and TBCOLn, which are made from the data. It is a warning, since the extra keywords are not used, if TFIELDS is more than 999, the maximum, or if TFORMn or TBCOLn is present for an n greater than TFIELDS. A header with no TFIELDS is not verified.
FITSFiles.BinaryField — Type
BinaryField(name, pntr, type, slice, leng, supp, unit, disp, dims,
zero, scale, null, dmin, dmax, lmin, lmax)Binary array element descriptor
FITSFiles.Bintable — Type
Bintable header-data unit (HDU)A Bintable HDU consists of a vector of cards and optionally a 2-dimensional array of binary data structured as a vector of records.
FITSFiles.MappedColumn — Type
MappedColumn(bytes, rowlen, offset, size, count, stride, decode, value, probe, source)The values of a field of a fixed number of elements of a binary table that is read in place from its file, which is memory-mapped, so that only the values that are indexed are read from the file. The bytes are the bytes of the table in the file, whose rows are rowlen bytes, and the field begins offset bytes after the beginning of a row. The first axis of the array is the rows, and the elements of a row are the later axes, which are size. Each element is stride bytes, and has count characters of a string or bits of a bit array. The type of the values of the file is that of the probe, which has values of the file: a number, a byte of a logical, a string, or a bit array. The function decode is that of an array of the values of the file to the values of the field, and value is that of one value, as for a FITSFiles.MappedArray, and the type of the values is that of decode of the probe. The source is the lazy array of the HDU that the values are read from, which the data are copied from when the HDU is written. The array is read-only.
FITSFiles.ScaledTable — Type
ScaledTable(records, scales)The records of a binary table (record = true) that has fields of floating-point or complex stored values that are scaled by a TSCALn and a TZEROn. The values of those fields are the physical values (see ScaledArray), which the dictionary scales has the scale and the zero of, by the name of the field, and are written as the stored values. The records are the values of parent.
Base.size — Method
Base.size(hdu::HDU{Bintable})The size of the two-dimensional byte array of the main table of a binary table extension, which is the number of bytes in a row and the number of rows, the NAXIS1 and the NAXIS2 of its header (Sect. 7.3.3 of the standard), so that the size of an HDU whose data are not read yet (see fits) is known without reading them. The number of rows is also the number of values of each column of the data, and TFIELDS is the number of columns. A header that does not have them has none, (0, 0).
FITSFiles.parsedims — Method
parsedims(value, j)Return the dimensions of the TDIMj keyword as a tuple of integers, or nothing if there is no keyword. The value is a character string of the form (l,m,n...) (Sect. 7.3.2 of the standard), where l, m, n, ... are the dimensions, and a single dimension, (l), is the tuple (l,). A value that is not of this form is not read: it gives a warning and nothing, and the keyword stays in the header unchanged.
FITSFiles.verifyfields! — Method
verifyfields!(Bintable, cards, mankeys)Verify the keywords that describe the fields of a binary table extension, and return the cards unchanged (Sect. 7.3.1 of the standard). It is an error, since the fields cannot be read, if TFIELDS is negative, or if TFORMn is missing for an n from 1 to TFIELDS. It is a warning, since the extra keywords are not used, if TFIELDS is more than 999, the maximum, or if TFORMn is present for an n greater than TFIELDS. A header with no TFIELDS is not verified.
FITSFiles.verifyheap! — Method
verifyheap!(cards, mankeys)Warn if THEAP of a binary table is outside of the range that the standard allows (Sect. 7.3.2), and return the cards unchanged. The heap starts THEAP bytes after the start of the main data table, so THEAP cannot be less than NAXIS1*NAXIS2 or more than that plus PCOUNT, the bytes of the gap and the heap.
FITSFiles.HDU — Method
HDU(hdu::HDU{ZImage}) -> HDU{Primary} or HDU{Image}
HDU(Primary, hdu::HDU{ZImage})
HDU(Image, hdu::HDU{ZImage})The HDU of the image that was compressed, which has its array (the data of the compressed image, which are decompressed if they are not yet) and the cards of its header: the keywords of the structure that were kept (ZSIMPLE, ZEXTEND, ZBLOCKED for the primary array, ZTENSION, ZPCOUNT, ZGCOUNT for an IMAGE extension, and ZHECKSUM and ZDATASUM) are SIMPLE, EXTEND, BLOCKED, XTENSION, PCOUNT, GCOUNT, CHECKSUM, and DATASUM again, with their values and comments, and the keywords of the table and of the compression are not there (Sect. 10.1.1 of the standard). It is the primary array if the header has ZSIMPLE, and an IMAGE extension if it does not, as the standard describes, unless the type is given.
FITSFiles.HDU — Method
HDU(ZImage, hdu::HDU{<:Union{Primary, Image}}; kwds...)The compressed image of the primary array or of the IMAGE extension hdu, whose array is the image and whose cards are those of the header, except the keywords of its structure (SIMPLE, EXTEND, BLOCKED, XTENSION, PCOUNT, GCOUNT, CHECKSUM, and DATASUM), which are kept as ZSIMPLE, ZEXTEND, ZBLOCKED, ZTENSION, ZPCOUNT, ZGCOUNT, ZHECKSUM, and ZDATASUM with their values and comments (Sect. 10.1.1 of the standard). The keywords are those of HDU(ZImage, array, cards; kwds...), whose cards may be those of an image too.
FITSFiles.ZImageField — Type
ZImageField(table, image, shape, tile, algorithm, parameters, quantization, dither, blank)The descriptor of the data of a compressed image: the fields of the binary table that has the tiles, the descriptor of the values of the image, the shape of the image and of its tiles, the algorithm and its parameters (ZNAMEi and ZVALi), the quantization of the floating-point values, and the seed of its dither, and the integer of the undefined values of the quantized values (ZBLANK).
FITSFiles.HDU — Method
HDU(hdu::HDU{ZTable}) -> HDU{Bintable}
HDU(Bintable, hdu::HDU{ZTable})The HDU of the table that was compressed, which has its data (the table of the compressed table, which is decompressed if it is not yet) and the cards of its header: the keywords of its structure, which the compressed table has as ZNAXIS1, ZNAXIS2, ZPCOUNT, ZTHEAP, and ZFORMn, are NAXIS1, NAXIS2, PCOUNT, THEAP, and TFORMn again, and ZHECKSUM and ZDATASUM are CHECKSUM and DATASUM again, with their values and comments, which are the last cards of the header. The keywords of the compression (ZTABLE, ZTILELEN, and ZCTYPn) are not there (Sect. 10.3.1 and 10.3.4 of the standard).
FITSFiles.ZTableField — Type
ZTableField(table, fields, format, tilelen, algorithms)The descriptor of a compressed table: the fields of the table of tiles that is in the file (table), the fields (fields) and the format (format) of the table that was compressed, the number of rows of each tile (tilelen, ZTILELEN), and the algorithm of each column (algorithms, ZCTYPn).
FITSFiles.Card — Type
Card(type, key, value, [units,] comment, format)
Card([key, [value, [comment]]]; <keywords>)
Card("HIERARCH", tokens, value, comment; <keywords>)Create a card type, where type is Comment, Continue, End, Hierarch, History, Invalid, or Value{T}.
Arguments
key::AbstractString="": keyword stringvalue::U=missing: keyword value, where U is Missing, Bool, Integer, AbstractFloat, a Complex number of integers or floats, or AbstractString, which is the typeTof the cardValue{T}. Another type of value is anArgumentError. A Quantity of a number may be given in place of the number, but a Quantity is not a type of value: the value of the card is the number, and the units of the Quantity are the units of the card. The units of a number without a Quantity are the unit string in square brackets at the beginning of the comment, e.g.,[km/s] velocity, as they are for an image, and the unit string is removed from the comment. The comment of a string, a logical, a mandatory keyword, text that is not a unit string, or a scale factor, is not units.tokens::AbstractString: the tokens of a HIERARCH keyword, which are separated by spacescomment::AbstractString="": comment string
Keywords
append::Bool=false: append an ampersand to the string value, which marks that the string is continued by a CONTINUE card. A string that is longer than the card (>68 characters) is always split into a card and CONTINUE cards, which are returned as a vector.fixed::Bool=true: use fixed format. A fixed-format number ends at byte 30, so aFloat64that has more than 20 characters is written with fewer digits of the mantissa, which are truncated, e.g.,1.2345678901234567e-100is written as1.2345678901234D-100. Usefixed=falseto keep all of the digits.slash::Integer=32: index of the comment separator (/). A value that passes the separator moves the separator to the right. A number in fixed format ends at the index 30, so the separator is at the index 32 or later. A comment, and the units, must end at or before the end of the card. If there is no space for the comment after the separator, the comment is dropped, or is continued at the index 32 on the CONTINUE cards of a string iftruncateis false.lpad::Integer=1: number of spaces before comment separatorrpad::Integer=1: number of spaces after comment separatorupad::Integer=1: number of spaces after the units stringtruncate::Bool=true: truncate a comment that is longer than the space at the end of the card, and the comment of the card is the truncated comment. Iffalse, the comment of a string is continued on CONTINUE cards of the string, and a comment of another value that does not fit, and units that do not fit, are anArgumentError. A comment is dropped if the comment separator is at the end of the card.warn::Bool=true: warn when a keyword longer than 8 characters creates a HIERARCH cardsplitat::Union{Char, Nothing}=' ': split a long string and its comment into the cards after the last character that fits, instead of splitting at any character ifnothingexponent::Char='D': the exponent letter of a float that is not 32-bit,'D'or'E', which the FITS standard both allow, e.g.,2.2710000001E11forexponent='E'. AFloat32is always written with anE. A number that is written with anEis read as aFloat32if that gives its value, and as aFloat64if it does not, so aFloat64that aFloat32holds, e.g.,0.5, is read as aFloat32. The letter is kept by the card when it is copied or written, and the letter of a card that is parsed is that of its image.
FITSFiles.CardFormat — Type
CardFormat(fixd, vbeg, vend, ampr, slsh, ubeg, uend, cbeg, cend)Create a card format descriptor.
FITSFiles.parsecomplex — Method
parsecomplex(real::AbstractString, imag::AbstractString)Determine the type of a complex number as the smallest type that holds both parts. The parts are integers if both are integers, and otherwise floats, where an integer is a float of a type that holds the integer exactly, i.e., a Float32, a Float64, or a BigFloat.
FITSFiles.parsenumber — Method
parsenumber(real::AbstractString)Determine the type of a number as a Float32, Float64, Int64, Int128, or BigInt. A floating-point number is a Float32 only if the Float32 is exactly the Float64 of its text, so that no precision is lost, e.g., 0.5 is a Float32, but 0.1 and 266.4 are a Float64. A number with a D exponent is a Float64.
FITSFiles.printfmt — Method
printfmt(vfmt, value)Return the text of a number with the printf format vfmt. The conversion e is for a number with a D exponent, which is written as a D. The format may end with |-, which writes the exponent with a sign only if it is negative and without leading zeros, e.g., E6.
FITSFiles.joincards — Method
joincards(cards)Join CONTINUE cards to initial long string card to create a long value and comment card. Cards after the end of the continued string are ignored. The comments of the cards are joined with a space, unless a comment ends with a space, since the spaces at the end of the comment of an image are not read, e.g., a comment that is split at any character has a space at the split.
FITSFiles.setvalue! — Method
setvalue!(card, value; <keywords>)Return the card with the value value, and the units, format, and comment of the card. A number without units has the units of the card, or the units at the beginning of the comment of the card if the card has no units, as for the constructor of a card. A string that fits on the card, i.e., that has at most 68 characters, is not split, and moves the comment to the right if the string passes the comment separator. A string that does not fit on the card is split into the cards of a long string, the first card and the CONTINUE cards, which are returned as a vector, at the comment separator, or at the end of the card if there is no comment. The keywords are those of the constructor of a card, where the default of a layout keyword is the layout of the card.
Keywords
fixed::Bool: use fixed format. The default is the format of the card.append::Bool=false: append an ampersand to the string value, which marks that the string is continued by a CONTINUE card.slash::Integer: index of the comment separator (/). The default is the index of the separator of the card, and the index 32 or more for the separator of the cards of a long string.lpad::Integer: number of spaces before the comment separator. The default is 0 if the separator follows the value of the card directly, and otherwise 1.rpad::Integer: number of spaces after the comment separator. The default is the number of spaces of the card, or 1 if the card has no comment.upad::Integer: number of spaces after the units string. The default is the number of spaces of the card, or 1 if the card has no units.truncate::Bool=true: truncate a comment that is longer than the space at the end of the card, and otherwise continue the comment on the CONTINUE cards of a string, or raise anArgumentErrorfor another value.splitat::Union{Char, Nothing}=' ': split a long string and its comment after the last character that fits, or at any character ifnothing.
The card is replaced by the new card when a layout keyword is given, even if the value is the same.
FITSFiles.splitcard — Method
splitcard(key, value, comment, format)Split card having long value and comment fields into multiple cards
If length of comment field is 0 because comment separator index is too large, then comment is deleted. Decreasing comment separator index will allow inclusion of comment.
Base.parse — Method
Base.parse(::Type{Card}, image::AbstractString, previous; strict = true, units = true)Parse 80 character card image that follows the card previous, or nothing. A CONTINUE card that does not continue a string is commentary text.
Base.parse — Method
Base.parse(::Type{Card}, image::AbstractString; strict = true, units = true)Parse 80 character card image from string buffer. A number with a lower case exponent letter (d or e) is not allowed by the standard, so it is an invalid card, unless strict is false. The units of a number, i.e., a unit string in square brackets at the beginning of the comment, are the units of the value, unless units is false or the keyword is mandatory.
The card is written as it is read, with the following exceptions, where the value is not changed: a number without an integer digit has a zero, e.g., .5 is 0.5; an exponent has at least two digits and a mantissa has one integer digit, e.g., E+007 is E+07 and 56.53E+13 is 5.653E+14; the sign of an integer zero is lost; and a number that is longer than before takes the spaces before the comment, but may move the comment, and the end of the comment of a full card is lost.
FITSFiles.formunit — Function
formunit(unit[, ufmt])Return the ASCII string of a unit in the FITS standard (Sect. 4.3). The style of the string is ufmt, which has three characters: the separator of the units, a space, ., or *; / if a unit with a negative power follows a slash, or - if it has the negative power; and the style of a power, d for digits following the unit, ^, or * for **. The default is -d.
FITSFiles.parseunit — Method
parseunit(string)Parse a unit string of the FITS standard (Sect. 4.3) and return the unit, or nothing if the string is not a valid unit string or has a unit that is not known. Units are multiplied by a space, ., or *, and divided by /, which may begin the string. A unit is raised to a power by an integer following the unit, by a decimal number or a ratio in parentheses following the unit, or by ** or ^ followed by an integer, a decimal number, or a ratio in parentheses. A scale factor, 10**k, 10^k, or 10+k, is followed by a unit and returns a quantity.
FITSFiles.parseunit — Method
parseunit(backend, string)Parse the unit string with the units of the backend, which is the module Unitful or DynamicQuantities, the latter when it is loaded.