Skip to content

Instantly share code, notes, and snippets.

@DhruvSondhi
Last active February 6, 2021 11:21
Show Gist options
  • Save DhruvSondhi/9626acc478bff535ca2404c4175f8a9b to your computer and use it in GitHub Desktop.
Save DhruvSondhi/9626acc478bff535ca2404c4175f8a9b to your computer and use it in GitHub Desktop.
Error while executing Quickstart Notebook
from tardis import run_tardis
from tardis.io.atom_data.util import download_atom_data
# the data is automatically downloaded
download_atom_data('kurucz_cd23_chianti_H_He')
# OUTPUT
[tardis.io.atom_data.atom_web_download][INFO ]
Downloading atomic data from https://media.githubusercontent.com/media/tardis-sn/tardis-refdata/master/atom_data/kurucz_cd23_chianti_H_He.h5 to /home/dhruvs/Downloads/tardis-data/kurucz_cd23_chianti_H_He.h5 (atom_web_download.py:48)
!curl -O https://raw.githubusercontent.com/tardis-sn/tardis/master/docs/using/components/models/examples/tardis_example.yml
#TARDIS now uses the data in the data repo
sim = run_tardis('tardis_example.yml')
# OUTPUT
[tardis.plasma.standard_plasmas][INFO ] Reading Atomic Data from kurucz_cd23_chianti_H_He.h5 (standard_plasmas.py:87)
[tardis.io.atom_data.util][INFO ] Atom Data kurucz_cd23_chianti_H_He.h5 not found in local path. Exists in TARDIS Data repo /home/dhruvs/Downloads/tardis-data/kurucz_cd23_chianti_H_He.h5 (util.py:33)
[tardis.io.atom_data.base][INFO ] Read Atom Data with UUID=6f7b09e887a311e7a06b246e96350010 and MD5=864f1753714343c41f99cb065710cace. (base.py:170)
[tardis.io.atom_data.base][INFO ] Non provided atomic data: synpp_refs, photoionization_data (base.py:176)
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-4-1a68e481065f> in <module>
1 #TARDIS now uses the data in the data repo
----> 2 sim = run_tardis('tardis_example.yml')
~/Repositories/tardis/tardis/base.py in run_tardis(config, atom_data, packet_source, simulation_callbacks)
36 tardis_config = Configuration.from_config_dict(config)
37
---> 38 simulation = Simulation.from_config(
39 tardis_config, packet_source=packet_source, atom_data=atom_data
40 )
~/Repositories/tardis/tardis/simulation/base.py in from_config(cls, config, packet_source, **kwargs)
531 plasma = kwargs["plasma"]
532 else:
--> 533 plasma = assemble_plasma(
534 config, model, atom_data=kwargs.get("atom_data", None)
535 )
~/Repositories/tardis/tardis/plasma/standard_plasmas.py in assemble_plasma(config, model, atom_data)
206 kwargs["helium_treatment"] = config.plasma.helium_treatment
207
--> 208 plasma = BasePlasma(
209 plasma_properties=plasma_modules,
210 property_kwargs=property_kwargs,
~/Repositories/tardis/tardis/io/util.py in __new__(cls, *args, **kwargs)
197 instance = super(HDFWriterMixin, cls).__new__(cls)
198 instance.optional_hdf_properties = []
--> 199 instance.__init__(*args, **kwargs)
200 return instance
201
~/Repositories/tardis/tardis/plasma/base.py in __init__(self, plasma_properties, property_kwargs, **kwargs)
28 self._build_graph()
29 # self.write_to_tex('Plasma_Graph')
---> 30 self.update(**kwargs)
31
32 def __getattr__(self, item):
~/Repositories/tardis/tardis/plasma/base.py in update(self, **kwargs)
182
183 for module_name in self._resolve_update_list(kwargs.keys()):
--> 184 self.plasma_properties_dict[module_name].update()
185
186 def _update_module_type_str(self):
~/Repositories/tardis/tardis/plasma/properties/base.py in update(self)
106 if len(self.outputs) == 1:
107 setattr(
--> 108 self, self.outputs[0], self.calculate(*self._get_input_values())
109 )
110 else:
~/Repositories/tardis/tardis/plasma/properties/ion_population.py in calculate(g_electron, beta_rad, partition_function, ionization_data)
72 phis[start_id - i : end_id - i - 1] = current_phis
73
---> 74 broadcast_ionization_energy = ionization_data[
75 partition_function.index
76 ].dropna()
~/.local/lib/python3.8/site-packages/pandas/core/series.py in __getitem__(self, key)
846 return self._get_values(key)
847
--> 848 return self._get_with(key)
849
850 def _get_with(self, key):
~/.local/lib/python3.8/site-packages/pandas/core/series.py in _get_with(self, key)
886
887 # handle the dup indexing case GH#4246
--> 888 return self.loc[key]
889
890 def _get_values_tuple(self, key):
~/.local/lib/python3.8/site-packages/pandas/core/indexing.py in __getitem__(self, key)
892
893 maybe_callable = com.apply_if_callable(key, self.obj)
--> 894 return self._getitem_axis(maybe_callable, axis=axis)
895
896 def _is_scalar_access(self, key: Tuple):
~/.local/lib/python3.8/site-packages/pandas/core/indexing.py in _getitem_axis(self, key, axis)
1110 raise ValueError("Cannot index with multidimensional key")
1111
-> 1112 return self._getitem_iterable(key, axis=axis)
1113
1114 # nested tuple slicing
~/.local/lib/python3.8/site-packages/pandas/core/indexing.py in _getitem_iterable(self, key, axis)
1050
1051 # A collection of keys
-> 1052 keyarr, indexer = self._get_listlike_indexer(key, axis, raise_missing=False)
1053 return self.obj._reindex_with_indexers(
1054 {axis: [keyarr, indexer]}, copy=True, allow_dups=True
~/.local/lib/python3.8/site-packages/pandas/core/indexing.py in _get_listlike_indexer(self, key, axis, raise_missing)
1263 keyarr, indexer, new_indexer = ax._reindex_non_unique(keyarr)
1264
-> 1265 self._validate_read_indexer(keyarr, indexer, axis, raise_missing=raise_missing)
1266 return keyarr, indexer
1267
~/.local/lib/python3.8/site-packages/pandas/core/indexing.py in _validate_read_indexer(self, key, indexer, axis, raise_missing)
1318
1319 with option_context("display.max_seq_items", 10, "display.width", 80):
-> 1320 raise KeyError(
1321 "Passing list-likes to .loc or [] with any missing labels "
1322 "is no longer supported. "
KeyError: "Passing list-likes to .loc or [] with any missing labels is no longer supported. The following labels were missing: MultiIndex([( 8, 0),\n (12, 0),\n (14, 0),\n (16, 0),\n (18, 0),\n (20, 0)],\n names=['atomic_number', 'ion_number']). See https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike"
@DhruvSondhi
Copy link
Author

This is the complete error & traceback 🤔

@jamesgillanders
Copy link

Can you roll back to python v3.7 to see if you get the same issue?

@DhruvSondhi
Copy link
Author

Sure I will check it once :)

@DhruvSondhi
Copy link
Author

Yes, it was fixed with Python version 3.8 ... Thank you very much for the info @jamesgillanders 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment