[sinks] correct units
This commit is contained in:
+22
-7
@@ -1359,11 +1359,16 @@ class SnapshotProcessor(HDF5Container):
|
||||
|
||||
f = open(csv_name)
|
||||
first_line = f.readline()
|
||||
second_line = f.readline()
|
||||
f.close()
|
||||
|
||||
if first_line[1] == "#":
|
||||
header = first_line[3:-1].split(",")
|
||||
units = second_line[3:-1].split(",")
|
||||
df = pd.read_csv(csv_name, header=None, names=header, skiprows=2)
|
||||
for key in header:
|
||||
if units[header.index(key)] == "m":
|
||||
df[key] = df[key] * self.info["unit_mass"].express(U.Msun)
|
||||
else:
|
||||
header = [
|
||||
"id",
|
||||
@@ -1652,9 +1657,9 @@ class SnapshotProcessor(HDF5Container):
|
||||
self._sinks,
|
||||
group="/datasets",
|
||||
unit={
|
||||
"Id": U.none,
|
||||
"M": U.Msun,
|
||||
"dmf": U.Msun,
|
||||
"id": U.none,
|
||||
"msink": U.Msun,
|
||||
"dmfsink": U.Msun,
|
||||
"x": "unit_density",
|
||||
"y": "unit_density",
|
||||
"z": "unit_density",
|
||||
@@ -1662,14 +1667,24 @@ class SnapshotProcessor(HDF5Container):
|
||||
"vy": "unit_velocity",
|
||||
"vz": "unit_velocity",
|
||||
"rot_period": "unit_time",
|
||||
"lx": U.none,
|
||||
"ly": U.none,
|
||||
"lz": U.none,
|
||||
"acc_rate": U.none,
|
||||
"lx": {"unit_mass" : 1, "unit_length" : 2, "unit_time" : -1},
|
||||
"ly": {"unit_mass" : 1, "unit_length" : 2, "unit_time" : -1},
|
||||
"lz": {"unit_mass" : 1, "unit_length" : 2, "unit_time" : -1},
|
||||
"acc_rate": {"unit_mass" : 1, "unit_time" : -1},
|
||||
"acc_lum": U.none,
|
||||
"age": U.year,
|
||||
"int_lum": U.none,
|
||||
"Teff": U.K,
|
||||
"level": U.none,
|
||||
"mbh": "unit_mass",
|
||||
"tform": "unit_time",
|
||||
"del_mass": U.Msun,
|
||||
"rho_gas": "unit_density",
|
||||
"cs**2": {"unit_velocity" : 2},
|
||||
"etherm": {"unit_mass" : 1, "unit_velocity" : 2},
|
||||
"vx_gas": "unit_velocity",
|
||||
"vy_gas": "unit_velocity",
|
||||
"vz_gas": "unit_velocity",
|
||||
},
|
||||
),
|
||||
"pspec": Rule(self, self._pspec, "Power spectrum", "/hdf5"),
|
||||
|
||||
Reference in New Issue
Block a user