Class RFits::TableData
In: lib/rfits/rfits.rb
Parent: Object

Represents tabular data in a FITS file.

Methods

<<   []   []=   column   delete   each   each_column   each_row   first   last   length   new   row   set_column   set_row   size   to_csv   to_s  

Included Modules

Enumerable

Attributes

table  [R]  The table the data lives in.

Public Class methods

Create a TableData object that is associated with the specifed table.

 data = TableData.new(table)

Public Instance methods

Append a new row.

 data << ['new', 2.2, 7, Complex.new(5, 5)]

Retrieve the ith row of data.

 data[2]  # ['a1', 1.1, 3, Complex.new(3, 4)]

or the value of the cell at the specified row and column.

 data[2, 3] # Complex.new(3, 4)  # the 4th cell in the 3rd row

Set the ith row to the specified values

 data[4] = ['new', 2.2, 7, Complex.new(5, 5)]

or specify the value of a particular cell

 data[4, 1] = 2.2  # the second column of the 5th row

Retrieve the ith column.

 data.column(2)  # [1, 2, 3, 4, 5]

Delete the ith row.

 table.delete(2)  # delete the 3rd row

Iterate through each row in the table.

Iterate through each column in the table.

Retrieve the first row in the table.

 table.first  # ['blah', 23.1, 9, Complex.new(4, 5)]

Retrieve the last row in the table.

 table.last  # ['new', 2.2, 7, Complex.new(5, 5)]

The number of rows in the table.

 table.length  # 5

Alias for TableData#[]

Set the ith columns to the specified values.

 data.set_column(2, [1, 2, 3, 4, 5])  # set the 3rd column (which is an integer column)

Convert the rows in the table to CSV.

Convert the rows to a string. Currently an alias to TableData#to_csv

[Validate]