question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding FITS_LDAC format for reading in astropy.table.Table.read()

See original GitHub issue

I am using Sextractor to output a catalogue in the FITS_LDAC format which is required in certain cases like using PSFex for extracting models of the PSFs. As specified in the PSFex manual: “The catalogue files read by PSFEx must be in SExtractor FITS_LDAC binary format.”.

sex M80-V.fits -c M80-V.sex -CATALOGUE_TYPE FITS_LDAC
>>> from astropy.table import Table
>>> out=Table.read("test.cat")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/astropy/table/table.py", line 2261, in read
    return io_registry.read(cls, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/astropy/io/registry.py", line 341, in read
    'read', cls, path, fileobj, args, kwargs)
  File "/usr/local/lib/python2.7/site-packages/astropy/io/registry.py", line 430, in _get_valid_format
    "{0}".format(format_table_str))
Exception: Format could not be identified.

I am using astropy version:

>>> astropy.__version__
u'1.1.1'

I am not able to read in the FITS_LDAC data using astropy.table.Table.read(“test.cat”) since the format isn’t supported.

It would be helpful if the format is added so that the data could be read as

astropy.table.Table.read("test.cat", format="fits.ldac")

After a bit of a research, I found that the support for FITS_LDAC format is provided in astromatic_wrapper.utils.ldac. So would astropy be integrating astromatic_wrapper in the core package or should separate functionality be added?

If someone is already working on this or wants to, I’d like to help.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
saimncommented, Jun 13, 2017

As discussed on the mailing list, there is a Python package that seems to support reading and writing FITS-LDAC files: https://github.com/fred3m/astromatic_wrapper http://astromatic-wrapper.readthedocs.io/en/latest/working_with.html#fits-ldac-files So I think this issue can be closed ?

1reaction
saimncommented, Jul 26, 2016

@AustereCuriosity - It is already possible to specify the extension name to Table.read, something like Table.read("my.cat", format="fits", hdu='LDAC_OBJECTS'). Maybe not well documented though … But there are maybe some other specific things that can justify a dedicated reader ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reading and Writing Table Objects — Astropy v5.2
The Table class includes two methods, read() and write() , that make it possible to read from and write to files. A number...
Read more >
Reading Tables — Astropy v5.2
The return value ( data in this case) is a Table object. By default, read() will try to guess the table format by...
Read more >
Unified File Read/Write Interface — Astropy v5.2
The Table class includes two methods, read() and write() , that make it possible to read from and write to files. A number...
Read more >
ASCII Tables (astropy.io.ascii) — Astropy v5.2
The write() function provides a way to write a data table as a formatted ASCII table. Most of the input table Supported Formats...
Read more >
Writing Tables — Astropy v5.2
To write a formatted ASCII table using the write() function: > ... Most of the input table Supported Formats for reading are also...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found