Skip to content
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

SpectralElement AttributeError: 'Table' object has no attribute 'lower' #402

Closed
gavinramsay opened this issue Dec 5, 2024 · 5 comments
Closed
Labels

Comments

@gavinramsay
Copy link

Hi
I've got a file which contains a passband. Im trying to read it in as a SpectralElement but get this error:

gHiper = SpectralElement.from_file(data)

where data contains two cols, wave and flux_col

AttributeError: 'Table' object has no attribute 'lower'

any idea what 'lower' means?

many thanks
Gavin

@pllim
Copy link
Contributor

pllim commented Dec 5, 2024

Hello and thanks for reaching out.

Is data a file name or a Table object? Can you please post the full traceback?

@gavinramsay
Copy link
Author

gavinramsay commented Dec 5, 2024

thanks for responding!

I dont understand much of the deeper python language terms but this is where i insert the data file:

data = Table.read('/Users/**/soft/stsci_python-2.12/pysynphot/data/generic/GTC_HIPERCAM.g_s_3.dat', format='ascii', names=('row','wave','flux_col'))

so possibly an object. but could be wrong!

many thanks for taking the trouble to reply.

@pllim
Copy link
Contributor

pllim commented Dec 5, 2024

Does this work for you?

gHiper = SpectralElement.from_file("/your/path/to/GTC_HIPERCAM.g_s_3.dat")

@pllim
Copy link
Contributor

pllim commented Dec 5, 2024

If you must build from Table columns, it would look more like this:

https://synphot.readthedocs.io/en/latest/synphot/bandpass.html#arrays

@gavinramsay
Copy link
Author

thats great. i was going round in circles but the above works. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants