Skip to content

Commit

Permalink
recfromtxt to genfromtxt
Browse files Browse the repository at this point in the history
  • Loading branch information
atharva-2001 committed Dec 17, 2024
1 parent e638829 commit 65a9c74
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tardis/io/model/readers/generic_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pandas as pd
from astropy import units as u
from numpy import recfromtxt
from numpy import genfromtxt
from radioactivedecay import Nuclide
from radioactivedecay.utils import Z_DICT, elem_to_Z

Expand Down Expand Up @@ -44,11 +44,12 @@ def read_simple_ascii_density(
time_of_model_string = fh.readline().strip()
time_of_model = parse_quantity(time_of_model_string)

data = recfromtxt(
data = genfromtxt(
fname,
skip_header=1,
names=("index", "velocity", "density"),
dtype=(int, float, float),
dtype=None,
encoding=None,
)
velocity = (data["velocity"] * u.km / u.s).to("cm/s")
mean_density = (data["density"] * u.Unit("g/cm^3"))[1:]
Expand Down Expand Up @@ -152,4 +153,4 @@ def read_uniform_mass_fractions(mass_fractions_section, no_of_shells):
f"mass_fractions are not defined properly in config file : {err.args}"
)

return mass_fractions, isotope_mass_fractions
return mass_fractions, isotope_mass_fractions

0 comments on commit 65a9c74

Please sign in to comment.