spacetelescope / astronify

Astronomical data sonification.
https://astronify.readthedocs.io
73 stars 15 forks source link

Problem with capital letters in column names #79

Open folsomcp opened 1 week ago

folsomcp commented 1 week ago

I ran into a problem using capital letters in table column names with the SoniSeries class. Specifically, if I use capital letters in the column name in the Astropy Table, and use the same capital letters in the value_col or time_col fields SoniSeries I get an error. If I use all lower case the it works fine.

So this works as expected

from astropy.table import Table
from astronify.series import SoniSeries
data_table = Table({"time":[0, 1, 2, 3, 4, 5, 9, 10, 11, 12],
                    "fluxu": [0.3, 0.4, 0.3, 0.5, 0.5, 0.4, 0.3, 0.2, 0.3, 0.1]})
data_soni = SoniSeries(data_table, time_col='time', val_col='fluxu')

But this version

data_table = Table({"time":[0, 1, 2, 3, 4, 5, 9, 10, 11, 12],
                    "fluxU": [0.3, 0.4, 0.3, 0.5, 0.5, 0.4, 0.3, 0.2, 0.3, 0.1]})
data_soni = SoniSeries(data_table, time_col='time', val_col='fluxU')

gives an error:

AttributeError: Input Table must contain a value column 'fluxU'

I took a quick look at the astronify/series/series.py file. In the SoniSeries class data function, around lines 151 - 152, there is a bit of code that seems to convert the data_table columns to all lower case. But I didn't see any corresponding code to convert the time_col and val_col values to all lowercase. Perhaps that miss-match is causing my issue!

scfleming commented 1 week ago

You are most likely correct, I'll see about fixing that bug in an update!