def snapshot(self, *args, **kwargs): req = ServerInstruction(operation=Operation.call, call_spec=CallSpec(target=self.remotePath + '.snapshot', args=args, kwargs=kwargs)) return self.askServer(req)
def call(self, target, *args, **kwargs): msg = ServerInstruction(operation=Operation.call, call_spec=CallSpec( target=target, args=args, kwargs=kwargs, )) return self.ask(msg)
def snapshot(self, instrument: str = None, *args, **kwargs): msg = ServerInstruction(operation=Operation.call, call_spec=CallSpec( target='snapshot' if instrument is None else f"{instrument}.snapshot", args=args, kwargs=kwargs, )) return self.ask(msg)
def getParamDict(self, instrument: str = None, attrs: List[str] = ['value'], *args, **kwargs): msg = ServerInstruction(operation=Operation.get_param_dict, serialization_opts=ParameterSerializeSpec( path=instrument, attrs=attrs, args=args, kwargs=kwargs, )) return self.ask(msg)
def create_instrument(self, instrument_class: str, name: str, *args: Any, **kwargs: Any) -> ProxyInstrumentModule: """ create a new instrument on the server and return a proxy for the new instrument. :param instrument_class: Class of the instrument to create or a string of of the class :param name: Name of the new instrument :param args: Positional arguments for new instrument instantiation :param kwargs: Keyword arguments for new instrument instantiation :returns: a new virtual instrument """ req = ServerInstruction(operation=Operation.create_instrument, create_instrument_spec=InstrumentCreationSpec( instrument_class=instrument_class, name=name, args=args, kwargs=kwargs)) _ = self.ask(req) return ProxyInstrumentModule(name=name, cli=self, remotePath=name)
def _getBluePrintFromServer(self, path): req = ServerInstruction(operation=Operation.get_blueprint, requested_path=path) return self.askServer(req)
def setParameters(self, parameters: Dict[str, Any]): msg = ServerInstruction( operation=Operation.set_params, set_parameters=parameters, ) return self.ask(msg)
def getBluePrint(self, path): msg = ServerInstruction( operation=Operation.get_blueprint, requested_path=path, ) return self.ask(msg)
def list_instruments(self) -> Dict[str, str]: """ Get the existing instruments on the server """ msg = ServerInstruction(operation=Operation.get_existing_instruments) return self.ask(msg)
def wrap(*a, **k): msg = ServerInstruction(operation=Operation.call, call_spec=CallSpec(target=bp.path, args=a, kwargs=k)) return self.askServer(msg)
def _remoteGet(self): msg = ServerInstruction(operation=Operation.call, call_spec=CallSpec(target=self.remotePath, )) return self.askServer(msg)
def _remoteSet(self, value: Any): msg = ServerInstruction(operation=Operation.call, call_spec=CallSpec(target=self.remotePath, args=(value, ))) return self.askServer(msg)