Skip to content

Commit

Permalink
grid can be a one-element array
Browse files Browse the repository at this point in the history
  • Loading branch information
moustakas committed Apr 6, 2019
1 parent 792da74 commit 96fc0a5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
11 changes: 8 additions & 3 deletions pro/isedfit/isedfit_chi2.pro
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@ function isedfit_chi2, maggies, ivarmaggies, modelmaggies, $
if nzz eq 1 then begin ; special case
modelmaggies1 = interpolate(modelmaggies[*,these],findgen(nthese))
endif else begin
modelmaggies1 = interpolate(modelmaggies[*,*,these],$
findgen(nfilt),zindx[igal],findgen(nthese),/grid)
if nthese eq 1 then begin
modelmaggies1 = interpolate(modelmaggies[*,*,these],$
findgen(nfilt),zindx[igal],/grid)
endif else begin
modelmaggies1 = interpolate(modelmaggies[*,*,these],$
findgen(nfilt),zindx[igal],findgen(nthese),/grid)
endelse
endelse
; perform acrobatic dimensional juggling to get the maximum likelihood
; scale-factor (total mass) and corresponding chi2 as a function of
Expand All @@ -96,7 +101,7 @@ function isedfit_chi2, maggies, ivarmaggies, modelmaggies, $
gridchunk[these,igal].totalmass_err = vscale_err ; /vscale/alog(10)
gridchunk[these,igal].bestmaggies = bestmaggies
endif
; splog, format='("All models = ",G0," minutes")', (systime(1)-t1)/60.0
; splog, format='("All models = ",G0," minutes")', (systime(1)-t1)/60.0
endfor ; galaxy loop
; splog, format='("All galaxies = ",G0," minutes")', (systime(1)-t0)/60.0

Expand Down
14 changes: 9 additions & 5 deletions pro/isedfit/read_isedfit.pro
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ function read_isedfit, isedfit_paramfile, params=params, thissfhgrid=thissfhgrid
i1 = result[these[ii]].modelindx ; mod 100
result[these[ii]].wave = grid[i1].wave
result[these[ii]].flux = grid[i1].flux
if params.nebular and tag_exist(grid,'nebflux') then result[these[ii]].nebflux = grid[i1].nebflux
if params.nebular and tag_exist(grid[0],'nebflux') then $
result[these[ii]].nebflux = grid[i1].nebflux
endif
endfor
endif
Expand All @@ -213,21 +214,23 @@ function read_isedfit, isedfit_paramfile, params=params, thissfhgrid=thissfhgrid
zwave = result[igal].wave*(1+z)
factor = result[igal].totalmass*(pc10/dlum[igal])^2.0/(1.0+z)
zflux_flam = factor*result[igal].flux ; [erg/s/cm2/A]
if params.nebular and tag_exist(grid,'nebflux') then znebflux_flam = factor*result[igal].nebflux ; [erg/s/cm2/A]
if params.nebular and tag_exist(grid[0],'nebflux') then $
znebflux_flam = factor*result[igal].nebflux ; [erg/s/cm2/A]
if params.igm and (keyword_set(noigm) eq 0) then begin
windx = findex(igmgrid.wave,zwave)
zindx = findex(igmgrid.zgrid,z)
igm = interpolate(igmgrid.igm,windx,zindx,/grid,missing=1.0)
zflux_flam *= igm
if params.nebular and tag_exist(grid,'nebflux') then znebflux_flam *= igm
if params.nebular and tag_exist(grid[0],'nebflux') then $
znebflux_flam *= igm
endif
zflux_fnu = zflux_flam*zwave^2/light ; [erg/s/cm2/Hz]
zflux_ab = -2.5*alog10(zflux_fnu>1D-50)-48.6
result[igal].wave = zwave
result[igal].flux = zflux_ab ; default
if keyword_set(fnu) then result[igal].flux = zflux_fnu
if keyword_set(flambda) then result[igal].flux = zflux_flam
if params.nebular and tag_exist(grid,'nebflux') then begin
if params.nebular and tag_exist(grid[0],'nebflux') then begin
znebflux_fnu = znebflux_flam*zwave^2/light ; [erg/s/cm2/Hz]
znebflux_ab = -2.5*alog10(znebflux_fnu>1D-50)-48.6
result[igal].nebflux = znebflux_ab ; default
Expand All @@ -240,7 +243,8 @@ function read_isedfit, isedfit_paramfile, params=params, thissfhgrid=thissfhgrid
factor = (1.0+z)/(pc10/dlum[igal])^2.0
result[igal].wave = result[igal].wave/(1.0+z)
result[igal].flux *= factor
if params.nebular and tag_exist(grid,'nebflux') then result[igal].nebflux *= factor
if params.nebular and tag_exist(grid[0],'nebflux') then $
result[igal].nebflux *= factor
endif
endfor
endelse
Expand Down

0 comments on commit 96fc0a5

Please sign in to comment.