Data is obained from databroker. Transfer items from data to a dictionary of numpy array, which has 2D shape same as scanning area. This function can handle stopped/aborted scans. Raster scan (snake scan) is also considered. Parameters ---------- data : pandas.core.fra
(
data,
datashape,
det_list=("xspress3_ch1", "xspress3_ch2", "xspress3_ch3"),
pos_list=("zpssx[um]", "zpssy[um]"),
scaler_list=("sclr1_ch3", "sclr1_ch4"),
create_each_det=False,
fly_type=None,
subscan_dims=None,
spectrum_len=4096,
)
| 3704 | |
| 3705 | |
| 3706 | def map_data2D( |
| 3707 | data, |
| 3708 | datashape, |
| 3709 | det_list=("xspress3_ch1", "xspress3_ch2", "xspress3_ch3"), |
| 3710 | pos_list=("zpssx[um]", "zpssy[um]"), |
| 3711 | scaler_list=("sclr1_ch3", "sclr1_ch4"), |
| 3712 | create_each_det=False, |
| 3713 | fly_type=None, |
| 3714 | subscan_dims=None, |
| 3715 | spectrum_len=4096, |
| 3716 | ): |
| 3717 | """ |
| 3718 | Data is obained from databroker. Transfer items from data to a dictionary of |
| 3719 | numpy array, which has 2D shape same as scanning area. |
| 3720 | |
| 3721 | This function can handle stopped/aborted scans. Raster scan (snake scan) is |
| 3722 | also considered. |
| 3723 | |
| 3724 | Parameters |
| 3725 | ---------- |
| 3726 | data : pandas.core.frame.DataFrame |
| 3727 | data from data broker |
| 3728 | datashape : tuple or list |
| 3729 | shape of two D image |
| 3730 | det_list : list, tuple, optional |
| 3731 | list of detector channels |
| 3732 | pos_list : list, tuple, optional |
| 3733 | list of pos pv |
| 3734 | scaler_list : list, tuple, optional |
| 3735 | list of scaler pv |
| 3736 | fly_type : string or optional |
| 3737 | raster scan (snake scan) or normal |
| 3738 | subscan_dims : 1D array or optional |
| 3739 | used at HXN, 2D of a large area is split into small area scans |
| 3740 | spectrum_len : int, optional |
| 3741 | standard spectrum length |
| 3742 | |
| 3743 | Returns |
| 3744 | ------- |
| 3745 | dict of numpy array |
| 3746 | """ |
| 3747 | data_output = {} |
| 3748 | new_v_shape = datashape[0] # updated if scan is not completed |
| 3749 | sum_data = None |
| 3750 | |
| 3751 | for n, c_name in enumerate(det_list): |
| 3752 | if c_name in data: |
| 3753 | detname = "det" + str(n + 1) |
| 3754 | logger.info("read data from %s" % c_name) |
| 3755 | channel_data = data[c_name] |
| 3756 | |
| 3757 | # new veritcal shape is defined to ignore zeros points caused by stopped/aborted scans |
| 3758 | new_v_shape = len(channel_data) // datashape[1] |
| 3759 | # Support for incomplete 1 row scan |
| 3760 | if not new_v_shape and len(channel_data): |
| 3761 | new_v_shape = 1 |
| 3762 | last_index = len(channel_data) |
| 3763 | fill_shape = channel_data[last_index].shape |
no test coverage detected