MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / map_data2D_srx_new

Function map_data2D_srx_new

pyxrf/model/load_data_from_db.py:1700–2208  ·  view source on GitHub ↗
(
    run_id_uid,
    fpath,
    create_each_det=False,
    fname_add_version=False,
    completed_scans_only=False,
    successful_scans_only=False,
    file_overwrite_existing=False,
    output_to_file=True,
    save_scaler=True,
    num_end_lines_excluded=None,
)

Source from the content-addressed store, hash-verified

1698
1699
1700def map_data2D_srx_new(
1701 run_id_uid,
1702 fpath,
1703 create_each_det=False,
1704 fname_add_version=False,
1705 completed_scans_only=False,
1706 successful_scans_only=False,
1707 file_overwrite_existing=False,
1708 output_to_file=True,
1709 save_scaler=True,
1710 num_end_lines_excluded=None,
1711):
1712 if num_end_lines_excluded:
1713 logger.warning(
1714 "The data loading function for new SRX format does not support the parameter "
1715 "'num_end_lines_excluded' ({num_end_lines_excluded}). All available data will "
1716 "be included in the output file."
1717 )
1718
1719 hdr = db[run_id_uid]
1720 start_doc = hdr.start
1721 runid = start_doc["scan_id"] # Replace with the true value (runid may be relative, such as -2)
1722
1723 print("**********************************************************")
1724 print(f"Loading scan #{runid}")
1725 print(f"Scan metadata format: version {start_doc['md_version']}")
1726
1727 if completed_scans_only and not _is_scan_complete(hdr):
1728 raise Exception("Scan is incomplete. Only completed scans are currently processed.")
1729 if successful_scans_only and not _is_scan_successful(hdr):
1730 raise Exception(
1731 "Scan is not successfully completed. Only successfully completed scans are currently processed."
1732 )
1733
1734 scan_doc = start_doc["scan"]
1735 stop_doc = hdr.stop
1736
1737 # The following scan parameters are used to compute positions for some motors.
1738 # (Positions of course stages are not saved during the scan)
1739 fast_start, fast_stop, fast_pts, slow_start, slow_stop, slow_pts = scan_doc["scan_input"][:6]
1740 fast_step = (fast_stop - fast_start) / fast_pts
1741 slow_step = (slow_stop - slow_start) / slow_pts
1742
1743 snaking_enabled = scan_doc["snake"] == 1
1744
1745 print(f"Scan type: {scan_doc['type']}")
1746
1747 # Check for detectors
1748 dets = []
1749 try:
1750 md_dets = hdr.start["scan"]["detectors"]
1751 for d in md_dets:
1752 if d in ("xs", "xs2", "xs4"):
1753 dets.append(d)
1754 except KeyError:
1755 # AMK forgot to add detectors to step scans
1756 # This is fixed, but left in for those scans
1757 if scan_doc["type"] == "XRF_STEP":

Callers 1

map_data2D_srxFunction · 0.85

Calls 12

_is_scan_completeFunction · 0.85
_is_scan_successfulFunction · 0.85
data_or_empty_arrayFunction · 0.85
repair_setFunction · 0.85
swap_axesFunction · 0.85
save_data_to_hdf5Function · 0.85
keysMethod · 0.80
clearMethod · 0.80
valuesMethod · 0.80

Tested by

no test coverage detected