Skip to content

Architecture

Arthur Glowacki edited this page Jul 26, 2019 · 2 revisions

Architecture

There are three main parts, the executable, and IO library, and the core analysis library.

xrf_maps.exe : Main executable

  • Dependencies: libxrf_io, libxrf_fit, hdf5, netcdf
  • Optional Dependencies: zeromq, qt-charts
  • Source:
    • src/core/main.cpp
      • Reads and parses command line arguments and creates an Analysis_Job object which is passed to be processed.

libxrf_io: IO library and general processing logic

  • Dependencies: libxrf_fit, hdf5, netcdf
  • Optional Dependencies: zeromq, qt-charts
  • Sources processing whole dataset in memory:
    • src/core/process_whole
      • Functions to process an Analysis_Job.
      • Each one will load the whole dataset in memory before processing it.
      • Functions to optimize fit parameters and per pixel fitting.
    • src/io/file/hl_file_io
      • High level file io.
      • Logic for checking if analyzed hdf5 files exist to read them instead of raw data.
      • Logic to load MDA files for meta data and netcdf files for spectra
    • src/io/file/mda_io
      • For loading MDA files.
      • All APS scans require an MDA file.
      • For APS step scans, Spectra, Scalers and other meta data are saved in MDA file.
      • For APS fly scans, Scalers and other meta data are saved in MDA file, Spectra is saved per row in NetCDF files.
    • src/io/file/hdf_io
      • Loads Analyzed and raw hdf dataset.
      • There is an APS HDF5 raw spectra dataset that can be generated by converting NetCDF rows into a compressed 3d array in HDF5
      • Loads Confocal XRF datasets from APS 20 beamline.
      • Loads HDF5 electron microscopy FEI EMD datasets
      • Saved Analyzed dataset
    • src/io/file/netcdf_io
      • Loads Netcdf files that save a spectra row
    • src/io/file/csv_io
      • For saving fit_parameters to csv format after optimizing them.
    • src/io/file/aps/aps_fit_params_import
      • For loading aps specific maps_fit_parameters_override.txt files
  • Sources for streaming datasets:
    • src/core/process_streaming
      • Functions to process an Analysis_Job using Stream_Blocks
    • src/workflow/source
      • Abstract class to define a stream source.
      • Connects to distributor or sink.
    • src/workflow/distributor
      • Abstract class to define a stream process distributor. Typically thread pool to process the spectra.
      • Connects to Sink
    • src/workflow/sink
      • Abstract class to define a stream sink
    • src/workflow/xrf/spectra_file_source
      • Loads dataset and passes the Spectra by a Stream_Block which contains meta information on which pixel it is
    • src/workflow/xrf/integrated_spectra_source
      • Integrates the detector dataset into one spectra
    • src/workflow/xrf/detector_sum_spectra_source
      • Adds up the spectra for N detectors. So if you have 4 detectors it will sum up all four into one spectra
    • src/workflow/xrf/spectra_net_streamer
      • Class for streaming Stream_Blocks over the network. Spectra and Analyzed Counts.
    • src/io/net/basick_serializer
      • Basic spectra encoder/decoder for sending and receiving sptectra and analyzed counts over the network.

libxrf_fit: Data structures, models, and fitting logic

  • Dependencies: src/support folder
  • Optional Dependencies: zeromq, qt-charts
  • Sources:
    • src/data_struct/analysis_job
      • Stores information for a job to run, dataset directory, number of detectors, files to process, ect
    • src/data_struct/quantification_standard
      • Storing quantification calibration curves
    • src/data_struct/element_quant
    • src/data_struct/element_info
      • Class to hold element information from reference/xrf_library.csv
    • src/data_struct/fit_parameters
      • Class used by optimizers and gauss_model.
      • With mpfit you can put contraints on the min and max values for the fit parameters
    • src/data_struct/fit_element_map
      • Dictionary <string, 2d array> that hold element counts after fitting
    • src/data_struct/params_override
      • Structure that holds maps_fit_parameter_override.txt info
    • src/data_struct/spectra
      • Data structure that hold the spectra, elapsed live time, elapsed real time, input counts, and output counts
      • template class that default to float32 but can be compiled as double
    • src/data_struct/spectra_line
      • One row of spectras
    • src/data_struct/spectra_volume
      • Rows and Col's of spectras
    • src/data_struct/stream_block
      • Used for streaming spectra. Holds info about the current pixel index, width, height of the dataset being loaded
    • src/quantification/models/quantification_model
      • Model used to generate the quantification calibration curve
    • src/fitting/models/base_model
      • Abstract class for all models
    • src/fitting/models/gaussian_model
      • Model used to generate model spectra
    • src/fitting/routines/base_fit_routine
      • Abstract class for all fit routines
    • src/fitting/routines/param_optimized_fit_routine
      • This class is used for integrated datasets, pass only 1 sepctra and optimize fit parameters to it.
    • src/fitting/routines/matrix_optimized_fit_routine
      • Per pixel matrix fitting.
    • src/fitting/routines/roi_fit_routine
      • Per pixel roi fitting.
    • src/fitting/routines/nnls_fit_routine
      • Per pixel non negative least squares fitting.
    • src/fitting/routines/svd_fit_routine
      • Per pixel singluar value decomposition fitting.
    • src/fitting/optimizers/optimizer
      • Abstract class for all optimizers
    • src/fitting/optimizers/mpfit_optimizer
      • Optimize fit parameters with constraints
    • src/fitting/optimizers/lmfit_optimizer
      • Optimize fit parameters ( does not support constraints)
    • src/support
      • Support libraries for MDA, NNLS, PyBind11
    • src/workflow/thread_pool
      • Thread Pool class
Clone this wiki locally