Repository navigation
Conversation
…umber (#931) get_input_project_file returned shared/manualreduce or autoreduce as soon as the folder existed, even without HB2B_<run>.h5; the load then failed and the windows went on into a NoneType crash. It now returns the folder that holds the run's file (manual, then auto; auto only), or raises a RuntimeError naming the file and folders, which the windows show. Combine runs by run number passed those folders on as project files and never worked: it now uses <folder>/HB2B_<run>.h5, and loadRunNumbers shows lookup errors in a pop-up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: truePre-merge checks:
|
…rors - Texture window: parse the run number once, so " 1060" or "01060" loads HB2B_1060.h5, the file the lookup checked. - Combine runs: Python ints (np.int16 overflowed above 32767); a range a:b includes b, and a range with more than two ends is refused; a run that cannot be found raises instead of being silently dropped (FileNotFoundError is now shown); fewer than two runs says so (and clears the choice) instead of exporting a previous combination or crashing; a new combine forgets the previous one; cancelling Browse or the save dialog does nothing. - NeXus lookup: finddata's CalledProcessError and an empty FileFinder result become RuntimeError; the peak-fitting, texture, combine-runs and manual-reduction windows show it in a pop-up. - Tests: the real lookup over a synthetic shared/ tree; combine by run number end to end on real data; the #931 crash path in peak fitting; padded run numbers in texture; manual reduction's unknown run; the archive test checks the file. Defects recorded, not fixed: - Peak-fitting load_and_plot and texture load_project_plot continue after a project file fails to load (e.g. a non-project file picked in the file dialog) into a NoneType error; proposed and declined (#931). To be added to docs/deferred_defects.md once #1026 brings that file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fanchercm
marked this pull request as draft
November 10, 2026 18:16
# Conflicts: # tests/ui/test_peak_fitting.py # tests/ui/test_texture_fitting.py
# Conflicts: # docs/ground_truths.md
…file Conflicts resolved: - combine_runs_viewer.py: keep #1026's saveFileDialogNXstress and its `-> None` on loadRunNumbers, with #931's error handling in it. - tests/ui (merge_projectfiles, peak_fitting, texture_fitting): keep both sides' new tests. #1026's test_load_project_files_auto_prompt_calls_both_save_dialogs_in_order stubbed load_combine_projects to return None; with #931's check that a combine happened (fewer than two runs -> error dialog) the stub now returns 1, as the real method does, instead of hanging on a modal dialog. Defects recorded, not fixed: - DD-11: the peak-fitting and texture windows carry on after a project file fails to load, into a NoneType error (proposed and declined, #931). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing half Since #1026, PeakFittingViewer.load_and_plot returns after a failed load and records current_hidra_file_name only on success, which is the fix B that #931 proposed. DD-11 and the #931 ground-truths section now say so. Defects recorded, not fixed: - DD-11: the texture-fitting window carries on after a project file fails to load (proposed and declined, #931). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… lookup notes Tests (no production change): - test_combine_by_run_number cleared the shared window's combination first; it passed even with loading switched off. It now resets the model, asserts the exact run files and messages, and uses two ranges. - test_single_run_does_not_offer_export stubs both export dialogs and gives the model a workspace with geometry, so a regression fails instead of hanging on a modal dialog. - New: bad run entries show one error (GUI); a failed combine clears the previous combination (unit). - NeXus lookup tests go through the public get_nexus_file. - Manual reduction test checks the lookup's message reaches the user. - Window state (typed text, chosen files, file name) is restored after each test; runs are linked or stubbed instead of copied. Docs: DD-11 describes the texture window's mixed state accurately; the NeXus lookup note says an empty result falls back to finddata. The manual-reduction comment no longer cites a nonexistent defect number. Defects recorded, not fixed: - DD-11: the texture-fitting window carries on after a project file fails to load (proposed and declined, #931). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…der; unreadable files reported Each approved separately, from the second review of #1089: - gui_helper.parse_integers: a range includes its end, as in combine runs and manual reduction ("1327:1330" was 3 runs in peak fitting, 4 elsewhere). Affects the peak-fitting run and sub-run boxes; selection only, no computed value changes. - Combine runs: runs keep the order typed (it numbers the combined file's sub-runs), a repeated run is combined once, and empty entries (a trailing comma) are skipped. - Combine runs' load_project_files also reports OSError (missing or non-HDF5 file) and KeyError (not a project file) instead of letting them escape the Qt slot. - Peak fitting's load_run_number parses the run box inside its try, so text such as "abc" is reported. - Type hints on get_input_project_file and the combine-runs parsers. - Tests for each, each failing without its change; parse_integers' test now asserts its results. Defects recorded, not fixed: - DD-11: the texture-fitting window carries on after a project file fails to load (proposed and declined, #931). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oxes; record DD-12 to DD-14 The 2D-plot sub-run box selects 0-based array positions (never the first), so "1:5" now plots sub-runs 2-6 for a file numbered 1..N (it was 2-5), not sub-run 5 as the ground truths said; the plot-sub-runs box mixes positions (one entry) and numbers (several). Kept for all three boxes (owner's decision with the corrected effect). Defects recorded, not fixed: - DD-12: peak fitting's sub-run boxes disagree on positions vs numbers; the 2D box can never plot the first sub-run. - DD-13: a missing sub-run in plot_diff_data raises IndexError, which escapes the Qt slot. - DD-14: CombineRunsModel.combine_project_files leaks a project-file handle when reading its record fails, and keeps a partial workspace after a failed append (latent). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts with #1027 (in next) resolved: - texture_fitting_viewer: next's load_project_plot(path) is called with #931's validated run_number - test_merge_projectfiles: the stand-in combine returns 1 (#931's count) on next's three-sub-run workspace; minimal_HidraWorkspace now requires sub_runs - test_peak_fitting: both new tests kept - test_texture_fitting: the load_project_plot stand-in records the path it is given (new signature) - docs: both sides kept; this branch's DD-11..14 unchanged Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # docs/deferred_defects.md # docs/ground_truths.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Loading by run number crashed with a
'NoneType' object has no attribute …error when a run was in the database but its project file had never been reduced, or couldn't be found.Root cause:
get_input_project_file(run)returnedshared/manualreduceorshared/autoreduceas soon as the folder existed, without checking thatHB2B_<run>.h5was in it. The load then failed, and both windows carried on into the empty workspace:load_and_plot→get_subruns_limit;load_project_plot→model.sub_runs.Changes (each approved individually)
get_input_project_filereturns a folder only if it holdsHB2B_<run>.h5.manualreduce, thenautoreduce. "auto":autoreduceonly.RuntimeError, naming the file and the folders searched ("has the run been reduced yet?"). The peak-fitting and texture windows already show that in a pop-up.<folder>/HB2B_<run>.h5.loadRunNumbersshows lookup errors in a pop-up. Without that, A would have made a missing run an unhandled error in the slot.Effect: no computed value changes. When the preferred folder holds the run's file, the lookup returns the same folder as before. A run only in
autoreducenow loads from there with "manual" preferred. A run that was never reduced gets a clear message instead of a crash.Not included
Both windows still continue after a load that fails for another reason, e.g. a file picked in the file dialog that isn't a project file. Making them stop was proposed but not approved; it's recorded in
docs/ground_truths.md. For run numbers, A stops a missing file before any load is attempted.Tests
tests/unit/pyrs/utilities/test_input_project_file.py: a syntheticshared/{manualreduce,autoreduce}tree, covering the preferred folder, the fallback to autoreduce, and missing files.tests/unit/pyrs/interface/combine_runs/test_combine_runs_crtl.py: run numbers become project-file paths, and a missing run raises.tests/ui/test_merge_projectfiles.py::test_load_missing_run_number_reports: a missing run shows a pop-up.pixi run mypy pyrs scripts tests) and the pre-commit hooks.test_get_input_project_file(skipped without/HFIR) now also requiresHB2B_1060.h5to be in IPTS-22731'smanualreduce.Closes #931
🤖 Generated with Claude Code