Beispiel #1
0
Datei: lsd.py Projekt: adrn/PTF
def getLightCurvesRadial(ra, dec, radius):
    """ Selects light curves from the Large Survey Database (LSD) on kepler
        given an ra and dec in degrees, and a radius in degrees. The constraints
        in the query are taken from the LSD wiki:
            http://www.oir.caltech.edu/twiki_ptf/bin/viewauth/Main/LSDNavtara
        except here I allow for saturated magnitude measurements in case a 
        microlensing event causes a star to saturate temporarily.
    """
    bounds_t = lb.intervalset((40000, 60000))  # Cover the whole survey
    bounds_xy = lb.beam(ra, dec, radius)

    query = db.query(
        "mjd, ptf_obj.ra, ptf_obj.dec, obj_id, mag_abs/1000. as mag, magerr_abs/1000. as magErr, apbsrms as sys_err, fid, flags, imaflags_iso \
                        FROM ptf_det, ptf_obj, ptf_exp\
                        WHERE ((flags & 1) == 0) & ((imaflags_iso & 3797) == 0) & (flags < 8) & (apbsrms > 0) & (fid == 2)"
    )

    if radius > 0.5:
        raise ValueError(
            "Radius is too large to do a straight query! Consider using 'getLightCurvesRadialBig' instead"
        )
    else:
        resultsArray = np.array(query.fetch(bounds=[(bounds_xy, bounds_t)]), dtype=[('mjd', np.float64), ('ra', np.float64), ('dec', np.float64), ('obj_id', np.int64), ('mag', np.float64), ('mag_err', np.float64), \
                        ('sys_err', np.float32), ('filter_id', np.uint8),  ('flags', np.uint16), ('imaflags_iso', np.uint16)])
        resultsArray = resultsArray.view(np.recarray)

    logging.debug("Number of unique objid's: {0}".format(
        len(np.unique(resultsArray.obj_id))))

    return resultsArray
Beispiel #2
0
Datei: lsd.py Projekt: adrn/PTF
def getLightCurvesRadial(ra, dec, radius):
    """ Selects light curves from the Large Survey Database (LSD) on kepler
        given an ra and dec in degrees, and a radius in degrees. The constraints
        in the query are taken from the LSD wiki:
            http://www.oir.caltech.edu/twiki_ptf/bin/viewauth/Main/LSDNavtara
        except here I allow for saturated magnitude measurements in case a 
        microlensing event causes a star to saturate temporarily.
    """    
    bounds_t  = lb.intervalset((40000, 60000)) # Cover the whole survey
    bounds_xy = lb.beam(ra, dec, radius)
    
    query = db.query("mjd, ptf_obj.ra, ptf_obj.dec, obj_id, mag_abs/1000. as mag, magerr_abs/1000. as magErr, apbsrms as sys_err, fid, flags, imaflags_iso \
                        FROM ptf_det, ptf_obj, ptf_exp\
                        WHERE ((flags & 1) == 0) & ((imaflags_iso & 3797) == 0) & (flags < 8) & (apbsrms > 0) & (fid == 2)")

    if radius > 0.5:
        raise ValueError("Radius is too large to do a straight query! Consider using 'getLightCurvesRadialBig' instead")
    else:
        resultsArray = np.array(query.fetch(bounds=[(bounds_xy, bounds_t)]), dtype=[('mjd', np.float64), ('ra', np.float64), ('dec', np.float64), ('obj_id', np.int64), ('mag', np.float64), ('mag_err', np.float64), \
                        ('sys_err', np.float32), ('filter_id', np.uint8),  ('flags', np.uint16), ('imaflags_iso', np.uint16)])
        resultsArray = resultsArray.view(np.recarray)
    
    logging.debug("Number of unique objid's: {0}".format(len(np.unique(resultsArray.obj_id))))
    
    return resultsArray
