File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -168,6 +168,39 @@ def write_fits_BinTable_file(
168168 hdu_list .writeto (output_path , overwrite = True )
169169
170170
171+ def read_fits_to_dict (file_path ):
172+ """Read Fits To Dict.
173+
174+ Read FITS file and return dictionary.
175+
176+ Parameters
177+ ----------
178+ file_path : str
179+ input file path
180+
181+ Returns
182+ -------
183+ dict
184+ file content
185+
186+ Raises
187+ ------
188+ IOError
189+ if input file is not found
190+ """
191+ if not os .path .exists (file_path ):
192+ raise IOError (f"Input file '{ file_path } ' not found" )
193+
194+ hdu_list = fits .open (file_path )
195+ data_input = hdu_list [1 ].data
196+ col_names = hdu_list [1 ].data .dtype .names
197+ data = {}
198+ for col_name in col_names :
199+ data [col_name ] = data_input [col_name ]
200+
201+ return data
202+
203+
171204def bin_edges2centers (bin_edges ):
172205 """Bin Edges To Centers.
173206
Original file line number Diff line number Diff 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" )
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ authors = ["Martin Kilbinger <martin.kilbinger@cea.fr>"]
66readme = " 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 "
1111camb = " 1.5.4"
1212datetime = " ^5.5"
1313numpy = " ^1.26.4"
You can’t perform that action at this time.
0 commit comments