import sys
sys.path.append("/Users/papr/work/pupil/pupil_src/shared_modules")
import pandas as pd
import seaborn as sns
import file_methods as fm
datapath = "/Volumes/cluster/recordings/reference_recordings/5-vs-10-point-2d-calib_v2.2"
notification_data = fm.load_pldata_file(datapath, "notify")
def from_ref_data(ref_data):
col_index = pd.MultiIndex.from_product(
[["normalized", "pixels"], ["x", "y"]], names=["unit", "coordinate"]
)
return pd.DataFrame(
[[*ref["norm_pos"], *ref["screen_pos"]] for ref in ref_data], columns=col_index
).stack(level=[0])
ref_data = [
from_ref_data(calib_data["ref_list"])
for calib_data, ts, topic in zip(*notification_data)
if topic == "notify.calibration.calibration_data"
]
ref_data = pd.concat(
ref_data, keys=notification_data.timestamps, names=["timestamp"]
)
ref_data
coordinate | x | y | ||
---|---|---|---|---|
timestamp | unit | |||
36.722786 | 0 | normalized | 0.424593 | 0.255945 |
pixels | 543.479258 | 535.719555 | ||
1 | normalized | 0.426099 | 0.256685 | |
pixels | 545.407200 | 535.186604 | ||
2 | normalized | 0.426993 | 0.257668 | |
... | ... | ... | ... | ... |
269735.971200 | 387 | pixels | 746.284958 | 275.000000 |
388 | normalized | 0.583721 | 0.618056 | |
pixels | 747.162724 | 275.000000 | ||
389 | normalized | 0.583836 | 0.617982 | |
pixels | 747.310480 | 275.053028 |
1170 rows × 2 columns
# Plots one recorded calibration per row, identified by `timestamp`
# Left column shows normalized coordinates, righ column shows pixel coordinates
sns.relplot(
data=ref_data,
x="x",
y="y",
col="unit",
row="timestamp",
facet_kws=dict(sharex=False, sharey=False),
)
<seaborn.axisgrid.FacetGrid at 0x12f2c6430>