Fix coverage: remove stray gather code, add /api/coverage route
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
db_data/
|
||||||
|
db_data/
|
||||||
@@ -1628,6 +1628,7 @@ def real_shots():
|
|||||||
return jsonify({'error': 'real_shots.json not found'}), 404
|
return jsonify({'error': 'real_shots.json not found'}), 404
|
||||||
with open(shot_path) as f:
|
with open(shot_path) as f:
|
||||||
return jsonify(json.load(f))
|
return jsonify(json.load(f))
|
||||||
|
@app.route("/api/coverage")def get_coverage(): """Get coverage data for all H5 files.""" import re as _re try: darf = {} if os.path.exists(DARF_FILE): with open(DARF_FILE) as _f: darf = json.load(_f) result = [] for f in os.listdir(DATA_DIR): if not f.endswith(".h5"): continue fpath = os.path.join(DATA_DIR, f) info = {"name": f, "size": os.path.getsize(fpath)} m = _re.match(r"auto_(d+)_(d{2})(d{2})(d{2})_b(d+)_rsn(d+)_seq(d+)_(d+)", f) if m: day, hh, mm, ss, board_id, rsn, seq, ts = m.groups() info["board_id"] = int(board_id) info["day"] = int(day) from datetime import datetime as _dt, timedelta as _td base = _dt(2020, 1, 1) + _td(days=int(day)-1, hours=int(hh), minutes=int(mm), seconds=int(ss)) info["date_str"] = base.isoformat() bid_str = str(board_id) if bid_str in darf: info["line"] = darf[bid_str].get("line") info["point"] = darf[bid_str].get("point") info["duration_sec"] = 8000 try: import h5py with h5py.File(fpath, "r") as h5f: attrs = dict(h5f.attrs) info["duration_sec"] = float(attrs.get("duration", attrs.get("record_length", 8000))) except: pass result.append(info) result.sort(key=lambda x: x.get("date_str", "")) return jsonify({"files": result, "count": len(result)}) except Exception as e: return jsonify({"error": str(e)}), 500
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(host='0.0.0.0', port=3001, debug=False)
|
app.run(host='0.0.0.0', port=3001, debug=False)
|
||||||
|
|||||||
@@ -2098,11 +2098,6 @@ async function loadCoverage() {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
document.getElementById('coverageEmpty').textContent = 'Error: ' + e.message;
|
document.getElementById('coverageEmpty').textContent = 'Error: ' + e.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw shot time dots on gather
|
|
||||||
drawShotDots(canvas, ctx, ml, mr, mb, pw, gatherData);
|
|
||||||
// Shot position overlay
|
|
||||||
if (gatherData && gatherData.epoch_start) drawGatherShots(canvas, ctx, traces, gatherData.time_axis, parseFloat(document.getElementById("gatherStart").value), parseFloat(document.getElementById("gatherDuration").value), gatherData.epoch_start);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderCoverage() {
|
function renderCoverage() {
|
||||||
|
|||||||
Reference in New Issue
Block a user