Beispiel #3
0
Datei: lsd.py Projekt: adrn/PTF
def getLightCurvesRadialBig(ra, dec, radius):
    """ Selects light curves from the Large Survey Database (LSD) on kepler
        given an ra and dec in degrees, and a radius in degrees. The constraints
        in the query are taken from the LSD wiki:
            http://www.oir.caltech.edu/twiki_ptf/bin/viewauth/Main/LSDNavtara
        except here I allow for saturated magnitude measurements in case a 
        microlensing event causes a star to saturate temporarily.
    """
    bounds_t = lb.intervalset((40000, 60000))  # Cover the whole survey
    bounds_xy = lb.beam(ra, dec, radius)

    query = db.query(
        "mjd, ptf_obj.ra, ptf_obj.dec, obj_id, mag_abs/1000. as mag, magerr_abs/1000. as magErr, apbsrms as sys_err, fid, flags, imaflags_iso \
                        FROM ptf_det, ptf_obj, ptf_exp\
                        WHERE ((flags & 1) == 0) & ((imaflags_iso & 3797) == 0) & (flags < 8) & (apbsrms > 0) & (fid == 2)"
    )

    logging.warn(
        "Remember: the 'objid's saved in a FITS file are stored as 64-bit integers, but they are meant to be used as unsigned 64-bit integers. Make sure to convert properly!"
    )
    for block in query.iterate(bounds=[(bounds_xy, bounds_t)],
                               return_blocks=True):
        # *** objid should really be np.uint64, but FITS doesn't handle uint64 so remember to convert it! ***
        resultsArray = np.array(block, dtype=[('mjd', np.float64), ('ra', np.float64), ('dec', np.float64), ('objid', np.int64), ('mag', np.float64), ('mag_err', np.float64), \
                        ('sys_err', np.float32), ('filter_id', int),  ('flags', int), ('imaflags_iso', int)])
        resultsArray = resultsArray.view(np.recarray)
        logging.debug("Number of unique objid's: {0}".format(
            len(np.unique(resultsArray.objid))))
        yield resultsArray
Beispiel #4
0
Datei: lsd.py Projekt: adrn/PTF
def getLightCurvesRadialBig(ra, dec, radius):
    """ Selects light curves from the Large Survey Database (LSD) on kepler
        given an ra and dec in degrees, and a radius in degrees. The constraints
        in the query are taken from the LSD wiki:
            http://www.oir.caltech.edu/twiki_ptf/bin/viewauth/Main/LSDNavtara
        except here I allow for saturated magnitude measurements in case a 
        microlensing event causes a star to saturate temporarily.
    """    
    bounds_t  = lb.intervalset((40000, 60000)) # Cover the whole survey
    bounds_xy = lb.beam(ra, dec, radius)
    
    query = db.query("mjd, ptf_obj.ra, ptf_obj.dec, obj_id, mag_abs/1000. as mag, magerr_abs/1000. as magErr, apbsrms as sys_err, fid, flags, imaflags_iso \
                        FROM ptf_det, ptf_obj, ptf_exp\
                        WHERE ((flags & 1) == 0) & ((imaflags_iso & 3797) == 0) & (flags < 8) & (apbsrms > 0) & (fid == 2)")
    
    logging.warn("Remember: the 'objid's saved in a FITS file are stored as 64-bit integers, but they are meant to be used as unsigned 64-bit integers. Make sure to convert properly!")
    for block in query.iterate(bounds=[(bounds_xy, bounds_t)], return_blocks=True):
        # *** objid should really be np.uint64, but FITS doesn't handle uint64 so remember to convert it! ***
        resultsArray = np.array(block, dtype=[('mjd', np.float64), ('ra', np.float64), ('dec', np.float64), ('objid', np.int64), ('mag', np.float64), ('mag_err', np.float64), \
                        ('sys_err', np.float32), ('filter_id', int),  ('flags', int), ('imaflags_iso', int)])
        resultsArray = resultsArray.view(np.recarray)
        logging.debug("Number of unique objid's: {0}".format(len(np.unique(resultsArray.objid))))
        yield resultsArray