dr-rodriguez / SEDkitSIMPLE

Utilities and examples for using SEDkit with SIMPLE
0 stars 0 forks source link

Not reading in Wavelength #4

Closed SherelynA closed 2 years ago

SherelynA commented 2 years ago

It seems like there is a problem with the sedkitsimple not recognizing the format of the tables and it also seems like in issue with sedkit because the idenitfy_spectrum_format doesn't recognize the https:...ascii urls whether it is .dat or .txt as being ascii files but it does when you just try directly give it the file if you have it at hand. @dr-rodriguez , the problem that seems to be happening is that it says numpy string object does not have attribute wavelength and thus the spectrum doesn't get read inScreen Shot 2022-08-08 at 9 20 53 PM I think it is not passing here, and also what does s.wavelength do?

Screen Shot 2022-08-08 at 9 29 07 PM
dr-rodriguez commented 2 years ago

I don't understand what you mean by "it does when you just try directly give it the file" -> there shouldn't be any difference between a local file and a remote file in terms of specutils. Can you show me what you are actually doing? The key issue, though, is that specutils doesn't have a robust way of identifying non-FITS files. For most of the loaders it fetches the header to identify what type of file it is, but for non-FITS files that is not possible.

This is the core of what SEDSIMPLE, AstrodbKit2, and specutils are trying to do:

from specutils import Spectrum1D
s = Spectrum1D.read('https://bdnyc.s3.amazonaws.com/WFC3/J0000%2B25.csv')
s = Spectrum1D.read('https://s3.amazonaws.com/bdnyc/IRS/0000%2B2554%20%285-14.5um%29.txt')
s = Spectrum1D.read('https://s3.amazonaws.com/bdnyc/0000%2B2554.txt')
s = Spectrum1D.read('https://s3.amazonaws.com/bdnyc/spex-prism_SDSSJ000013.54%2B255418.6_20040724_BUR06C.txt')

None of these work and there's not much we can do about it. You'll have to read them in manually without specutils and convert it into the formats expected by sedkit. The longer term alternative is to standardize the format so it can be auto-recognized and parsed by specutils.

As for what is s.wavelength: s is a temporary variable containing the Spectrum1D object as returned from AstrodbKit2 and specutils. s.wavelength is accessing the wavelength array from that object. If specutils is unable to parse the file, s is a string (technically, numpy.str_) of the url it tried to load and as such doesn't have a s.wavelength attribute. I can see about creating a more descriptive error message since the gist of it is that the spectrum could not be read by specutils.