Skip to content

Commit d54113e

Browse files
Merge remote-tracking branch 'upstream/develop' into develop
2 parents ef0aa57 + 1c4cc8d commit d54113e

4 files changed

Lines changed: 40 additions & 6 deletions

File tree

cs_util/cat.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,39 @@ def write_fits_BinTable_file(
185185
hdu_list.writeto(output_path, overwrite=True)
186186

187187

188+
def read_fits_to_dict(file_path):
189+
"""Read Fits To Dict.
190+
191+
Read FITS file and return dictionary.
192+
193+
Parameters
194+
----------
195+
file_path : str
196+
input file path
197+
198+
Returns
199+
-------
200+
dict
201+
file content
202+
203+
Raises
204+
------
205+
IOError
206+
if input file is not found
207+
"""
208+
if not os.path.exists(file_path):
209+
raise IOError(f"Input file '{file_path}' not found")
210+
211+
hdu_list = fits.open(file_path)
212+
data_input = hdu_list[1].data
213+
col_names = hdu_list[1].data.dtype.names
214+
data = {}
215+
for col_name in col_names:
216+
data[col_name] = data_input[col_name]
217+
218+
return data
219+
220+
188221
def bin_edges2centers(bin_edges):
189222
"""Bin Edges To Centers.
190223

cs_util/cosmo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ def sigma_crit(z_lens, z_source, cos, d_lens=None, d_source=None):
7979

8080
a_lens = 1 / (1 + z_lens)
8181
a_source = 1 / (1 + z_source)
82-
if not d_lens:
82+
if d_lens is None:
8383
d_lens = cos.angular_diameter_distance(a_lens) * units.Mpc
84-
if not d_source:
84+
if d_source is None:
8585
d_source = cos.angular_diameter_distance(a_source) * units.Mpc
8686

8787
d_lens_source = cos.angular_diameter_distance(a_lens, a_source) * units.Mpc

cs_util/plots.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def savefig(fname, close_fig=True):
4343
fname : str
4444
output file name
4545
close_fig : bool, optional
46-
closes figure if True (default)
46+
closes figure if ``True`` (default); chose ``False``
47+
to display figure in a jupyter notebook
4748
4849
"""
4950
plt.savefig(fname, facecolor="w", bbox_inches="tight")

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ authors = ["Martin Kilbinger <martin.kilbinger@cea.fr>"]
66
readme = "README.md"
77

88
[tool.poetry.dependencies]
9-
python = ">=3.9,<3.12"
10-
astropy = "5.2"
9+
python = ">=3.9,<3.13"
10+
astropy = "^5.0"
1111
camb = "1.5.4"
1212
datetime = "^5.5"
1313
numpy = "^1.26.4"
1414
matplotlib = "^3.8.4"
1515
swig = "^4.2.1"
1616
scipy = "^1.13.0"
17-
# Install pyccl via pip
1817
vos = "^3.6.1"
1918
keyring = "^25.2.0"
19+
pyccl = "^3.0.2"
2020

2121
[tool.poetry.dev-dependencies]
2222
pytest = "^6.2.5"

0 commit comments

Comments
 (0)