stix2xspec.stix2xspec module
- stix2xspec.stix2xspec.background_subtract(spectrogram, spectrogram_bk, counts_spec, testing=False)
Perform background subtraction of spectrogram counts.
- Parameters
spectrogram (stix2xspec.Spectrogram) – The spectrogram of the signal that will be background subtracted
spectrogram_bk (stix2xspec.Spectrogram) – The spectrogram of the background that will be subtracted from the signal
counts_spec (np.array) – Original, uncorrected counts of input spectrogram.
- Returns
Arrays containing background-subtracted counts and total error.
- Return type
tuple
- stix2xspec.stix2xspec.bk_count_manipulations(bk_counts, duration, timedel, energy_bins, eff_ewidth, ntimes, error=False)
Adjust input counts for effective energy width and duration.
- Parameters
bk_counts (np.array) – The input array.
duration (np.array) – Array of time bin durations.
timedel (np.array) – Array of time deltas.
energy_bins (np.array) – Energy bins.
eff_ewidth (np.array) – Effective energy bin width.
ntimes (int) – Number of times.
error (bool) – Defaults to False. Set to True if input array is counts error rather than counts.
- Returns
array containing the input adjusted for effective energy width and duration.
- Return type
np.array
- stix2xspec.stix2xspec.convert_spectrogram(fits_path_data, fits_path_bk=None, shift_duration=0, energy_shift=0, distance=1.0, elut_filename=None, replace_doubles=False, keep_short_bins=True, to_fits=False, use_discriminators=True, testing=False)
Convert STIX spectrogram for use in XSPEC (translation of _stx_convert_spectrogram.pro_, which coverts STIX spectrograms for use with OPSEX, and also of _stx_convert_pixel_data.pro_, which does the same for L1A pixel data).
- Parameters
fits_path_data (str) – Full path to FITS file to be converted.
fits_path_bk (str) – Full path to FITS background file to be subtracted.
shift_duration (int, optional) – Defaults to 0. Shift all time bins by 1 to account for FSW time input discrepancy prior to 09-Dec-2021. N.B. WILL ONLY WORK WITH FULL TIME RESOLUTION DATA WHICH IS OFTEN NOT THE CASE FOR PIXEL DATA.
energy_shift (int, optional) – Defaults to 0. Shift all energies by this value in keV. Rarely needed only for cases where there is a significant shift in calibration before a new ELUT can be uploaded.
distance (float, optional) – Defaults to 1.0. Distance in AU between Solar Orbiter and the Earth.
elut_filename (str, optional) – Defaults to None. Name of the ELUT file to use.
replace_doubles (bool, optional) – Defaults to False.
keep_short_bins (bool, optional) – Defaults to True. Otherwise discards time bins shorter than a minimum value.
to_fits (bool, optional) – Defaults to False. If True, a FITS file will be written.
use_discriminators (bool, optional) – Defaults to True.
- Returns
Full path to FITS file that has been written with the converted spectrogram.
- Return type
str
- stix2xspec.stix2xspec.new_energy_axis(spec, emin=1, emax=150)
Correct energy axis if required.
- Parameters
spec (stix2xspec.Spectrogram) – The input spectrogram
emin (int, optional) – Defaults to 1. The minimum energy.
emax (int, optional) – Defaults to 150. The maximum energy.
- Returns
stx_energy_axis object containing new energy axis, list of new energies.
- Return type
tuple