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

Function read_hdf_APS

pyxrf/model/fileio.py:1450–1623  ·  view source on GitHub ↗

Data IO for files similar to APS Beamline 13 data format. This might be changed later. Parameters ---------- working_directory : str path folder file_name : str selected h5 file load_summed_data : bool, optional load summed spectrum or not l

(
    working_directory,
    file_name,
    # The following parameters allow fine grained control over what is loaded from the file
    load_summed_data=True,  # Enable loading of RAW, FIT or ROI data from 'sum' channel
    load_each_channel=False,  # .. RAW data from individual detector channels
    load_processed_each_channel=True,  # .. FIT or ROI data from the detector channels
    load_raw_data=True,  # For all channels: load RAW data
    load_fit_results=True,  # .. load FIT data
    load_roi_results=True,
)

Source from the content-addressed store, hash-verified

1448
1449
1450def read_hdf_APS(
1451 working_directory,
1452 file_name,
1453 # The following parameters allow fine grained control over what is loaded from the file
1454 load_summed_data=True, # Enable loading of RAW, FIT or ROI data from 'sum' channel
1455 load_each_channel=False, # .. RAW data from individual detector channels
1456 load_processed_each_channel=True, # .. FIT or ROI data from the detector channels
1457 load_raw_data=True, # For all channels: load RAW data
1458 load_fit_results=True, # .. load FIT data
1459 load_roi_results=True,
1460): # .. load ROI data
1461 """
1462 Data IO for files similar to APS Beamline 13 data format.
1463 This might be changed later.
1464
1465 Parameters
1466 ----------
1467
1468 working_directory : str
1469 path folder
1470 file_name : str
1471 selected h5 file
1472 load_summed_data : bool, optional
1473 load summed spectrum or not
1474 load_each_channel : bool, optional
1475 indicates whether to load raw experimental data for each detector channel or not
1476 load_raw_data : bool
1477 load raw experimental data
1478 load_processed_each_channel : bool
1479 indicates whether or not to load processed results (fit, roi) for each detector channel
1480 load_fit_results :bool
1481 load fitting results
1482 load_roi_results : bool
1483 load results of roi computation
1484
1485 Returns
1486 -------
1487 data_dict : dict
1488 with fitting data
1489 data_sets : dict
1490 data from each channel and channel summed, a dict of DataSelection objects
1491 """
1492 data_sets = OrderedDict()
1493 img_dict = OrderedDict()
1494
1495 # Empty container for metadata
1496 mdata = ScanMetadataXRF()
1497
1498 file_path = os.path.join(working_directory, file_name)
1499
1500 # defined in other_list in config file
1501 try:
1502 dict_sc = retrieve_data_from_hdf_suitcase(file_path)
1503 except Exception:
1504 dict_sc = {}
1505
1506 with h5py.File(file_path, "r+") as f:
1507 # Retrieve metadata if it exists

Callers 4

load_data_from_hdf5Function · 0.85
read_hdf_to_stitchFunction · 0.85
fit_pixel_data_and_saveFunction · 0.85
_load_dataset_from_hdf5Function · 0.85

Calls 8

ScanMetadataXRFClass · 0.85
RawHDF5DatasetClass · 0.85
DataSelectionClass · 0.85
get_fit_dataFunction · 0.85
itemsMethod · 0.80
updateMethod · 0.80
keysMethod · 0.80

Tested by

no test coverage detected