Quick MAJ before code sprint
This commit is contained in:
parent
53b320fa60
commit
51eb706118
@ -332,6 +332,16 @@
|
||||
"show(cv_labels)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"plt.imsave('../Res/labels.png', labels)\n",
|
||||
"plt.imsave('../Res/prediction.png', cv_labels)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
|
@ -101,7 +101,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"train_part = .7\n",
|
||||
"train_part = .9\n",
|
||||
"\n",
|
||||
"split = np.zeros_like(gt)\n",
|
||||
"\n",
|
||||
@ -118,6 +118,32 @@
|
||||
"plt.show()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"import matplotlib.animation\n",
|
||||
"import numpy as np\n",
|
||||
"\n",
|
||||
"t = np.linspace(0,2*np.pi)\n",
|
||||
"x = np.sin(t)\n",
|
||||
"\n",
|
||||
"fig, ax = plt.subplots()\n",
|
||||
"ax.axis([0,2*np.pi,-1,1])\n",
|
||||
"l, = ax.plot([],[])\n",
|
||||
"\n",
|
||||
"def animate(i):\n",
|
||||
" l.set_data(t[:i], x[:i])\n",
|
||||
"\n",
|
||||
"ani = matplotlib.animation.FuncAnimation(fig, animate, frames=len(t))\n",
|
||||
"\n",
|
||||
"from IPython.display import HTML\n",
|
||||
"HTML(ani.to_jshtml())"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
|
@ -41,17 +41,32 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"l = ld2dap.LoadTIFF(layers_files[5])\n",
|
||||
"l = ld2dap.LoadTIFF(layers_files)\n",
|
||||
"t = ld2dap.Treshold(1e4)\n",
|
||||
"a = ld2dap.AttributeProfiles(area = [1e3, 1e6])\n",
|
||||
"a = ld2dap.SelfDualAttributeProfiles(area = [1e3, 1e6])\n",
|
||||
"f = ld2dap.Differential()\n",
|
||||
"d = ld2dap.ShowFig('all', fname='../Res/aps.png', pad_inches=0, symb=True, vmax=255)\n",
|
||||
"d_ap_3 = ld2dap.ShowFig(stack_id=3, fname='../Res/daps_3.png', pad_inches=0, symb=True, vmax=255, transparent=True)\n",
|
||||
"d_dap_3 = ld2dap.ShowFig(stack_id=3, fname='../Res/aps_3.png', pad_inches=0, symb=True, vmax=255, transparent=True)\n",
|
||||
"d_ap_6 = ld2dap.ShowFig(stack_id=6, fname='../Res/daps_6.png', pad_inches=0, symb=True, vmax=255, transparent=True)\n",
|
||||
"d_dap_6 = ld2dap.ShowFig(stack_id=6, fname='../Res/aps_6.png', pad_inches=0, symb=True, vmax=255, transparent=True)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"t.input = l\n",
|
||||
"a.input = t\n",
|
||||
"f.input = a\n",
|
||||
"d.input = f\n",
|
||||
"d.run()"
|
||||
"d_dap_3.input = f\n",
|
||||
"d_dap_6.input = f\n",
|
||||
"d_ap_3.input = a\n",
|
||||
"d_ap_6.input = a\n",
|
||||
"l.run()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"$\\rho^{area}_{1000}$"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ class SelfDualAttributeProfiles(Filter):
|
||||
if self.__getattribute__(att) is not None:
|
||||
att_symb[att].append(None)
|
||||
att_symb[att].extend(
|
||||
['\rho^{{{}}}_{{{}}}'.format(att, x) for x in self.__getattribute__(att)])
|
||||
['\\rho^{{{}}}_{{{}}}'.format(att, x) for x in self.__getattribute__(att)])
|
||||
|
||||
return att_symb
|
||||
|
||||
|
@ -13,7 +13,7 @@ from ld2dap.core import Output
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
class ShowFig(Output):
|
||||
def __init__(self, stack_id=0, symb=False, fname=None, bbox_inches='tight', pad_inches=1, vmax=None):
|
||||
def __init__(self, stack_id=0, symb=False, fname=None, bbox_inches='tight', pad_inches=1, vmax=None, transparent=False):
|
||||
super().__init__(self.__class__.__name__)
|
||||
self.bbox_inches = bbox_inches
|
||||
self.pad_inches = pad_inches
|
||||
@ -21,6 +21,7 @@ class ShowFig(Output):
|
||||
self.symb = symb
|
||||
self.fname = fname
|
||||
self.vmax = vmax
|
||||
self.transparent = transparent
|
||||
|
||||
def _process(self, data, metadata):
|
||||
if self.stack_id == 'all':
|
||||
@ -49,6 +50,6 @@ class ShowFig(Output):
|
||||
f1.set_title(' > '.join(filter(None, stack.desc[i])))
|
||||
|
||||
if self.fname is not None:
|
||||
fig.savefig(self.fname, bbox_inches=self.bbox_inches, pad_inches=self.pad_inches)
|
||||
fig.savefig(self.fname, bbox_inches=self.bbox_inches, pad_inches=self.pad_inches, transparent=self.transparent)
|
||||
plt.show()
|
||||
plt.close(fig)
|
||||
|
Loading…
Reference in New Issue
Block a user