;+ ; NAME: ; F_CONVERSION ; ; PURPOSE: ; Calculates conversion factors for the current model and drm ; and to load them into CONVI ; ; CATEGORY: ; SPEX ; ; CALLING SEQUENCE: ; result = f_conversion(Edges, Drm, E_in, F_model, Apar_arr) ; ; INPUTS: ; E_IN : 2xM input energy bins ; DRM : Detector response matrix dimensioned n x m where n is the number ; of output energy bins and m is the number of input energy bins. ; Edges : 2xN output energy bins. ; F_MODEL : Spectral model used, e.g. power law or thermal brem. ; APAR_arr : Array of Parameters used in call to F_MODEL. ; ; OPTIONAL INPUTS: ; if the inputs aren't givent the current values in spex_commons are used ; throught the routine SPEX_CURRENT ; ; KEYWORD PARAMETERS: ; ; OUTPUTS: ; Result - Conversion factors for each channel for each set of parameters in ; Apar_arr ; ; RESTRICTIONS: ; ; PROCEDURE: ; Run Get_conversion for each set of parameters in Apar_arr ; ; EXAMPLE: ; ; Convi = F_conversion( Edges, Drm, E_in, F_model, Apar_arr) ; ; CALLS: ; SPEX_CURRENT, EXIST, GET_CONVERSION ; MODIFICATION HISTORY: ; Version 1, RAS, 21-mar-1996 ;- function F_conversion, Edges, Drm, E_in, F_model, Apar_arr if not exist(edges) then edges=spex_current('edges') if not exist(drm) then drm=spex_current('drm') if not exist(e_in) then e_in=spex_current('e_in') if not exist(f_model) then f_model=spex_current('f_model') if not exist(apar_arr) then apar_arr=spex_current('apar_arr') sapar = size(apar_arr) if sapar(0) eq 1 then napar=1 else napar =sapar(2) result = fltarr(n_elements(edges(0,*)), napar) for i=0,napar-1 do begin get_conversion, e_in=e_in, drm=drm, f_model=f_model, $ apar=apar_arr(*,i), e_out=edges, conversion=conversion result(0,i) = conversion endfor return, result end