astropy / astropy/astropy

Position of the INFOs in votables

Open
#17,949 0 comments 0 reactions 0 assignees View on GitHub
Bug io.votable
Dominant language
Python
Stars
5.3k
Forks
2.2k
Avg merge
1d 20h
Merged PRs (30d)
81

Description

### Description

In VOTables, the INFOs that are in VOTABLE or RESOURCE can be either on top or at the bottom. See section 7.1 of the standard:

![Image](https://github.com/user-attachments/assets/5c10c710-94ba-4ba9-8c15-7b1587c2026a)

Maybe it's a bug, maybe I didn't find how, but I couldn't add an INFO at the bottom of a RESOURCE.

So I tried to read this file:

```xml



```

Called `test.vot` with:

```python
from astropy.io.votable import parse
table = parse("test.vot")
table.to_xml("output.vot")
```

The output file is now:

```xml





```

We can see that astropy took an info below a table, and wrote it before the table.

### Expected behavior

I would expect:
- to be able to add an info either before or after the data when instantiating a `VOTableFile` object within astropy
- the order to be respected when the table goes through I/O

### Possible solution

The only other VOTable parser I know has two types of INFO structures, a normal one called `info`, and an other one called `post_info`. See its documentation https://github.com/cds-astro/cds-votable-rust/tree/main/crates/cli

Maybe something similar could be implemented here? Otherwise maybe the `Info` class could have a `post` attribute (a boolean) to tag whether this is coming before or after the data?

### How to Reproduce

### Versions

```python
import astropy
try:
astropy.system_info()
except AttributeError:
import platform; print(platform.platform())
import sys; print("Python", sys.version)
import astropy; print("astropy", astropy.__version__)
import numpy; print("Numpy", numpy.__version__)
import erfa; print("pyerfa", erfa.__version__)
try:
import scipy
print("Scipy", scipy.__version__)
except ImportError:
print("Scipy not installed")
try:
import matplotlib
print("Matplotlib", matplotlib.__version__)
except ImportError:
print("Matplotlib not installed")
```
```
platform
--------
platform.platform() = 'Linux-6.1.131-1-MANJARO-x86_64-with-glibc2.41'
platform.version() = '#1 SMP PREEMPT_DYNAMIC Thu Mar 13 15:02:58 UTC 2025'
platform.python_version() = '3.13.0'

packages
--------
astropy 7.0.0
numpy 2.2.2
scipy --
matplotlib --
pandas --
pyerfa 2.0.1.5
```

Contributor guide

Open the contributing guide

Research direction

Start with the astropy.io.votable.parse and VOTableFile entry points, the Info class, and to_xml using the supplied XML example. Trace how an INFO after a TABLE is represented and serialized. Done means INFO placement can be selected when constructing a VOTableFile and a parse/to_xml round trip preserves whether it appears before or after the table.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.