Skip to content

SASBDB export#3912

Draft
wpotrzebowski wants to merge 31 commits intomainfrom
sasbdb_report
Draft

SASBDB export#3912
wpotrzebowski wants to merge 31 commits intomainfrom
sasbdb_report

Conversation

@wpotrzebowski
Copy link
Copy Markdown
Contributor

@wpotrzebowski wpotrzebowski commented Apr 1, 2026

Description

This work adds and refines the SASBDB export flow in SasView: collect session, fit, sample, and instrument data; review it in a multi-tab dialog; export JSON files, a PDF report, and a SasView project snapshot.

Documentation

  • sasbdb_help.rst updated for the dialog, Guinier/Estimate, Generate Report, and supported shape models (substring-based routing in code).

Dependencies

  • FreeSAS (freesas): optional; needed only for Estimate. If unavailable, the user gets a clear message.
  • Otherwise: project-standard PySide6, matplotlib, dominate, etc.

How Has This Been Tested?

  • Automated: SASBDBDialogTest, SASBDBTest, and related qtgui tests (CI / run_tests.sh or run_tests.bat as appropriate).
  • Manual:
    1. Load 1D data; open Tools → Export to SASBDB.
    2. Check tabs, required fields, and Shape visualization after fitting e.g. sphere or core_shell_sphere.
    3. Guinier: use Estimate with and without freesas installed; confirm messages and fields when it succeeds.
    4. Export and Generate Report: outputs appear beside the chosen JSON path with expected names.
    5. macOS: Estimate does not appear as the default (blue) button before interaction.

Review Checklist

  • Code follows project style; GUI work avoids blocking the UI thread for heavy work.
  • Help (sasbdb_help.rst) matches the UI (Generate Report, Guinier/Estimate).
  • Missing freesas fails gracefully with a clear user message.
  • SASBDBDialogUI.ui changes are built into SASBDBDialogUI.py via convertUI.py (or the project UI build step).
  • Tests pass in CI (or locally where applicable).

Documentation (check at least one)

  • There is nothing that needs documenting
  • Documentation changes are in this PR
  • There is an issue open for the documentation (link?)

Installers

  • There is a chance this will affect the installers, if so
    • Windows installer (GH artifact) has been tested (installed and worked)
    • MacOSX installer (GH artifact) has been tested (installed and worked)
    • Wheels installer (GH artifact) has been tested (installed and worked)

Licensing (untick if necessary)

  • The introduced changes comply with SasView license (BSD 3-Clause)

Note:

Added Cursor rules (sasview.mdc) probably deserves a separate PR but keeping it here for the reference

… to Guinier data model and UI. Update ViewerModel to handle empty data more robustly and ensure proper data binding in SASBDBDialog. Adjust UI elements for clarity and consistency.
- Introduced a new button in the Guinier tab to estimate values using FreeSAS for 1D datasets.
- Updated the dialog to accept optional 1D data for Guinier analysis.
- Modified the UI to allow manual entry of Guinier values, enhancing user flexibility.
- Adjusted documentation to reflect changes in the Guinier tab functionality and user instructions.
- Removed automatic population of Guinier fields; users can now choose to estimate or enter values manually.
- Updated the dialog fixture to include new fields: experimental_molecular_weight, experiment_date, and beamline_instrument.
- Ensured all required fields for validation are present to prevent CI hangs during headless testing.
- Integrated qtbot for better widget management during tests.
- Added type checking in SASBDBExporter to ensure only Data1D or Data2D objects are processed for export.
- Updated SASBDBDialog to handle cases where filesWidget may be None, improving error handling.
- Refactored unit tests for SASBDBDialog to use QWidget instead of MagicMock for parent, ensuring more realistic testing scenarios.
- Improved test coverage for exporting functionality and handling of FreeSAS integration.
- Enhanced the test cases to ensure proper cleanup of dialog parent to prevent runtime errors during teardown.
- Wrapped dialog parent assignments and method calls in try-finally blocks to ensure dialogs are orphaned correctly.
- Improved exception handling in tests to gracefully manage scenarios where filesWidget or other components may be None.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant