Exemplo n.º 1
0
def set_defaults(**kwargs):
    """
    Set defaults of this module
    
    If you give no keyword arguments, the default values will be reset.
    """
    clear_memoization(keys=['ivs.sed.ld'])
    if not kwargs:
        kwargs = dict(
            grid='kurucz',
            odfnew=True,
            z=+0.0,
            vturb=2,
            alpha=False,
            nover=False,  # KURUCZ
            He=97,  # WD
            t=1.0,
            a=0.0,
            c=0.5,
            m=1.0,
            co=1.05)  # MARCS and COMARCS

    for key in kwargs:
        if key in defaults:
            defaults[key] = kwargs[key]
            logger.info('Set %s to %s' % (key, kwargs[key]))
Exemplo n.º 2
0
def set_defaults(**kwargs):
    """
    Set defaults of this module
    
    If you give no keyword arguments, the default values will be reset.
    """
    clear_memoization(keys=["ivs.sed.ld"])
    if not kwargs:
        kwargs = dict(
            grid="kurucz",
            odfnew=True,
            z=+0.0,
            vturb=2,
            alpha=False,
            nover=False,  # KURUCZ
            He=97,  # WD
            t=1.0,
            a=0.0,
            c=0.5,
            m=1.0,
            co=1.05,
        )  # MARCS and COMARCS

    for key in kwargs:
        if key in defaults:
            defaults[key] = kwargs[key]
            logger.info("Set %s to %s" % (key, kwargs[key]))
Exemplo n.º 3
0
def _get_itable_markers(photband,
                        gridfile,
                        teffrange=(-np.inf, np.inf),
                        loggrange=(-np.inf, np.inf)):
    """

    Get a list of markers to more easily retrieve integrated fluxes.
    """
    clear_memoization()

    ff = pf.open(gridfile)
    ext = ff[photband]
    columns = ext.columns.names
    names = ['teff', 'logg']
    grid = [ext.data.field('teff'), ext.data.field('logg')]
    if 'ebv' in columns:
        names.append('ebv')
        grid.append(ext.data.field('ebv'))
    if 'vrad' in columns:
        names.append('vrad')
        grid.append(ext.data.field('vrad'))

    grid_axes = [np.sort(list(set(i))) for i in grid]

    # -- we construct an array representing the teff-logg-ebv content, but
    #   in one number: 50000400 means:
    #   T=50000,logg=4.0
    N = len(grid[0])
    markers = np.zeros(N, float)
    gridpnts = np.zeros((N, len(grid)))
    pars = np.zeros((N, 5))

    for i, entries in enumerate(zip(*grid)):
        markers[i] = encode(
            **{key: entry
               for key, entry in zip(names, entries)})
        gridpnts[i] = entries
        pars[i] = list(ext.data[i][-5:])
    ff.close()
    sa = np.argsort(markers)
    print('read in gridfile', gridfile)
    pars[:, -1] = np.log10(pars[:, -1])
    return markers[sa], grid_axes, gridpnts[sa], pars[sa]
Exemplo n.º 4
0
def _get_itable_markers(photband,gridfile,
                    teffrange=(-np.inf,np.inf),loggrange=(-np.inf,np.inf)):
    """
    Get a list of markers to more easily retrieve integrated fluxes.
    """
    clear_memoization()
    
    ff = pf.open(gridfile)
    ext = ff[photband]
    columns = ext.columns.names
    names = ['teff','logg']
    grid = [ext.data.field('teff'),
            ext.data.field('logg')]
    if 'ebv' in columns:
        names.append('ebv')
        grid.append(ext.data.field('ebv'))
    if 'vrad' in columns:
        names.append('vrad')
        grid.append(ext.data.field('vrad'))
    
    grid_axes = [np.sort(list(set(i))) for i in grid]
    
    #-- we construct an array representing the teff-logg-ebv content, but
    #   in one number: 50000400 means: 
    #   T=50000,logg=4.0
    N = len(grid[0])
    markers = np.zeros(N,float)
    gridpnts = np.zeros((N,len(grid)))
    pars = np.zeros((N,5))
    
    for i,entries in enumerate(zip(*grid)):
        markers[i] = encode(**{key:entry for key,entry in zip(names,entries)})
        gridpnts[i]= entries
        pars[i] = list(ext.data[i][-5:])
    ff.close()
    sa = np.argsort(markers)
    print 'read in gridfile',gridfile
    pars[:,-1] = np.log10(pars[:,-1])
    return markers[sa],grid_axes,gridpnts[sa],pars[sa]