NuSTAR Python Event Filtering Subtroutines
- nustar_pysolar.filter.bad_pix(evtdata, fpm='A')
Do some basic filtering on known bad pixels.
- Parameters:
evtdata (FITS data class) – This should be an hdu.data structure from a NuSTAR FITS file.
fpm ({"FPMA" | "FPMB"}) – Which FPM you’re filtering on. Assumes A if not set.
- Returns:
goodinds – Index of evtdata that passes the filtering.
- Return type:
iterable
- nustar_pysolar.filter.by_det(evtdata, det_id=0)
Apply Det filtering to the data.
- Parameters:
evtdata (FITS data class) – This should be an hdu.data structure from a NuSTAR FITS file.
det_id (int) – Values of 0,1,2 or 3 Defaults to 0
- nustar_pysolar.filter.by_energy(evtdata, energy_low=2.5, energy_high=10.0)
Apply energy filtering to the data.
- Parameters:
evtdata (FITS data class) – This should be an hdu.data structure from a NuSTAR FITS file.
energy_low (float) – Low-side energy bound for the map you want to produce (in keV). Defaults to 2.5 keV.
energy_high (float) – High-side energy bound for the map you want to produce (in keV). Defaults to 10 keV.
- nustar_pysolar.filter.by_time(evtdata, hdr, time_range)
Apply time filtering to the data.
- Parameters:
evtdata (FITS data class) – This should be an hdu.data structure from a NuSTAR FITS file.
hdr (FITS header structure) – This should be an hdu.header structure from a NuSTAR FITS file
time_range (astropy.time format 2 elements) – Min, max time range to consider, in astropy time format
- nustar_pysolar.filter.by_xy(evtdata, hdr, xy_range)
Apply position filtering to the data.
- Parameters:
evtdata (FITS data class) – This should be an hdu.data structure from a NuSTAR FITS file.
hdr (FITS header structure) – This should be an hdu.header structure from a NuSTAR FITS file
xy_range (float list 4 elements) – Min, max x and min, max y in HPS arcseconds
- nustar_pysolar.filter.event_filter(evtdata, fpm='FPMA', energy_low=2.5, energy_high=10, hdr=0, xy_range=0, time_range=0, dets_id=[], no_grade_filter=False, no_bad_pix_filter=False)
- All in one filter module. By default applies an energy cut,
selects only events with grade == 0, and removes known hot pixel.
Note that this module returns a cleaned eventlist rather than the indices to the cleaned events.
- Parameters:
evtdata (FITS data structure) – This should be an hdu.data structure from a NuSTAR FITS file.
fpm ({"FPMA" | "FPMB"}) – Which FPM you’re filtering on. Defaults to FPMA.
energy_low (float) – Low-side energy bound for the map you want to produce (in keV). Defaults to 2.5 keV.
energy_high (float) – High-side energy bound for the map you want to produce (in keV). Defaults to 10 keV.
hdr (FITS header structure) – This should be an hdu.header structure from a NuSTAR FITS file Only needed when doing filtering by time or xy If not supplied no tim or xy filtering, even if they are specified
xy_range (float list 4 elements) – Min, max x and min, max y in HPS arcseconds Default not used, needs hdr to be supplied
time_range (astropy.time format 2 elements) – Min, max time range to consider, in astropy time format Default not used, needs hdr to be supplied
dets_id (int list up to 4 elements) – Which dets (0,1,2 and/or 3) to include Defaults to using all dets
no_bad_pix_filter (bool True or False) – Don’t filter the bad pixels Default is False (so does filter bad pixels)
no_grade_filter (bool True or False) – Return all grades, not just grade == 0 Default is False (so does return grade ==0)
- Returns:
cleanevt – This is the subset of evtdata that pass the data selection cuts.
- Return type:
FITS data class.
- nustar_pysolar.filter.gradezero(evtdata)
Only accept counts with GRADE==0.
- Parameters:
evtdata (FITS data class) – This should be an hdu.data structure from a NuSTAR FITS file.
- Returns:
goodinds – Index of evtdata that passes the filtering.
- Return type:
iterable