jkrogager / VoigtFit

Python code to fit absorption lines semi-interactively
http://voigtfit.readthedocs.io/
MIT License
28 stars 12 forks source link

Can't run with unknown lines #35

Closed keheintz closed 3 years ago

keheintz commented 3 years ago

Hi JK, I tried running the code but I get the following error (note that it works fine on other, almost identical input files). Any clue to what's going on? I have tried to add the fine-structure transitions it complains about manually to the linelist.dat file, but it still complains. Thanks! Kasper

(VoigtfitEnv) Kaspers-MacBook-Pro:inputs keheintz$ VoigtFit input_grb160203a_fsl.pars

   VoigtFit 3.11.7.1                     

by Jens-Kristian Krogager          

Institut d'Astrophysique de Paris  
November 2017                      

  \/ \  _/\    /                   
      \/   \  / oigtFit            
            \/                     

Loaded Solar abundances from Asplund et al. 2009 (photospheric)

Reading Parameters from file: input_grb160203a_fsl.pars

The transition (SiIIa_1264) not found in line list!

The transition (FeIIa_2333) not found in line list!

Continuum Fitting : manual [spline]

         The components have been removed.

         The components have been removed.

Traceback (most recent call last): File "/opt/anaconda3/envs/VoigtfitEnv/bin/VoigtFit", line 33, in sys.exit(load_entry_point('VoigtFit==3.11.7.1', 'console_scripts', 'VoigtFit')()) File "/opt/anaconda3/envs/VoigtfitEnv/lib/python3.8/site-packages/VoigtFit/main.py", line 496, in main popt, chi2 = dataset.fit(verbose=False, parameters['fit_options']) File "/opt/anaconda3/envs/VoigtfitEnv/lib/python3.8/site-packages/VoigtFit/dataset.py", line 1959, in fit popt = self.minimizer.minimize(kwargs) File "/opt/anaconda3/envs/VoigtfitEnv/lib/python3.8/site-packages/lmfit/minimizer.py", line 2285, in minimize return function(kwargs) File "/opt/anaconda3/envs/VoigtfitEnv/lib/python3.8/site-packages/lmfit/minimizer.py", line 1646, in leastsq lsout = scipy_leastsq(self.__residual, variables, lskws) File "/opt/anaconda3/envs/VoigtfitEnv/lib/python3.8/site-packages/scipy/optimize/minpack.py", line 410, in leastsq shape, dtype = _check_func('leastsq', 'func', func, x0, args, n) File "/opt/anaconda3/envs/VoigtfitEnv/lib/python3.8/site-packages/scipy/optimize/minpack.py", line 24, in _check_func res = atleast_1d(thefunc(((x0[:numinputs],) + args))) File "/opt/anaconda3/envs/VoigtfitEnv/lib/python3.8/site-packages/lmfit/minimizer.py", line 576, in __residual out = self.userfcn(params, self.userargs, **self.userkws) File "/opt/anaconda3/envs/VoigtfitEnv/lib/python3.8/site-packages/VoigtFit/dataset.py", line 1945, in chi model_spectrum = np.concatenate(model) File "<__array_function__ internals>", line 5, in concatenate ValueError: need at least one array to concatenate (VoigtfitEnv) Kaspers-MacBook-Pro:inputs keheintz$

jkrogager commented 3 years ago

Hey, could you try to send the input file, or paste it here?

keheintz commented 3 years ago

Of course, here the code in the input file:

Define information about the data

name : GRB160203A z_sys: 3.51877 save : GRB160203A

data '../../data/GRB160203A/GRB160203A_OB6UVBshort.dat' 37.55 data '../../data/GRB160203A/GRB160203A_OB6VISshort.dat' 21.74 data '../../data/GRB160203A/GRB160203A_OB6NIRshort.dat' 24.5

C_order = -1 norm_method: spline

lines to fit

lines SiIIa_1264 velspan=500 lines FeIIa_2333

Define components

component SiIIa -87.9 21.42 13.554 velocity var_b=False var_z=False component SiIIa -4.8 43.64 13.689 velocity var_b=False var_z=False component SiIIa 46.4 11.00 12.42 velocity var_b=False var_z=False

copy components from SiIIa to FeIIa

Print abundances

abundance

jkrogager commented 3 years ago

I see I never got around to answering you here. The solution was to identify the correct path to the linelist.dat in the package installation and add the lines there. I'll try to come up with some convenience functions for doing this more easily in the future. I'm closing for now.