Skip to content

Conversation

@tomeichlersmith
Copy link
Member

@tomeichlersmith tomeichlersmith commented Nov 11, 2025

I don't actually have an idea of what commands to be included here, but hopefully this is a good enough example to get the ball rolling. The basic structure of holding a pflib::Target is defined and it is shown how we can define specific functions that are then call-able from Python via the pypflib Python module.

Bindings

  • wrapping std::shared_ptr<pflib::Target> in a PyTarget which defines the various run commands
  • version namespace git_describe and tag
  • logging namespace level, open, close, set
  • packing namespace ECONDEventPacket

To Do

@tomeichlersmith tomeichlersmith force-pushed the 239-bind-run-commands-to-python branch from 15f9489 to 2f722bc Compare November 12, 2025 22:07
@tomeichlersmith tomeichlersmith marked this pull request as ready for review November 12, 2025 22:28
@tomeichlersmith
Copy link
Member Author

tomeichlersmith commented Nov 12, 2025

🚀 😎

stuff is looking good,

  • implemented a grab_pedestals function just to test handling one (real) frame of data
  • need to bind accessors for ECONDEventPacket (maybe need to bind DAQLinkFrame then?)
# on the ZCU
[eichl008@umn-zcu102-ldmx build]$ python3
Python 3.9.21 (main, Aug 19 2025, 00:00:00) 
[GCC 11.5.0 20240719 (Red Hat 11.5.0-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pypflib
>>> pypflib.logging.open(color = True)
>>> tgt = pypflib.PyTarget({})
creating { }
>>> tgt.start_run()
start_run
>>> ep = tgt.grab_pedestals()
>>> ep
<pypflib.WordVector object at 0xffffa9737c10>
>>> [hex(w) for w in ep]
['0x3ffc1051', '0xf313f02b', '0xe5006f', '0xe045801f', '0xffffffff', '0xc532000', '0xa427c00', '0xa329000', '0xb52d400', '0xd735c00', '0xd234400', '0xbf2f800', '0xdd36c00', '0xd333c00', '0xc330c00', '0xdb36c00', '0xe739c00', '0xcd33400', '0xd234c00', '0xe338800', '0xe137c00', '0xe539400', '0xcd33800', '0xd935c00', '0xcf34400', '0xc732400', '0xdf37c00', '0xcf33c00', '0xdf37c00', '0xe338c00', '0xf53c800', '0xe93a800', '0xcc33000', '0xc531c00', '0xdd36c00', '0xd334c00', '0xc932800', '0xcb33400', '0xd736400', '0xd735c00', '0xb92e400', '0xbf2fc00', '0xe043801f', '0xffffffff', '0xe639c00', '0xbf2fc00', '0xc431400', '0xd535400', '0xc230c00', '0xb72dc00', '0xbf30800', '0xa82a800', '0xd935c00', '0xcf33c00', '0xe238400', '0xcd33800', '0xd535400', '0xd634800', '0xc331400', '0xb92e400', '0xbf2fc00', '0xe93a400', '0xe338c00', '0xea3a800', '0xed3b400', '0xe539400', '0xe739800', '0xf83d800', '0xdf37c00', '0xfc3f400', '0xdd37400', '0xcf33800', '0xeb3ac00', '0xc731800', '0xcf33c00', '0xab2b000', '0xc331400', '0xd334400', '0xd134800', '0xb32dc00', '0xbd2f400', '0x6405598e']
>>> econ = pypflib.ECONDEventPacket(1)
>>> econ._from(ep[1:])
(2025-11-12 22:30:04) [decoding]  warn: Event header 8b CRC does not match trasmitted value: 00100101 != 01101111
(2025-11-12 22:30:04) [decoding]  warn: CRC over all link sub-packets does not match transmitted value 0x1586df11 != 0xe043801f

@tomeichlersmith tomeichlersmith force-pushed the 239-bind-run-commands-to-python branch from 4b4020e to 195edfa Compare November 12, 2025 23:13
@tomeichlersmith tomeichlersmith changed the title bind run commands to python bind select pflib functions to python Nov 13, 2025
@tomeichlersmith tomeichlersmith merged commit a6bcae9 into main Nov 13, 2025
3 checks passed
@tomeichlersmith tomeichlersmith deleted the 239-bind-run-commands-to-python branch November 13, 2025 16:40
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.

bind unpacking code to Python for access in Run Control and DQM bind specific run commands to python

2 participants