Describe the bug
When running TARDIS simulation with a custom density and abundance profile, the following Value error pops up.
raise ValueError(
ValueError: Unable to coerce to Series, length must be 6: given 7
To Reproduce
When the line producing the error is traced, one can see that the error is produced due to TARDIS not reading the first shell in the csv part of the csvy file. For example:
abund.csvy
---
name: cvy_model_abundance_dataframes
model_density_time_0: 1 day
model_isotope_time_0: 0 day
description: csvy file to test abundances and decay (test values declared in the CSV section)
tardis_model_config_version: v1.0
datatype:
fields:
- name: velocity
unit: km/s
desc: velocities of shell outer bounderies.
- name: density
unit: g/cm^3
desc: density of shell.
- name: H
desc: fractional H abundance
- name: He
desc: fractional He abundance
- name: Ni56
desc: fractional Ni56 abundance
v_inner_boundary: 9000 km/s
v_outer_boundary: 16000 km/s
---
velocity,density,H,He,Ni56
9000, 5e-10, 0.5, 0.5, 0
10500, 2.0e-10, 0.0, 0.98, 0.02
12000, 9e-11, 0.33, 0.64, 0.03
13000, 9e-12, 0.3, 0.6, 0.1
14000, 6e-12, 0.5, 0.4, 0.1
15000, 4e-12, 0.4, 0.55, 0.05
16000, 3e-12, 0.2, 0.79, 0.01
from tardis import run_tardis
sim2 = run_tardis("config.yml", log_level='INFO', show_convergence_plots=False, virtual_packet_logging=True)
Screenshots
System
OS:
[x] GNU/Linux
[ ] macOS
Temporary workaround
Since we figured out that the error was caused by all the density parameters being read while the first shell's mass fractions are ignored, by changing line 165 in file /site-packages/tardis/model/base.py to
@property
def elemental_number_density(self):
self.composition.density = self.composition.density[1:] # adding this line temporarily fixes the error since it ignores the density of the first shell read.
elemental_number_density = (
(
self.composition.elemental_mass_fraction
* self.composition.density
)
.divide(self.composition.element_masses, axis=0)
.dropna()
)
Since this is not a permanent solution, please suggest how to solve this problem.
Describe the bug When running TARDIS simulation with a custom density and abundance profile, the following Value error pops up.
To Reproduce
When the line producing the error is traced, one can see that the error is produced due to TARDIS not reading the first shell in the csv part of the csvy file. For example:
abund.csvy
config.yml
sim.py
Screenshots
System
Temporary workaround
Since we figured out that the error was caused by all the density parameters being read while the first shell's mass fractions are ignored, by changing line 165 in file
/site-packages/tardis/model/base.py
toSince this is not a permanent solution, please suggest how to solve this problem.