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

Function map_data2D_srx_new_tiled

pyxrf/model/load_data_from_db.py:2211–2612  ·  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,
    catalog=None,
)

Source from the content-addressed store, hash-verified

2209
2210
2211def map_data2D_srx_new_tiled(
2212 run_id_uid,
2213 fpath,
2214 create_each_det=False,
2215 fname_add_version=False,
2216 completed_scans_only=False,
2217 successful_scans_only=False,
2218 file_overwrite_existing=False,
2219 output_to_file=True,
2220 save_scaler=True,
2221 num_end_lines_excluded=None,
2222 catalog=None,
2223):
2224 if num_end_lines_excluded:
2225 logger.warning(
2226 "The data loading function for new SRX format does not support the parameter "
2227 "'num_end_lines_excluded' ({num_end_lines_excluded}). All available data will "
2228 "be included in the output file."
2229 )
2230
2231 hdr = catalog[run_id_uid]
2232 start_doc = hdr.start
2233 runid = start_doc["scan_id"] # Replace with the true value (runid may be relative, such as -2)
2234 md_version = start_doc["md_version"]
2235
2236 logger.info("Loading scan %r", runid)
2237 logger.info("Metadata version: %r", md_version)
2238
2239 if completed_scans_only and not _is_scan_complete(hdr):
2240 raise Exception("Scan is incomplete. Only completed scans are currently processed.")
2241 if successful_scans_only and not _is_scan_successful(hdr):
2242 raise Exception(
2243 "Scan is not successfully completed. Only successfully completed scans are currently processed."
2244 )
2245
2246 scan_doc = start_doc["scan"]
2247
2248 logger.info("Start document:\n%s", pprint.pformat(start_doc))
2249
2250 # The following scan parameters are used to compute positions for some motors.
2251 # (Positions of course stages are not saved during the scan)
2252 fast_start, fast_stop, fast_pts, slow_start, slow_stop, slow_pts = scan_doc["scan_input"][:6]
2253 fast_step = (fast_stop - fast_start) / fast_pts
2254 slow_step = (slow_stop - slow_start) / slow_pts
2255
2256 snaking_enabled = bool(scan_doc["snake"])
2257
2258 print(f"Scan type: {scan_doc['type']}")
2259
2260 # Check for detectors
2261 dets = []
2262 try:
2263 md_dets = hdr.start["scan"]["detectors"]
2264 for d in md_dets:
2265 if d in ("xs", "xs2", "xs4"):
2266 dets.append(d)
2267 except KeyError:
2268 # AMK forgot to add detectors to step scans

Callers 1

map_data2D_srxFunction · 0.85

Calls 8

_is_scan_completeFunction · 0.85
_is_scan_successfulFunction · 0.85
swap_axesFunction · 0.85
save_data_to_hdf5Function · 0.85
keysMethod · 0.80

Tested by

no test coverage detected