New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LaTeX reader fails to read LaTeX table with astropy.units that was written with LaTeX writer #5205
Comments
This is with AstroPy 1.2.1 Example test case:
|
I will fully admit that it would be nice to round-trip everything. However, when I wrote the LaTex Reader/Writer classes, I consciously decided not to worry too much about round-tripping. Nobody should be using LaTeX as a data storage format. The use cases I had in mind are these:
This is not to say that I won't be thrilled if somebody implements a complete LaTeX table parser, I'm just saying that round-tripping LaTeX tables does not seem very important to me because LaTeX tables tend to be one-way (write and send to publisher) and are generally not used for saving your results to disk and reading them back in tomorrow. Out of curiosity: Do you actually need to round-trip LaTeX tables or did you stumble on this by accident and just wondered why it did not work? |
While my CS spirit agrees that LaTeX tables are a non-ideal serialization format, my astronomer spirit has a specific use case for using LaTeX tables: The results of a paper should be reproducible.
|
The AstroPy.Tables documentation currently claims that the LaTeX read/writer has the property that "it can read the tables that it writes." http://docs.astropy.org/en/stable/api/astropy.io.ascii.Latex.html#astropy.io.ascii.Latex |
I use a script to generate tables and plots form the same source for exactly that reason. I keep the data as e.g. fits and then generate both the LaTeX tables and the figures form the same tex file to keep it in sync. |
I'm happy to help and do some real work to address this issue as well as #5160 I've forked and started a new branch at https://github.com/wmwv/astropy/tree/test-read-write to add a read-write test for all things currently tested in the |
That is great. When you think it's ready, just open a pull request for On 8/11/16 9:20 AM, Michael Wood-Vasey wrote:
|
(Removed the units label, since this is not something the units module can help with) |
I just ran into this issue with Astropy 4.0. The behavior was surprising to me. I had to do this as a workaround for my data: result_tex = Table.read('my_result.tex', format='ascii.latex', data_start=4) |
I'd like to bump this issue. The documentation states: The table reader can't read back exactly what it printed if that includes units. We should modify the documentation to say something like, "The reader can read back LaTeX tables it creates, but it will not properly handle units, and additional commands may need to be added to the |
LaTeX reader fails to read LaTeX table with astropy.units that was written with LaTeX writer.
Round-tripping astropy.units should be added to the astropy table LaTeX writing/reading test suite.
The text was updated successfully, but these errors were encountered: