pro responsematrixchange ; this IDL code creates new internal bkg files for any response matrix for a 1 arcmin2 extraction area and for Rextraction=5 arcsec (point sources) ; the core REQUIRES IDL Astrolib to compile properly path = '/home/simone/Scrivania/XIFUbkgfiles/2020/'; insert your path to where the response matrix is located rmffile = 'XIFU_CC_BASELINECONF_2018_10_10'; insert your response matrix name (WITHOUT .rmf) extension = '.rmf' file=path+rmffile+extension ;read energy bounds from response matrix file FXBOPEN, UNIT,file, 'EBOUNDS' ; FXBREAD,UNIT, channels, 'CHANNEL' & FXBREAD,UNIT, Emin, 'E_MIN' & FXBREAD,UNIT, Emax, 'E_MAX'; FXBCLOSE, UNIT; dE= Emax-Emin bkg=0.005; your expected NXB background level in cts/cm2/s/keV bkg2=bkg/8.2; cts/arcmin2/s/keV bkg3=bkg2*dE; cts/arcmin2/s/bin bkg4=bkg3*0.0218; cts/s/bin with Rextraction=5arcsec (point sources) a=mrdfits(path+'int1arcmin2.pha', 1, hdr, /fscale) ; this should be just a mock copy of your diffuse bkg file to be used as a template to write the internal one a.rate=bkg3 mwrfits,a,path+'internal_1arcmin2_'+rmffile+'.pha',hdr,/create a.rate=bkg4 mwrfits,a,path+'internal_pointsources_'+rmffile+'.pha',hdr,/create end