Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelaye committed May 11, 2016
1 parent 5eee43a commit 2843eea
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 183 deletions.
167 changes: 56 additions & 111 deletions notebooks/test_pipeline.ipynb
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"cd ~/Dropbox/CTX_to_jpg/pipeline_check/"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -27,26 +16,22 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
"path = Path(\"/Users/klay6683/data/planet4/ice_free_check\")\n",
"path.mkdir(exist_ok=True)\n",
"cm = clustering.ClusteringManager(fnotched_dir=path,\n",
" include_angle=True, include_distance=False, \n",
" include_radius=False, eps=10, min_distance=20)"
"cm.cluster_image_name('ESP_022699_0985')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": false
},
"outputs": [],
"source": [
"cm.cluster_image_name('ESP_022699_0985')"
"db = io.DBManager()"
]
},
{
Expand All @@ -57,7 +42,7 @@
},
"outputs": [],
"source": [
"from planet4 import plotting"
"data = db.get_image_name_markings('ESP_022699_0985')"
]
},
{
Expand All @@ -68,29 +53,50 @@
},
"outputs": [],
"source": [
"db = io.DBManager()"
"from ipyparallel import Client\n",
"c = Client()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": false
},
"outputs": [],
"source": [
"data = db.get_image_name_markings('ESP_022699_0985')"
"# At the beginning of the notebook\n",
"import logging\n",
"logger = logging.getLogger()\n",
"assert len(logger.handlers) == 1\n",
"logger.addHandler(logging.StreamHandler())\n",
"handler = logger.handlers[1]\n",
"handler.setLevel(logging.DEBUG)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"scrolled": false
},
"outputs": [],
"source": [
"blotches = data[data.marking=='blotch']"
"def process_imgid(id_, dynamic=False, angle=False, distance=False, radius=False):\n",
" import matplotlib.pyplot as plt\n",
" from planet4 import plotting, clustering\n",
" from pathlib import Path\n",
" path = Path(\"/Users/klay6683/data/planet4/pipelinecheck5\")\n",
" cm = clustering.ClusteringManager(fnotched_dir=path,\n",
" do_dynamic_min_samples=dynamic,\n",
" include_angle=angle,\n",
" include_distance=distance,\n",
" include_radius=radius)\n",
" cm.cluster_image_id(id_)\n",
" plotting.plot_image_id_pipeline(id_, datapath=path, save=True)\n",
"# plt.close('all')\n",
" return id_"
]
},
{
Expand All @@ -101,8 +107,7 @@
},
"outputs": [],
"source": [
"def is_rad1_larger(x):\n",
" return x['radius_1']>x['radius_2']"
"%matplotlib inline"
]
},
{
Expand All @@ -113,7 +118,7 @@
},
"outputs": [],
"source": [
"data.loc[data.marking=='blotch', 'rad1larger'] = blotches.apply(is_rad1_larger, axis=1)"
"process_imgid('1dr')"
]
},
{
Expand All @@ -124,7 +129,7 @@
},
"outputs": [],
"source": [
"data.rad1larger.value_counts()"
"plotting.plot_clustered_fans('1dr')"
]
},
{
Expand All @@ -135,18 +140,9 @@
},
"outputs": [],
"source": [
"data[data.marking=='blotch'].info()"
"plotting.plot_clustered_blotches('1dr')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -155,8 +151,7 @@
},
"outputs": [],
"source": [
"from ipyparallel import Client\n",
"c = Client()"
"plotting.plot_finals('1dr')"
]
},
{
Expand All @@ -167,38 +162,25 @@
},
"outputs": [],
"source": [
"# At the beginning of the notebook\n",
"import logging\n",
"logger = logging.getLogger()\n",
"assert len(logger.handlers) == 1\n",
"logger.addHandler(logging.StreamHandler())\n",
"handler = logger.handlers[1]\n",
"handler.setLevel(logging.DEBUG)"
"from planet4.plotting import plot_clustered_blotches, plot_clustered_fans, plot_finals"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": false
"collapsed": false
},
"outputs": [],
"source": [
"def process_imgid(id_, dynamic=False, angle=False, distance=False, radius=False):\n",
" import matplotlib.pyplot as plt\n",
" from planet4 import plotting, clustering\n",
" from pathlib import Path\n",
" path = Path(\"/Users/klay6683/data/planet4/pipelinecheck5\")\n",
" cm = clustering.ClusteringManager(fnotched_dir=path,\n",
" do_dynamic_min_samples=dynamic,\n",
" include_angle=angle,\n",
" include_distance=distance,\n",
" include_radius=radius)\n",
" cm.cluster_image_id(id_)\n",
" plotting.plot_image_id_pipeline(id_, datapath=path, save=True)\n",
"# plt.close('all')\n",
" return id_"
"image_id = '1dr'\n",
"imgid = markings.ImageID(image_id)\n",
"fig, axes = plt.subplots(ncols=2, figsize=(10, 4))\n",
"axes = axes.ravel()\n",
"for ax in axes:\n",
" imgid.show_subframe(ax=ax)\n",
"plot_clustered_fans(image_id, ax=axes[0])\n",
"plot_clustered_blotches(image_id, ax=axes[1])\n"
]
},
{
Expand All @@ -208,42 +190,25 @@
"collapsed": true
},
"outputs": [],
"source": [
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"process_imgid('1dr')"
]
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
"plotting.plot_clustered_blotches('1dr')"
]
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
"plotting.plot_finals('1dr')"
]
"source": []
},
{
"cell_type": "code",
Expand All @@ -252,45 +217,25 @@
"collapsed": true
},
"outputs": [],
"source": [
"from planet4.plotting import plot_clustered_blotches, plot_clustered_fans, plot_finals"
]
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
"image_id = '1dr'\n",
"imgid = markings.ImageID(image_id)\n",
"fig, axes = plt.subplots(ncols=3, figsize=(10, 4))\n",
"axes = axes.ravel()\n",
"# for ax in axes:\n",
"# imgid.show_subframe(ax=ax)\n",
"# plot_clustered_fans(image_id, ax=axes[1])\n",
"plot_clustered_blotches(image_id, ax=axes[2])\n"
]
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
"image_id = '1dr'\n",
"imgid = markings.ImageID(image_id)\n",
"fig, axes = plt.subplots(ncols=3, figsize=(10, 4))\n",
"axes = axes.ravel()\n",
"# for ax in axes:\n",
"# imgid.show_subframe(ax=ax)\n",
"plot_clustered_fans(image_id, ax=axes[1])\n",
"plot_clustered_blotches(image_id, ax=axes[2])\n"
]
"source": []
},
{
"cell_type": "code",
Expand Down
Loading

0 comments on commit 2843eea

Please sign in to comment.