diff --git a/AGILECalib_H/eff_area/AGILE_mksar_loop_H.pro b/AGILECalib_H/eff_area/AGILE_mksar_loop_H.pro index 43fdbdd..5665bd3 100644 --- a/AGILECalib_H/eff_area/AGILE_mksar_loop_H.pro +++ b/AGILECalib_H/eff_area/AGILE_mksar_loop_H.pro @@ -17,6 +17,7 @@ ; 13/11/2013: selecting the /aref directory (V. Fioretti) ; 6/11/2015: loading the environment variable (V. Fioretti) ; 13/12/2015: new Fermi-style energy bands (A. Chen) +; 6/10/2023: T class added (V. Fioretti) ae_path = GETENV('CALIB_AE_RSP') ae_path = ae_path+'/aref' @@ -42,7 +43,7 @@ for t=0, nthetas-1 do begin ;ener=[35,50,71,100,141,200,283,400,632,1000,1732,3000,5477,10000,20000] -ener=[10,35,50,71,100,173,300,548,1000,1732,3000,5477,10000,20000,100000] + ener=[10,35,50,71,100,173,300,548,1000,1732,3000,5477,10000,20000,100000] ;if theta eq 1 then str_theta='01' else str_theta=strtrim(theta,2) ;if phi eq 0 then str_phi='00' else str_phi=strtrim(phi,2) @@ -52,15 +53,18 @@ ener=[10,35,50,71,100,173,300,548,1000,1732,3000,5477,10000,20000,100000] openw,u,fileperandrew,width=1000,/get_lun printf,u - printf,u,' E AeffG AeffL AeffS' + printf,u,' E AeffG AeffL AeffS AeffT' printf,u for i=0,n_elements(ener)-1 do begin printf,u, ener[i], area_H(ae_path=ae_path, energ=ener[i], tip='G', theta=fix(str_theta[t]), phi=phi, filtro=filtro[f], spec=spec), $ area_H(ae_path=ae_path, energ=ener[i], tip='L', theta=fix(str_theta[t]), phi=phi, filtro=filtro[f], spec=spec), $ - area_H(ae_path=ae_path, energ=ener[i], tip='S', theta=fix(str_theta[t]), phi=phi, filtro=filtro[f], spec=spec) + area_H(ae_path=ae_path, energ=ener[i], tip='S', theta=fix(str_theta[t]), phi=phi, filtro=filtro[f], spec=spec), $ + area_H(ae_path=ae_path, energ=ener[i], tip='T', theta=fix(str_theta[t]), phi=phi, filtro=filtro[f], spec=spec) endfor + + free_lun,u endfor diff --git a/AGILECalib_H/eff_area/AGILE_write_all_sar_H0026.pro b/AGILECalib_H/eff_area/AGILE_write_all_sar_H0026.pro new file mode 100644 index 0000000..118587c --- /dev/null +++ b/AGILECalib_H/eff_area/AGILE_write_all_sar_H0026.pro @@ -0,0 +1,85 @@ +; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +; % AGILE_write_all_sar_H0026.pro % +; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +; Description: +; Effective area production - step 2 +; Reading: +; - AG_GRID_G0017_S0001_H0007_template.sar.gz +; - __.txt +; Calling: +; - readaeff_I0026.pro, interp_sar_I0026.pro, initheads.pro +; Output: +; AG_GRID_G0017_S${filter}${eventtype}_H0026.sar.gz +; --------------------------------------- +; Authors: +; A. Chen (INAF/IASF Mi) +; --------------------------------------- +; Modification history: +; 6/10/2023: copied from AGILE_write_all_sar_H0025.pro (V. Fioretti) +; 6/10/2023: H0026 and T class added (V. Fioretti) + + + +@readaeff_I0026 +@interp_sar_I0026 + +sar_path = GETENV('CALIB_AE_RSP') +sar_path = sar_path+'/sar' + +; .sar.gz path keyword (0 = Default, 1 = enter new path) +sar_path_key = 0 + +read, sar_path_key, PROMPT = '% - .sar.gz directory [0 = $CALIB_AE_RSP/sar, 1 = new directory]:' +if sar_path_key EQ 1 then read, sar_path, PROMPT = '% - .sar.gz directory (e.g. /home):' + +ae_path = GETENV('CALIB_AE_RSP') +ae_path = ae_path+'/aref' +; .ae path keyword (0 = Default, 1 = enter new path) +ae_path_key = 0 + +read, ae_path_key, PROMPT = '% - .ae directory [0 = $CALIB_AE_RSP/aref, 1 = new directory]:' +if ae_path_key EQ 1 then read, ae_path, PROMPT = '% - .ae directory (e.g. /home):' + +template = sar_path+'/AG_GRID_G0017_S0001_H0007_template.sar.gz' + +fileid = 'H0026' +factor = [[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]] + +table = mrdfits(template,0,head0) +flags = mrdfits(template,1,head1) +labels = mrdfits(template,2,head2) +initheads, head0, head1, head2, fileid + +filters = ['F4','FM','FT3ab'] +status = ['G','L','S', 'T'] +thetas = ['01','30','35','45','50','60'] +nthetas = n_elements(thetas) +phis = ['00','45'] +nphis = n_elements(phis) + +thetamap = intarr(n_elements(labels.polar_angle)) +for itheta = 1, nthetas - 1 do thetamap = thetamap + (labels.polar_angle ge thetas[itheta]) +thetamap = thetamap + (labels.polar_angle ge 70.0) + +readaeff_I0025, ae_path, filters[0], thetas[0], phis[0], energies, areas +nenergies = n_elements(energies) +allareas = replicate(areas[0], nenergies, nthetas, nphis) + +for ifilter = 0, n_elements(filters)-1 do $ + for istatus = 0, n_elements(status)-1 do begin + stancon = 'S' + filters[ifilter] + status[istatus] + filename = sar_path+'/AG_GRID_G0017_' + stancon + '_' + fileid + '.sar' + sxaddpar, head0, 'STAN_CON', stancon + sxaddpar, head0, 'EXTEND', 'T' + for itheta = 0, nthetas - 1 do for iphi = 0, nphis - 1 do begin + readaeff_I0025, ae_path, filters[ifilter], thetas[itheta], phis[iphi], energies, areas + allareas[*, itheta, iphi] = areas + endfor + interp_sar_I0025, table, allareas, labels, energies, thetas, phis, istatus, factor = factor[*,ifilter] + mwrfits, table, filename, head0, /create + mwrfits, flags, filename, head1 + mwrfits, labels, filename, head2 + spawn, 'ftchecksum '+filename+' update=yes datasum=yes chatter=0' + spawn, 'gzip -f '+filename +endfor +end diff --git a/AGILECalib_H/eff_area/area_H.pro b/AGILECalib_H/eff_area/area_H.pro index 40af115..70abd1c 100644 --- a/AGILECalib_H/eff_area/area_H.pro +++ b/AGILECalib_H/eff_area/area_H.pro @@ -14,7 +14,7 @@ ; Modification history: ; 13/11/2013: taking the /aref directory as input (V. Fioretti) ; 13/12/2015: new Fermi-style energy bands (A. Chen) - +; 06/10/2023: T class added (V. Fioretti) function area_H,ae_path=ae_path,theta=theta,phi=phi,energy=energy,tip=tip,spec=spec,filtro=filtro @@ -41,6 +41,7 @@ energie=af(0,*) if tip eq 'G' then aree=af(1,*) if tip eq 'L' then aree=af(2,*) if tip eq 'S' then aree=af(3,*) +if tip eq 'T' then aree=af(4,*) ;print,aree diff --git a/AGILECalib_H/eff_area/interp_sar_I0026.pro b/AGILECalib_H/eff_area/interp_sar_I0026.pro new file mode 100644 index 0000000..3b55203 --- /dev/null +++ b/AGILECalib_H/eff_area/interp_sar_I0026.pro @@ -0,0 +1,38 @@ +; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +; % interp_sar_I0026 % +; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +; --------------------------------------- +; Authors: +; A. Chen (INAF/IASF Mi) +; --------------------------------------- +; 6/10/2023: copied from interp_sar_I0025.pro (V. Fioretti) +; 6/10/2023: H0026 added (V. Fioretti) + +pro interp_sar_I0026, table, allareas, labels, energies, thetas, phis, istatus, factor = factor + +nthetas = n_elements(thetas) +nphis = n_elements(phis) +thetamap = intarr(n_elements(labels.polar_angle)) +for itheta = 1, nthetas - 1 do thetamap = thetamap + (labels.polar_angle ge thetas[itheta]) +thetamap = thetamap + (labels.polar_angle gt 90.0) +nenergies = n_elements(energies) + for ietab = 0, n_elements(labels.energy) - 1 do $ + for ittab = 0, n_elements(labels.polar_angle) - 1 do $ + for iaztab = 0, n_elements(labels.azimuth_angle) - 1 do begin + if thetamap[ittab] gt (nthetas - 1) then table[ietab, ittab, iaztab] = 0 $ + else begin + t0 = 10.0d ^ interpol(alog10(allareas[*, thetamap[ittab], iaztab mod 2].(istatus)), alog10(energies), alog10(labels.energy[ietab])) + if thetamap[ittab]+1 gt (nthetas - 1) then begin +; print, t0 + t1 = t0 + endif else $ + t1 = 10.0d ^ interpol(alog10(allareas[*, thetamap[ittab]+1, iaztab mod 2].(istatus)), alog10(energies), alog10(labels.energy[ietab])) + if (thetamap[ittab]+1 lt nthetas) then $ + table[ietab, ittab, iaztab] = interpol([t0,t1], double(thetas[thetamap[ittab]:thetamap[ittab]+1]), labels.polar_angle[ittab]) $ + else $ + table[ietab, ittab, iaztab] = interpol([t0,t1], double([thetas[thetamap[ittab]],thetas[thetamap[ittab]]+40.0]), labels.polar_angle[ittab]) + endelse + table[ietab, ittab, iaztab] = factor[ittab] * table[ietab, ittab, iaztab] + endfor + +end diff --git a/AGILECalib_H/eff_area/readaeff_I0026.pro b/AGILECalib_H/eff_area/readaeff_I0026.pro new file mode 100644 index 0000000..42be4b0 --- /dev/null +++ b/AGILECalib_H/eff_area/readaeff_I0026.pro @@ -0,0 +1,51 @@ +; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +; % readaeff_I0026.pro % +; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +; Description: +; Routine called by AGILE_write_all_sar_H0026.pro +; Reading: +; - __.txt +; --------------------------------------- +; Authors: +; A. Chen (INAF/IASF Mi) +; --------------------------------------- +; Modification history: +; 6/10/2023: copied from readaeff_I0025.pro (V. Fioretti) +; 6/10/2023: H0026 and T class added (V. Fioretti) + +pro readaeff_I0026, ae_path, filter, theta, phi, energies, area, directory = directory + +if n_elements(directory) eq 0 then begin + directory=ae_path+'/' + filename = directory + filter + '_' + theta + '_' + phi + '_H.txt' +endif + + +e = 0.0d & ag = 0.0d & al = 0.0d & as = 0.0d & agls = 0.0d +earr = [0.0d,10.0d] & agarr = [0.0d,0.1d] & alarr = [0.0d,0.1d] & asarr = [0.0d,0.1d]& aglsarr = [0.0d,0.1d] +dummy = '' + +openr, u, filename, /get_lun +for i = 0, 3 do readf, u, dummy +while not eof(u) do begin + readf, u, e, ag, al, as, agls + earr = [earr, e] + factor = 1.0 + agarr = [agarr, ag / factor] + alarr = [alarr, al / factor] + asarr = [asarr, as / factor] + aglsarr = [aglsarr, agls / factor] +endwhile +free_lun, u +num = n_elements(earr)-1 +energies = earr[1:num] +area = replicate({G: 0.0d, L:0.0d, S:0.0d, T: 0.0d}, num) +area.G = agarr[1:num] +area.L = alarr[1:num] +area.S = asarr[1:num] +area.T = aglsarr[1:num] + + +end + + diff --git a/AGILECalib_H/resp_ae_BAND/aeffi_H.pro b/AGILECalib_H/resp_ae_BAND/aeffi_H.pro index 328ee40..85f10a4 100644 --- a/AGILECalib_H/resp_ae_BAND/aeffi_H.pro +++ b/AGILECalib_H/resp_ae_BAND/aeffi_H.pro @@ -10,6 +10,7 @@ ; Modification history: ; 24/10/2013: JPG removed, saving output in postscript (V. Fioretti) ; 13/12/2015: new Fermi-style energy bands (A. Chen) +; 03/10/2023: T class added (V. Fioretti) pro aeffi_H,ee, a, run, fil, inde, bol @@ -36,11 +37,15 @@ pro aeffi_H,ee, a, run, fil, inde, bol wg=where((ee.evstatus eq 'G') eq bol) wl=where((ee.evstatus eq 'L') eq bol) ws=where((ee.evstatus eq 'S') eq bol) +wgls = where(((ee.evstatus eq 'G') eq bol) or ((ee.evstatus eq 'L') eq bol) or ((ee.evstatus eq 'S') or bol)) + ;w31=where((ee31.evstatus eq tip) eq bol) cag=canali_H(a(1,wg)*1000) cal=canali_H(a(1,wl)*1000) cas=canali_H(a(1,ws)*1000) +cagls=canali_H(a(1,wgls)*1000) + ;ca31=canali(a31(1,w31)*1000) ;canal=[10.,35,50,71,100,141,200,283,400,632,1000,1732,3000,5477,10000,20000,100000] @@ -69,20 +74,21 @@ TVLCT, 255 * RED, 255 * GREEN, 255 * BLUE plot_oo,er,smooth(cag/ff,2) $ ,psym=-3,yrange=[1,1000.],xrange=[10,100000.],xstyle=1,ystyle=1 $ - ,xtitle='Energy [MeV]',ytitle='Effective Area [cm!u2!n]',title='black:G, blue:L, red:S' + ,xtitle='Energy [MeV]',ytitle='Effective Area [cm!u2!n]',title='black:G, blue:L, red:S, green:T' oplot,er,smooth(cal/ff,2),psym=-3,color=1, thick=3 oplot,er,smooth(cas/ff,2),psym=-3,color=2, thick=3 ;oplot,er,smooth(ca31/ff,2),psym=-6,color=verde oplot,er,smooth(cag/ff,2),psym=-3,color=0, thick=3 - +oplot,er,smooth(cagls/ff,2),psym=-3,color=3, thick=3 ;legend,['F4','F2','FT3-0','FT3-1'],color=[nero,blu,rosso,verde],linestyle=[0,0,0,0],/bot,/rig fits_write,run+'_'+fil+'_H.ae',[ transpose(er[0:numchannels-1]), $ transpose(smooth(cag/ff,2)), $ transpose(smooth(cal/ff,2)), $ - transpose(smooth(cas/ff,2)) ] + transpose(smooth(cas/ff,2)), $ + transpose(smooth(cagls/ff,2)) ] diff --git a/AGILECalib_H/resp_ae_BAND/maris_H.pro b/AGILECalib_H/resp_ae_BAND/maris_H.pro index 9644603..54772ed 100644 --- a/AGILECalib_H/resp_ae_BAND/maris_H.pro +++ b/AGILECalib_H/resp_ae_BAND/maris_H.pro @@ -10,7 +10,7 @@ ; A. Giuliani, A. Chen (INAF/IASF Mi) ; --------------------------------------- ; 13/12/2015: new Fermi-style energy bands (A. Chen) - +; 03/10/2023: T class added (V. Fioretti) @@ -19,7 +19,7 @@ pro maris_H,ee,a,the,phi,run,fil tipo=['G','L','S'] -mmat=fltarr(3,14,14) +mmat=fltarr(4,14,14) for j=0,2 do begin @@ -29,6 +29,10 @@ for j=0,2 do begin endfor +wc=where((ee.evstatus eq tipo(0)) or (ee.evstatus eq tipo(1)) or (ee.evstatus eq tipo(2))) +mat=matmake14(a(1,wc)*1000,ee(wc).energy) +mmat(3,*,*)=mat + ;map,total(mmat(0,*,*),1),/scl fits_write,run+'_'+fil+'_H.rsp',mmat diff --git a/eff_area/AGILE_mksar_loop.pro b/eff_area/AGILE_mksar_loop.pro index ba8dd87..7f888c6 100644 --- a/eff_area/AGILE_mksar_loop.pro +++ b/eff_area/AGILE_mksar_loop.pro @@ -16,6 +16,7 @@ ; Modification history: ; 13/11/2013: selecting the /aref directory (V. Fioretti) ; 6/11/2015: loading the environment variable (V. Fioretti) +; 6/10/2023: T class added (V. Fioretti) ae_path = GETENV('CALIB_AE_RSP') ae_path = ae_path+'/aref' @@ -50,13 +51,14 @@ for t=0, nthetas-1 do begin openw,u,fileperandrew,width=1000,/get_lun printf,u - printf,u,' E AeffG AeffL AeffS' + printf,u,' E AeffG AeffL AeffS AeffT' printf,u for i=0,n_elements(ener)-1 do begin printf,u, ener[i], area(ae_path=ae_path, energ=ener[i], tip='G', theta=fix(str_theta[t]), phi=phi, filtro=filtro[f], spec=spec), $ area(ae_path=ae_path, energ=ener[i], tip='L', theta=fix(str_theta[t]), phi=phi, filtro=filtro[f], spec=spec), $ - area(ae_path=ae_path, energ=ener[i], tip='S', theta=fix(str_theta[t]), phi=phi, filtro=filtro[f], spec=spec) + area(ae_path=ae_path, energ=ener[i], tip='S', theta=fix(str_theta[t]), phi=phi, filtro=filtro[f], spec=spec), $ + area(ae_path=ae_path, energ=ener[i], tip='T', theta=fix(str_theta[t]), phi=phi, filtro=filtro[f], spec=spec) endfor free_lun,u diff --git a/eff_area/AGILE_write_all_sar_I0026.pro b/eff_area/AGILE_write_all_sar_I0026.pro new file mode 100644 index 0000000..e445157 --- /dev/null +++ b/eff_area/AGILE_write_all_sar_I0026.pro @@ -0,0 +1,84 @@ +; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +; % AGILE_write_all_sar_I0026.pro % +; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +; Description: +; Effective area production - step 2 +; Reading: +; - AG_GRID_G0017_S0001_I0007_template.sar.gz +; - __.txt +; Calling: +; - readaeff_I0026.pro, interp_sar_I0026.pro, initheads.pro +; Output: +; AG_GRID_G0017_S${filter}${eventtype}_I0026.sar.gz +; --------------------------------------- +; Authors: +; A. Chen (INAF/IASF Mi) +; --------------------------------------- +; Modification history: +; 06/10/2023: copied from AGILE_write_all_sar_I0023.pro (V. Fioretti) +; 06/10/2023: I0026 and T class added (V. Fioretti) + + +@readaeff_I0026 +@interp_sar_I0026 + +sar_path = GETENV('CALIB_AE_RSP') +sar_path = sar_path+'/sar' + +; .sar.gz path keyword (0 = Default, 1 = enter new path) +sar_path_key = 0 + +read, sar_path_key, PROMPT = '% - .sar.gz directory [0 = $CALIB_AE_RSP/sar, 1 = new directory]:' +if sar_path_key EQ 1 then read, sar_path, PROMPT = '% - .sar.gz directory (e.g. /home):' + +ae_path = GETENV('CALIB_AE_RSP') +ae_path = ae_path+'/aref' +; .ae path keyword (0 = Default, 1 = enter new path) +ae_path_key = 0 + +read, ae_path_key, PROMPT = '% - .ae directory [0 = $CALIB_AE_RSP/aref, 1 = new directory]:' +if ae_path_key EQ 1 then read, ae_path, PROMPT = '% - .ae directory (e.g. /home):' + +template = sar_path+'/AG_GRID_G0017_S0001_I0007_template.sar.gz' + +fileid = 'I0026' +factor = [[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]] + +table = mrdfits(template,0,head0) +flags = mrdfits(template,1,head1) +labels = mrdfits(template,2,head2) +initheads, head0, head1, head2, fileid + +filters = ['F4','FM','FT3ab'] +status = ['G','L','S', 'T'] +thetas = ['01','30','35','45','50','60'] +nthetas = n_elements(thetas) +phis = ['00','45'] +nphis = n_elements(phis) + +thetamap = intarr(n_elements(labels.polar_angle)) +for itheta = 1, nthetas - 1 do thetamap = thetamap + (labels.polar_angle ge thetas[itheta]) +thetamap = thetamap + (labels.polar_angle ge 70.0) + +readaeff_I0026, ae_path, filters[0], thetas[0], phis[0], energies, areas +nenergies = n_elements(energies) +allareas = replicate(areas[0], nenergies, nthetas, nphis) + +for ifilter = 0, n_elements(filters)-1 do $ + for istatus = 0, n_elements(status)-1 do begin + stancon = 'S' + filters[ifilter] + status[istatus] + filename = sar_path+'/AG_GRID_G0017_' + stancon + '_' + fileid + '.sar' + sxaddpar, head0, 'STAN_CON', stancon + sxaddpar, head0, 'EXTEND', 'T' + for itheta = 0, nthetas - 1 do for iphi = 0, nphis - 1 do begin + readaeff_I0026, ae_path, filters[ifilter], thetas[itheta], phis[iphi], energies, areas + allareas[*, itheta, iphi] = areas + endfor + interp_sar_I0026, table, allareas, labels, energies, thetas, phis, istatus, factor = factor[*,ifilter] + mwrfits, table, filename, head0, /create + mwrfits, flags, filename, head1 + mwrfits, labels, filename, head2 + spawn, 'ftchecksum '+filename+' update=yes datasum=yes chatter=0' + spawn, 'gzip -f '+filename +endfor +end diff --git a/eff_area/area.pro b/eff_area/area.pro index ce72155..8aa149b 100644 --- a/eff_area/area.pro +++ b/eff_area/area.pro @@ -13,7 +13,7 @@ ; --------------------------------------- ; Modification history: ; 13/11/2013: taking the /aref directory as input (V. Fioretti) - +; 6/10/2023: T class added (V. Fioretti) function area,ae_path=ae_path,theta=theta,phi=phi,energy=energy,tip=tip,spec=spec,filtro=filtro @@ -40,6 +40,7 @@ energie=af(0,*) if tip eq 'G' then aree=af(1,*) if tip eq 'L' then aree=af(2,*) if tip eq 'S' then aree=af(3,*) +if tip eq 'T' then aree=af(4,*) ;print,aree diff --git a/eff_area/interp_sar_I0026.pro b/eff_area/interp_sar_I0026.pro new file mode 100644 index 0000000..8a48ba9 --- /dev/null +++ b/eff_area/interp_sar_I0026.pro @@ -0,0 +1,39 @@ +; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +; % interp_sar_I0026 % +; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +; --------------------------------------- +; Authors: +; A. Chen (INAF/IASF Mi) +; --------------------------------------- +; Modification History: +; 06/10/2023: copied from interp_sar_I0023.pro (V. Fioretti) +; 06/10/2023: I0026 added (V. Fioretti) + +pro interp_sar_I0026, table, allareas, labels, energies, thetas, phis, istatus, factor = factor + +nthetas = n_elements(thetas) +nphis = n_elements(phis) +thetamap = intarr(n_elements(labels.polar_angle)) +for itheta = 1, nthetas - 1 do thetamap = thetamap + (labels.polar_angle ge thetas[itheta]) +thetamap = thetamap + (labels.polar_angle gt 90.0) +nenergies = n_elements(energies) + for ietab = 0, n_elements(labels.energy) - 1 do $ + for ittab = 0, n_elements(labels.polar_angle) - 1 do $ + for iaztab = 0, n_elements(labels.azimuth_angle) - 1 do begin + if thetamap[ittab] gt (nthetas - 1) then table[ietab, ittab, iaztab] = 0 $ + else begin + t0 = 10.0d ^ interpol(alog10(allareas[*, thetamap[ittab], iaztab mod 2].(istatus)), alog10(energies), alog10(labels.energy[ietab])) + if thetamap[ittab]+1 gt (nthetas - 1) then begin +; print, t0 + t1 = t0 + endif else $ + t1 = 10.0d ^ interpol(alog10(allareas[*, thetamap[ittab]+1, iaztab mod 2].(istatus)), alog10(energies), alog10(labels.energy[ietab])) + if (thetamap[ittab]+1 lt nthetas) then $ + table[ietab, ittab, iaztab] = interpol([t0,t1], double(thetas[thetamap[ittab]:thetamap[ittab]+1]), labels.polar_angle[ittab]) $ + else $ + table[ietab, ittab, iaztab] = interpol([t0,t1], double([thetas[thetamap[ittab]],thetas[thetamap[ittab]]+40.0]), labels.polar_angle[ittab]) + endelse + table[ietab, ittab, iaztab] = factor[ittab] * table[ietab, ittab, iaztab] + endfor + +end diff --git a/eff_area/readaeff_I0026.pro b/eff_area/readaeff_I0026.pro new file mode 100644 index 0000000..e6a0e04 --- /dev/null +++ b/eff_area/readaeff_I0026.pro @@ -0,0 +1,50 @@ +; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +; % readaeff_I0026.pro % +; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +; Description: +; Routine called by AGILE_write_all_sar_I0026.pro +; Reading: +; - __.txt +; --------------------------------------- +; Authors: +; A. Chen (INAF/IASF Mi) +; --------------------------------------- +; Modification history: +; 06/10/2023: copied from readaeff_I0023.pro (V. Fioretti) +; 06/10/2023: I0026 and T class added (V. Fioretti) + +pro readaeff_I0026, ae_path, filter, theta, phi, energies, area, directory = directory + +if n_elements(directory) eq 0 then begin + directory=ae_path+'/' + filename = directory + filter + '_' + theta + '_' + phi + '.txt' +endif + + +e = 0.0d & ag = 0.0d & al = 0.0d & as = 0.0d & agls = 0.0d +earr = [0.0d,10.0d] & agarr = [0.0d,0.1d] & alarr = [0.0d,0.1d] & asarr = [0.0d,0.1d]& aglsarr = [0.0d,0.1d] +dummy = '' + +openr, u, filename, /get_lun +for i = 0, 3 do readf, u, dummy +while not eof(u) do begin + readf, u, e, ag, al, as, agls + earr = [earr, e] + factor = 1.0 + agarr = [agarr, ag / factor] + alarr = [alarr, al / factor] + asarr = [asarr, as / factor] + aglsarr = [aglsarr, agls / factor] +endwhile +free_lun, u +num = n_elements(earr)-1 +energies = earr[1:num] +area = replicate({G: 0.0d, L:0.0d, S:0.0d, T: 0.0d}, num) +area.G = agarr[1:num] +area.L = alarr[1:num] +area.S = asarr[1:num] +area.T = aglsarr[1:num] + +end + + diff --git a/resp_ae_BAND/aeffi.pro b/resp_ae_BAND/aeffi.pro index b336511..37158bd 100644 --- a/resp_ae_BAND/aeffi.pro +++ b/resp_ae_BAND/aeffi.pro @@ -9,6 +9,7 @@ ; --------------------------------------- ; Modification history: ; 24/10/2013: JPG removed, saving output in postscript (V. Fioretti) +; 03/10/2023: Adding T class (V. Fioretti) pro aeffi,ee, a, run, fil, inde, bol @@ -35,11 +36,15 @@ pro aeffi,ee, a, run, fil, inde, bol wg=where((ee.evstatus eq 'G') eq bol) wl=where((ee.evstatus eq 'L') eq bol) ws=where((ee.evstatus eq 'S') eq bol) +wgls = where(((ee.evstatus eq 'G') eq bol) or ((ee.evstatus eq 'L') eq bol) or ((ee.evstatus eq 'S') or bol)) + ;w31=where((ee31.evstatus eq tip) eq bol) cag=canali(a(1,wg)*1000) cal=canali(a(1,wl)*1000) cas=canali(a(1,ws)*1000) +cagls=canali(a(1,wgls)*1000) + ;ca31=canali(a31(1,w31)*1000) canal=[10.,35,50,71,100,141,200,283,400,632,1000,1732,3000,5477,10000,20000,100000] @@ -83,12 +88,13 @@ TVLCT, 255 * RED, 255 * GREEN, 255 * BLUE plot_oo,er,smooth(cag/ff,2) $ ,psym=-3,yrange=[1,1000.],xrange=[10,100000.],xstyle=1,ystyle=1 $ - ,xtitle='Energy [MeV]',ytitle='Effective Area [cm!u2!n]',title='black:G, blue:L, red:S' + ,xtitle='Energy [MeV]',ytitle='Effective Area [cm!u2!n]',title='black:G, blue:L, red:S, green:T' oplot,er,smooth(cal/ff,2),psym=-3,color=1, thick=3 oplot,er,smooth(cas/ff,2),psym=-3,color=2, thick=3 ;oplot,er,smooth(ca31/ff,2),psym=-6,color=verde oplot,er,smooth(cag/ff,2),psym=-3,color=0, thick=3 +oplot,er,smooth(cagls/ff,2),psym=-3,color=3, thick=3 ;legend,['F4','F2','FT3-0','FT3-1'],color=[nero,blu,rosso,verde],linestyle=[0,0,0,0],/bot,/rig @@ -96,7 +102,8 @@ oplot,er,smooth(cag/ff,2),psym=-3,color=0, thick=3 fits_write,run+'_'+fil+'.ae',[ transpose(er(0:15)), $ transpose(smooth(cag/ff,2)), $ transpose(smooth(cal/ff,2)), $ - transpose(smooth(cas/ff,2)) ] + transpose(smooth(cas/ff,2)), $ + transpose(smooth(cagls/ff,2)) ] diff --git a/resp_ae_BAND/maris.pro b/resp_ae_BAND/maris.pro index 4e4d97b..d41e34b 100644 --- a/resp_ae_BAND/maris.pro +++ b/resp_ae_BAND/maris.pro @@ -9,7 +9,8 @@ ; Authors: ; A. Giuliani, A. Chen (INAF/IASF Mi) ; --------------------------------------- - +; Modification history: +; 03/10/2023: Adding T class (V. Fioretti) @@ -18,7 +19,7 @@ pro maris,ee,a,the,phi,run,fil tipo=['G','L','S'] -mmat=fltarr(3,16,16) +mmat=fltarr(4,16,16) for j=0,2 do begin @@ -28,6 +29,10 @@ for j=0,2 do begin endfor +wc=where((ee.evstatus eq tipo(0)) or (ee.evstatus eq tipo(1)) or (ee.evstatus eq tipo(2))) +mat=matmake16(a(1,wc)*1000,ee(wc).energy) +mmat(3,*,*)=mat + ;map,total(mmat(0,*,*),1),/scl fits_write,run+'_'+fil+'.rsp',mmat