astrofrog / astrofrog/sedfitter

Error convolving Herschel filter

Open
#57 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
21
Forks
23
PR merge metrics
No merged PRs in 30d

Description

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
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?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at sedfitter/filter/filter.py in rebin and follow the call from sedfitter/convolve/convolve.py:100 using the Filter setup shown in the issue. Reproduce the NoneType failure with the Herschel transmission file, determine how read populates the filter data, and add a focused regression test showing that convolve_model_dir handles this input without the error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.