mirror of
https://github.com/Richard-Sti/csiborgtools_public.git
synced 2025-05-21 10:01:11 +00:00
Velocity observer (#86)
* Continue if r200c not defined * Remove smooth scale * Remove smooth scale * Edit Max Matching plot * Add peculiar velocity * Add Vobs calculation * Edit docs * Add Vobs plot * Improve plotting * Edit naming convention * Make a note * Add new cat options * Update density field RSP calculation * Update field 2 rsp * Move functions and shorten documentation * Improve transforms and comments * Update docs * Update imports * Edit calculation * Add docs * Remove imports * Add Quijote flags * Edit documentation * Shorten documentation * Edit func calls * Shorten * Docs edits * Edit docs * Shorten docs * Short docs edits * Simplify docs a little bit * Save plotting * Update env
This commit is contained in:
parent
8e3127f4d9
commit
ae92fd9b72
18 changed files with 761 additions and 788 deletions
|
@ -37,21 +37,6 @@ except ModuleNotFoundError:
|
|||
def get_counts(nsim, bins, paths, parser_args):
|
||||
"""
|
||||
Calculate and save the number of haloes in each mass bin.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
nsim : int
|
||||
Simulation index.
|
||||
bins : 1-dimensional array
|
||||
Array of bin edges (in log10 mass).
|
||||
paths : csiborgtools.read.Paths
|
||||
Paths object.
|
||||
parser_args : argparse.Namespace
|
||||
Parsed command-line arguments.
|
||||
|
||||
Returns
|
||||
-------
|
||||
None
|
||||
"""
|
||||
simname = parser_args.simname
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
|
@ -75,13 +60,14 @@ def get_counts(nsim, bins, paths, parser_args):
|
|||
counts[nobs, :] = csiborgtools.number_counts(logmass, bins)
|
||||
elif simname == "quijote_full":
|
||||
cat = csiborgtools.read.QuijoteHaloCatalogue(
|
||||
nsim, paths, nsnap=4, load_fitted=False, load_initial=False)
|
||||
nsim, paths, nsnap=4, load_fitted=False, load_initial=False,
|
||||
load_backup=parser_args.from_quijote_backup)
|
||||
logmass = numpy.log10(cat["group_mass"])
|
||||
counts = csiborgtools.number_counts(logmass, bins)
|
||||
else:
|
||||
raise ValueError(f"Unknown simulation name `{simname}`.")
|
||||
|
||||
fout = paths.halo_counts(simname, nsim)
|
||||
fout = paths.halo_counts(simname, nsim, parser_args.from_quijote_backup)
|
||||
if parser_args.verbose:
|
||||
print(f"{datetime.now()}: saving halo counts to `{fout}`.")
|
||||
numpy.savez(fout, counts=counts, bins=bins, rmax=parser_args.Rmax)
|
||||
|
@ -97,6 +83,9 @@ if __name__ == "__main__":
|
|||
parser.add_argument(
|
||||
"--Rmax", type=float, default=155,
|
||||
help="High-res region radius in Mpc / h. Ignored for `quijote_full`.")
|
||||
parser.add_argument("--from_quijote_backup",
|
||||
type=lambda x: bool(strtobool(x)), default=False,
|
||||
help="Flag to indicate Quijote backup data.")
|
||||
parser.add_argument("--lims", type=float, nargs="+", default=[11., 16.],
|
||||
help="Mass limits in Msun / h.")
|
||||
parser.add_argument("--bw", type=float, default=0.2,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue