Example #1
0
def visualize(run, wheel, sector, station):
    identifier, params = buildDicts(run, wheel, sector, station)
    data = dataFetch.visualize(identifier, params)
    imgBytes = mutliplot.plot(data)
    response = make_response(imgBytes.getvalue())
    response.headers['Content-Type'] = 'image/png'
    return response
Example #2
0
def get_adrian(run, wheel, sector, station):
    identifier, params = buildDicts(run, wheel, sector, station)
    data = dataLoad.get_matrix_from_DB(identifier, params)
    imgBytes = a_plot.plot_occupancy_hitmap(
        data.get("data")[0].get("matrix"), "title", "a.u.")
    response = make_response(imgBytes.getvalue())
    response.headers['Content-Type'] = 'image/png'
    return response
Example #3
0
def runData(run, wheel, sector, station):
    identifier, params = buildDicts(run, wheel, sector, station)
    data = dataLoad.get_matrix_from_DB(identifier, params)
    if (data == None):
        return _make_response("Record not found", 404)
    else:
        if (len(data.get("data")) != 1):
            return _make_response(
                f"Request with did not return single result. Expected: 1, actual: {len(data.get('data'))}",
                500)
        return jsonify(data.get("data")[0])
Example #4
0
def score():
    # body: {
    #   'run': '300000',
    #   'wheel': '0',
    #   'sector': '1',
    #   'station': '1',
    #   'layers': ['12', '10', '9', '7', '6', '5', '2', '1']
    # }
    body = request.get_json()
    badLayers = list(map(int, body["layers"]))
    identifier, params = buildDicts(body["run"], body["wheel"], body["sector"],
                                    body["station"])
    return jsonify(dataLoad.update_user_score(identifier, params, badLayers))
Example #5
0
def runData(run, wheel, sector, station):
    identifier, params = buildDicts(run, wheel, sector, station)
    run_data = dataLoad.get_matrix_from_DB(identifier, params)
    if (run_data == None):
        return _make_response("Record not found", 404)
    else:
        data = run_data.get("data")
        if data == None:
            return _make_response(f"Record does not contain any data", 404)
        if len(data) != 1:
            return _make_response(
                f"Request with did not return single result. Expected: 1, actual: {len(data)}",
                500)
        return jsonify(data[0])
Example #6
0
def visualize_raw(run, wheel, sector, station):
    identifier, params = buildDicts(run, wheel, sector, station)
    data = dataFetch.visualize(identifier, params)
    return jsonify([{
        k: numpyUtils.to_python_matrix(v)
    } for value in data for k, v in value.items()])
Example #7
0
def skip(run, wheel, sector, station):
    identifier, params = buildDicts(run, wheel, sector, station)
    dataLoad.mark_as_skipped(identifier, params)
    return get_uncertain_matrix()