Skip to content

Adds qt-like signals to Parameters#548

Open
MarcusZuber wants to merge 2 commits into
masterfrom
signals-for-parameters
Open

Adds qt-like signals to Parameters#548
MarcusZuber wants to merge 2 commits into
masterfrom
signals-for-parameters

Conversation

@MarcusZuber

@MarcusZuber MarcusZuber commented Apr 10, 2025

Copy link
Copy Markdown
Member

I was looking for an elegant way to connect different Parameterizable-Parameters and had this idea.

This uses https://github.com/nexconnectio/pynnex which implements qt-like signals and slots and is quite light-weight. Currently, the development is quite active and looks clean.

Example:

from concert.devices.cameras.dummy import Camera
camera = await Camera()

def print_value(val):
   print(value)

camera['exposure_time'].value_set.connect(print_value)
camera.exposure = 1*q.s


exp = await CT(...)
reco = await OnlineReco(...)

exp['num_projections'].value_set.connect(reco, reco.set_number)

One motivation for this would be to couple experiment parameters with addon-parameters (the number of the online-reco couples with the num_projections of the CT experiment).

TODO:

  • Tests
  • Doc

Parameters emit signals when the value and limits is changed by the user.
@MarcusZuber MarcusZuber force-pushed the signals-for-parameters branch from e6b807a to 7926fe0 Compare April 10, 2025 07:33
@codecov

codecov Bot commented Apr 10, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.75000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.73%. Comparing base (2eb3060) to head (5bfb527).
⚠️ Report is 24 commits behind head on master.

Files with missing lines Patch % Lines
concert/base.py 90.90% 2 Missing ⚠️
concert/tests/unit/test_signals.py 96.15% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #548      +/-   ##
==========================================
+ Coverage   82.85%   83.73%   +0.88%     
==========================================
  Files         133      134       +1     
  Lines       10928    11022      +94     
==========================================
+ Hits         9054     9229     +175     
+ Misses       1874     1793      -81     

☔ 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.

@MarcusZuber

Copy link
Copy Markdown
Member Author

Works only with python3.10+. 3.9 will be EOL this October. I don't think we will do a new realease before...

@tfarago

tfarago commented Nov 12, 2025

Copy link
Copy Markdown
Contributor

Doesn't psutil work only on linux? I get the motivation but the concrete cases you mentioned could be also handled without signals, or? Let's discuss this Friday in the meeting.

@MarcusZuber

Copy link
Copy Markdown
Member Author

I did' t add psutil here... Sure, lets discuss it on Friday.

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.

2 participants