Skip to content

Commit

Permalink
Merge pull request #2 from CosmoStat/develop
Browse files Browse the repository at this point in the history
Merge new commits from CosmoStat:develop
  • Loading branch information
AndreasTersenov authored Aug 11, 2023
2 parents 737671f + aea1c67 commit b4e7dc1
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.ipynb_checkpoints
__pycache__
71 changes: 71 additions & 0 deletions sp_peaks/slics.py
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

0 comments on commit b4e7dc1

Please sign in to comment.