Skip to content

Commit

Permalink
modifying write cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaetan Facchinetti (gaetan.facchinetti@ulb.be) committed Jun 7, 2024
1 parent ae32301 commit c2ce2f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/py21cmcast/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def warning_on_one_line(message, category, filename, lineno, file=None, line=Non
warnings.formatwarning = warning_on_one_line


def compare_arrays(array_1 : np.ndarray, array_2 : np.ndarray, eps : float):
def compare_arrays(array_1 : np.ndarray, array_2 : np.ndarray, eps : float = 0):
"""
## Compare arrays to a certain precision
Expand Down Expand Up @@ -237,11 +237,12 @@ def __init__(self, dir_path : str, lightcone_name : str, z_bins : list = None,
self._save()



def _get_power_spectra(self):

if ((self._z_bins is None) or (self._z_bins == np.array([]))
or (self._k_bins is None) or (self._k_bins == np.array([]))
or (self._z_array is None) or (self._z_array == np.array([]))):
if ((self._z_bins is None) or compare_arrays(self._z_bins, np.array([]))
or (self._k_bins is None) or compare_arrays(self._k_bins, np.array([]))
or (self._z_array is None) or compare_arrays(self._z_array, np.array([]))):

if self._verbose:
warnings.warn("Impossible to compute the power spectra as bins are missing")
Expand Down
1 change: 1 addition & 0 deletions src/py21cmcast/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ def run_lightcone_from_config(config_file: str, n_omp: int = None, random_seed:
global_quantities = global_quantities,
direc = cache_path,
random_seed = random_seed,
write = False,
**extra_params,
**kwargs,
)
Expand Down

0 comments on commit c2ce2f3

Please sign in to comment.