aboutsummaryrefslogtreecommitdiff
path: root/qolab/tsdb
diff options
context:
space:
mode:
Diffstat (limited to 'qolab/tsdb')
-rw-r--r--qolab/tsdb/__init__.py44
1 files changed, 43 insertions, 1 deletions
diff --git a/qolab/tsdb/__init__.py b/qolab/tsdb/__init__.py
index f4d703c..b4ea644 100644
--- a/qolab/tsdb/__init__.py
+++ b/qolab/tsdb/__init__.py
@@ -16,7 +16,49 @@ logger.setLevel(logging.INFO)
class Ingester(utsdb.Ingester):
"""Same as universal_tsdb.Ingester but sets measurement_prefix.
- so measurement becomes measurement_prefix.measurement"""
+
+ Handy with ``@tsdb_append_metric_for_class_setter_or_getter`` decorator
+ to be used in hardware controlled classes
+
+ Parameters
+ ----------
+ measurement_prefix: str (default is empty)
+ standard ``utsdb`` measurement becomes measurement_prefix.measurement
+
+ Example
+ -------
+
+ >>> from qolab.hardware.basic import BasicInstrument
+ >>> from qolab.tsdb import Ingester
+ >>> tsdb_client = Client("influx", "http://localhost:8428", database="qolab")
+ >>> tsdb_ingester = Ingester(
+ >>> tsdb_client, batch=10, measurement_prefix="experiment.title"
+ >>> )
+ >>>
+ >>> class InstWithLog(BasicInstrument):
+ >>> def __init__(self, *args, **kwds):
+ >>> super().__init__(*args, **kwds)
+ >>> self.config["Device type"] = "TestTSDBLogger"
+ >>> self.config["Device model"] = "v01"
+ >>> self.config["FnamePrefix"] = "test_log"
+ >>> self.config["SavePath"] = "./data"
+ >>> self.deviceProperties.update({"D"})
+ >>> self.d = 13.45
+ >>>
+ >>> @BasicInstrument.tsdb_append
+ >>> def setD(self, val):
+ >>> self.d = val
+ >>>
+ >>> @BasicInstrument.tsdb_append
+ >>> def getD(self):
+ >>> return self.d
+ >>>
+ >>> dev = InstWithLog(tsdb_ingester=tsdb_ingester, device_nickname="tester")
+ >>> dev.getD()
+ >>> dev.setD(3)
+ >>>
+ >>> tsdb_ingester.commit()
+ """
def __init__(self, client, batch=0, measurement_prefix=""):
super().__init__(client, batch=batch)