Example #1
0
def specrate(parlist):
    """Return the countrate of the spectrum as observed through the
    obsmode, based on the binned wavelength set; and write the resulting
    spectrum to a file, returning the filename."""

    d=getparms(parlist)
    sp=parse_spec(d['spectrum'])
    bp=ObsBandpass(d['instrument'])
    
    #Check overlap status & proceed accordingly
    ostat=bp.check_overlap(sp)

    try:
        obs=Observation(sp,bp,force=odict[ostat])
    except KeyError:
        obs=Observation(sp,bp,bp.wave,force=odict[ostat])

    obs.convert('counts')
    try:
        obs.writefits(d['output'],binned=True)
    except KeyError:
        d['output']=None

    if ostat == 'full':
        return "%g;%s"%(obs.countrate(),d['output'])
    else:
        return "%g;%s;%s"%(obs.countrate(),d['output'],owarn[ostat])
Example #2
0
def calcphot(parlist):
    """Calculate either effstim or efflam, depending on the input argument"""
    d=getparms(parlist)
    sp=parse_spec(d['spectrum'])
    bp=ObsBandpass(d['obsmode'])
    # obs=bp.observe(sp)
    
    ostat=bp.check_overlap(sp)
    
    try:
        obs=Observation(sp,bp,force=odict[ostat])
    except KeyError:
        obs=Observation(sp,bp,bp.wave,force=odict[ostat])

    obs.convert('counts')
    ans=obs.efflam()

    if ostat == 'full':
        return ans
    else:
        return ans, owarn[ostat]
Example #3
0
def countrate(parlist):
    """Return the pivot wavelength and countrate of the spectrum as
    observed through the obsmode, but based on the native waveset"""
    d=getparms(parlist)
    sp=parse_spec(d['spectrum'])
    bp=ObsBandpass(d['instrument'])


    #Check overlap status & proceed accordingly
    ostat=bp.check_overlap(sp)
    
    try:
        obs=Observation(sp,bp,force=odict[ostat])
    except KeyError:
        obs=Observation(sp,bp,bp.wave,force=odict[ostat])

    obs.convert('counts')
    efflam=obs.efflam()
    ans=obs.countrate(binned=False)

    if ostat == 'full':
        return ans,efflam
    else:
        return ans, efflam, owarn[ostat]