From ef2a5fbf0603ba952409d15838d27938d12368a9 Mon Sep 17 00:00:00 2001 From: ml server Date: Fri, 24 Jan 2020 15:37:08 -0700 Subject: [PATCH] less worse input/output --- notebooks/wut-web-dev.ipynb | 70 +++++++++++++------------------------ 1 file changed, 25 insertions(+), 45 deletions(-) diff --git a/notebooks/wut-web-dev.ipynb b/notebooks/wut-web-dev.ipynb index ca9213f..2b75453 100644 --- a/notebooks/wut-web-dev.ipynb +++ b/notebooks/wut-web-dev.ipynb @@ -136,9 +136,6 @@ "source": [ "waterfallpng=os.path.basename(rfile)\n", "print('Random waterfall:', waterfallpng)\n", - "#f=text.EvalFormatter()\n", - "#obsid=(f.format(\"{waterfall[slice(10,17)]}\", waterfall=waterfallpng))\n", - "#print('Observation URL: https://network.satnogs.org/observations/{}'.format(obsid))\n", "if prediction_bool[0] == False:\n", " rating = 'BAD'\n", "else:\n", @@ -162,24 +159,7 @@ "metadata": {}, "outputs": [], "source": [ - "#display(Image(filename=rfile, width=300))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Get Obs ID from user. obsid()\n", - "# Validate Obs ID.\n", - "# Predict obsid. predict()\n", - "# Return prediction.\n", - "# Prediction needs to find corresponding waterfall.\n", - "# Load obsid json.\n", - "# Get transmitter_mode.\n", - "# Copy waterfall to processing location (meh, should hit directly).\n", - "# Load correct .tf model file based on transmitter_mode." + "from collections import defaultdict" ] }, { @@ -192,25 +172,6 @@ "minobsid=1292461" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - " #display(Image(filename=rfile, width=100))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "#import pandas as pd\n", - "#from pandas.io.json import json_normalize" - ] - }, { "cell_type": "code", "execution_count": null, @@ -221,11 +182,22 @@ " if int(datObs) > ( minobsid - 1 ) and int(datObs) < maxobsid:\n", " obsjsonfile=('/srv/satnogs/download/' + format(datObs) + '/' + format(datObs) + '.json')\n", " #!cat $obsjsonfile\n", - " print('observation json file: ', obsjsonfile )\n", + " print('observation json file: ', obsjsonfile)\n", " with open(obsjsonfile) as f:\n", - " data = json.load(f)\n", - " print(data)\n", - " print(type(data))" + " content = f.read()\n", + " data = json.loads(content)\n", + " res = {x : data[x] for x in range(len(data))}\n", + " res2 = dict(enumerate(data))\n", + " obs_dict=(res2[0])\n", + " obs_waterfallurl=(obs_dict['waterfall'])\n", + " obs_id=(obs_dict['id'])\n", + " print('obs_waterfall: ', obs_waterfallurl)\n", + " obs_waterfall=os.path.basename(obs_waterfallurl)\n", + " print(obs_waterfall)\n", + " print('Observation ID: ', obs_id)\n", + " obs_waterfall_path = os.path.join('/srv/satnogs/download', str(obs_id), obs_waterfall)\n", + " print(obs_waterfall_path)\n", + " display(Image(filename=obs_waterfall_path, width=100))" ] }, { @@ -245,7 +217,15 @@ "metadata": {}, "outputs": [], "source": [ - "#display(Image(filename=rfile, width=300))" + "# Get Obs ID from user. obsid()\n", + "# Validate Obs ID.\n", + "# Predict obsid. predict()\n", + "# Return prediction.\n", + "# Prediction needs to find corresponding waterfall.\n", + "# Load obsid json.\n", + "# Get transmitter_mode.\n", + "# Copy waterfall to processing location (meh, should hit directly).\n", + "# Load correct .tf model file based on transmitter_mode." ] } ],