Open graceparkk opened 2 years ago
Can you also provide me with the target name you are passing, as opposed to the spectrum url? For example, 2MASS J23062928-0502285 is easier for me to try and diagnose.
For 2MASS J23062928-0502285 I only see 1 spectrum in the SIMPLE database. Where are you seeing the .dat file? This is what I see for the SIMPLE database inventory for that object:
print(sed.inventory['Spectra'])
[{'spectrum': 'https://s3.amazonaws.com/bdnyc/optical_spectra/U20823.fits',
'original_spectrum': None,
'local_spectrum': '$BDNYC_spectra/optical_spectra/U20823.fits',
'regime': 'optical',
'telescope': 'CTIO 4m',
'instrument': 'R-C Spec',
'mode': None,
'observation_date': datetime.datetime(2003, 4, 20, 7, 45, 18, 601000),
'wavelength_units': 'A',
'flux_units': 'erg s-1 cm-2 A-1',
'wavelength_order': None,
'comments': None,
'reference': 'Reid08b',
'other_references': None}]
If you've added a new spectrum to the database, that's fine, but SEDSIMPLE should loop over all available spectra.
The objects are 2MASS J19360187-5502322 2MASS J17072343-0558249 2MASS J10511900+5613086 2MASS J12130336-0432437 2MASS J15203974+3546210 2MASS J12392727+5515371
For example, 2MASS J19360187-5502322 has two spectra file: .fits file and .dat file. However, when I load the spectra, it only gives me one.
If you do print(sed.inventory['Spectra'])
for 2MASS J19360187-5502322 do you actually see two entries? I see you have a screenshot, but I just don't see that in the database which makes me wonder if you may be using one database in your python script and another for your GUI tool.
I've also pushed a few changes to sedsimple to better handle spectra, including a check for ampere and conversion to Angstroms (this is a hacky fix; I would rather resolve it in some fashion with a fix addressing #2 ). You can also now do something like this:
sed = SEDSIMPLE(db, '2MASS J10511900+5613086', auto_db=True)
sed.load_spectra_db(spectra_format='wcs1d-fits', error_scale=0.1)
# Get error about index, diagnosing:
spec_input = sed.inventory['Spectra'][0]
wave, flux, unc, ref = sed.fetch_single_spectrum_db(spec_input, spectra_format='wcs1d-fits', error_scale=0.1)
print(len(wave), len(flux), len(unc))
# 1600 4 4. These scales do not match- additional transformations needed
Basically, you can pass spectra_format
to specify the specutils loader you want to use (from https://specutils.readthedocs.io/en/stable/spectrum1d.html#list-of-loaders). That can help address some issues. The error_scale
parameter is set by default to np.nan (this is to construct a synthetic flux_unc Quantity object when none exists). We want to be careful about this, but for testing you may want to put something like error_scale=0.1
For 2MASS J10511900+5613086, I was able to read it with wcs1d-fits but the arrays are massively different: 1600 wavelengths for just 4 flux values. I don't know if that is the best loader, but the data is arranged in an unusual format and needs careful vetting first. Pretty much all of your examples working, but they fail with this error. I don't know enough about the formatting of the KPNO spectra so I don't know how to work with these. Are these perhaps not 1D spectra?
For 2MASS J19360187-5502322 I was able to get the spectrum loaded, but not plotted- the plotting aspect is on @hover2pi's end as that is handled by sedkit.
I've been looking at 6 objects and I wasn't able to load the spectra for all of them. Here are the following spectra: https://s3.amazonaws.com/bdnyc/optical_spectra/U20823.fits https://s3.amazonaws.com/bdnyc/optical_spectra/U20701.fits https://s3.amazonaws.com/bdnyc/optical_spectra/u20388.fits https://s3.amazonaws.com/bdnyc/optical_spectra/U11044.fits https://s3.amazonaws.com/bdnyc/SpeX/Prism/spex-prism_SDSSJ152039.82%2B354619.8_20080712_BUR10A.txt https://s3.amazonaws.com/bdnyc/1239%2B5515.txt
One more thing... For each object I've been looking at (e.g. 2MASS J19360187-5502322, 2MASS J19360187-5502322), there are two spectra. However, I'm only getting one spectrum, and the other spectrum I've been not getting are .dat files. I'm not sure if this is the problem with only .dat files or if it's because I'm not passing through the first spectrum.