Reorganize HNL DIS spline directories under resources/processes#102
Reorganize HNL DIS spline directories under resources/processes#102austinschneider wants to merge 1 commit into
Conversation
Squashed diff for paths: - resources/processes/HNLDISSplines - resources/processes/DipoleHNLDISSplines - vendor/cereal - vendor/delabella - vendor/photospline - vendor/pybind11 Source commits on dev/HNL_DIS_clean that contributed: 088b1cd (Nicholas Kamp): move around the HNL DIS fits files 503f918 (Nicholas Kamp): add the processes.py for the HNL splines
da5daf5 to
4112bfa
Compare
3c2cad2 to
af5236c
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Reorganizes HNL DIS spline resources under resources/processes/* and adds Python helpers for loading spline-based interaction processes.
Changes:
- Adds
processes.pyloaders for HNLDIS and Dipole HNLDIS spline bundles (v1.0/v2.0). - Adds Dipole HNLDIS spline
.datresources forM_0001000MeV. - Moves/organizes resources into versioned directories under
resources/processes/.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/processes/HNLDISSplines/HNLDISSplines-v2.0/processes.py | Adds loader helpers for HNLDIS spline processes (v2.0). |
| resources/processes/HNLDISSplines/HNLDISSplines-v1.0/processes.py | Adds loader helpers for HNLDIS spline processes (v1.0). |
| resources/processes/DipoleHNLDISSplines/DipoleHNLDISSpline-v2.0/processes.py | Adds loader helpers for dipole HNLDIS spline processes (v2.0). |
| resources/processes/DipoleHNLDISSplines/DipoleHNLDISSpline-v1.0/processes.py | Adds loader helpers for dipole HNLDIS spline processes (v1.0). |
| resources/processes/DipoleHNLDISSplines/DipoleHNLDISSpline-v1.0/M_0001000MeV/sigma-nubar-N-nc-GRV98lo_patched_central.dat | Adds tabulated dipole cross-section data for nubar, NC. |
| resources/processes/DipoleHNLDISSplines/DipoleHNLDISSpline-v1.0/M_0001000MeV/sigma-nubar-N-em-GRV98lo_patched_central.dat | Adds tabulated dipole cross-section data for nubar, EM. |
| resources/processes/DipoleHNLDISSplines/DipoleHNLDISSpline-v1.0/M_0001000MeV/sigma-nu-N-nc-GRV98lo_patched_central.dat | Adds tabulated dipole cross-section data for nu, NC. |
| resources/processes/DipoleHNLDISSplines/DipoleHNLDISSpline-v1.0/M_0001000MeV/sigma-nu-N-em-GRV98lo_patched_central.dat | Adds tabulated dipole cross-section data for nu, EM. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def _get_process_types(process_types): | ||
| if process_types is None: | ||
| process_types = ["CC", "NC"] | ||
|
|
||
| for i, p in enumerate(process_types): | ||
| if p not in processes: | ||
| raise ValueError(f"process_types[{i}] \"{p}\" not supported. Allowed proccesses are {processes}") | ||
|
|
||
| if len(process_types) == 0: | ||
| print("Warning: len(process_types) == 0") | ||
|
|
||
| return process_types |
There was a problem hiding this comment.
_get_process_types references processes, but processes is not defined in this module, so calling this helper will raise NameError. Either define an allowed-processes collection (e.g., processes = {'CC','NC'}) in this file or remove this helper if process selection isn’t supported here.
| m4_str = f"{int(m4_MeV):07d}" | ||
| m4_GeV = m4_GeV = float(m4_MeV)*1e-3 |
There was a problem hiding this comment.
m4_MeV defaults to None but is immediately used in int(m4_MeV) / float(m4_MeV), which will raise TypeError when the caller relies on defaults. Make m4_MeV a required argument (no default) or explicitly validate and raise a clear ValueError when it’s missing. Also, the m4_GeV = m4_GeV = ... double-assignment should be corrected.
| m4_str = f"{int(m4_MeV):07d}" | |
| m4_GeV = m4_GeV = float(m4_MeV)*1e-3 | |
| if m4_MeV is None: | |
| raise ValueError("m4_MeV must be provided") | |
| m4_str = f"{int(m4_MeV):07d}" | |
| m4_GeV = float(m4_MeV) * 1e-3 |
| dxs_file = os.path.join(base_path, f"M_0000000MeV/dsdxdy-nu-N-nc-GRV98lo_patched_central.fits") | ||
| xs_file = os.path.join(base_path, f"M_{m4_str}MeV/sigma-nu-N-nc-GRV98lo_patched_central.fits") |
There was a problem hiding this comment.
nunubar is computed but not used when building filenames: both dxs_file and xs_file are hardcoded to nu. This will load neutrino splines even when primary is an antineutrino. Use nunubar in the filenames (consistent with the non-dipole loader) so nubar primaries load ...-nubar-... resources.
| dxs_file = os.path.join(base_path, f"M_0000000MeV/dsdxdy-nu-N-nc-GRV98lo_patched_central.fits") | |
| xs_file = os.path.join(base_path, f"M_{m4_str}MeV/sigma-nu-N-nc-GRV98lo_patched_central.fits") | |
| dxs_file = os.path.join(base_path, f"M_0000000MeV/dsdxdy-{nunubar}-N-nc-GRV98lo_patched_central.fits") | |
| xs_file = os.path.join(base_path, f"M_{m4_str}MeV/sigma-{nunubar}-N-nc-GRV98lo_patched_central.fits") |
| isoscalar = True | ||
|
|
||
| if not isoscalar: | ||
| raise ValueError("Non-isoscalar splines are not supported for CSMSDISSplines-v1.0") |
There was a problem hiding this comment.
The error message references CSMSDISSplines-v1.0, but this module is under HNLDISSplines/HNLDISSplines-v1.0. Updating the message to the correct spline family/version will make failures easier to diagnose (same issue appears in the v2.0 and dipole variants).
| raise ValueError("Non-isoscalar splines are not supported for CSMSDISSplines-v1.0") | |
| raise ValueError("Non-isoscalar splines are not supported for HNLDISSplines-v1.0") |
|
|
||
| for i, p in enumerate(process_types): | ||
| if p not in processes: | ||
| raise ValueError(f"process_types[{i}] \"{p}\" not supported. Allowed proccesses are {processes}") |
There was a problem hiding this comment.
Correct spelling in the error message: 'proccesses' → 'processes'.
| raise ValueError(f"process_types[{i}] \"{p}\" not supported. Allowed proccesses are {processes}") | |
| raise ValueError(f"process_types[{i}] \"{p}\" not supported. Allowed processes are {processes}") |
| from typing import Tuple, List, Any, Optional | ||
| import siren | ||
| import collections |
There was a problem hiding this comment.
This module defines several unused items: Tuple/Any imports, neutrino_types/antineutrino_types, and primary_processes. Since these are new files and the full module is shown in the diff, consider removing unused imports/variables to keep the loader minimal and reduce confusion (same pattern appears in the v1.0 and dipole variants).
| from typing import Tuple, List, Any, Optional | |
| import siren | |
| import collections | |
| from typing import List, Optional | |
| import siren |
| neutrino_types = [t for t in primary_types if t in neutrinos] | ||
| antineutrino_types = [t for t in primary_types if t in antineutrinos] |
There was a problem hiding this comment.
This module defines several unused items: Tuple/Any imports, neutrino_types/antineutrino_types, and primary_processes. Since these are new files and the full module is shown in the diff, consider removing unused imports/variables to keep the loader minimal and reduce confusion (same pattern appears in the v1.0 and dipole variants).
| m4_str = f"{int(m4_MeV):07d}" | ||
| m4_GeV = m4_GeV = float(m4_MeV)*1e-3 | ||
|
|
||
| primary_processes = [] |
There was a problem hiding this comment.
This module defines several unused items: Tuple/Any imports, neutrino_types/antineutrino_types, and primary_processes. Since these are new files and the full module is shown in the diff, consider removing unused imports/variables to keep the loader minimal and reduce confusion (same pattern appears in the v1.0 and dipole variants).
4112bfa to
4a7e297
Compare
af5236c to
d8afcb8
Compare
4a7e297 to
e68be1a
Compare
d8afcb8 to
2390c7f
Compare
e68be1a to
b179a08
Compare
2390c7f to
94b2c44
Compare
|
Closing to reopen from the commit author's account so they can be added as a reviewer. Branch unchanged; will be re-linked from the new PR shortly. |
Stack: PR 4 of 14
This PR is part of a 14-PR stack decomposing
dev/HNL_DISinto reviewable chunks.feat/detectors-resourceschore/file-reorgMerge order:
feat/detectors-resourcesshould land before this PR.Squashed contents
Squashed diff for paths:
Source commits on dev/HNL_DIS_clean that contributed:
088b1cd (Nicholas Kamp): move around the HNL DIS fits files
503f918 (Nicholas Kamp): add the processes.py for the HNL splines
Notes
dev/HNL_DIS_clean..fitsdata files have been removed from the branch and are packaged separately.