Skip to content

Commit a216ad2

Browse files
committed
Add small notebook for exploring artificial images
1 parent fc44aac commit a216ad2

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"%matplotlib inline\n",
10+
"from matplotlib import pyplot as plt\n",
11+
"import numpy as np\n",
12+
"from ipywidgets import interactive, interact\n",
13+
"\n",
14+
"from convenience_functions import show_image\n",
15+
"import image_sim as isim\n",
16+
"\n",
17+
"# Use custom style for larger fonts and figures\n",
18+
"plt.style.use('guide.mplstyle')"
19+
]
20+
},
21+
{
22+
"cell_type": "code",
23+
"execution_count": null,
24+
"metadata": {},
25+
"outputs": [],
26+
"source": [
27+
"def complete_image(bias_level=1100, read=10.0, gain=1, dark=0.1, \n",
28+
" exposure=30, hot_pixels=True, sky_counts=200):\n",
29+
" synthetic_image = np.zeros([500, 500])\n",
30+
" show_image(synthetic_image + \n",
31+
" isim.read_noise(synthetic_image, read) +\n",
32+
" isim.bias(synthetic_image, bias_level, realistic=True) + \n",
33+
" isim.dark_current(synthetic_image, dark, exposure, hot_pixels=hot_pixels) +\n",
34+
" isim.sky_background(synthetic_image, sky_counts),\n",
35+
" cmap='gray',\n",
36+
" figsize=(4, 4))\n",
37+
" \n",
38+
"i = interactive(complete_image, bias_level=(1000,1200,10), dark=(0.0,1,0.1), sky_counts=(0, 300, 50),\n",
39+
" gain=(0.5, 3.0, 0.25), read=(0, 50, 5.0),\n",
40+
" exposure=(0, 300, 30))\n",
41+
"\n",
42+
"for kid in i.children:\n",
43+
" try:\n",
44+
" kid.continuous_update = False\n",
45+
" except KeyError:\n",
46+
" pass\n",
47+
"i"
48+
]
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": null,
53+
"metadata": {},
54+
"outputs": [],
55+
"source": []
56+
}
57+
],
58+
"metadata": {
59+
"kernelspec": {
60+
"display_name": "Python 3",
61+
"language": "python",
62+
"name": "python3"
63+
},
64+
"language_info": {
65+
"codemirror_mode": {
66+
"name": "ipython",
67+
"version": 3
68+
},
69+
"file_extension": ".py",
70+
"mimetype": "text/x-python",
71+
"name": "python",
72+
"nbconvert_exporter": "python",
73+
"pygments_lexer": "ipython3",
74+
"version": "3.7.3"
75+
}
76+
},
77+
"nbformat": 4,
78+
"nbformat_minor": 4
79+
}

0 commit comments

Comments
 (0)