FUNCTION dustem_param_range2param_values,iv_min,iv_max,iv_Nvalues,Nc=Nc,log=log,help=help ;+ ; NAME: ; dustem_param_range2param_values ; PURPOSE: ; computes sets (combinations) of dustem parameter values with no duplicate combination, based on min-max values for each parameter ; CATEGORY: ; Dustem ; CALLING SEQUENCE: ; params_set=dustem_param_range2param_values(iv_min,iv_max,iv_Nvalues[,Nc=][,log=]) ; INPUTS: ; iv_min : minimum values of parameters (array of Npar values) ; iv_max : maximum values of parameters (array of Npar values) ; iv_Nvalues : Number of individual parameter cvalues needed (array of Npar values) ; OPTIONAL INPUT PARAMETERS: ; log : array indicating which parameter should be sampled in log scale (1) or linear scale (0). Default is linear for all parameters ; OUTPUTS: ; params_set :array of pointers containing parameter values (has Nc elements each pointing to an array of Npar values) ; OPTIONAL OUTPUT PARAMETERS: ; Nc : nmeber of parameter combinations ; ACCEPTED KEY-WORDS: ; help : If set, print this help ; COMMON BLOCKS: ; None ; SIDE EFFECTS: ; None ; RESTRICTIONS: ; ; PROCEDURE: ; None ; EXAMPLES ; res=dustem_param_range2param_values([0,2.],[8.,3.e1],[9,5],Nc=Nc,log=[0,1]) ; print,*res[13] ; 4.00000 3.93598 ; MODIFICATION HISTORY: ; Written by J.-Ph. Bernard (2023) ; Evolution details on the DustEMWrap gitlab. ; See http://dustemwrap.irap.omp.eu/ for FAQ and help. ;- IF keyword_set(help) THEN BEGIN doc_library,'dustem_param_range2param_values' ivs=0. goto,the_end ENDIF Nparams=n_elements(iv_min) ;==compute number of combinations Nc=1L FOR i=0L,Nparams-1 DO Nc=Nc*iv_Nvalues[i] ;compute parameters possible values par_values=ptrarr(Nparams) FOR i=0L,Nparams-1 DO BEGIN vv=range_gen(iv_Nvalues[i],[iv_min[i],iv_max[i]],log=log[i]) par_values[i]=ptr_new(vv) ENDFOR ;=== compute combinations ivs=ptrarr(Nc) vec=fltarr(Nparams) ;individual vector of parameter values FOR i=0L,Nc-1 DO BEGIN ij=index2ij([i],iv_Nvalues) FOR j=0L,Nparams-1 DO BEGIN vec[j]=(*par_values[j])[ij[0,j]] ENDFOR ivs[i]=ptr_new(vec) ;print,vec ;stop ENDFOR the_end: RETURN,ivs END