Esempio n. 1
0
def plot():
    if not request.args.has_key("source_id") or not request.args.has_key("field_id") or not request.args.has_key("ccd_id"):
        abort(404)
    
    source_id = int(request.args["source_id"])
    field_id = int(request.args["field_id"])
    ccd_id = int(request.args["ccd_id"])
    
    if request.args.has_key("set_tags"):
        if request.args["set_tags"] == "true":
            try:
                tags = [str(x) for x in request.args.getlist("tags")]
            except KeyError:
                tags = []
            
            if request.args.has_key("new_tag"):
                tags.append(str(request.args["new_tag"]))
            
            lc_document = light_curve_collection.find_one({"field_id" : field_id, "ccd_id" : ccd_id, "source_id" : source_id})
            
            tags = [str(tag).strip() for tag in tags if len(tag.strip()) > 0]
            
            if lc_document != None:
                update_light_curve_document_tags(lc_document, tags, light_curve_collection)
    
    lc_document = light_curve_collection.find_one({"field_id" : field_id, "ccd_id" : ccd_id, "source_id" : source_id})
    return render_template('candidates/plot.html', light_curve=lc_document, all_tags=sorted(light_curve_collection.distinct("tags")))
Esempio n. 2
0
def candidate_data():
    """ Load candidate light curves from MongoDB """
    
    search = {}
    search["field_id"] = int(request.args["field_id"])
    search["ccd_id"] = int(request.args["ccd_id"])
    search["source_id"] = int(request.args["source_id"])
    
    candidate = light_curve_collection.find_one(search)
    return jsonify(light_curve=candidate)