diff options
author | Aaron LI <aly@aaronly.me> | 2019-02-28 21:37:45 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2019-02-28 21:37:45 +0800 |
commit | c0c1435cd1bacc9d5f51ad9b1015fd507507cc97 (patch) | |
tree | cbef3c0e91357e2c99dcc72ea2f6ac06c563438d /fg21sim/extragalactic/clusters/main.py | |
parent | 0743d3ce488e48f43be3e4ba03a6d593ed7a7b49 (diff) | |
download | fg21sim-c0c1435cd1bacc9d5f51ad9b1015fd507507cc97.tar.bz2 |
clusters/main: Also pad merger events in halos data
Diffstat (limited to 'fg21sim/extragalactic/clusters/main.py')
-rw-r--r-- | fg21sim/extragalactic/clusters/main.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py index 8fdefb0..074758a 100644 --- a/fg21sim/extragalactic/clusters/main.py +++ b/fg21sim/extragalactic/clusters/main.py @@ -532,6 +532,13 @@ class GalaxyClusters: os.rename(outfile, outfile+".old") logger.info("Converting halos data into a Pandas DataFrame ...") + + # Pad the merger events to be same length + nmax = max([d["merger_num"] for d in self.halos]) + padkeys = ["merger_mass1", "merger_mass2", "merger_z", "merger_t"] + for d in self.halos: + pad_dict_list(d, padkeys, length=nmax) + keys_ignored = ["gamma", "spectrum", "spectrum_fiducial", "template"] keys = [k for k in self.halos[0].keys() if k not in keys_ignored] halos_df = dictlist_to_dataframe(self.halos, keys=keys) |