From 1cecfd0afd8939a213dc78ef1f42bc770b3cbe1e Mon Sep 17 00:00:00 2001 From: "Gaetan Facchinetti (gaetan.facchinetti@ulb.be)" Date: Wed, 12 Jun 2024 08:19:17 +0200 Subject: [PATCH] new modifications here --- src/py21cmcast/core.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/py21cmcast/core.py b/src/py21cmcast/core.py index 253f71c..854d3de 100644 --- a/src/py21cmcast/core.py +++ b/src/py21cmcast/core.py @@ -687,8 +687,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