model fn
parent
54b53d217a
commit
6f3b4daab4
|
@ -69,9 +69,7 @@
|
||||||
"minobsid = 1292461\n",
|
"minobsid = 1292461\n",
|
||||||
"maxobsid = 1470525\n",
|
"maxobsid = 1470525\n",
|
||||||
"#maxobsid = 1591638\n",
|
"#maxobsid = 1591638\n",
|
||||||
"base_dir = ('/srv/wut/data')\n",
|
"base_dir = ('/srv/wut/data')"
|
||||||
"sample_dir = ('/srv/wut/data/test/unvetted')\n",
|
|
||||||
"model_file = os.path.join(base_dir, 'models', 'wut-DUV-201912.tf')"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -94,18 +92,6 @@
|
||||||
"#site_intro()"
|
"#site_intro()"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"def wut_model(model_file):\n",
|
|
||||||
" model = load_model(model_file)\n",
|
|
||||||
" \n",
|
|
||||||
" return model"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
|
@ -160,7 +146,7 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"def obs_wutsay(test_data_gen):\n",
|
"def obs_wutsay(test_data_gen, model):\n",
|
||||||
" prediction = model.predict(\n",
|
" prediction = model.predict(\n",
|
||||||
" x=test_data_gen,\n",
|
" x=test_data_gen,\n",
|
||||||
" verbose=0)\n",
|
" verbose=0)\n",
|
||||||
|
@ -202,6 +188,30 @@
|
||||||
" return obs_var"
|
" return obs_var"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def wutObs(datObs, showwater):\n",
|
||||||
|
" if int(datObs) > ( minobsid - 1 ) and int(datObs) < ( maxobsid + 1):\n",
|
||||||
|
" doallthethings(datObs, showwater)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def wut_model(txmode):\n",
|
||||||
|
" model_file = os.path.join(base_dir, 'models', (txmode), 'wut-train-cluster.tf')\n",
|
||||||
|
" model = load_model(model_file)\n",
|
||||||
|
" \n",
|
||||||
|
" return model"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
|
@ -214,10 +224,13 @@
|
||||||
" obs_waterfallpic=os.path.basename(obs_waterfall)\n",
|
" obs_waterfallpic=os.path.basename(obs_waterfall)\n",
|
||||||
" obs_waterfalltmp = os.path.join('/srv/satnogs/download', str(get_obs_var('id', datObs)), obs_waterfallpic)\n",
|
" obs_waterfalltmp = os.path.join('/srv/satnogs/download', str(get_obs_var('id', datObs)), obs_waterfallpic)\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
" txmode='DUV'\n",
|
||||||
|
" model=wut_model(txmode)\n",
|
||||||
|
" \n",
|
||||||
" test_dir=gen_image_tmp(obs_waterfalltmp, showwater);\n",
|
" test_dir=gen_image_tmp(obs_waterfalltmp, showwater);\n",
|
||||||
" test_data_gen=gen_image(obs_waterfalltmp, test_dir);\n",
|
" test_data_gen=gen_image(obs_waterfalltmp, test_dir);\n",
|
||||||
" \n",
|
" \n",
|
||||||
" prediction_bool=obs_wutsay(test_data_gen);\n",
|
" prediction_bool=obs_wutsay(test_data_gen, model);\n",
|
||||||
"\n",
|
"\n",
|
||||||
" print()\n",
|
" print()\n",
|
||||||
" print('Observation ID: ', get_obs_var('id', datObs))\n",
|
" print('Observation ID: ', get_obs_var('id', datObs))\n",
|
||||||
|
@ -236,7 +249,7 @@
|
||||||
" print()\n",
|
" print()\n",
|
||||||
" print('https://network.satnogs.org/observations/' + str(get_obs_var('id', datObs)))\n",
|
" print('https://network.satnogs.org/observations/' + str(get_obs_var('id', datObs)))\n",
|
||||||
" #!cat $obsjsonfile\n",
|
" #!cat $obsjsonfile\n",
|
||||||
" rm_image_tmp(test_dir) "
|
" rm_image_tmp(test_dir)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -245,18 +258,7 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"def wutObs(datObs, showwater):\n",
|
"def display_main():\n",
|
||||||
" if int(datObs) > ( minobsid - 1 ) and int(datObs) < ( maxobsid + 1):\n",
|
|
||||||
" doallthethings(datObs, showwater)"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"def display_main(model):\n",
|
|
||||||
" print('Enter an Observation ID between', minobsid, 'and', maxobsid)\n",
|
" print('Enter an Observation ID between', minobsid, 'and', maxobsid)\n",
|
||||||
" rand_obsid=random.randint(minobsid,maxobsid)\n",
|
" rand_obsid=random.randint(minobsid,maxobsid)\n",
|
||||||
" wutObs_slide = wg.IntText(value=rand_obsid, description=' ')\n",
|
" wutObs_slide = wg.IntText(value=rand_obsid, description=' ')\n",
|
||||||
|
@ -270,7 +272,7 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"model=wut_model(model_file)"
|
"head_pic()"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -279,21 +281,16 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"header=head_pic()\n",
|
"site_intro()"
|
||||||
"left_side=site_intro()\n",
|
]
|
||||||
"right_side=display_main(model)\n",
|
},
|
||||||
"#image=('/srv/satnogs/satnogs-wut/pics/wut-web.png')\n",
|
{
|
||||||
"image=None\n",
|
"cell_type": "code",
|
||||||
"footer=None\n",
|
"execution_count": null,
|
||||||
"center=None\n",
|
"metadata": {},
|
||||||
"AppLayout(header=header,\n",
|
"outputs": [],
|
||||||
" left_sidebar=left_side,\n",
|
"source": [
|
||||||
" center=image,\n",
|
"display_main()"
|
||||||
" right_sidebar=right_side,\n",
|
|
||||||
" footer=footer,\n",
|
|
||||||
" grid_gap='20px',\n",
|
|
||||||
" justify_items='center',\n",
|
|
||||||
" align_items='center')"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue