Skip to content

Commit e03701b

Browse files
committed
Added negative data index to warning
1 parent 581178f commit e03701b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

validphys2/src/validphys/pseudodata.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,14 @@ def make_replica(
239239
if np.all(shifted_pseudodata[full_mask] >= 0) or not resample_negative_pseudodata:
240240
return shifted_pseudodata
241241

242-
raise ReplicaGenerationError(f"No valid replica found after {max_tries} attempts")
242+
# Find which dataset index corresponds to the negative points, and print it out for debugging purposes
243+
negative_mask = shifted_pseudodata < 0 & full_mask
244+
negative_indices = np.where(negative_mask)[0]
245+
246+
raise ReplicaGenerationError(
247+
f"No valid replica found after {max_tries} attempts. "
248+
f"Negative global indices: {negative_indices.tolist()}"
249+
)
243250

244251

245252
def central_values_array(groups_dataset_inputs_loaded_cd_with_cuts):

0 commit comments

Comments
 (0)