When running the main code using the example data, the following errors have been detected:
h2s_plots.py
An error has been detected on line 635.
with h5py.File(halo_bins_file, "r") as f:
halo_counts_bins = []
for i in range(70):
group_name = f"bin_{i:02d}"
mass = f[group_name]['Mass_shuffled'][:]
parent_mask = mass > 0
halos_in_bin = np.sum(parent_mask)
halo_counts_bins.append(halos_in_bin / (volume * bin_width))
Using the sample data, it has been observed that bins bin_57, bin_62, bin_63, bin_64, ..., bin_69 are missing.
To solve the error in the code, it is proposed to set these bins to 0, although this may mask future errors.
with h5py.File(halo_bins_file, "r") as f:
halo_counts_bins = []
for i in range(70):
group_name = f"bin_{i:02d}"
halos_in_bin = 0
if group_name in f.keys():
mass = f[group_name]['Mass_shuffled'][:]
parent_mask = mass > 0
halos_in_bin = np.sum(parent_mask)
halo_counts_bins.append(halos_in_bin / (volume * bin_width))
h2s_profile_vel
The functions fit_vr_profile and fit_vtheta_profile failed because y array was empty. To solve this failure, it proposed to add the following line of code to the functions to return None and print a warning message.
...
# Use only nonzero y (to avoid log problems)
mask = y > 0
x = x[mask]
y = y[mask]
if y.size == 0:
print("ValueError: `ydata` must not be empty!")
return None
# Initial guess: amplitudes, means, sigmas
...
main_UNIT.py
Fail fit_radial_profile function because r_fit = r[positive_mask] is empty. Maybe it is better to use a control parameter to skip this step when the data is not suitable.
When running the main code using the example data, the following errors have been detected:
h2s_plots.py
An error has been detected on line 635.
Using the sample data, it has been observed that bins
bin_57, bin_62, bin_63, bin_64, ..., bin_69are missing.To solve the error in the code, it is proposed to set these bins to 0, although this may mask future errors.
h2s_profile_vel
The functions
fit_vr_profileandfit_vtheta_profilefailed because y array was empty. To solve this failure, it proposed to add the following line of code to the functions to return None and print a warning message.main_UNIT.py
Fail
fit_radial_profilefunction becauser_fit = r[positive_mask]is empty. Maybe it is better to use a control parameter to skip this step when the data is not suitable.