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

How to add absorption to the model and set upper and lower limits #303

Open
unknowner-m opened this issue Dec 7, 2024 · 0 comments
Open

Comments

@unknowner-m
Copy link

I am a graduate student and I am trying to fit the NIRSPEC g395h spectrum using PAHFIT. According to Lai+2020, I added the short wavelength feature in the yaml file.

PAH_3.3:
  kind: dust_feature
  wavelength: 3.29
  fwhm: 0.0418

PAH_3.4:
  kind: dust_feature
  wavelength: 3.4
  fwhm: 0.0299

PAH_3.47:
  kind: dust_feature
  wavelength: 3.47
  fwhm: 0.1
##########################
# Absorption Model      #
##########################
H2O_absorption:
  kind: absorption
  tau: 2.5
  wavelength: 3.05
  fwhm: 0.406

CO2_absorption:
  kind: absorption
  tau: 1.532
  wavelength: 4.27
  fwhm: 0.033

CO_absorption:
  kind: absorption
  tau: 0.4
  wavelength: 4.67
  fwhm: 0.1

When I start running the script

model = Model.from_yaml('model.yaml')
model.guess(spec)
model.fit(spec, maxiter=10000)
display(model)
model.plot(spec)

I got the following error

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[67], [line 12](vscode-notebook-cell:?execution_count=67&line=12)
     [10](vscode-notebook-cell:?execution_count=67&line=10) model.fit(spec, maxiter=10000)
     [11](vscode-notebook-cell:?execution_count=67&line=11) display(model)
---> [12](vscode-notebook-cell:?execution_count=67&line=12) model.plot(spec)

File d:\Anaconda\envs\pahfit\Lib\site-packages\pahfit\model.py:538, in Model.plot(self, spec, redshift, use_instrument_fwhm, label_lines, scalefac_resid, **errorbar_kwargs)
    [535] ext_model = S07_attenuation(tau_sil=tau)(lam_mod)
    [537](file:///D:/Anaconda/envs/pahfit/Lib/site-packages/pahfit/model.py:537) if has_abs:
--> [538](file:///D:/Anaconda/envs/pahfit/Lib/site-packages/pahfit/model.py:538)     raise NotImplementedError(
    [539](file:///D:/Anaconda/envs/pahfit/Lib/site-packages/pahfit/model.py:539)         "plotting absorption features not implemented yet"
    [540](file:///D:/Anaconda/envs/pahfit/Lib/site-packages/pahfit/model.py:540)     )
    [542](file:///D:/Anaconda/envs/pahfit/Lib/site-packages/pahfit/model.py:542) if has_att or has_abs:
    [543](file:///D:/Anaconda/envs/pahfit/Lib/site-packages/pahfit/model.py:543)     ax_att = ax.twinx()  # axis for plotting the extinction curve

NotImplementedError: plotting absorption features not implemented yet

Does this mean that the absorption feature cannot be applied in the current version?

In addition, I checked the feature table and found that the wavelength and fwhm of the features I added did not have upper and lower limits set. How should I set them correctly?

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

1 participant