-
Notifications
You must be signed in to change notification settings - Fork 9
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
make function for AD prime plugin #837
Comments
such as this definition: from apstools.devices import AD_plugin_primed
from apstools.devices import AD_prime_plugin2
def ensure_AD_plugin_primed(plugin, allow_warmup=False):
"""
Ensure the AD plugin is warmed up, if allowed.
This is a workaround for a check in area_detector_handlers which
found a mismatch in the description of the image array parameters
(size, number of bits, & color mode) between the cam and the plugin.
Even with ``lazy_open=1``, ophyd (via area_detector_handlers) checks
if the area detector HDF5 plugin has been _primed_.
We might need to prime it. Here's ophyd's test (which is not sufficient)::
if np.array(plugin.array_size.get()).sum() == 0:
logger.info(f"Priming {plugin.name} ...")
plugin.warmup()
"""
if allow_warmup:
if not AD_plugin_primed(plugin):
logger.info(f"Priming {plugin.name} ...")
AD_prime_plugin2(plugin) then replace the original call with this new one: from .. import iconfig
from apstools.devices import ensure_AD_plugin_primed
ensure_AD_plugin_primed(adsimdet.hdf1, iconfig.get("ALLOW_AREA_DETECTOR_WARMUP", False)) |
Can't this be fixed in ophyd? |
Fixing this problem in ophyd would involve removing the def stage(self):
if np.array(self.array_size.get()).sum() == 0:
raise UnprimedPlugin(
f"The plugin {self.dotted_name} on the "
f"area detector with name {self.root.name} "
f"has not been primed."
)
return super().stage() There must be other code (called by the bluesky RunEngine) which reports the image array parameters in the descriptor documents. In the case of a |
This is a common pattern:
Make it into a function.
The text was updated successfully, but these errors were encountered: