public class FITS extends Object
FITS f = FITS.fromPath(p) HDU offsets = f.getHDU("ZDrsCellOffsets").orElseThrow(IOException::new); BinTable binTable = offsets.getBinTable();
BinTables can also directly be accessed by name if they exist.
FITS.fromPath(p).getBinTableByName("Events") .ifPresent(binTable -> { //do something with bintable })
Data from the BinTable can be read using the BinTableReader and ZFITSHeapReader classes.
FITS f = new FITS(u); BinTable events = f.getBinTableByName("Events").orElseThrow(IOException::new);
for(OptionalTypesMap
Created by mackaiver on 03/11/16.
Modifier and Type | Field and Description |
---|---|
HDU |
primaryHDU |
Modifier and Type | Method and Description |
---|---|
static FITS |
fromFile(File file)
Creates a fits instance from a File object without throwing checked exceptions immediately.
|
static FITS |
fromPath(Path path)
Creates a fits instance from a path object without throwing checked exceptions immediately.
|
Optional<BinTable> |
getBinTableByName(String hduExtName)
Returns the binary data table which is in the HDU by the given name.
|
Optional<HDU> |
getHDU(int hduIndex)
This method returns the HDU at given index if it exists.
|
Optional<HDU> |
getHDU(String extname)
Extensions may have keyword called EXTNAME.
|
List<HDU> |
getHDUs()
Get a list of all HDUs in the fits file.
|
DataInputStream |
getInputStreamForHDUData(HDU hdu)
Provides a datastream to the data area of the given hdu.
|
Map<String,HDU> |
getNamedHDUs()
Get the a mapping of HDU names to all named HDU objects in the file.
|
public HDU primaryHDU
public FITS(URL url) throws IOException
IOException
public static FITS fromPath(Path path)
path
- The path to the fits filepublic static FITS fromFile(File file)
file
- the fits filepublic Optional<HDU> getHDU(String extname)
extname
- the HDU to get.public Optional<HDU> getHDU(int hduIndex)
hduIndex
- the HDU to get.public Map<String,HDU> getNamedHDUs()
public List<HDU> getHDUs()
public Optional<BinTable> getBinTableByName(String hduExtName)
hduExtName
- the name of the hdu which contains the bintablepublic DataInputStream getInputStreamForHDUData(HDU hdu) throws IOException
hdu
- the HDU of interest.IOException
- in case the stream cannot be openedCopyright © 2019. All rights reserved.