[AstroPy] Reading Time columns from ascii tables

Varun Bhalerao varunb at iucaa.in
Wed Aug 17 01:59:01 EDT 2016


Dear all,

I have a table which has UT dates, and I want the final astropy Table to have astropy.time.Time objects. Currently, I have a roundabout way of doing it. Can I directly supply the dtype or something else to tell Table.read() that this is a astropy.time column?

Sample table:
rccd160711.0024_s.fits 13.113 0.005 2016-07-18T17:37:07
rccd160711.0025_s.fits 14.269 0.011 2016-07-18T17:37:12
rccd160711.0026_s.fits 14.203 0.011 2016-07-18T17:37:12
rccd160711.0027_s.fits 14.224 0.010 2016-07-18T17:37:12
rccd160711.0028_s.fits 13.637 0.007 2016-07-18T17:37:10
rccd160711.0029_s.fits 13.657 0.007 2016-07-18T17:37:10
rccd160711.0030_s.fits 13.659 0.007 2016-07-18T17:37:11

Current code:
from astropy.table import Table, column
tab = Table.read("sample.txt", names=("filename", "mag", "err", "time"), format="ascii")

# Now replace the time column
timecol = Column(name="time", data=Time(tab["time"]))
tab.remove_column("time")
tab.add_column(timecol)


Thanks,
-- Varun
____________________
-  Varun Bhalerao  -
Office: A 214, IUCAA
Ph: +91 20 2560 4214
www.iucaa.in/~varunb

This email is encrypted and signed with OpenPGP.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/astropy/attachments/20160817/ee898c91/attachment.sig>


More information about the AstroPy mailing list