Closed prjemian closed 3 years ago
Use print()
instead of a pretty table like pyRestTable.
this is a minimal example:
(class_2021_03) jemian@vm:~$ ipython
Python 3.8.8 (default, Feb 24 2021, 21:46:12)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.21.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import databroker
...: from scipy import ndimage
...: from apstools.utils import listruns
...:
...: cat = databroker.catalog["class_data_examples"]
...: print(f"{len(cat) = }")
...: listruns(db=cat.v1)
...:
len(cat) = 59
catalog name: class_data_examples
========= ========================== ======= ======= ========================================
short_uid date/time exit scan_id command
========= ========================== ======= ======= ========================================
f7b96eb 2021-02-26 15:53:08.941444 unknown 65 count(detectors=['adsimdet'], num=1)
e693870 2021-02-22 19:04:06.141078 success 39 scan(detectors=['temperature_setpoin ...
4fe01dd 2021-02-22 18:29:28.631949 success 32 count(detectors=['temperature'], num=20)
1dbed4f 2021-02-26 15:30:24.568066 unknown 61 count(detectors=['adsimdet'], num=1)
361400d 2021-02-26 15:44:16.602373 unknown 64 count(detectors=['adsimdet'], num=1)
56c2dae 2021-02-23 10:34:00.034502 success 45 scan(detectors=['temperature_setpoin ...
6bb9a4b 2021-02-22 18:38:24.851409 abort 37 scan(detectors=['temperature_setpoin ...
0eca468 2021-03-03 10:40:35.430278 success 76 count(detectors=['adsimdet'], num=1)
2befeb8 2021-02-26 15:38:32.784263 unknown 62 count(detectors=['adsimdet'], num=1)
c49f204 2021-02-26 00:21:35.750333 unknown 52 count(detectors=['adsimdet'], num=1)
daaebeb 2021-02-27 16:24:52.777810 success 73 count(detectors=['adsimdet'], num=1)
4705e97 2021-02-22 18:59:06.562506 success 38 scan(detectors=['temperature_setpoin ...
75b01ca 2021-03-03 10:48:19.682975 success 80 count(detectors=['adsimdet'], num=1)
01013b8 2021-02-23 00:16:12.899690 success 42 scan(detectors=['temperature_setpoin ...
7e309ce 2021-02-22 18:33:49.130694 success 34 count(detectors=['temperature'], num=20)
37d2c3b 2021-02-23 10:35:02.214576 success 46 scan(detectors=['temperature_setpoin ...
0401c91 2021-03-06 15:10:19.356874 success 83 rel_scan(detectors=['noisy'], num=23 ...
a8bcac2 2021-03-06 15:16:41.614573 success 90 scan(detectors=['noisy'], num=21, ar ...
1219f70 2021-02-26 16:04:30.688444 unknown 68 count(detectors=['adsimdet'], num=1)
6255bc8 2021-03-03 10:45:35.730732 success 79 count(detectors=['adsimdet'], num=1)
========= ========================== ======= ======= ========================================
Out[1]: <pyRestTable.rest_table.Table at 0x7ff735871f40>
In [2]: run = cat.search({"scan_id": 44})[-1]
...: ds = run.primary.read()
...: np_arr = ds["temperature_readback"]
...: print(f"{np_arr.mean().values = }")
...: print(f"{np_arr.std().values = }")
...:
np_arr.mean().values = array(78.30275489)
np_arr.std().values = array(76.86473889)
In [3]: # TODO: repeat for scan_id = 57
...:
In [4]: run = cat.search({"scan_id": 80})[-1]
...: ds = run.primary.read()
...: np_frame = ds["adsimdet_image"][0][0].to_masked_array()
...: print(f"{ndimage.measurements.center_of_mass(np_frame) = }")
...: print(f"{ndimage.measurements.maximum_position(np_frame) = }")
...: print(f"{np_frame.max() = }")
...: print(f"{np_frame.min() = }")
...:
ndimage.measurements.center_of_mass(np_frame) = (443.4099839785622, 444.8162751497467)
ndimage.measurements.maximum_position(np_frame) = (101, 108)
np_frame.max() = 190
np_frame.min() = 7
In [5]:
the extra TODO:
In [5]: run = cat.search({"scan_id": 57})[-1]
...: ds = run.primary.read()
...: np_arr = ds["temperature_readback"]
...: print(f"{np_arr.mean().values = }")
...: print(f"{np_arr.std().values = }")
...:
np_arr.mean().values = array(24.99790311)
np_arr.std().values = array(0.28447621)
image analysis using data from previous session packed and unpacked with
databroker-pack