All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fact.io.zfits.Catalog Maven / Gradle / Ivy

Go to download

The FACT telescope is a Cherenkov telescope on the island of La Palma. This set of tools is dedicated to read, parse and process raw data produced by the FACT telescope.

The newest version!
package fact.io.zfits;

import stream.util.parser.ParseException;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/**
 * This class encapsulates the catalog describing the position and sizes of the table entries.
 * 
 * @author Michael Bulinski <[email protected]>
 */
public class Catalog {
	private int numTiles;
	private int numCols; 
	private long[][] offsetList;
	private long[][] sizeList;
	private long[] tileOffsetList;
	private long[] tileSizeList;

	/**
	 * Load the catalog of the position and sizes of the table entries.
	 * 
	 * @param input The catalog data to read.
	 * @param numTiles The number of tiles in the table.
	 * @param numCols The number of columns in the table.
	 * @throws ParseException Thrown when the catalog is broken.
	 */
	Catalog(byte[] input, int numTiles, int numCols) throws ParseException {
		this.numTiles = numTiles;
		this.numCols = numCols;
		ByteBuffer buffer = ZFitsUtil.wrap(input);
		buffer.order(ByteOrder.BIG_ENDIAN);
		
		//int expectedCatalogSize = 2*numTiles*numCols*8;
		//if ( input.length !=  expectedCatalogSize)
		//	throw new ParseException("The catalog has : "+input.length+" bytes, this is to many or not enough entries. Expected: "+expectedCatalogSize+" bytes.");
		this.offsetList = new long[numTiles][numCols];
		this.sizeList   = new long[numTiles][numCols];
		this.tileOffsetList = new long[numTiles];
		this.tileSizeList   = new long[numTiles];

		//load the catalog
		for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy