Beispiel #1
0
def make_point_sources_file(filename,
                            name,
                            exp_time,
                            fov,
                            sky_center,
                            absorb_model="wabs",
                            nH=0.05,
                            area=40000.0,
                            prng=None,
                            append=False,
                            overwrite=False,
                            src_filename=None,
                            input_sources=None,
                            output_sources=None):
    """
    Make a SIMPUT catalog made up of contributions from
    point sources. 

    Parameters
    ----------
    filename : string
        The filename for the SIMPUT catalog.
    name : string
        The name of the SIMPUT photon list.
    exp_time : float, (value, unit) tuple, or :class:`~astropy.units.Quantity`
        The exposure time of the observation in seconds.
    fov : float, (value, unit) tuple, or :class:`~astropy.units.Quantity`
        The field of view in arcminutes.
    sky_center : array-like
        The center RA, Dec of the field of view in degrees.
    absorb_model : string, optional
        The absorption model to use, "wabs" or "tbabs". Default: "wabs"
    nH : float, (value, unit) tuple, or :class:`~astropy.units.Quantity`, optional
        The hydrogen column in units of 10**22 atoms/cm**2. 
        Default: 0.05
    area : float, (value, unit) tuple, or :class:`~astropy.units.Quantity`, optional
        The effective area in cm**2. It must be large enough 
        so that a sufficiently large sample is drawn for the 
        ARF. Default: 40000.
    prng : :class:`~numpy.random.RandomState` object, integer, or None
        A pseudo-random number generator. Typically will only 
        be specified if you have a reason to generate the same 
        set of random numbers, such as for a test. Default is None, 
        which sets the seed based on the system time.
    append : boolean, optional
        If True, the photon list source will be appended to an existing
        SIMPUT catalog. Default: False
    overwrite : boolean, optional
        Set to True to overwrite previous files. Default: False
    src_filename : string, optional
        If set, this will be the filename to write the source
        to. By default, the source will be written to the same
        file as the SIMPUT catalog.
    input_sources : string, optional
        If set to a filename, input the source positions, fluxes,
        and spectral indices from an ASCII table instead of generating
        them. Default: None
    output_sources : string, optional
        If set to a filename, output the properties of the sources
        within the field of view to a file. Default: None
    """
    events = make_ptsrc_background(exp_time,
                                   fov,
                                   sky_center,
                                   absorb_model=absorb_model,
                                   nH=nH,
                                   area=area,
                                   input_sources=input_sources,
                                   output_sources=output_sources,
                                   prng=prng)
    phlist = SimputPhotonList(events["ra"],
                              events["dec"],
                              events["energy"],
                              events["flux"],
                              name=name)
    if append:
        cat = SimputCatalog.from_file(filename)
        cat.append(phlist, src_filename=src_filename, overwrite=overwrite)
    else:
        cat = SimputCatalog.from_source(filename,
                                        phlist,
                                        src_filename=src_filename,
                                        overwrite=overwrite)
    return cat
Beispiel #2
0
def make_cosmological_sources_file(filename, name, exp_time, fov,
                                   sky_center, cat_center=None,
                                   absorb_model="wabs", nH=0.05, area=40000.0,
                                   overwrite=False, output_sources=None, 
                                   write_regions=None, src_filename=None,
                                   prng=None, append=False):
    r"""
    Make a SIMPUT catalog made up of contributions from
    galaxy clusters, galaxy groups, and galaxies.

    Parameters
    ----------
    filename : string
        The filename for the SIMPUT catalog.
    name : string
        The name of the SIMPUT photon list.
    exp_time : float, (value, unit) tuple, or :class:`~astropy.units.Quantity`
        The exposure time of the observation in seconds.
    fov : float, (value, unit) tuple, or :class:`~astropy.units.Quantity`
        The field of view in arcminutes.
    sky_center : array-like
        The center RA, Dec of the field of view in degrees.
    cat_center : array-like
        The center of the field in the coordinates of the
        halo catalog, which range from -5.0 to 5.0 degrees
        along both axes. If None is given, a center will be
        randomly chosen.
    absorb_model : string, optional
        The absorption model to use, "wabs" or "tbabs". Default: "wabs"
    nH : float, (value, unit) tuple, or :class:`~astropy.units.Quantity`, optional
        The hydrogen column in units of 10**22 atoms/cm**2. 
        Default: 0.05
    area : float, (value, unit) tuple, or :class:`~astropy.units.Quantity`, optional
        The effective area in cm**2. It must be large enough 
        so that a sufficiently large sample is drawn for the 
        ARF. Default: 40000.
    overwrite : boolean, optional
        Set to True to overwrite previous files. Default: False
    output_sources : string, optional
        If set to a filename, output the properties of the sources
        within the field of view to an ASCII file. Default: None
    write_regions : string, optional
        If set to a filename, output circle ds9 regions corresponding to the
        positions of the halos with radii corresponding to their R500 
        projected on the sky. Default: None
    src_filename : string, optional
        If set, this will be the filename to write the source
        to. By default, the source will be written to the same
        file as the SIMPUT catalog
    prng : :class:`~numpy.random.RandomState` object, integer, or None
        A pseudo-random number generator. Typically will only 
        be specified if you have a reason to generate the same 
        set of random numbers, such as for a test. Default is None, 
        which sets the seed based on the system time. 
    append : boolean, optional
        If True, the photon list source will be appended to an existing
        SIMPUT catalog. Default: False
    """
    events = make_cosmological_sources(exp_time, fov, sky_center,
                                       cat_center=cat_center,
                                       absorb_model=absorb_model, nH=nH,
                                       area=area, output_sources=output_sources,
                                       write_regions=write_regions,prng=prng)
    phlist = SimputPhotonList(events["ra"], events["dec"], events["energy"],
                              events["flux"], name=name)
    if append:
        cat = SimputCatalog.from_file(filename)
        cat.append(phlist, src_filename=src_filename, overwrite=overwrite)
    else:
        cat = SimputCatalog.from_source(filename, phlist,
                                        src_filename=src_filename,
                                        overwrite=overwrite)
    return cat