def write_pha_from_binner(self, file_name, start=None, stop=None, overwrite=False, force_rsp_write=False, extract_measured_background=False): """ Write PHA fits files from the selected bins. If writing from an event list, the bins are from create_time_bins. If using a pre-time binned time series, the bins are those native to the data. Start and stop times can be used to control which bins are written to files :param file_name: the file name of the output files :param start: optional start time of the bins :param stop: optional stop time of the bins :param overwrite: if the fits files should be overwritten :param force_rsp_write: force the writing of RSPs :param extract_measured_background: Use the selected background rather than a polynomial fit to the background :return: None """ # we simply create a bunch of dispersion plugins and convert them to OGIP ogip_list = [OGIPLike.from_general_dispersion_spectrum(sl) for sl in self.to_spectrumlike(from_bins=True, start=start, stop=stop, extract_measured_background=extract_measured_background)] # write out the PHAII file pha_writer = PHAWrite(*ogip_list) pha_writer.write(file_name, overwrite=overwrite, force_rsp_write=force_rsp_write)
def write_pha_from_binner(self, file_name, start=None, stop=None, overwrite=False, force_rsp_write=False): """ Write PHA fits files from the selected bins. If writing from an event list, the bins are from create_time_bins. If using a pre-time binned time series, the bins are those native to the data. Start and stop times can be used to control which bins are written to files :param file_name: the file name of the output files :param start: optional start time of the bins :param stop: optional stop time of the bins :param overwrite: if the fits files should be overwritten :param force_rsp_write: force the writing of RSPs :return: None """ # we simply create a bunch of dispersion plugins and convert them to OGIP ogip_list = [ OGIPLike.from_general_dispersion_spectrum(sl) for sl in self.to_spectrumlike(from_bins=True, start=start, stop=stop) ] # write out the PHAII file pha_writer = PHAWrite(*ogip_list) pha_writer.write(file_name, overwrite=overwrite, force_rsp_write=force_rsp_write)
def write_pha(self, filename, overwrite=False, force_rsp_write=False): """ Writes the observation, background and (optional) rsp to PHAII fits files :param filename: base file name to write out :param overwrite: if you would like to force overwriting of the files :param force_rsp_write: force the writing of an rsp even if not required """ # we need to pass up the variables to an OGIPLike # so that we have the proper variable name # a local import here because OGIPLike is dependent on this from threeML.plugins.OGIPLike import OGIPLike ogiplike = OGIPLike.from_general_dispersion_spectrum(self) ogiplike.write_pha(file_name=filename, overwrite=overwrite, force_rsp_write=force_rsp_write)
def write_pha(self, filename: str, overwrite: bool = False, force_rsp_write: bool = False) -> None: """ Writes the observation, background and (optional) rsp to PHAII fits files :param filename: base file name to write out :param overwrite: if you would like to force overwriting of the files :param force_rsp_write: force the writing of an rsp even if not required """ # we need to pass up the variables to an OGIPLike # so that we have the proper variable name # a local import here because OGIPLike is dependent on this from threeML.plugins.OGIPLike import OGIPLike ogiplike = OGIPLike.from_general_dispersion_spectrum(self) ogiplike.write_pha( file_name=filename, overwrite=overwrite, force_rsp_write=force_rsp_write )