Width of photometric data points: too narrow horizontal bar
Closed this issue · 5 comments
1.) The wavelength of the photometric data points seems to be too narrow. This is clearest when plotting data for wide filters, e.g. WISE W3:
WISE-Filter.pdf
or similarly, though less dramatically, e.g. for 2MASS filters. In the figure, the purple horizontal line is what species
is currently showing. Arguably, there is no universal meaningful definition but maybe the FWHM or W_eff (from the mini-plots which the SVO filter service shows when clicking on (?)
) would give a better sense of the range of wavelengths contributing to the flux. These definitions are indicated in the plot in black and blue, respectively.
A (too?) fancy version: when calculating synthetic photometry, the width could be set e.g. to the asymmetrical 1-sigma region (i.e., contain 68.4% of the flux) around the flux-averaged central wavelength… But for the data, somehow, the width should be increased, I feel.
2.) On a related note, at your leasure, could you provide the option of showing the filter profiles in the same panel as the residuals, and colour the filters automatically according to the data points? I think this would be a compact yet clear way of presenting that practical reference information.
Bedankt!
Hi Gabriel!
I just tested this:
from species import SpeciesInit
from species.data.database import Database
from species.read.read_filter import ReadFilter
filter_name = 'WISE/WISE.W3'
SpeciesInit()
database = Database()
database.add_filter(filter_name)
read_filt = ReadFilter(filter_name)
print(read_filt.wavelength_range())
print(read_filt.mean_wavelength())
print(read_filt.effective_wavelength())
print(read_filt.filter_fwhm())
print(read_filt.effective_width())
Which seems to calculate the same values as listed by SVO.
When using plot_spectrum
, it uses the mean wavelength and FWHM/2 for the errorbar, so the width of the full errorbar is FWHM. It could be that there is an issue somewhere when creating the plot. Could you share (a zoom of) the plot from species
which has the issue? Did you change units? Perhaps the problem is there.
Thanks a lot for your super-quick answer! See attached for W2 as a less radical example.
spek_nur2MASSundW1W2_drift-phoenix_NPkte2e3_M.pdf
I am not (consciously) doing anything with the units and just have quantity='flux',
and not setting the units.
And now a zoom on W3:
W3-Zoom.pdf
I was following the tutorial and updating the photometry after the fit, calculating residuals, passing around boxes, etc.. If I run the code above (thanks!), I get:
In [32]: filter_name = 'WISE/WISE.W3'
In [33]: read_filt = ReadFilter(filter_name)
...: print(read_filt.wavelength_range())
...: print(read_filt.mean_wavelength())
...: print(read_filt.effective_wavelength())
...: print(read_filt.filter_fwhm())
...: print(read_filt.effective_width())
(7.2, 18.41)
12.807576122968731
10.786586320619927
6.275653531239454
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[42], line 6
4 print(read_filt.effective_wavelength())
5 print(read_filt.filter_fwhm())
----> 6 print(read_filt.effective_width())
File ~/.local/lib/python3.8/site-packages/typeguard/__init__.py:1037, in typechecked.<locals>.wrapper(*args, **kwargs)
1035 check_return_type(retval, memo)
1036 except TypeError as exc:
-> 1037 raise TypeError(*exc.args) from None
1039 # If a generator is returned, wrap it if its yield/send/return types can be checked
1040 if inspect.isgenerator(retval) or isasyncgen(retval):
TypeError: type of the return value must be numpy.float32; got numpy.float64 instead
Maybe for broad filters the effective width would be a better measure than the FWHM but that is a second-order thought.
I found the issue, which was introduced when implementing the unit conversion. There was a factor 2 missing in the error bar width. It should be fixed in commit 6fbdccb. Thanks for pointing that out 👍
Super, it works! Thanks a lot.