Skip to content

Parameters#568

Draft
takluyver wants to merge 9 commits into
masterfrom
feat/params
Draft

Parameters#568
takluyver wants to merge 9 commits into
masterfrom
feat/params

Conversation

@takluyver

Copy link
Copy Markdown
Member

Supports simple parameters: boolean, integer, float or string (the same types available for user-editable variables).

Parameters go in the context file like this:

use_xgm_pulses = Parameter(bool, default=False,
                           description="Use pulse count from XGM instead of bunch pattern")

@Variable(title="Pulses", summary="mean")
def pulses(run, use_xgm: "param#use_xgm_pulses"):
    ...

The values can be edited for new runs:

image image

And changed when reprocessing:

image

They can also be set for damnit reprocess, with --param use_xgm_pulses=True.

TODO:

  • Use set parameter values in listener
  • Force select affected variables in the reprocess dialog when changing parameters (this requires the GUI to know more about variables than it does so far)
  • Tests
  • Documentation

@codecov

codecov Bot commented May 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 39.11672% with 193 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.38%. Comparing base (9175086) to head (32a56cb).

Files with missing lines Patch % Lines
damnit/gui/process.py 11.97% 125 Missing ⚠️
damnit/ctxsupport/ctxrunner.py 60.97% 16 Missing ⚠️
damnit/backend/db.py 59.45% 15 Missing ⚠️
damnit/backend/extract_data.py 38.88% 11 Missing ⚠️
damnit/ctxsupport/damnit_ctx.py 60.71% 11 Missing ⚠️
damnit/backend/extraction_control.py 60.86% 9 Missing ⚠️
damnit/gui/main_window.py 63.63% 4 Missing ⚠️
damnit/ctxsupport/damnit_writing.py 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #568      +/-   ##
==========================================
- Coverage   79.97%   78.38%   -1.60%     
==========================================
  Files          42       42              
  Lines        8070     8340     +270     
==========================================
+ Hits         6454     6537      +83     
- Misses       1616     1803     +187     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tmichela

tmichela commented Jun 1, 2026

Copy link
Copy Markdown
Member

Coupld thoughts, ideas, questions.

  1. I think I'd prefer we don't input a data type, but rather force a default value and infer the type from it, similar to what metro does. this seems more natural. value = parameter(0). It also feels like forcing a default value is a good thing, but maybe you have other use cases?
  2. I had in mind to either allow having parameters as Group fields, or (better) automatically exposing Group fields (that is of supported data type) as parameter.
  3. How do you plan to deal with changing the type of a parameter when exiting data exists already in the db?
  4. for a later iteration, but I think it will be very useful to have a clear UI view where we can see for each parameter: default value, value applied to the processed data and value that would be applied upon reprocessing.

@daniloefl

Copy link
Copy Markdown

Hello. I am working on a context file for a beamtime and this feature would be very useful. I am also using Groups and being able to set their parameters by standard would also be a very nice, because all relevant parameters are in the end group parameters.

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.

3 participants