Closed pfreddy closed 6 years ago
@pfreddy currently very busy trying to dig out the old data set.
Hi @pfreddy - can provide more details, in particular concerning the error messages?
I copy below the whole error message:
tardis.atomic - INFO - Preparing the NLTE data
tardis.plasma.properties.partition_function - INFO - Calculating rates for species (8, 0)
Traceback (most recent call last):
File "/home/barna/anaconda/envs/tardis/bin/tardis", line 64, in <module>
radial1d_mdl = model.Radial1DModel(tardis_config)
File "/home/barna/anaconda/envs/tardis/lib/python2.7/site-packages/tardis/model.py", line 118, in __init__
v_outer=tardis_config.structure.v_outer)
File "/home/barna/anaconda/envs/tardis/lib/python2.7/site-packages/tardis/plasma/standard_plasmas.py", line 131, in __init__
j_blues=None, w=w, link_t_rad_t_electron=link_t_rad_t_electron)
File "/home/barna/anaconda/envs/tardis/lib/python2.7/site-packages/tardis/plasma/base.py", line 22, in __init__
self.update(**kwargs)
File "/home/barna/anaconda/envs/tardis/lib/python2.7/site-packages/tardis/plasma/base.py", line 147, in update
self.plasma_properties_dict[module_name].update()
File "/home/barna/anaconda/envs/tardis/lib/python2.7/site-packages/tardis/plasma/properties/base.py", line 97, in update
*self._get_input_values()))
File "/home/barna/anaconda/envs/tardis/lib/python2.7/site-packages/tardis/plasma/properties/partition_function.py", line 216, in _calculate_general
previous_electron_densities)
File "/home/barna/anaconda/envs/tardis/lib/python2.7/site-packages/tardis/plasma/properties/partition_function.py", line 159, in _main_nlte_calculation
np.linalg.solve(rates_matrix[:, :, i], x)
File "/home/barna/anaconda/envs/tardis/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 381, in solve
r = gufunc(a, b, signature=signature, extobj=extobj)
File "/home/barna/anaconda/envs/tardis/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 90, in _raise_linalgerror_singular
raise LinAlgError("Singular matrix")
numpy.linalg.linalg.LinAlgError: Singular matrix
@aoifeboyle any idea why it should fail specifically for O I? Or is this just coincidence?
No coincidence, I chose the neutral oxygen. :)
As I mentioned above, the NLTE treatment works fine for a few ions (e.g. Ca 2 or Si 3), but fails in other cases (like O 1).
@chvogl - please comment
Hi,
Just ran into this issue. Confirming [Ca 2] works, but [Si 2] raises LinAlgError: Singular matrix.
This problem is due to errors in the currently used atomic dataset. The dataset contains levels that do not have any allowed radiative transitions (upwards- or downwards). As a result the rate matrix can contain rows of zeros, which causes a Singular matrix error when trying to solve the linear system of equations. For species such as [Ca 2], which do not have such levels, the NLTE excitation solver works fine. The respective levels seem to be duplicate levels, which have been erroneously written to the atomic datafile.
The first step to resolve this issue would be to check if atomic data files created with the new Carsus database also feature the above mentioned duplicate levels.
This is something for you @yeganer!!
Hi, I recently updated my installation of Tardis and found that NLTE stopped working completely.... Before updating it did work for part of the ions.
Now I get two types of errors: If I list only one species (e.g. [Ca 2]), I get:
[tardis.model.base ][WARNING] Abundances have not been normalized to 1. - normalizing (base.py:348)
tardis.model.base - WARNING - Abundances have not been normalized to 1. - normalizing
[tardis.plasma.standard_plasmas][INFO ] Reading Atomic Data from kurucz_cd23_chianti_H_He.h5 (standard_plasmas.py:72)
tardis.plasma.standard_plasmas - INFO - Reading Atomic Data from kurucz_cd23_chianti_H_He.h5
tardis.atomic - INFO - Read Atom Data with UUID=5ca3035ca8b311e3bb684437e69d75d7 and MD5=21095dd25faa1683f4c90c911a00c3f8
tardis.atomic - INFO - Preparing the NLTE data
[tardis.plasma.base ][DEBUG ] Updating modules in the following order: (base.py:195)
tardis.plasma.base - DEBUG - Updating modules in the following order:
[tardis.plasma.properties.atomic][WARNING] Zeta_data missing - replaced with 1s. Missing ions: [(12, 13), (14, 15), (16, 17), (18, 19), (20, 21), (22, 23), (24, 25), (26, 27), (27, 28), (28, 29)] (atomic.py:184)
tardis.plasma.properties.atomic - WARNING - Zeta_data missing - replaced with 1s. Missing ions: [(12, 13), (14, 15), (16, 17), (18, 19), (20, 21), (22, 23), (24, 25), (26, 27), (27, 28), (28, 29)]
[tardis.plasma.properties.partition_function][INFO ] Calculating rates for species (16, 1) (partition_function.py:119)
tardis.plasma.properties.partition_function - INFO - Calculating rates for species (16, 1)
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-22-42401495d0e2> in <module>()
----> 1 model = run_tardis('M07_M07_11_18.5_tardis_Ni_nlte.yml')
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/base.pyc in run_tardis(config, atom_data)
35 tardis_config = Configuration.from_config_dict(config)
36
---> 37 simulation = Simulation.from_config(tardis_config, atom_data=atom_data)
38 simulation.run()
39
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/simulation/base.pyc in from_config(cls, config, **kwargs)
377 else:
378 plasma = assemble_plasma(config, model,
--> 379 atom_data=kwargs.get('atom_data', None))
380 if 'runner' in kwargs:
381 runner = kwargs['runner']
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/plasma/standard_plasmas.pyc in assemble_plasma(config, model, atom_data)
151
152 plasma = BasePlasma(plasma_properties=plasma_modules,
--> 153 property_kwargs=property_kwargs, **kwargs)
154
155 return plasma
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/plasma/base.pyc in __init__(self, plasma_properties, property_kwargs, **kwargs)
22 self._build_graph()
23 # self.write_to_tex('Plasma_Graph')
---> 24 self.update(**kwargs)
25
26 def __getattr__(self, item):
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/plasma/base.pyc in update(self, **kwargs)
156
157 for module_name in self._resolve_update_list(kwargs.keys()):
--> 158 self.plasma_properties_dict[module_name].update()
159
160 def _update_module_type_str(self):
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/plasma/properties/base.pyc in update(self)
124 if len(self.outputs) == 1:
125 setattr(self, self.outputs[0], self.calculate(
--> 126 *self._get_input_values()))
127 else:
128 new_values = self.calculate(*self._get_input_values())
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/plasma/properties/radiative_properties.pyc in calculate(self, g, level_number_density, lines_lower_level_index, lines_upper_level_index, metastability, lines)
75 (lines.ion_number == species[1])
76 stimulated_emission_factor[(stimulated_emission_factor < 0) &
---> 77 nlte_lines_mask[np.newaxis].T] = 0.0
78 return stimulated_emission_factor
79
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/pandas/core/series.pyc in __getitem__(self, key)
599 key = com._apply_if_callable(key, self)
600 try:
--> 601 result = self.index.get_value(self, key)
602
603 if not is_scalar(result):
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/pandas/core/indexes/base.pyc in get_value(self, series, key)
2475 try:
2476 return self._engine.get_value(s, k,
-> 2477 tz=getattr(series.dtype, 'tz', None))
2478 except KeyError as e1:
2479 if len(self) > 0 and self.inferred_type in ['integer', 'boolean']:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value (pandas/_libs/index.c:4404)()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value (pandas/_libs/index.c:4087)()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc (pandas/_libs/index.c:5210)()
KeyError: None
If I list 2 or more (e.g. ['S II','Ca II','Si II']), I get:
[tardis.model.base ][WARNING] Abundances have not been normalized to 1. - normalizing (base.py:348)
tardis.model.base - WARNING - Abundances have not been normalized to 1. - normalizing
[tardis.plasma.standard_plasmas][INFO ] Reading Atomic Data from kurucz_cd23_chianti_H_He.h5 (standard_plasmas.py:72)
tardis.plasma.standard_plasmas - INFO - Reading Atomic Data from kurucz_cd23_chianti_H_He.h5
tardis.atomic - INFO - Read Atom Data with UUID=5ca3035ca8b311e3bb684437e69d75d7 and MD5=21095dd25faa1683f4c90c911a00c3f8
tardis.atomic - INFO - Preparing the NLTE data
[tardis.plasma.base ][DEBUG ] Updating modules in the following order: (base.py:195)
tardis.plasma.base - DEBUG - Updating modules in the following order:
[tardis.plasma.properties.atomic][WARNING] Zeta_data missing - replaced with 1s. Missing ions: [(12, 13), (14, 15), (16, 17), (18, 19), (20, 21), (22, 23), (24, 25), (26, 27), (27, 28), (28, 29)] (atomic.py:184)
tardis.plasma.properties.atomic - WARNING - Zeta_data missing - replaced with 1s. Missing ions: [(12, 13), (14, 15), (16, 17), (18, 19), (20, 21), (22, 23), (24, 25), (26, 27), (27, 28), (28, 29)]
[tardis.plasma.properties.partition_function][INFO ] Calculating rates for species (16, 1) (partition_function.py:119)
tardis.plasma.properties.partition_function - INFO - Calculating rates for species (16, 1)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-23-42401495d0e2> in <module>()
----> 1 model = run_tardis('M07_M07_11_18.5_tardis_Ni_nlte.yml')
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/base.pyc in run_tardis(config, atom_data)
35 tardis_config = Configuration.from_config_dict(config)
36
---> 37 simulation = Simulation.from_config(tardis_config, atom_data=atom_data)
38 simulation.run()
39
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/simulation/base.pyc in from_config(cls, config, **kwargs)
377 else:
378 plasma = assemble_plasma(config, model,
--> 379 atom_data=kwargs.get('atom_data', None))
380 if 'runner' in kwargs:
381 runner = kwargs['runner']
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/plasma/standard_plasmas.pyc in assemble_plasma(config, model, atom_data)
151
152 plasma = BasePlasma(plasma_properties=plasma_modules,
--> 153 property_kwargs=property_kwargs, **kwargs)
154
155 return plasma
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/plasma/base.pyc in __init__(self, plasma_properties, property_kwargs, **kwargs)
22 self._build_graph()
23 # self.write_to_tex('Plasma_Graph')
---> 24 self.update(**kwargs)
25
26 def __getattr__(self, item):
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/plasma/base.pyc in update(self, **kwargs)
156
157 for module_name in self._resolve_update_list(kwargs.keys()):
--> 158 self.plasma_properties_dict[module_name].update()
159
160 def _update_module_type_str(self):
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/plasma/properties/base.pyc in update(self)
124 if len(self.outputs) == 1:
125 setattr(self, self.outputs[0], self.calculate(
--> 126 *self._get_input_values()))
127 else:
128 new_values = self.calculate(*self._get_input_values())
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/plasma/properties/partition_function.pyc in _calculate_general(self, t_electrons, lines, atomic_data, nlte_data, general_level_boltzmann_factor, j_blues, previous_beta_sobolev, previous_electron_densities)
208 atomic_data, nlte_data, t_electrons, j_blues,
209 beta_sobolevs, general_level_boltzmann_factor,
--> 210 previous_electron_densities)
211 return general_level_boltzmann_factor
212
/home/ran/anaconda2/envs/tardis/lib/python2.7/site-packages/tardis/plasma/properties/partition_function.pyc in _main_nlte_calculation(self, atomic_data, nlte_data, t_electrons, j_blues, beta_sobolevs, general_level_boltzmann_factor, previous_electron_densities)
116 """
117 for species in nlte_data.nlte_species:
--> 118 j_blues = j_blues.values
119 logger.info('Calculating rates for species %s', species)
120 number_of_levels = atomic_data.levels.energy.ix[species].count()
AttributeError: 'numpy.ndarray' object has no attribute 'values'
@livnehra Can you please open a new issue and add a zip file containing the database and all information needed to run your setup. I'll be working on the NLTE part of tardis in the next weeks and this issue has to be solved.
Sure, opened issue #777 . Tell me if I can help in any way. Thanks!
@yeganer - this should work now, right?
@yeganer ensured me that with the new default atomic data set (which is in the tardis-refdata repo) this error should not occur any more. I am closing this one until further notice.
Hi,
I've tried to run a calculation with some NLTE-species after the example configuration file.
plasma: nlte: species: ['Ca 2']
It works well for a few ions, but it cannot handle e.g. Si 2 or O 2, and returns with an error message.