EMToolKit.algorithms package

EMToolKit.algorithms.multi_inst_dem_wrapper module

EMToolKit.algorithms.simple_reg_dem module

EMToolKit.algorithms.simple_reg_dem.simple_reg_dem(data, errors, exptimes, logt, tresps, kmax=100, kcon=5, steps=[0.1, 0.5], drv_con=8.0, chi2_th=1.0, tol=0.1)[source]

EMToolKit.algorithms.simple_reg_dem_parallel module

EMToolKit.algorithms.simple_reg_dem_wrapper module

EMToolKit.algorithms.simple_reg_dem_wrapper.autoloading_simple_reg_dem_wrapper(datasequence, save_dir=None, recalc=False, wrapargs={})[source]

Wrapper function that calculates or loads a precomputed simple regularized DEM.

NOTE: Autoloading wrapper interfaces are supplied as an example and for convenience. They save and loads by Pickle which is not a long-term solution. Saving and loading functionality will be incorporated into the main EMToolKit code and not algorithm wrappers in the future. Either way, the definitive interface is the regular non autoloading wrapper.

This function first checks if a precomputed DEM exists in the specified directory. If not, it calculates the DEM using simple_reg_dem_wrapper, saves the result, and returns it.

Parameters:
  • datasequence (NDCubeSequence) – A sequence of data cubes containing the observations. Each cube should contain 2D spatial data with associated uncertainties and metadata.

  • save_dir (str, optional) – The directory where the DEM result will be saved or loaded from. Default is current working.

  • recalc_simple (bool, optional) – If True, the DEM will be recalculated even if a precomputed result exists. Default is False.

  • wrapargs (dict, optional) – Additional arguments to pass to the initialization routines of the simple_reg_dem_wrapper function.

Returns:

  • emtk.dem_model – The DEM model generated from the input data.

  • tuple – The output from the simple_reg_dem_wrapper function.

EMToolKit.algorithms.simple_reg_dem_wrapper.simple_reg_dem_wrapper(datasequence, wrapargs={})[source]

Wrapper function for the simple regularized Differential Emission Measure (DEM) calculation.

This function prepares input data and passes it to the simple_reg_dem algorithm. It processes the input data to ensure that all input maps have consistent dimensions, extracts the necessary metadata, and then calls the DEM calculation.

Parameters:
  • datasequence (NDCubeSequence) – A sequence of data cubes containing the observations. Each cube should contain 2D spatial data with associated uncertainties and metadata.

  • wrapargs (dict, optional) – Additional arguments to pass to the initialization routines of the simple_reg_dem function.

Returns:

  • list of numpy.ndarray – The calculated DEM coefficients for each temperature bin.

  • list of numpy.ndarray – The temperature bins used in the calculation.

  • list of numpy.ndarray – The basis functions for the temperature bins.

  • WCS – World Coordinate System (WCS) information from the input data.

  • str – A string identifier for the DEM method used.

EMToolKit.algorithms.simple_reg_dem_wrapper_parallel module

EMToolKit.algorithms.sparse_em module

EMToolKit.algorithms.sparse_em.simplex(zequation, constraint, m1, m2, m3, eps=None)[source]
EMToolKit.algorithms.sparse_em.sparse_em_init(trlogt_list, tresp_list, bases_sigmas=None, differential=False, bases_powers=[], normalize=False, use_lgtaxis=None)[source]
EMToolKit.algorithms.sparse_em.sparse_em_solve(image, errors, exptimes, Dict, zfac=[], eps=0.001, tolfac=1.4, relax=True, symmbuff=1.0, adaptive_tolfac=True, epsfac=1e-10)[source]

EMToolKit.algorithms.sparse_em_wrapper module

EMToolKit.algorithms.sparse_em_wrapper.autoloading_sparse_em_wrapper(datasequence, save_dir=None, *, wrapargs={}, recalc=False)[source]

Wrapper function that calculates or loads a precomputed sparse regularized DEM.

NOTE: Autoloading wrapper interfaces are supplied as an example and for convenience. They save and loads by Pickle which is not a long-term solution. Saving and loading functionality will be incorporated into the main EMToolKit code and not algorithm wrappers in the future. Either way, the definitive interface is the regular non autoloading wrapper.

This function first checks if a precomputed DEM exists in the specified directory. If not, it calculates the DEM using sparse_em_wrapper, saves the result, and returns it.

Parameters:
  • datasequence (NDCubeSequence) – A sequence of data cubes containing the observations. Each cube should contain 2D spatial data with associated uncertainties and metadata.

  • save_dir (str, optional) – The directory where the DEM result will be saved or loaded from. Default is current working.

  • recalc (bool, optional) – If True, the DEM will be recalculated even if a precomputed result exists. Default is False.

  • wrapargs (A dictionary)

Returns:

  • emtk.dem_model – The DEM model generated from the input data.

  • tuple – The output from the sparse_em_wrapper function.

EMToolKit.algorithms.sparse_em_wrapper.sparse_em_wrapper(datasequence, wrapargs={})[source]

Wrapper function for the sparse regularized Differential Emission Measure (DEM) calculation.

This function prepares input data and passes it to the sparse_em_init and sparse_em_solve algorithms. It processes the input data to ensure that all input maps have consistent dimensions, extracts the necessary metadata, and then calls the DEM calculation.

Parameters:
  • datasequence (NDCubeSequence) – A sequence of data cubes containing the observations. Each cube should contain 2D spatial data with associated uncertainties and metadata.

  • wrapargs (dict, optional) – Additional arguments to pass to the initialization routines of the sparse_em functions.

Returns:

  • list of numpy.ndarray – The calculated DEM coefficients for each temperature bin.

  • list of numpy.ndarray – The temperature bins used in the calculation.

  • list of numpy.ndarray – The basis functions for the temperature bins.

  • WCS – World Coordinate System (WCS) information from the input data.

  • str – A string identifier for the DEM method used.

EMToolKit.algorithms.sparse_nlmap_dem_wrapper module

EMToolKit.algorithms.sparse_nlmap_solver module

class EMToolKit.algorithms.sparse_nlmap_solver.nlmap_operator(*args, **kwargs)[source]

Bases: LinearOperator

setup(amat, regmat, map_drvvec, wgtvec, reg_map_drvvec, dtype='float32', reg_fac=1)[source]
EMToolKit.algorithms.sparse_nlmap_solver.solve(data0, errors0, amat0, guess=None, reg_fac=1, func=None, dfunc=None, ifunc=None, regmat=None, silent=False, solver=None, sqrmap=False, regfunc=None, dregfunc=None, iregfunc=None, map_reg=False, adapt_lam=True, solver_tol=0.001, niter=40, dtype='float32', steps=None, precompute_ata=False, flatguess=True, chi2_th=1.0, store_outer_Av=False, conv_chi2=1e-15)[source]

Module contents