Class: RFits::HDU
- Inherits:
-
Object
- Object
- RFits::HDU
- Defined in:
- lib/rfits/rfits.rb
Overview
The base class for all HDUs. It’s possible to use this on its own, but really it’s intended to be abstract.
Constant Summary collapse
- HDU_TYPE_MAP =
{ IO::Proxy::IMAGE_HDU => :image, IO::Proxy::ASCII_TBL => :ascii_tbl, IO::Proxy::BINARY_TBL => :binary_tbl, IO::Proxy::ANY_HDU => :other }
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
The data associated with the HDU.
-
#file ⇒ Object
readonly
The file object associated with the HDU.
-
#header ⇒ Object
readonly
The header associated with the HDU.
Instance Method Summary collapse
-
#hdu_type ⇒ Object
Get the type of HDU.
-
#initialize(file, extpos) ⇒ HDU
constructor
Initialize a new HDU in the specified file at the specified position (zero-based).
-
#position ⇒ Object
Get the position of the HDU.
- #reset_position ⇒ Object
Constructor Details
Instance Attribute Details
#data ⇒ Object (readonly)
The data associated with the HDU.
798 799 800 |
# File 'lib/rfits/rfits.rb', line 798 def data @data end |
#file ⇒ Object (readonly)
The file object associated with the HDU.
792 793 794 |
# File 'lib/rfits/rfits.rb', line 792 def file @file end |
#header ⇒ Object (readonly)
The header associated with the HDU.
795 796 797 |
# File 'lib/rfits/rfits.rb', line 795 def header @header end |
Instance Method Details
#hdu_type ⇒ Object
Get the type of HDU. Possibilities are: :image, :ascii_tbl, :binary_tbl, :other
814 815 816 817 |
# File 'lib/rfits/rfits.rb', line 814 def hdu_type reset_position() HDU_TYPE_MAP[IO::Proxy.fits_get_hdu_type(self.file.io)] || :unknown end |
#position ⇒ Object
Get the position of the HDU.
puts hdu.position # 2 -> this is the third HDU in the file
821 822 823 824 |
# File 'lib/rfits/rfits.rb', line 821 def position reset_position() IO::Proxy.fits_get_hdu_num(self.file.io) - 1 end |
#reset_position ⇒ Object
826 827 828 |
# File 'lib/rfits/rfits.rb', line 826 def reset_position IO::Proxy.fits_movabs_hdu(self.file.io, @extpos + 1) end |