-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'CosmoStat:develop' into mass_map_generator
- Loading branch information
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.ipynb_checkpoints | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
"""SLICS. | ||
:Name: slics.py | ||
:Description: This package contains methods to interface with | ||
the (Cosmo-)SLICS simulations (Hernois-Deraps et al). | ||
:Authors: Martin Kilbinger <[email protected]> | ||
""" | ||
|
||
col_names = [ | ||
"RA", | ||
"Dec", | ||
"e1_data", | ||
"e2_data", | ||
"w", | ||
"redshift_true_sim", | ||
"gamma1_sim", | ||
"gamma2_sim", | ||
"kappa_sim", | ||
"S_metacal_data", | ||
] | ||
|
||
col_names_essential = [ | ||
"RA", | ||
"Dec", | ||
"e1_data", | ||
"e2_data", | ||
"redshift_true_sim", | ||
] | ||
|
||
|
||
import os | ||
from astropy.io import ascii | ||
|
||
|
||
def read_catalogue(file_path, all_col=True): | ||
"""Read Catalogue. | ||
Read SLICS catalogue and return content. | ||
Parameters | ||
---------- | ||
file_path : str | ||
input file path | ||
all_col : bool, optional | ||
if True returns all columns; if False (default) only | ||
essential columns | ||
Raises | ||
------ | ||
IOError | ||
if input file not found | ||
Returns | ||
------- | ||
dict | ||
catalogue content | ||
""" | ||
if not os.path.exists(file_path): | ||
raise IOError(f"SLICS catlogue file {file_path} does not exist") | ||
|
||
if all_col: | ||
include_names = None | ||
else: | ||
include_names = col_names_essential | ||
|
||
dat = ascii.read(file_path, names=col_names, include_names=include_names) | ||
|
||
return dat |