added append_data to lib

This commit is contained in:
2026-06-03 12:59:26 +02:00
parent 0893592990
commit 02ce0b756b
2 changed files with 9 additions and 5 deletions
+7
View File
@@ -48,6 +48,13 @@ class ArcticLibrary:
self.lib.update(symbol, df)
def append_data(self, symbol, df):
df.index = df.index.view("datetime64[ns]") # adb supports update only for timeseries indexes
df.index.name = "run"
self.lib.append(symbol, df)
def has_index(self, symbol, index):
index = encode_index(index)
+2 -5
View File
@@ -30,11 +30,8 @@ def append_run(beamline: Beamline, pgroup: PGroup, run: int, row: dict[str, Any]
timestamp = datetime.fromisoformat(timestamp) if timestamp else datetime.now()
row = {"timestamp": timestamp, **row} # setdefault would not force timestamp to be the first column
index = pd.Timestamp(run) # adb supports update only for timeseries indexes
index = pd.Index([index], name="run")
df = pd.DataFrame(row, index=index)
lib.append(pgroup, df)
df = pd.DataFrame(row, index=[run])
lib.append_data(pgroup, df)
row = {"run": run, **row} # setdefault would not force run to be the first column