From 516a693d36c7b8ffa5e5613ee0b582d730818aa4 Mon Sep 17 00:00:00 2001 From: Gelu M Nita <45239927+Gelu-Nita@users.noreply.github.com> Date: Sun, 7 May 2023 09:36:43 -0400 Subject: [PATCH] updates of the geometrical sampling routines --- idl/gx_ebtel_valid_path.pro | 2 +- idl/gxmodel__define.pro | 10 +++++----- userslib/aia/AIA.pro | 4 ++-- userslib/sampling/blos_layers.pro | 2 +- userslib/sampling/blos_tr.pro | 3 +-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/idl/gx_ebtel_valid_path.pro b/idl/gx_ebtel_valid_path.pro index f734525..9823428 100644 --- a/idl/gx_ebtel_valid_path.pro +++ b/idl/gx_ebtel_valid_path.pro @@ -5,7 +5,7 @@ function gx_ebtel_valid_path,path,has_ddm=has_ddm,quiet=quiet goto,not_valid CATCH, /CANCEL ENDIF - restore,gx_findfile(path) + if file_exist(path) then restore, path else restore,gx_findfile(file_basename(path)) if ~isa(DEM_COR_RUN) or $ ~isa(DEM_TR_RUN) or $ ~isa(LOGTDEM) or $ diff --git a/idl/gxmodel__define.pro b/idl/gxmodel__define.pro index cfedb3a..e591352 100644 --- a/idl/gxmodel__define.pro +++ b/idl/gxmodel__define.pro @@ -1042,7 +1042,7 @@ pro gxModel::Slice,parms,row,scanner=scanner missing=0 (self->GetVolume())->GetVertexAttributeData,'voxel_id',id if n_elements(id) gt 0 then begin - var=interpolate(id,fix(vol_ind[*,0]),fix(vol_ind[*,1]),fix(vol_ind[*,2]),missing=missing) + var=interpolate(id,round(vol_ind[*,0]),round(vol_ind[*,1]),round(vol_ind[*,2]),missing=missing) idx=gx_name2idx(parms,'VoxelID') if (size(idx))[0] ne 0 then begin (*scanner).parms[*,*,idx]=var @@ -1089,7 +1089,7 @@ pro gxModel::Slice,parms,row,scanner=scanner idx=gx_name2idx(parms,'h') if (size(idx))[0] ne 0 then begin vol=(self->R(/volume)-1)*gx_rsun(unit='km') - (*scanner).parms[*,*,idx]=interpolate(vol,fix(vol_ind[*,0]),fix(vol_ind[*,1]),fix(vol_ind[*,2]),missing=missing) + (*scanner).parms[*,*,idx]=interpolate(vol,round(vol_ind[*,0]),round(vol_ind[*,1]),round(vol_ind[*,2]),missing=missing) assigned[idx]=1 end @@ -1159,7 +1159,7 @@ pro gxModel::Slice,parms,row,scanner=scanner if (size(idx))[0] ne 0 then begin vol=self->Box2Volume('bmed',/corona) if isa(vol)then begin - (*scanner).parms[*,*,idx]=interpolate(vol,fix(vol_ind[*,0]),fix(vol_ind[*,1]),fix(vol_ind[*,2]),missing=missing) + (*scanner).parms[*,*,idx]=interpolate(vol,round(vol_ind[*,0]),round(vol_ind[*,1]),round(vol_ind[*,2]),missing=missing) assigned[idx]=1 end end @@ -1170,7 +1170,7 @@ pro gxModel::Slice,parms,row,scanner=scanner vol=self->Box2Volume('length',/corona) if isa(vol)then begin vol=gx_rsun()*vol/2 - (*scanner).parms[*,*,idx]=interpolate(vol,fix(vol_ind[*,0]),fix(vol_ind[*,1]),fix(vol_ind[*,2]),missing=missing) + (*scanner).parms[*,*,idx]=interpolate(vol,round(vol_ind[*,0]),round(vol_ind[*,1]),round(vol_ind[*,2]),missing=missing) assigned[idx]=1 end end @@ -1346,7 +1346,7 @@ pro gxModel::Slice,parms,row,scanner=scanner end if (idx_parms[k] eq 'SpineS') or (idx_parms[k] eq 'HasArr') or $ (idx_parms[k] eq 'SpineR') or (idx_parms[k] eq 'dummy_n_b')then begin - (*scanner).parms[*,*,idx]+=interpolate(vol[box2vol],fix(vol_ind[*,0]),fix(vol_ind[*,1]),fix(vol_ind[*,2]),missing=missing) + (*scanner).parms[*,*,idx]+=interpolate(vol[box2vol],round(vol_ind[*,0]),round(vol_ind[*,1]),round(vol_ind[*,2]),missing=missing) endif else (*scanner).parms[*,*,idx]+=interpolate(vol[box2vol],vol_ind[*,0],vol_ind[*,1],vol_ind[*,2],missing=missing) endif end diff --git a/userslib/aia/AIA.pro b/userslib/aia/AIA.pro index 59b3595..51796e9 100644 --- a/userslib/aia/AIA.pro +++ b/userslib/aia/AIA.pro @@ -86,7 +86,7 @@ pro aia,parms,rowdata,nparms,rparms,path=path,logtdem=logtdem,dem_run=dem_run,qr rowparms=transpose(parms[pix,*,*]) cutoff=max(where(rowparms[nhi_idx,*] ge n_hi0)) if cutoff ge 0 then rowparms[nhi_idx,0:cutoff]=n_hi0 - tr_idx=max(where((ulong(rowparms[v_idx,*]) and gx_voxelid(/euv)) ne 0 and rowparms[t0_idx,*] ne 0)) + tr_idx=max(where((ulong(rowparms[v_idx,*]) and gx_voxelid(/euv)) ne 0)) point_in=where((rowparms[t0_idx,*] gt 0 and rowparms[v_idx,*] gt 1 and rowparms[nhi_idx,*] lt n_hi0), Nvox) if Nvox gt 0 then begin parmin=rowparms[*,point_in] @@ -95,7 +95,7 @@ pro aia,parms,rowdata,nparms,rparms,path=path,logtdem=logtdem,dem_run=dem_run,qr dem_interpolate,n,t,dem,path=path,logtdem=logtdem,dem_run=dem_run,qrun=qrun,lrun=lrun,qarr=parmin[q_idx,*],larr=parmin[l_idx,*],avgdem=avgdem tr_factor=1 if AddTR eq 1 then begin - tr_idx=max(where((ulong(parmin[v_idx,*]) and gx_voxelid(/euv)) ne 0 and parmin[t0_idx,*] ne 0)) + tr_idx=max(where((ulong(parmin[v_idx,*]) and gx_voxelid(/euv)) ne 0)) if tr_idx ge 0 then begin point_in=where((parmin[t0_idx,*] gt 0 and parmin[nhi_idx,*] lt n_hi0)) dem_interpolate,n_tr,t_tr,dem_tr,path=path,logtdem=logtdem,dem_run=dem_tr_run,lrun=lrun,qrun=qrun,$ diff --git a/userslib/sampling/blos_layers.pro b/userslib/sampling/blos_layers.pro index edc7065..f2187b4 100644 --- a/userslib/sampling/blos_layers.pro +++ b/userslib/sampling/blos_layers.pro @@ -34,7 +34,7 @@ pro blos_layers,parms,rowdata,info=info rparms=transpose(parms[pix,*,*]) z=float(reform(rparms[12,*])) for chanid =0, nchan-1 do begin - idx=max(where(fix(z) eq chanid,count)) + idx=max(where(round(z) eq chanid,count)) if count gt 0 then begin rowdata[pix,chanid,0]=rparms[2,idx] rowdata[pix,chanid,1]=rparms[2,idx]*cos(rparms[3,idx]*!dtor) diff --git a/userslib/sampling/blos_tr.pro b/userslib/sampling/blos_tr.pro index 3944f64..dd383c5 100644 --- a/userslib/sampling/blos_tr.pro +++ b/userslib/sampling/blos_tr.pro @@ -31,8 +31,7 @@ pro blos_tr,parms,rowdata,info=info rowdata[*]=0 for pix=0, Npix-1 do begin rparms=transpose(parms[pix,*,*]) - z=float(reform(rparms[8,*])) - idx=max(where(((ulong(rparms[5,*]) and 2l) eq 2l) and (z ge 0),count)) + idx=max(where(((ulong(rparms[5,*]) and gx_voxelid(/tr)) eq gx_voxelid(/tr)),count)) if count gt 0 then begin rowdata[pix,0,0]=rparms[2,idx] rowdata[pix,0,1]=rparms[2,idx]*cos(rparms[3,idx]*!dtor)