diff --git a/Framework/PythonInterface/plugins/algorithms/GetLiveInstrumentValue.py b/Framework/PythonInterface/plugins/algorithms/GetLiveInstrumentValue.py index 5f63a0bc5555cbc0e4563f4c309e4b7dfa727b8e..a857a0c21e91b2aa9bfcd1f85f0b7c9c643c5907 100644 --- a/Framework/PythonInterface/plugins/algorithms/GetLiveInstrumentValue.py +++ b/Framework/PythonInterface/plugins/algorithms/GetLiveInstrumentValue.py @@ -58,14 +58,29 @@ class GetLiveInstrumentValue(DataProcessorAlgorithm): else: return ':CS:SB:' - def _get_live_value(self): + @staticmethod + def _caget(pvname, as_string=False): + """Retrieve an EPICS PV value""" try: - from epics import caget + from CaChannel import CaChannel, CaChannelException, ca except ImportError: - raise RuntimeError("PyEpics must be installed to use this algorithm. " - "For details, see https://www.mantidproject.org/PyEpics_In_Mantid") + raise RuntimeError("CaChannel must be installed to use this algorithm. " + "For details, see https://www.mantidproject.org/CaChannel_In_Mantid") + if as_string: + dbr_type = ca.DBR_STRING + else: + dbr_type = None + try: + chan = CaChannel(pvname) + chan.setTimeout(5.0) + chan.searchw() + return chan.getw(dbr_type) + except CaChannelException as e: + raise RuntimeError("Error reading EPICS PV \"{}\": {}".format(pvname, str(e))) + + def _get_live_value(self): epicsName = self._prefix() + self._instrument + self._name_prefix() + self._propertyName - return caget(epicsName, as_string=True) + return self._caget(epicsName, as_string=True) def _set_output_value(self, value): if value is not None: diff --git a/docs/source/algorithms/GetLiveInstrumentValue-v1.rst b/docs/source/algorithms/GetLiveInstrumentValue-v1.rst index c93da0976e444e678da66162509a1938db9136a0..78ab36dc2c9cc0c65af512a258140bb1ab435f44 100644 --- a/docs/source/algorithms/GetLiveInstrumentValue-v1.rst +++ b/docs/source/algorithms/GetLiveInstrumentValue-v1.rst @@ -12,7 +12,7 @@ GetLiveInstrumentValue This algorithm gets live values such as run title or theta from an instrument. -Values are accessed via EPICS, so EPICS support must be installed in Mantid for this algorithm to work. This is included by default on Windows but see the instructions `here <https://www.mantidproject.org/PyEpics_In_Mantid>`_ for other platforms. +CaChannel must be installed for this algorithm to work. See the instructions `here <https://www.mantidproject.org/CaChannel_In_Mantid>`_. The instrument must also be on IBEX or have additional processes installed to supply the EPICS values. If it does not, you will get an error that the requested value could not be found. diff --git a/docs/source/interfaces/ISIS Reflectometry.rst b/docs/source/interfaces/ISIS Reflectometry.rst index b20f2fab93624916583a67a5741bca4a33b2cfb2..253daa9ee02676155185311cd56b1329512123ac 100644 --- a/docs/source/interfaces/ISIS Reflectometry.rst +++ b/docs/source/interfaces/ISIS Reflectometry.rst @@ -497,7 +497,7 @@ Interface to re-link it. Live data monitoring has the following requirements: -- EPICS support must be installed in Mantid. This is included by default on Windows but see the instructions `here <https://www.mantidproject.org/PyEpics_In_Mantid>`_ for other platforms. +- CaChannel must be installed in Mantid. See the instructions `here <https://www.mantidproject.org/CaChannel_In_Mantid>`_. - The instrument must be on IBEX or have additional processes installed to supply the EPICS values. If it does not, you will get an error that live values could not be found for `Theta` and the slits.