slimfits
Version:
Package for loading data stored in FITS data format
73 lines • 2.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var DataResult = /** @class */ (function () {
function DataResult(data, name) {
this.data = data;
this.name = name;
}
return DataResult;
}());
exports.DataResult = DataResult;
/**
* Contains constants describing basic structure of FITS file. Each unit of organization,
* be it header of payload is padded to be a multiple of 2880, which defined to be a block length.
*
* In header each line has constant length of 80 ASCII characters, with 8 bytes for the keyword,
* hence abbreviated key names.
*
* Block length divided by line length gives the maximal count of lines per block: 36.
*/
exports.Constants = {
blockLength: 2880,
lineLength: 80,
keyLength: 8,
maxKeywordsInBlock: 36
};
var BitPix;
(function (BitPix) {
BitPix[BitPix["Uint8"] = 8] = "Uint8";
BitPix[BitPix["Char"] = 8] = "Char";
BitPix[BitPix["Int16"] = 16] = "Int16";
BitPix[BitPix["Int32"] = 32] = "Int32";
BitPix[BitPix["Int64"] = 64] = "Int64";
BitPix[BitPix["Float32"] = -32] = "Float32";
BitPix[BitPix["Float64"] = -64] = "Float64";
BitPix[BitPix["Unknown"] = 0] = "Unknown";
})(BitPix = exports.BitPix || (exports.BitPix = {}));
var BitPixUtils = /** @class */ (function () {
function BitPixUtils() {
}
/**
* Gets size of type in bytes
* @static
* @public
* @param {BitPix} type - The type.
* @return {number} - size in bytes
*/
BitPixUtils.getByteSize = function (type) {
return Math.abs(type) / 8;
};
BitPixUtils.getBitPixForLetter = function (format) {
switch (format) {
case 'A':
return BitPix.Char;
case 'B':
return BitPix.Uint8;
case 'I':
return BitPix.Int16;
case 'J':
return BitPix.Int32;
case 'K':
return BitPix.Int64;
case 'E':
return BitPix.Float32;
case 'D':
return BitPix.Float64;
default:
throw new Error('unrecognized format');
}
};
return BitPixUtils;
}());
exports.BitPixUtils = BitPixUtils;
//# sourceMappingURL=interfaces.js.map