com.sparkfits.FitsLib

FitsBlock

class FitsBlock extends AnyRef

Main class to handle a HDU of a fits file. Main features are

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. FitsBlock
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new FitsBlock(hdfsPath: Path, conf: Configuration, hduIndex: Int)

    hdfsPath

    : (Path) Hadoop path containing informations on the file to read.

    conf

    : (Configuration) Hadoop configuration containing informations on the run.

    hduIndex

    : (Int) Index of the HDU to read (zero-based).

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def BlockBoundaries: (Long, Long, Long, Long)

    Return the indices of the first and last bytes of the HDU: hdu_start=header_start, data_start, data_stop, hdu_stop

    Return the indices of the first and last bytes of the HDU: hdu_start=header_start, data_start, data_stop, hdu_stop

    returns

    (Long, Long, Long, Long), the split of the HDU.

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. val blockBoundaries: (Long, Long, Long, Long)

  9. val blockHeader: Array[String]

  10. def buildHeader(buffer: Array[Byte], prevline: String = ""): List[String]

  11. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. val data: FSDataInputStream

  13. val empty_hdu: Boolean

  14. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. val fs: FileSystem

  18. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  19. def getColTypes(header: Array[String], col: Int = 0): List[String]

    Return the types of elements for each column as a list.

    Return the types of elements for each column as a list.

    col

    : (Int) Column index used for the recursion.

    returns

    (List[String]), list with the types of elements for each column as given by the header.

  20. def getColumnName(header: Array[String], colIndex: Int): String

    Get the name of a column with index colIndex of a HDU.

    Get the name of a column with index colIndex of a HDU.

    header

    : (Array[String]) The header of the HDU.

    colIndex

    : (Int) Index (zero-based) of a column.

    returns

    (String), the name of the column.

  21. def getColumnType(header: Array[String], colIndex: Int): String

    Get the type of the elements of a column with index colIndex of a HDU.

    Get the type of the elements of a column with index colIndex of a HDU.

    header

    : (Array[String]) The header of the HDU.

    colIndex

    : (Int) Index (zero-based) of a column.

    returns

    (String), the type (FITS convention) of the elements of the column.

  22. def getElementFromBuffer(subbuf: Array[Byte], fitstype: String): Any

    Companion to readLineFromBuffer.

    Companion to readLineFromBuffer. Convert one array of bytes corresponding to one element of the table into its primitive type.

    subbuf

    : (Array[Byte]) Array of byte describing one element of the table.

    fitstype

    : (String) The type of this table element according to the header.

    returns

    the table element converted from binary.

  23. def getHeaderComments(header: Array[String]): HashMap[String, String]

    Get the comments of the header.

    Get the comments of the header. We assume the comments are written after a backslash (\).

    header

    : (Array[String]) The header of the HDU.

    returns

    (HashMap[String, String]), a map of keyword/comment.

  24. def getHeaderKeywords(header: Array[String]): Array[String]

    Return the KEYWORDS of the header.

    Return the KEYWORDS of the header.

    returns

    (Array[String]), array with the KEYWORDS of the HDU header.

  25. def getHeaderNames(header: Array[String]): HashMap[String, String]

    Get the names of the header.

    Get the names of the header. We assume that the names are inside quotes 'my_name'.

    header

    : (Array[String]) The header of the HDU.

    returns

    (HashMap[String, String]), a map of keyword/name.

  26. def getHeaderValues(header: Array[String]): HashMap[String, Int]

    Return the (KEYWORDS, VALUES) of the header

    Return the (KEYWORDS, VALUES) of the header

    returns

    (HashMap[String, Int]), map array with (keys, values_as_int).

  27. def getNCols(header: Array[String]): Long

    Get the number of column of a HDU.

    Get the number of column of a HDU. We rely on what's written in the header, meaning here we do not access the data directly.

    header

    : (Array[String]) The header of the HDU.

    returns

    (Long), the number of rows as written in KEYWORD=TFIELDS.

  28. def getNHDU: Int

    Return the number of HDUs in the file.

    Return the number of HDUs in the file.

    returns

    (Int) the number of HDU.

  29. def getNRows(header: Array[String]): Long

    Get the number of row of a HDU.

    Get the number of row of a HDU. We rely on what's written in the header, meaning here we do not access the data directly.

    header

    : (Array[String]) The header of the HDU.

    returns

    (Long), the number of rows as written in KEYWORD=NAXIS2.

  30. def getSizeRowBytes(header: Array[String]): Int

    Get the size (bytes) of each row of a HDU.

    Get the size (bytes) of each row of a HDU. We rely on what's written in the header, meaning here we do not access the data directly.

    header

    : (Array[String]) The header of the HDU.

    returns

    (Int), the size (bytes) of one row as written in KEYWORD=NAXIS1.

  31. def getSplitLocation(fitstype: String): Int

    Companion routine to rowSplitLocations.

    Companion routine to rowSplitLocations. Returns the size of a primitive according to its type from the FITS header.

    fitstype

    : (String) Element type according to FITS standards (I, J, K, E, D, L, A, etc)

    returns

    (Int), the size (bytes) of the element.

  32. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  33. val isHDUBelowMax: Boolean

  34. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  35. val ncols: Int

  36. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  37. final def notify(): Unit

    Definition Classes
    AnyRef
  38. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  39. val numberOfHdus: Int

  40. def readHeader: Array[String]

    Read the header of a HDU.

    Read the header of a HDU. The cursor needs to be at the start of the header. We assume that each header row has a standard size of 80 Bytes, and the total size of the header is 2880 Bytes.

    returns

    (Array[String) the header is an array of Strings, each String being one line of the header.

  41. def readHeader(position: Long): Array[String]

    Read a header at a given position

    Read a header at a given position

    position

    : (Long) The byte index to seek in the file. Need to correspond to a valid header position. Use in combination with BlockBoundaries._1 for example.

    returns

    (Array[String) the header is an array of Strings, each String being one line of the header.

  42. def readLineFromBuffer(buf: Array[Byte], col: Int = 0): List[_]

    Convert binary row into row.

    Convert binary row into row. You need to have the cursor at the beginning of a row. Example

    // Set the cursor at the beginning of the data block
    setCursor(BlockBoundaries._2)
    // Initialise your binary row
    val buffer = Array[Byte](size_of_one_row_in_bytes)
    // Read the first binary row into buffer
    data.read(buffer, 0, size_of_one_row_in_bytes)
    // Convert buffer
    val myrow = readLineFromBuffer(buffer)
    buf

    : (Array[Byte]) Row of byte read from the data block.

    col

    : (Int=0) Index of the column (used for the recursion).

    returns

    (List[_]) The row as list of elements (float, int, string, etc.) as given by the header.

  43. def registerBlockBoundaries(sep: String = ";;"): Unit

    Register the boundaries of the HDU in the Hadoop configuration.

    Register the boundaries of the HDU in the Hadoop configuration. By doing this, we broadcast the values to the executors. It is sent as a long String, and can be read properly afterwards using retrieveBlockBoundaries. Make sure you use the same separators.

    sep

    : (String) Line separator used to form the String. Default is ;;

  44. def registerHeader(sep: String = ";;"): Unit

    Register the header in the Hadoop configuration.

    Register the header in the Hadoop configuration. By doing this, we broadcast the header to the executors. The header is sent as a long String, and can be read properly afterwards using retrieveHeader. Make sure you use the same separators.

    sep

    : (String) Line separator used to form the String. Default is ;;

  45. def resetCursorAtData: Unit

    Place the cursor at the beginning of the data of the block

  46. def resetCursorAtHeader: Unit

    Place the cursor at the beginning of the header of the block

  47. def retrieveBlockBoundaries(sep: String = ";;"): (Long, Long, Long, Long)

    Retrieve the blockboundaries from the Hadoop configuration.

    Retrieve the blockboundaries from the Hadoop configuration. Make sure you use the same separators as in registerBlockBoundaries.

    sep

    : (String) Line separator used to split the String. Default is ;;

    returns

    the block boundaries as Tuple4 of Long. See BlockBoundaries.

  48. def retrieveHeader(sep: String = ";;"): Array[String]

    Retrieve the header from the Hadoop configuration.

    Retrieve the header from the Hadoop configuration. Make sure you use the same separators as in registerHeader.

    sep

    : (String) Line separator used to split the String. Default is ;;

    returns

    the header as Array[String]. See readHeader.

  49. def rowSplitLocations(col: Int = 0): List[Int]

    Description of a row in terms of bytes indices.

    Description of a row in terms of bytes indices. rowSplitLocations returns an array containing the position of elements (byte index) in a row. Example if we have a row with [20A, E, E], one will have rowSplitLocations -> [0, 20, 24, 28] that is a string on 20 Bytes, followed by 2 floats on 4 bytes each.

    col

    : (Int) Column position used for the recursion. Should be left at 0.

    returns

    (List[Int]), the position of elements (byte index) in a row.

  50. val rowTypes: List[String]

  51. def setCursor(position: Long): Unit

    Set the cursor at the position (byte index, Long).

    Set the cursor at the position (byte index, Long).

    position

    : (Long) The byte index to seek in the file.

  52. val splitLocations: List[Int]

  53. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  54. def toString(): String

    Definition Classes
    AnyRef → Any
  55. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  56. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  57. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped