;+ ;PROCEDURE - GET_CONVERSION ; ;PURPOSE - Compute conversion factors as a function of the spectral model. ; The conversion factors are the ratio of the count rate spectrum ; divided by the photon spectrum. ; ;Category: SPEX ; ;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. ; E_OUT - 2xN output energy bins. The E_OUT are optional. In this ; case the conversion factors are set to the count rate in the units ; of the rows of the drm. ; F_MODEL - Spectral model used, e.g. power law or thermal brem. ; APAR - Parameters used in call to F_MODEL. ; ;Optional Inputs: ; W_IN - Width of input energy bins. ;Outputs: ; MODEL_IN - Photon spectrum defined on E_IN in photons/cm^2/s/keV ; MODEL_OUT - Photon spectrum defined on E_OUT ; CONVERSION - Conversion factors. ; ;Call: GET_CONVERSION, E_IN=E_IN, W_IN=W_IN, DRM=DRM, $ ; F_MODEL=F_MODEL, APAR=APAR, E_OUT=E_OUT, $ ; MODEL_IN = MODEL_IN, MODEL_OUT= MODEL_OUT, CONVERSION=CONVERSION ; ;History: ; Written by RAS 92/9/26, used in Run_Curvefit and associated routines ; mod, ras, 17-jun-94, changed energy specification to edges instead of mean ; Version 2, ras, 21-mar-1996 ; Version 3, made e_out optional, richard.schwartz@gsfc.nasa.gov, 18-aug-1997 ;- pro GET_CONVERSION, E_IN=E_IN, W_IN=W_IN, DRM=DRM, $ F_MODEL=F_MODEL, APAR=APAR, E_OUT=E_OUT, $ MODEL_IN = MODEL_IN, MODEL_OUT= MODEL_OUT, CONVERSION=CONVERSION model_in = call_function(f_model, e_in, apar) ;Model on input channels if keyword_set(e_out) then $ model_out= call_function(f_model, e_out, apar) $;model on output channels else model_out = drm(*,0)*0.0 + 1.0 if not exist(w_in) then edge_products, e_in, width=w_in ;The conversion factors are the count rate model divided by the photon model case (size(drm))(0) of 1: conversion = drm else: conversion = f_div(drm#(model_in*w_in),model_out) endcase end