Closed drvdputt closed 4 months ago
Won't forcing all columns to be BoundedMaskedColumn
's do the trick here?
Hopefully the new simpler Tabulate
underlying format #283 fixed this; @drvdputt ?
Yes, this issue was of the same origin as #274. Closing.
Bug description
The code crashes when trying to print Features.
Reproducing
This is a strange bug, reproducible with very minimal examples
This crashes:
with the following minimal yaml file
On the other hand, if a stellar component is added, everything is fine
Exceptions and tracebacks
Click for full output
Traceback (most recent call last): File "/Users/dvandeputte/opt/miniconda3/envs/pahfitcube/lib/python3.11/site-packages/astropy/table/pprint.py", line 90, in _auto_format_func out = format_func(format_, val) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dvandeputte/opt/miniconda3/envs/pahfitcube/lib/python3.11/site-packages/astropy/table/pprint.py", line 88, inCause
I don't know how to solve this, but I was able to narrow it down to a certain behavior. We’re using a formatting function that expects 3-tuples as input, and this function is passed to the pretty printer for the table. But astropy.table.pprint, does something automagically with the dimensionality, and ends up passing the individual elements to our function, instead of tuples. With the working example pack, we get a BoundedMaskedColumn (a type that we derive from the regular MaskedColumn), while its a regular Column for the lines only case. For some reason, pprint behaves differently in this case, and it probably depends on the details of BoundedMaskedColumn. I have not tried this with a regular MaskedColumn.
Workaround
A temporary workaround would be to add a starlight component to the yaml file, and then remove it in python (by setting model.features = model.features[1:]). This forces the relevant columns to be BoundedMaskedColumn.