def get_instrument_values(self,inst_id=None,position=None,ts=None): """ given an instrument id and either a position name or timestamp return a list of (pvname,values) tuples for all PVs in that instrument. returns list_of_pv_values where list_of_pv_values is a list of (pvname,values) Note that the values returned may be None, meaning 'unknown' """ if position is not None: try: pos_id,pos_name,ts,a = self.get_positions(inst_id=inst_id,name=position)[0] except IndexError: ts = None if ts is None: return ([], 0) pvs = [i['pvname'] for i in self.inst_pvs.select(where="inst=%i" % inst_id)] data = dict.fromkeys(pvs,None) a = Archiver() for pvname in pvs: for d in a.get_data(pvname,ts-3600.0,ts)[0]: if d[0] <= ts: data[pvname] = d[1] a.db.close() pvnames = data.keys() pvnames.sort() vals = [(p,data[p]) for p in pvnames] return vals,ts