Skip to content

Commit

Permalink
Merge pull request #2 from gaetanfacchinetti/idm
Browse files Browse the repository at this point in the history
new modifications here
  • Loading branch information
gaetanfacchinetti authored Jun 12, 2024
2 parents 58e5aa8 + 1cecfd0 commit 1659ef9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/py21cmcast/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,15 @@ def compute_power_spectrum_sensitivity(self):
# This makes the code longer but it is necessary to have everything well defined and no numerical problems
_, _data_arr = p21c_p.compute_powerspectra_1D(self._lightcone, chunk_indices = self._chunk_indices, remove_nans=False, vb=False)

self._k_array_sens = np.array([data['k'] for data in _data_arr])
self._power_spectrum_sens = np.array([data['delta'] for data in _data_arr])
n_k = np.max([len(data['k']) for data in _data_arr])
n_ps = np.max([len(data['delta']) for data in _data_arr])

self._k_array_sens = np.full((len(_data_arr), n_k), fill_value=np.nan)
self._power_spectrum_sens = np.full((len(_data_arr), n_ps), fill_value=np.nan)

for idata, data in enumerate(_data_arr):
self._k_array_sens[idata, 0:len(data['k'])] = data['k']
self._power_spectrum_sens[idata, 0:len(data['delta'])] = data['delta']

self._is_ps_sens_computed = True

Expand Down

0 comments on commit 1659ef9

Please sign in to comment.