-
Notifications
You must be signed in to change notification settings - Fork 1
Progress and Issues
This wiki is meant to be read as a temporary reference as to my recent progress and the issues I'm facing. Thus, I'd like to keep it short and precise. A detailed description will be updated on the Blog https://aaryapatil.wordpress.com/ soon.
Progress and Issues:
- I have spent a significant amount of time to understand the workflow of the io.fits sub-package. I thus have the following chain of control flow in mind:
astropy.io.connect
The connect file basically connects all the I/O FITS operations that the user specifies in the io.fits namespace.
Our focus will be on read_table_fits() and write_table_fits(), for the time being, since writing is our first priority and a comparatively easier task, write_table_fits()
will be the main focus. From write_table_fits(), the control flows to table_to_hdu()
from .convenience.
astropy.io.convenience
The convenience file provides all the convenience functions to read and write FITS. We are particularly interested in the table_to_hdu
. Here I am doing the following:
if table.has_mixin_columns:
unsupported_cols = table.columns.not_isinstance((BaseColumn, Quantity, Time))
time_cols = table.columns.isinstance(Time)
if time_cols:
newtable = Table(table)
table = get_time_table(newtable)
The get_time_table will replace the time columns by embedded columns (dictionary of columns) of dimensions (N,2). The issue being that it should be a TFORMn='2D'
FITS Binary Table column. I am not sure if that happens explicitly once I replace the columns as a dictionary of columns.
Also, I haven't yet figured out how to define them as a dictionary of columns.
diction = dict(jd1 = Column([1,2,3]), jd2 = Column([12,4,5]))
diction = Column(dict(jd1 = [1,2,3], jd2 = [12,4,5]))
if I make a table column as table['col'] = diction using both strategies, it fails and provides each table element as a dictionary of columns which is broadcasted in the first case ::
<Column name='c' dtype='object' length=3>
{'jd1': <Column dtype='int64' length=3>
1
2
3, 'jd2': <Column dtype='int64' length=3>
12
4
5}
{'jd1': <Column dtype='int64' length=3>
1
2
3, 'jd2': <Column dtype='int64' length=3>
12
4
5}
{'jd1': <Column dtype='int64' length=3>
1
2
3, 'jd2': <Column dtype='int64' length=3>
12
4
5}
and a dictionary of arrays broadcasted in the second ::
<Column name='c' dtype='object' length=3>
{'jd1': [1, 2, 3], 'jd2': [12, 4, 5]}
{'jd1': [1, 2, 3], 'jd2': [12, 4, 5]}
{'jd1': [1, 2, 3], 'jd2': [12, 4, 5]}
Thus, the summary of Issues include:
- How to define the dictionary of columns for jd1, jd2.
- Would the high level (python level) embedded Table columns be enough to have an embedded Binary Table column in FITS
- Where to place the logic, as a separate module or as a function in the Time Class.
I have read the FITS primer to get a quick glance of FITS, read about the various keywords supported, the Time documentation and metadata, the SOFA definitions to get a grasp of the basic concepts and the FITS Time journal to start the mapping of keywords relevant to Time.