-
Notifications
You must be signed in to change notification settings - Fork 0
Add adapter controller #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LuisFSegalla
wants to merge
12
commits into
main
Choose a base branch
from
add-adapter-controller
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c6ce3a0
Add initial version of xspress_fp_adapter_controller
LuisFSegalla 96a2c6a
Add on_update_callback for chunks and logic to cycle through all MCAs
LuisFSegalla 424f0b4
Lock FastCS-Odin
LuisFSegalla 232eb7d
Ignore put method value type until FastCS is fixed
LuisFSegalla 698a17c
change project script entrypoint
LuisFSegalla 7c61e74
update _pypi.yml
LuisFSegalla 76d9633
update fastcs-odin
LuisFSegalla e123ca7
Remove verbose from _pypi.yml
LuisFSegalla 60ab84d
add ConfigFan for file_prefix and file_path
LuisFSegalla c4934cb
Updated logic for mca_list
LuisFSegalla f41489a
Add tests for fp_adapter
LuisFSegalla 4f7c2d1
Updated old tests
LuisFSegalla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import logging | ||
|
|
||
| from fastcs.attributes import AttrRW | ||
| from fastcs_odin.controllers import ( | ||
| FrameProcessorAdapterController, | ||
| ) | ||
| from fastcs_odin.controllers.odin_subcontroller import OdinSubController | ||
| from fastcs_odin.util import get_all_sub_controllers | ||
|
|
||
|
|
||
| class XspressFPAdapterController(FrameProcessorAdapterController): | ||
| chunks: AttrRW[int] | ||
| acq_id: AttrRW[str] | ||
|
|
||
| async def initialise(self): | ||
| await super().initialise() | ||
|
|
||
| # Construct a list with all the MCA dataset chunks | ||
| mca_list = [] | ||
| for sub_controller in get_all_sub_controllers(self): | ||
| match sub_controller: | ||
| case OdinSubController(): | ||
| for parameter in sub_controller.parameters: | ||
| if "chunks" in parameter.uri and "0" in parameter.uri: | ||
| # Parameter name will be in the form of mca_X_chunks_0 | ||
| # sub_controller path will be in the form of ["FP", "X",...] | ||
| mca_list.append( | ||
| (sub_controller.path[1], parameter.name.split("_")[1]) | ||
| ) | ||
| case _: | ||
| logging.warning( | ||
| f"Subcontroller {sub_controller} not an OdinAdapterController" | ||
| ) | ||
|
|
||
| async def set_chunk_fp(value: int): | ||
| for sub_controller, mca_num in mca_list: | ||
| await self.connection.put( | ||
| f"api/0.1/fp/{sub_controller}/config/hdf/dataset/mca_{mca_num}/chunks", | ||
| [value, 1, 4096], # pyright: ignore[reportArgumentType] | ||
| ) | ||
|
|
||
| self.chunks.add_on_update_callback(callback=set_chunk_fp) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To add a test for this you could:
create a controller XspressFPAdapterController
mock super initialise
{idx}/chunks