tardis-sn/carsus

Combined ionization energies do not work with a single ion

epassaro opened this issue · 0 comments

Describe the bug

The hack to combine ionization energies from NIST and CMFGEN:

import copy
import pandas as pd

combined_ionization_energies = copy.deepcopy(ionization_energies)
combined_ionization_energies.base = cmfgen_reader.ionization_energies.combine_first(ionization_energies.base)

does not work when selecting a single ion in CMFGEN reader.

from carsus.io.cmfgen import CMFGENReader

cmfgen_reader = CMFGENReader.from_config('C 0', '/tmp/atomic', 
                                         priority=30, 
                                         ionization_energies=True, 
                                         cross_sections=True, 
                                         collisions=True, 
                                         #temperature_grid=temperature_grid, 
                                         drop_mismatched_labels=True,
                                        )

That happens because the ionization energies is a np.float64 instead of a pd.Series when just a single value is returned.

To Reproduce

Screenshots

System

  • OS:

    • GNU/Linux
    • macOS
  • Environment (conda list):

Additional context