Standard Wrapper Scripts¶
- nustar_gen.wrappers.make_image(infile, elow=3, ehigh=20, clobber=True, outpath=False, usrgti=False)¶
Spawn an xselect instance that produces the image in the energy range.
- Parameters:
infile (str) – Full path to the file that you want to process
elow (float) – Low-energy band for the image. Default is 3 keV.
ehigh (float) – High-energy band for the image. Default is 20 keV.
clobber (boolean, optional, default=True) – Overwrite existing files?
outpath (str, optional, default=os.path.dirname(infile)) – Set the destination for output. Defaults to same location as infile.
usrgti (str, optional, default = False) – Use a GTI file to time-fitler the data (see nustar_gen.utils.make_usr_gti) If False, do nothing.
- Returns:
outfile – The full path to the output image.
- Return type:
str
- nustar_gen.wrappers.make_spectra(infile, mod, src_reg, usrgti=False, mode='01', bgd_reg='None', outpath='None', runmkarf=True, runmkrmf=True, extended='no', grouping_flag=False, group_min_count=30, group_pi_bad_high=1909, group_pi_bad_low=35, group_append='grp', oa_hist=False)¶
Generate a script to run nuproducts to extract a source (and optionally a background) spectrum along with their response files. Does not automatically run this script (must be run from the command line) separately.
Always runs numkrmf.
- Parameters:
infile (str) – Full path to the input event file.
mod (str) – ‘A’ or ‘B’
src_reg (str) – Full path to source region.
usrgti (str, optional, default=False) – If not False must be the full path to the GTI that you want to apply to the spectrum.
mode (str, optional, default = '01') – Optional. Used primarily if you’re doing mode06 analysis and need to specify output names that are more complicated.
bgd_reg (str, optional, default='None') – If not ‘None’, then must be the full path to the background region file
outpath (str) – Output path for the resulting spectra. Default is to put the spectra in the same location as infile.
runmkarf (bool, optional, default=True) – Flag for whether or not to generate an ARF. Alternative is False.
runmkarf – Flag for whether or not to generate an RMF. Alternative is False.
extended (str, optional, default='no') – Flag for whether or not to use the extended ARF. Default is ‘no’. Alternative is ‘yes’.
grouping_flag (bool) – Optional. Used to indicate if the grouping of the spectra should be done or not
group_min_count (int default value: 30) – Minimum count rate used for grppha run
group_pi_bad_high (int default value: 1909) – Channel number above which bad flag is applied
group_pi_bad_low (int default value: 35) – Channel number below which bad flag is applied
group_append (str default value:'grp') – A subtring which will be appended to the grouped spectra
- Returns:
scr – Path to the resulting shell script
- Return type:
str
- nustar_gen.wrappers.make_lightcurve(infile, mod, src_reg, barycorr=False, time_bin=<Quantity 100. s>, mode='01', usrgti=False, bgd_reg='None', outpath='None', elow=3, ehigh=20)¶
Generate a script to run nuproducts to make a lightcurve. Script must be run from the command line.
- Parameters:
infile (str) – Full path to the input event file.
mod (str) – ‘A’ or ‘B’
src_reg (str) – Full path to source region.
barycorr (bool, optional, default=False) – If True, then queries the infile for the OBJ J2000 coordinates and uses these for the barycenter correction.
time_bin (astropy unit, options, default=100) – Length of the time bin. Min is 1*u.s
mode (str, optional, default = '01') – Used primarily if you’re doing mode06 analysis and need to specify output names that are more complicated.
usrgti (str, optional, default=False) – If not False, must be the full path to the GTI that you want to apply to the spectrum.
bgd_reg (str, optional, Default='None') – If not ‘None’, then must be the full path to the background region file
outpath (str, optional) – Optional. Default is to put the lightcurves in the same location as infile
elow (float, optional, default = 3) – Low-energy bound in keV
ehigh (float, optional, default = 20) – High-energy bound in keV
- Returns:
scr – Path to the resulting shell script
- Return type:
str
- nustar_gen.wrappers.make_exposure_map(obs, mod, vign_energy=False, det_expo=False, evf=False)¶
Create a script to run nuexpoomap. Returns the script name.
- Parameters:
obs (nustar_gen.info.Observation(), required) – A valid observation metadata.
mod (str) – ‘A’ or ‘B’
vign_energy (float, optional) – Energy where you want to apply the vignetting. Default is no vignetting.
det_expo (boolean, optional, default=False) – Whether or not to retain the DET1 exposure map file
- Returns:
scr – Path to the script
- Return type:
str
- nustar_gen.wrappers.extract_sky_events(infile, regfile, elow=1.6, ehigh=165.0, clobber=True, outpath=False)¶
Spawn an xselect instance that produces a new event file screened using a sky ds9 region file.
- Parameters:
infile (str) – Full path to the event file that you want to process
regfile (str) – Full path to a ds9 region file (in sky coordinates) to be used to filter the events.
elow (float, optional, default=3) – Low energy cut to use.
ehigh (float, optional, default=20) – High energy cut to use.
clobber (boolean, optional, default=True) – Overwrite existing files?
outpath (str, optional, default=os.path.dirname(infile)) – Set the destination for output. Defaults to same location as infile.
- Returns:
outfile – The full path to the output image.
- Return type:
str
- nustar_gen.wrappers.barycenter_events(obs, infile, mod='A', barycorr_pars=None)¶
Run barycorr on an event file.
- Parameters:
obs (nustar_gen.info.Observation) – An instance of the Observation class
infile (str) – Full path to input file
mod (str) – Module to use. ‘A’ or ‘B’
barycorr_pars (dict, optional, default=None) – If not None, must be a dict giving additional parameters to be passed to barycorr, in the format {‘refframe’: ‘icrs’, ‘ra’: 123.456}
- nustar_gen.wrappers.apply_gti(infile, gtifile, clobber=True, outpath=False)¶
Spawn an xselect instance that produces a new event file screened using GTI file
- Parameters:
infile (str) – Full path to the event file that you want to process
regfile (str) – Full path to a ds9 region file (in sky coordinates) to be used to filter the events.
clobber (boolean, optional, default=True) – Overwrite existing files?
outpath (str, optional, default=os.path.dirname(infile)) – Set the destination for output. Defaults to same location as infile.
- Returns:
outfile – The full path to the output image.
- Return type:
str