Closed alexmaragko closed 3 years ago
It seems that the IPAC input table is case sensitive to column names. The input table I used had the following header entries:
| wavelength | flux | | double | double | | micron | Jy | | null | null |
Changing "wavelength" to "WAVELENGTH" and "flux" to "FLUX", as well as the wavelength units from micron to um, resolved the issue.
For the units part, Astropy units support the "micron" unit keyword so I'm not sure why it didn't work.
Also, only 2 column IPAC tables are accepted, so any spectra having flux uncertainties should drop the uncertainties column.
This issue is caused because the flux and wavelength names are expected to be "FLUX" and "WAVELENGTH" implicitly in observation.py: https://github.com/PAHdb/pyPAHdb/blob/88ec27229d902e71cb8a8ff18ea80b85c01056e0/pypahdb/observation.py#L93-L94 https://github.com/PAHdb/pyPAHdb/blob/88ec27229d902e71cb8a8ff18ea80b85c01056e0/pypahdb/observation.py#L96
The names should be retrieved from the data column names instead using data.colnames
, specifically data.colnames[0]
and data.colnames[1]
.
This should be easily fixed in a future PR.
Capitalizing the column names before accessing them solves the issue--see https://github.com/PAHdb/pyPAHdb/commit/351a2956102b7fed3f864616c728b80be7611178
When trying to read a 2 or 3 column (3rd column being flux uncertainties) IPAC spectrum file it raises a “Format not recognized” error. However, Astropy's “ascii.read” can read both tables without errors. This is strange because on line 91 of observation.py, ascii.read is called in the exact same way as when reading the spec file independently using ascii.read. Moving the spectrum file into the "resources/" directory made no difference. I'm uploading the 2 column spectrum file here (renamed from .ipac to .txt so that GitHub can recognize it). spec_example.txt