OxfordIonTrapGroup / oitg

Python package of helper routines (result loading, fitting, etc) for the Oxford Ion-Trap Group (OITG).
https://oxfordiontrapgroup.github.io/oitg/
13 stars 9 forks source link

results.py: Convenience functions for extracting and sorting ndscan experiments #44

Closed AVB25 closed 11 months ago

AVB25 commented 11 months ago

Some simple convenience functions that have been helpful to me, and I think may be helpful to others. They parse the results dictionary yielded by load_results to translate all PYON into python objects and make data more accessible. There are also functions to sort a multi-dimensional scan, possibly with missing entries (only tested for 2-D scans so far).

Demo usage for loading and directly plotting a 2D scan with missing entries:

scan_results, scan_axes, args = load_ndscan(day=day, rid=rid, experiment="abaqus")

data = scan_results["measurement_camera_readout_p_0"]["data"]
axis_0 = scan_axes[0]["data"] / scan_axes[0]["spec"]["scale"]
axis_1 = scan_axes[1]["data"] / scan_axes[1]["spec"]["scale"]

plt.pcolormesh(axis_0, axis_1, data)
plt.xlabel(f"{scan_axes[0]['description']} ({scan_axes[0]['spec']['unit']})")
plt.ylabel(f"{scan_axes[1]['description']} ({scan_axes[1]['spec']['unit']})")