projects/barrel/barrel_sp_v3.5/
barrel_sp_fold_m4.pro
NAME: barrel_sp_fold_m4.pro DESCRIPTION: BARREL mid-level spectral folding routine method4 = analytical spectral model + dual DRMs REQUIRED INPUTS: subspec background subtracted count spectrum subspecerr its error bars model spectral model of electron spectrum (default is exponential) 1 = exponential 2 = monoenergetic drm response matrix for correct payload altitude and chosen PID of electrons drm2 second response matrix (will find allowed interpolated range between these two) phmean energy channel centers (should have length = length of spectrum) -- this is for the photons dimension phwidth energy channel widths (should have length = length of spectrum) -- this is for the photons dimension ctwidth energy channel widths (should have length = length of spectrum) -- this is for the counts dimension usebins subset of energy channels (count space) to actually use for fitting maxcycles Maximum number of times to try rescaling range for fit parameters OPTIONAL INPUTS: quiet Don't make graphs + screen output verbose show some debugging info as fits go along OUTPUTS: params best fit parameters param_ranges ranges on best fit parameters (1 sigma) (2x2 array) modvals values of the fit function at the centers of the energy bins chisquare chi-square (not reduced) dof degrees of freedom associated with chisquare CALLS: barrel_sp_fitgrid4.pro STATUS: TO BE ADDED: Support for other spectral models Reasonable formula to guess e-folding or mono-E from count spectrum REVISION HISTORY: Version 1.0 DMS 7/18/12 -- split out from barrel_folding as new middle layer; fixed "dof" to use "usebins" (at the same time as fixing "fitgrid1" to use "usebins") Errors fixed 7/20/12 -- definition of "tryspec" didn't include multiplication by "phwidth", meaning lousy starting point for fits -- which converged anyway. Version 2.3 DMS ;8/26/12 -- fixed logical error in rescaling algorithm in search for chisquare+1 contour. Removed redundant routine identifier from "message" Version 2.4 DMS 8/26/12 -- added support for model 2 (monoenergetic) Version 3.4 DMS 4/17/14 -- save elecmodel for best fit e- spectrum
Routines
top source barrel_sp_fold_m4
barrel_sp_fold_m4, subspec, subspecerr, model, drm, drm2, phmean, phwidth, ctwidth, usebins, maxcycles, params, param_ranges, elecmodel, modvals, chisquare, dof, quiet=quiet, verbose=verbose
Parameters
- subspec
- subspecerr
- model
- drm
- drm2
- phmean
- phwidth
- ctwidth
- usebins
- maxcycles
- params
- param_ranges
- elecmodel
- modvals
- chisquare
- dof
Keywords
- quiet
- verbose
File attributes
Modification date: | Tue Oct 21 13:53:31 2014 |
Lines: | 99 |