taskGNU Astronomy Utilities - Tasks: task #16192, Add the possibility of read/write...


You are not allowed to post comments on this tracker with your current authentication level.

task #16192: Add the possibility of read/write vectors

Submitter:  Raul Infante-Sainz <infantesainz>
Submitted:  Sat 14 May 2022 12:05:26 AM UTC
Should Start On:  Fri 13 May 2022 12:00:00 AM UTC Should be Finished on:  Fri 13 May 2022 12:00:00 AM UTC
Category:  Table Priority:  5 - Normal
Item Group:  New feature Status:  Done
Privacy:  Public Percent Complete:  100%
Assigned to:  makhlaghi Open/Closed:  Closed
Effort:  0.00

Sun 01 Jan 2023 03:37:43 AM UTC, comment #3: 

Vector column read/write has been added to Gnuastro in Commit 055148303a :-).

A full section called "Vector columns" has been added under the Table section of the book that describes how to operate on/with vector columns with complete examples.

Thanks a lot Raul for suggesting this, when you get a chance to try it out, post your thoughts here ;-).

Mohammad Akhlaghi <makhlaghi>
Project Administrator
Tue 17 May 2022 10:00:50 AM UTC, comment #2: 

Thanks a lot Mohammad. This is the best way I found to make it easy to play with: just a small Python code to generate two tables. It only needs Astropy and will generate two fits tables.

- table-simple.fits: table containing 3 rows and 3 columns, single values.

- table-vector.fits: table containing 3 rows and 3 columns. The second column is a vector with three elements (named as VECTOR).

I think the code is self-explanatory:

from astropy.table import Table

# Simple table with no multi-value column.
data_simple = [('row1', 1, 1),
               ('row2', 2, 2),
               ('row3', 3, 3)]

t_simple = Table(rows=data_simple, names=('A', 'B', 'C'))
t_simple.write('table-simple.fits', format='fits', overwrite=True)

# Vector-column table. Last column has multiple values (vector).
data_vector = [('row1', (11,12,13), 1),
               ('row2', (21,22,23), 1),
               ('row3', (31,32,33), 3)]

t_vector = Table(rows=data_vector, names=('A', 'VECTOR', 'C'))
t_vector.write('table-vector.fits', format='fits', overwrite=True)

Just save these lines as 'table.py', execute it and then open with Topcat. You will see how they look like.

$ python3 table.py
$ astscript-fits-view table-simple.fits table-vector.fits

Raul Infante-Sainz <infantesainz>
Project Member
Sun 15 May 2022 11:58:41 PM UTC, comment #1: 

Indeed, this would be a very good, useful and powerful feature to have in Gnuastro!

To start doing some tests, can you upload a table that has vector columns? Ideally a small one with only 3 or 4 rows, and a handful of columns (where one column is vector)

Or maybe describe how we can make a vector column with other tools (like with TOPCAT) from scratch (maybe filled with random values, or even a constant value; it doesn't matter what the values inside the vector column are).

Mohammad Akhlaghi <makhlaghi>
Project Administrator
Sat 14 May 2022 12:05:26 AM UTC, original submission:  

In some cases, there are tables that contains vectors. That is, for a given column and row, there is not only one value but multiple values. Right now Table only considers the first value. At some point it would be necessary to be able to read/write vectors.

Raul Infante-Sainz <infantesainz>
Project Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by makhlaghi (Posted a comment)
  • -email is unavailable- added by infantesainz (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-01 makhlaghi StatusNone Done
        Percent Complete0% 100%
        Assigned toNone makhlaghi
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.10