Esempio n. 1
0

# SWIFT gives the conversion to cgs as an attribute, use this concisely
def to_cgs(path, fname, hpath):
    return hdf5_get(path,
                    fname,
                    hpath,
                    attr='Conversion factor to physical CGS '
                    '(including cosmological corrections)')


# a
extractors['a'] = extractor(keytype='header',
                            filetype='snapshot',
                            dependencies=tuple(),
                            hpath='/Header',
                            attr='Scale-factor',
                            convert=lambda vals, raw, path, fname, hpath: raw,
                            units=U.dimensionless_unscaled,
                            unit_convert=None)

# h
extractors['h'] = extractor(keytype='header',
                            filetype='snapshot',
                            dependencies=tuple(),
                            hpath='/Cosmology',
                            attr='h',
                            convert=lambda vals, raw, path, fname, hpath: raw,
                            units=U.dimensionless_unscaled,
                            unit_convert=None)

# Lbox
Esempio n. 2
0
def mu(vals):
    return 1. / (vals.fH + .25 * vals.fHe)


# convenience function to get cosmology utility
def cosmo(vals):
    return FlatLambdaCDM(H0=vals.h * 100. * U.km * U.s**-1 * U.Mpc**-1,
                         Om0=vals.Omega0,
                         Ob0=vals.Omegab)


# a
extractors['a'] = extractor(keytype='header',
                            filetype='snapshot',
                            dependencies=tuple(),
                            hpath='/Header',
                            attr='Time',
                            convert=lambda vals, raw, path, fname, hpath: raw,
                            units=U.dimensionless_unscaled,
                            unit_convert=None)

# h
extractors['h'] = extractor(keytype='header',
                            filetype='snapshot',
                            dependencies=tuple(),
                            hpath='/Header',
                            attr='HubbleParam',
                            convert=lambda vals, raw, path, fname, hpath: raw,
                            units=U.dimensionless_unscaled,
                            unit_convert=None)

# code_to_g
Esempio n. 3
0
    snapshots[snap_id(level=level, phys=phys, halo=halo, snap=snapnum)] = {
        'group': (group_path, group_file),  # omit .X.hdf5
        'snapshot': (snapshot_path, snapshot_file),  # omit .X.hdf5
    }

# define a mnemonic suffix for each particle type in AURIGA
T = {'g': '0', 'dm': '1', 'b2': '2', 'b3': '3', 's': '4', 'bh': '5'}

# column order for abundance tables
elements = ['H', 'He', 'C', 'N', 'O', 'Ne', 'Mg', 'Si', 'Fe']

# a
extractors['a'] = extractor(keytype='header',
                            filetype='snapshot',
                            dependencies=tuple(),
                            hpath='/Header',
                            attr='Time',
                            convert=lambda vals, raw, path, fname, hpath: raw,
                            units=U.dimensionless_unscaled,
                            unit_convert=None)

# h
extractors['h'] = extractor(keytype='header',
                            filetype='snapshot',
                            dependencies=tuple(),
                            hpath='/Header',
                            attr='HubbleParam',
                            convert=lambda vals, raw, path, fname, hpath: raw,
                            units=U.dimensionless_unscaled,
                            unit_convert=None)

# Lbox