Skip to content

Commit

Permalink
Merge pull request #35 from CosmoStat/develop
Browse files Browse the repository at this point in the history
v 0.0.6
  • Loading branch information
martinkilbinger authored Sep 14, 2023
2 parents 0e2a066 + 7f65c70 commit a9898cc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cs_util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@

from warnings import warn

__version__ = "0.0.5"
__version__ = "0.0.6"
21 changes: 21 additions & 0 deletions cs_util/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from datetime import datetime
from astropy.io import fits
from astropy.io import ascii
from astropy.table import Table


def write_header_info_sp(primary_header, name="unknown", version="unknown"):
Expand Down Expand Up @@ -106,6 +107,26 @@ def add_shear_bias_to_header(primary_header, R, R_shear, R_select, c):
primary_header["c_2"] = (c[1], "Additive bias 2nd comp")


def write_ascii_table_file(cols, names, fname):
"""Write Ascii Table File.
Write ASCII file with table data.
Parameters
----------
cols : list
data columns
names : list of str
column names
fname : str
output file name
"""
t = Table(cols, names=names)
with open(fname, "w") as fout:
ascii.write(t, fout, delimiter="\t")


def write_fits_BinTable_file(
cols,
output_path,
Expand Down
20 changes: 9 additions & 11 deletions cs_util/cosmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@
import pyccl as ccl


# Set ell_max to large value, for spline interpolation (in integral over
# C_ell to get real-space correlation functions). Avoid aliasing
# (oscillations)
ccl.spline_params.ELL_MAX_CORR = 10_000_000

ccl.spline_params.N_ELL_CORR = 5_000


def get_cosmo_default():
"""Get Cosmo Default.
Expand All @@ -44,6 +36,12 @@ def get_cosmo_default():
n_s=0.96,
)

# Set ell_max to large value, for spline interpolation (in integral over
# C _ell to get real-space correlation functions). Avoid aliasing
# ( oscillations)
cos.cosmo.spline_params.ELL_MAX_CORR = 10_000_000
cos.cosmo.spline_params.N_ELL_CORR = 5_000

return cos


Expand Down Expand Up @@ -302,9 +300,9 @@ def xipm_theo(
for corr_type in ("GG+", "GG-"):
xipm[corr_type] = ccl.correlation(
cos,
ell,
cl,
theta.to("deg"),
ell=ell,
C_ell=cl,
theta=theta.to("deg"),
type=corr_type,
)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ astropy
datetime
numpy
matplotlib
pyccl
pyccl==2.6.1
vos

0 comments on commit a9898cc

Please sign in to comment.