Skip to content

Commit 5a82427

Browse files
Add output verbosity control (#131)
* Create and use load_numeric_block method in io/ascii.py * Disable some rules for docs/ * Initial implementation of the new tutorial * Add add_from_zip_path to Experiments collection * Update data index hash * Use data from web repo * Use another dataset * Save project after every fit * Clean up * Initial implementation of plotting parameter evolution * Replace conditions category with diffrn using CIF naming * Simplify extract_metadata API and make data loading explicit * Fix fit_results to store snapshot parameters per experiment * Clean up tutorial ed-17.py duplicate plot_param calls * Fix test to use save_as() matching current ProjectInfo.path default * Add integer index support to CollectionBase.__getitem__ * Rename plot_param to plot_param_series with versus descriptor * Clean up tutorial * Update docs with new notebook * Simplify constraints API to single expression string * Fix docstring lint errors in CollectionBase.__getitem__ * New dataset and update tutorials * Update T-scan notebook * Add fit verbosity parameter with full, short and silent modes * Update notebook * Add project-level verbosity with full, short and silent modes * Improve grammar and consistency in ed-17 tutorial * Fix docstring lint errors in data loading methods * Increase notebook cell timeout to 1200s for T-scan tutorial
1 parent 742589a commit 5a82427

23 files changed

Lines changed: 506 additions & 116 deletions

File tree

.github/workflows/tutorial-tests-colab.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ jobs:
4141

4242
- name: Check if Jupyter Notebooks run without errors
4343
run: >
44-
python -m pytest --nbmake docs/tutorials/ --nbmake-timeout=600 --color=yes
44+
python -m pytest --nbmake docs/tutorials/ --nbmake-timeout=1200 --color=yes
4545
-n=auto

docs/architecture/architecture.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@ It owns and coordinates all components:
689689
| `project.analysis` | `Analysis` | Calculator, minimiser, fitting |
690690
| `project.summary` | `Summary` | Report generation |
691691
| `project.plotter` | `Plotter` | Visualisation |
692+
| `project.verbosity` | `str` | Console output level (full/short/silent) |
692693

693694
### 7.1 Data Flow
694695

@@ -721,6 +722,47 @@ project_dir/
721722
└── hrpt.cif # One file per experiment
722723
```
723724

725+
### 7.3 Verbosity
726+
727+
`Project.verbosity` controls how much console output operations produce.
728+
It is backed by `VerbosityEnum` (in `utils/enums.py`) and accepts three
729+
values:
730+
731+
| Level | Enum member | Behaviour |
732+
| -------- | ---------------------- | -------------------------------------------------- |
733+
| `full` | `VerbosityEnum.FULL` | Multi-line output with headers, tables, and detail |
734+
| `short` | `VerbosityEnum.SHORT` | One-line status message per action |
735+
| `silent` | `VerbosityEnum.SILENT` | No console output |
736+
737+
The default is `'full'`.
738+
739+
```python
740+
project.verbosity = 'short'
741+
```
742+
743+
**Resolution order:** methods that produce console output (e.g.
744+
`analysis.fit()`, `experiments.add_from_data_path()`) accept an optional
745+
`verbosity` keyword argument. When the argument is `None` (the default),
746+
the method reads `project.verbosity`. When a string is passed, it
747+
overrides the project-level setting for that single call.
748+
749+
```python
750+
# Use project-level default for all operations
751+
project.verbosity = 'short'
752+
project.analysis.fit() # → short mode
753+
754+
# Override for a single call
755+
project.analysis.fit(verbosity='silent') # → silent, project stays short
756+
```
757+
758+
**Output styles per level:**
759+
760+
- **Data loading**`full`: paragraph header + detail line; `short`:
761+
`✅ Data loaded: Experiment 🔬 'name'. N points.`; `silent`: nothing.
762+
- **Fitting**`full`: per-iteration progress table with improvement
763+
percentages; `short`: one-row-per-experiment summary table; `silent`:
764+
nothing.
765+
724766
---
725767

726768
## 8. User-Facing API Patterns

0 commit comments

Comments
 (0)