add numbers to the table

This commit is contained in:
hiro98 2020-01-26 14:13:54 +01:00
parent 75ce8797eb
commit 1797e68c35
8 changed files with 113 additions and 51 deletions

View file

@ -98,7 +98,7 @@
},
{
"cell_type": "code",
"execution_count": 138,
"execution_count": 142,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -110,16 +110,19 @@
},
"outputs": [
{
"ename": "TypeError",
"evalue": "object of type 'function' has no len()",
"output_type": "error",
"traceback": [
"\u001b[0;31m\u001b[0m",
"\u001b[0;31mTypeError\u001b[0mTraceback (most recent call last)",
"\u001b[0;32m<ipython-input-138-7fa66147a009>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mhypothesis\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mevaluate_hypothesis\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mcandidates\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0md_candidates\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msigma_candidates\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mT\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmaximum\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m80\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhypothesis\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Documents/Projects/UNI/Prakt/FP/tem/auswertung/utility.py\u001b[0m in \u001b[0;36mevaluate_hypothesis\u001b[0;34m(analyzed, maximum, gold)\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[0mdiffs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mempty\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmaximum\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0manalyzed\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 228\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 229\u001b[0;31m \u001b[0msquared_ds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mx\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmaximum\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfind_miller_indices\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 230\u001b[0m \u001b[0mds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msqrt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msquared_ds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 231\u001b[0m \u001b[0ma\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0manalyzed\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0mds\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Documents/Projects/UNI/Prakt/FP/tem/auswertung/utility.py\u001b[0m in \u001b[0;36m<listcomp>\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[0mdiffs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mempty\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmaximum\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0manalyzed\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 228\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 229\u001b[0;31m \u001b[0msquared_ds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mx\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmaximum\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfind_miller_indices\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 230\u001b[0m \u001b[0mds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msqrt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msquared_ds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 231\u001b[0m \u001b[0ma\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0manalyzed\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0mds\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mTypeError\u001b[0m: object of type 'function' has no len()"
"name": "stdout",
"output_type": "stream",
"text": [
"(array([ 4, 4, 9, 11, 13, 24, 27, 30, 40]), array([[0.4365859 , 0.00314502, 0.03385928],\n",
" [0.38654813, 0.00246542, 0.01311343],\n",
" [0.39925472, 0.00175345, 0.0193526 ],\n",
" [0.39935277, 0.00158683, 0.00165195],\n",
" [0.4097683 , 0.00153681, 0.02061948],\n",
" [0.41640285, 0.00116798, 0.02043268],\n",
" [0.40118533, 0.00102217, 0.01063151],\n",
" [0.4014384 , 0.00097094, 0.007732 ],\n",
" [0.40573231, 0.00085894, 0.01187421]]), array([0.0287859 , 0.02125187, 0.00854528, 0.00844723, 0.0019683 ,\n",
" 0.00860285, 0.00661467, 0.0063616 , 0.00206769]))\n"
]
}
],
@ -130,7 +133,7 @@
},
{
"cell_type": "code",
"execution_count": 101,
"execution_count": 143,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -150,9 +153,9 @@
"\\(\\sqrt{9}\\) & 0.3993 & 0.0018 & 0.0194 & 0.009 \\\\\n",
"\\(\\sqrt{11}\\) & 0.3994 & 0.0016 & 0.0017 & 0.008 \\\\\n",
"\\(\\sqrt{13}\\) & 0.4098 & 0.0015 & 0.0206 & 0.002 \\\\\n",
"\\(\\sqrt{23}\\) & 0.4076 & 0.0011 & 0.02 & 0.000 \\\\\n",
"\\(\\sqrt{28}\\) & 0.4085 & 0.001 & 0.0108 & 0.001 \\\\\n",
"\\(\\sqrt{31}\\) & 0.4081 & 0.001 & 0.0079 & 0.000 \\\\\n",
"\\(\\sqrt{24}\\) & 0.4164 & 0.0012 & 0.0204 & 0.009 \\\\\n",
"\\(\\sqrt{27}\\) & 0.4012 & 0.001 & 0.0106 & 0.007 \\\\\n",
"\\(\\sqrt{30}\\) & 0.4014 & 0.001 & 0.0077 & 0.006 \\\\\n",
"\\(\\sqrt{40}\\) & 0.4057 & 0.0009 & 0.0119 & 0.002 \\\\\n",
"\n"
]
@ -164,7 +167,7 @@
},
{
"cell_type": "code",
"execution_count": 135,
"execution_count": 144,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -174,24 +177,14 @@
"slide_type": "-"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ 730.29050427 4120.30484636 2244.84475614 95331.69131926\n",
" 2037.07066904 2236.39955377 7100.34700268 12776.96536546\n",
" 6167.76634145]\n"
]
}
],
"outputs": [],
"source": [
"a, d_a, sigma_a = determine_lattice_constant(hypothesis)"
]
},
{
"cell_type": "code",
"execution_count": 136,
"execution_count": 145,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -205,10 +198,10 @@
{
"data": {
"text/plain": [
"(0.4011, 0.0027, 0.0051)"
"(0.4002, 0.0027, 0.0046)"
]
},
"execution_count": 136,
"execution_count": 145,
"metadata": {},
"output_type": "execute_result"
}
@ -219,7 +212,7 @@
},
{
"cell_type": "code",
"execution_count": 137,
"execution_count": 146,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -238,9 +231,9 @@
"10 & \\mqty{2 & 2 & 1}, \\mqty{3 & 0 & 0} \\\\\n",
"12 & \\mqty{3 & 1 & 1} \\\\\n",
"14 & \\mqty{3 & 2 & 0} \\\\\n",
"24 \\\\\n",
"29 \\\\\n",
"32 \\\\\n",
"25 & \\mqty{4 & 2 & 2} \\\\\n",
"28 & \\mqty{3 & 3 & 3}, \\mqty{5 & 1 & 1} \\\\\n",
"31 & \\mqty{5 & 2 & 1} \\\\\n",
"41 & \\mqty{6 & 2 & 0} \\\\\n",
"\n"
]
@ -249,6 +242,21 @@
"source": [
"print(generate_miller_table(hypothesis[0]))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"autoscroll": false,
"collapsed": false,
"ein.hycell": false,
"ein.tags": "worksheet-0",
"slideshow": {
"slide_type": "-"
}
},
"outputs": [],
"source": []
}
],
"metadata": {

View file

@ -41,7 +41,7 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 117,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -111,7 +111,7 @@
},
{
"cell_type": "code",
"execution_count": 39,
"execution_count": 118,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -128,7 +128,7 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": 128,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -143,10 +143,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\\(\\sqrt{4}\\) & 0.409 & 0.013 & 0.013 & 0.001 \\\\\n",
"\\(\\sqrt{3}\\) & 0.424 & 0.009 & 0.01 & 0.016 \\\\\n",
"\\(\\sqrt{3}\\) & 0.405 & 0.006 & 0.008 & 0.003 \\\\\n",
"\\(\\sqrt{3}\\) & 0.418 & 0.008 & 0.01 & 0.010 \\\\\n",
"1 & \\(\\sqrt{4}\\) & 0.409 & 0.013 & 0.013 & 0.001 \\\\\n",
"2 & \\(\\sqrt{3}\\) & 0.424 & 0.009 & 0.01 & 0.016 \\\\\n",
"3 & \\(\\sqrt{3}\\) & 0.405 & 0.006 & 0.008 & 0.003 \\\\\n",
"4 & \\(\\sqrt{3}\\) & 0.418 & 0.008 & 0.01 & 0.010 \\\\\n",
"\n"
]
}
@ -157,7 +157,7 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 120,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -174,7 +174,7 @@
"(0.4131417242218807, 0.009111543899908446, 0.007970106548602144)"
]
},
"execution_count": 33,
"execution_count": 120,
"metadata": {},
"output_type": "execute_result"
}
@ -186,7 +186,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": 121,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -203,7 +203,7 @@
"(0.413, 0.009, 0.008)"
]
},
"execution_count": 34,
"execution_count": 121,
"metadata": {},
"output_type": "execute_result"
}
@ -214,7 +214,7 @@
},
{
"cell_type": "code",
"execution_count": 116,
"execution_count": 125,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -229,8 +229,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"4 & \\mqty{1 & 1 & 1} \\\\\n",
"5 & \\mqty{2 & 0 & 0} \\\\\n",
"3 & \\mqty{1 & 1 & 1} \\\\\n",
"4 & \\mqty{2 & 0 & 0} \\\\\n",
"\n"
]
}
@ -238,6 +238,34 @@
"source": [
"print(generate_miller_table(hypothesis[0]))"
]
},
{
"cell_type": "code",
"execution_count": 123,
"metadata": {
"autoscroll": false,
"collapsed": false,
"ein.hycell": false,
"ein.tags": "worksheet-0",
"slideshow": {
"slide_type": "-"
}
},
"outputs": [
{
"data": {
"text/plain": [
"(array([4, 3, 3, 3]), array([[0.4085 , 0.01308148, 0.01326061],\n [0.42383283, 0.00906311, 0.00981952],\n [0.4046813 , 0.00647365, 0.00820019],\n [0.41821154, 0.00823919, 0.00956327]]), array([0.0007 , 0.01603283, 0.0031187 , 0.01041154]))"
]
},
"execution_count": 123,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"hypothesis"
]
}
],
"metadata": {

View file

@ -95,3 +95,27 @@
\label{fig:gold_hires-profile_10}
\end{figure}
\begin{figure}[H]\centering
\input{../auswertung/figs/gold_hires/profile_1.pgf}
\caption{}
\label{fig:gold_hires-profile_1}
\end{figure}
\begin{figure}[H]\centering
\input{../auswertung/figs/gold_hires/profile_4.pgf}
\caption{}
\label{fig:gold_hires-profile_4}
\end{figure}
\begin{figure}[H]\centering
\input{../auswertung/figs/gold_hires/profile_6.pgf}
\caption{}
\label{fig:gold_hires-profile_6}
\end{figure}
\begin{figure}[H]\centering
\input{../auswertung/figs/gold_hires/profile_10.pgf}
\caption{}
\label{fig:gold_hires-profile_10}
\end{figure}

View file

@ -221,8 +221,9 @@ def generate_miller_table(squares):
squares = np.unique(squares)
inds = find_miller_indices(squares)
out = ''
for i, ind_list in zip(squares, inds):
out += f'{i + 1} & '
out += f'{i} & '
for ind in ind_list:
out += r'\mqty{' + ' & '.join(ind.astype(str)) + '}, '
out = out[:-2]
@ -243,10 +244,11 @@ def evaluate_hypothesis(analyzed, maximum=10, gold=.4078):
def generate_hypethsesis_table(squared, analyzed, residues):
out = ''
for square, value, residue in zip(squared, analyzed, residues):
for i, square, value, residue in zip(range(1, len(squared)+1),
squared, analyzed, residues):
value = np.array(scientific_round(*value))
out += rf'\(\sqrt{{{square}}}\) & ' \
out += rf'{i} & \(\sqrt{{{square}}}\) & ' \
+ ' & '.join(value.astype(str)) + f' & {residue:.3f} \\\\\n'
return out