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

Error convolving Herschel filter #57

Open
gdcteixeira opened this issue Nov 17, 2017 · 2 comments
Open

Error convolving Herschel filter #57

gdcteixeira opened this issue Nov 17, 2017 · 2 comments

Comments

@gdcteixeira
Copy link

I've recently started to try to use the python version of the sed fitting tool, and I need to add herschel and Atlasgal filters.

I've tried to follow the documents and the issues raised in the sedfitter github page. But i've hit a roadblock.

What i'm using is his:


from sedfitter.filter import Filter
from sedfitter.convolve import convolve_model_dir
from astropy import units as u

hersh_pacs_70 = Filter()
hersh_pacs_70.name = 'pacs70'
hersh_pacs_70.central_wavelength = 71.330763 * u.micron
hersh_pacs_70.read('Herschel_Pacs.blue_mic.dat')

model_dir = '../models_sed_fit/models_r06'
convolve_model_dir(model_dir, [hersh_pacs_70])

I took the Hershel transmission curve from the Virtual observatory, converted the wavelenghts into microns, ordered from bigger wavelength to lower and added the #wave to the header. The Herschel file is something like this:

# wav = 71.330763
118.69400024000001 1.06E-4
118.34300232 1.11E-4
117.9940033 1.15E-4

Unfortunately when i run the script I end up with the following error:

python new_convolve.py
INFO: 200710 SEDs found in /home/gteixeira/models_sed_fit/models_r06 [sedfitter.convolve.convolve]
|>-----------------------------------------|   0 /200k ( 0.00%)INFO: Rebinning filters [sedfitter.convolve.convolve]
Traceback (most recent call last):
  File "new_convolve.py", line 53, in <module>
    convolve_model_dir(model_dir, [hersh_pacs_70])
  File "/usr/lib/python2.7/site-packages/sedfitter/convolve/convolve.py", line 41, in convolve_model_dir
    return _convolve_model_dir_1(model_dir, filters, overwrite=overwrite)
  File "/usr/lib/python2.7/site-packages/sedfitter/convolve/convolve.py", line 100, in _convolve_model_dir_1
    binned_filters = [f.rebin(s.nu) for f in filters]
  File "/usr/lib/python2.7/site-packages/sedfitter/filter/filter.py", line 107, in rebin
    self_nu_hz = self.nu.to(u.Hz).value
AttributeError: 'NoneType' object has no attribute 'to'

Do you know what I'm missing? Do I still need to define nu despite reading the transmission from the file?

@gdcteixeira
Copy link
Author

The error seems to come from the filter.read() function.

I got around it by using the following:

data = np.loadtxt('Herschel_Pacs.blue.dat',  skiprows=1)
wav = data[:,0]
response = data[:,1]
title_data = np.genfromtxt('Herschel_Pacs.blue.dat',  dtype=str, comments=None, skip_footer=len(response) )
hersh_pacs_70 = Filter()
hersh_pacs_70.name = 'pacs70'
hersh_pacs_70.central_wavelength = float(title_data[-1])* u.micron
hersh_pacs_70.nu = wav *u.GHz
hersh_pacs_70.response = response
hersh_pacs_70.normalize()

model_dir = '../models_sed_fit/models_r06'
convolve_model_dir(model_dir, [hersh_pacs_70])

Notice that the file used was an ascii file with the first line of the type

# wav = 70

and then 2 columns, the first with the frequencies in GHz and the second with the response.

I'll try to look into what can be causing the filter.read() problem.

@mpound
Copy link

mpound commented May 11, 2018

Did you get reasonable fitting results with this approach? My understanding was that the Herschel filter response functions needed to be normalized by integration over frequency since Herschel passbands refer to constant energy spectrum nu*Fnu = constant. So I thought they should be normalized according to Appendix A of Robitaille et al did for IRAC. http://iopscience.iop.org/article/10.1086/512039/fulltext/

I have not had sensible results with my own attempt at Herschel (and Gaia) convolution and fitting.

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

No branches or pull requests

2 participants