astrofrog / astrofrog/sedfitter

error when defining filters as wavelengths only

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

Description

Hello,
I am fitting an SED and, rather than having defined the filters to convolve with the models I have just defined the set of wavelengths that the data was observed at. The definitions are in the form
filters=[4.64000e-01*u.micron, 5.51000e-01*u.micron, 2.15000e+00*u.micron, 3.40000e+00*u.micron, 3.77000e+00*u.micron...]

I run the fitting module via the code
fit('', filters, apertures, modeldir_kurucz, 'kurucz_output.txt', extinction_law=extinction, distance_range=[8., 9.]*u.kpc,av_range=[1.55,6.2])

the output I get is the following error:

File "/home/thomas/Software/venv/lib/python3.11/site-packages/sedfitter/fit.py", line 180, in fit
fitter = Fitter(filter_names, apertures, model_dir,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thomas/Software/venv/lib/python3.11/site-packages/sedfitter/fit.py", line 86, in __init__
self.models = Models.read(model_dir, self.filters,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thomas/Software/venv/lib/python3.11/site-packages/sedfitter/models.py", line 142, in read
return cls._read_version_1(directory, filters,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thomas/Software/venv/lib/python3.11/site-packages/sedfitter/models.py", line 190, in _read_version_1
filename = '%s/convolved/%s.fits' % (directory, filt['name'])
~~~~^^^^^^^^
KeyError: 'name'

I don't want to use any of the provided filters but only want to use the wavelengths of the data. Is there a workaround for this?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in sedfitter/fit.py at Fitter, fit, and Models.read, then inspect _read_version_1 around the convolved filter filename lookup at line 190. Compare the filter structure expected there with the wavelength-only values in the issue. Done means wavelength-only fitting no longer raises KeyError: 'name' and the requested SED fit can proceed.

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
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.