-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add initial orchestrators idea #1169
Closed
Closed
Changes from all commits
Commits
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 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,41 @@ | ||
from .detectors import SimDetector | ||
|
||
|
||
class SimDetectorOrch(SimDetector): | ||
def configure_peaks(self, **kwargs): | ||
""" | ||
Grid: dict {"Start": (M,N), "Width": (J,K), "Num": (W,L), | ||
"Step": (P,Q)} | ||
|
||
Configures the driver to create a grid of Peaks. | ||
""" | ||
|
||
grid = kwargs.get("grid") | ||
|
||
# Most intuitive configuration is set | ||
# using grid. | ||
if grid is not None: | ||
start_tuple = grid["Start"] | ||
width_tuple = grid["Width"] | ||
num_tuple = grid["Num"] | ||
step_tuple = grid["Step"] | ||
|
||
self.cam.peak_start.put(start_tuple) | ||
self.cam.peak_width.put(width_tuple) | ||
self.cam.peak_num.put(num_tuple) | ||
self.cam.peak_step.put(step_tuple) | ||
|
||
# Making it possible to oberride other parameters that | ||
# are not basically necessary but influence on the | ||
# configuration | ||
properties = { | ||
kwargs.get("variation"): self.cam.peak_variation, | ||
kwargs.get("gain"): self.cam.gain, | ||
kwargs.get("gain_xy"): self.cam.gain_xy, | ||
} | ||
|
||
for _property in properties.keys(): | ||
if _property is not None: | ||
properties[_property].put(_property) | ||
|
||
self.cam.sim_mode.put(1) |
This file contains 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,43 @@ | ||
from .plugins import ProcessPlugin | ||
|
||
|
||
class ProcessPluginOrch(ProcessPlugin): | ||
def configure_average(self, num_to_avg=1, **kwargs): | ||
""" | ||
num_to_avg: int | ||
|
||
Configures ProcessPlugin to output | ||
and average of the last num_to_avg images | ||
""" | ||
|
||
# Most intuitive configuration is | ||
# set by default. Can be overriden by user with kwargs. | ||
self.enable_background.put(0) | ||
self.enable_flat_field.put(0) | ||
self.enable_offset_scale.put(0) | ||
|
||
self.enable_filter.put(1) | ||
self.enable.put(1) | ||
self.filter_type.put(1) # Average | ||
|
||
self.auto_reset_filter.put(num_to_avg) | ||
self.filter_callbacks.put(1) # Array N only | ||
self.num_filter.put(num_to_avg) | ||
|
||
# Overriding with kwargs part | ||
properties = { | ||
kwargs.get("enable_background"): self.enable_background, | ||
kwargs.get("enable_flat_field"): self.enable_flat_field, | ||
kwargs.get("enable_offset_scale"): self.enable_offset_scale, | ||
kwargs.get("enable_filter"): self.enable_filter, | ||
kwargs.get("enable"): self.enable, | ||
kwargs.get("filter_type"): self.filter_type, | ||
kwargs.get("auto_reset_filter"): self.auto_reset_filter, | ||
kwargs.get("filter_callbacks"): self.filter_callbacks, | ||
kwargs.get("num_filter"): self.num_filter, | ||
kwargs.get("reset_filter"): self.reset_filter, | ||
} | ||
|
||
for _property in properties.keys(): | ||
if _property is not None: | ||
properties[_property].put(_property) |
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.
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.
This is going to make the keys the values in kwargs (many of which will be
None
). I think what you want is something likeThere 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.
I tried something similar to:
but for some reason the operation completed without errors but also without changing the PV values.
I tried testing again now but for some reason, cloning my own fork, installing it with pip and testing it with the same SimDetector IOC container image i used before throws an NotImplementedError every time i try to execute a put operation... what am i doing wrong?
shouldnt this be implemented in the base class?