============ Get data ============ :code:`redback` provides a simple interface to getting data from the open access, Swift, OTTER, and BATSE catalogs, in different formats. We also provide simple interfaces to get data from the FINK and LASAIR brokers, as well as the open access catalog. The different APIs to get data implemented in - Swift: Prompt, X-ray afterglow [counts, flux, flux density] - Open access catalog: Supernova, kilonova, tidal disruption event [photometry] - OTTER: Tidal disruption event [photometry, x-ray and radio data] - FINK and LASAIR Broker: Supernova, kilonova, tidal disruption event or other transient [photometry] - BATSE: Prompt [count rate] For example, downloading the X-ray afterglow of GRB 070809 is as simple as .. code:: python GRB = '070809' data = redback.get_data.get_bat_xrt_afterglow_data_from_swift(grb=GRB, data_mode="flux") Or downloading the flux_density/magnitude data of the kilonova at2017gfo from the open access catalog .. code:: python kne = 'at2017gfo' data = redback.get_data.get_kilonova_data_from_open_transient_catalog_data(transient=kne) Or from OTTER (Open multiwavelength Transient Event Repository). Note that OTTER currently only has TDE data (photometry, x-ray and radio data) but the developers will be adding more data in the future. .. code:: python tde = 'at2019dsg' data = redback.get_data.get_tidal_disruption_event_data_from_otter(transient=tde) # Get both radio and x-ray observations data = redback.get_data.get_tidal_disruption_event_data_from_otter(transient='at2019dsg',obs_type=['radio', 'xray']) All these commands return the data, in a pandas dataframe. They also save the raw and processed data in a sensible way. For example, the kilonova data will be saved to :code:`kilonova/at2017gfo.csv`, afterglow will be saved to :code:`GRBData/afterglow/flux/GRB070809.csv` and TDE data will be saved to :code:`tde/at2019dsg.csv`. Please look at the API or the examples to see how we can get other data. Basic processing and metadata ------------------------- We do some basic processing to the raw data to make the files homogenous and save them in a homogenous format. We also get metadata about the transient, such as redshift, start time, photon index etc from publically available sources. Users can also provide this metadata themselves. Private data or simulated data ------------------------- We do not have to use data from the above catalogs for fitting. Redback can be used on private data or simulated data. This is described in more detail in the transient or simulation documentation. A general example which shows the API for downloading data from any of the above catalogs is available `here `_. Adding filters to Redback ------------------------- Redback includes many filters that are a part of the SN Cosmo distribution. You can get a full list using the following command: .. code:: python from redback import filters filters.show_all_filters() We have implemented a few options to add additional filters. Note, SN Cosmo does not allow to permanently add a filter to its filter database. This means that you have add any non-default filter to Redback every time you start a new session. In the following we describe different methods of adding a filter. * Adding a filter from a text file .. code:: python from redback import filters fname = 'Gemini_GMOS-N.u.dat' # Unique filter label filter_label = 'gmos-n::u' # Label shown in the plotting plot_label = 'GMOS-N/u' # If you want to overwrite any existing entry overwrite = True filters.add_filter_user(fname, filter_label, PLOT_LABEL=plot_label, OVERWRITE=overwrite) * Adding a filter using the Spanish Virtual Observatory The `Spanish Virtual Observatory (SVO) `_ has an extensive repository of astronomical filters of many observatories and space telescopes. The developer version of `Astroquery `_ allows accessing the SVO in a very convenient way. It is straightforward to add a filter from the SVO to Redback. .. code:: python from astroquery.svo_fps import SvoFps from redback import filters # We want to add GROND filters to Redback filter_table = SvoFps.get_filter_list(facility='La Silla', instrument='GROND') # The table has many columns. The filter ID are stored in 'filterID'. # We use this column to construct the filter label and the plot labels. # Unique filter labels filter_label = ['grond::' + x.split('/')[1].split('.')[1] for x in filter_table['filterID']] # Plot labels plot_label = ['GROND/' + x.split('/')[1].split('.')[1] for x in filter_table['filterID']] [filters.add_filter_svo(filter_table[ii], filter_label[ii], plot_label[ii]) for ii in range(len(filter_table))] We have pre-configured Redback to add a set of filters that are not a part of SN Cosmo distribution. The pre-configured list includes the Euclid Space Telescope, the GROND camera at the 2.2m MPG telescope, the EFOSC2/Gunn filters at 3.58m NTT telescope, the Spitzer Space Telescope and the WISE Space Telescope. To add them you need the developer version of `Astroquery `_. .. code:: python from astroquery.svo_fps import SvoFps from redback import filters filters.add_common_filters() Notes ------------------------- Before working with UV/optical/IR data from the Open Access Catalogue/FINK/LASAIR/Otter you should check the data. For example, for the Open Access Catalogue, you need to check whether the data are in the AB or Vega system and whether any extinction correction was applied to the data on the Open Access Catalogue. By default, Redback assumes that the OAC data is in AB magnitude and throws away any explicitly flagged VEGA data from the processed file (keeping the raw data intact). Redback also assumes the data is as observed i.e., without any extinction corrections applied. If this is not true, you are better off using/editing the raw data and loading the redback transient object manually instead of using the class methods. You should also check that the filter names are correct. For example, 'r' band in redback is treated as the SDSS r band, but it may actually be referring to the R band or e.g., ZTF/LSST r band which have different filter response functions.