Commit 42c1235a authored by Sauerwein Nick Jacob's avatar Sauerwein Nick Jacob
Browse files

test of FocusCamera, In the train I have to modify the plotting of the results

parent df6ffa1a
......@@ -58,22 +58,20 @@ class FocusCamera:
measurement = {'time': time,'im': im}
if self.measure_full:
max_int = np.max(im)
if max_int > self.min_intensity:
maximum_pos, contour = LA.find_beam(im, plot = False)
ymin, ymax = ax_beam.get_ylim()
xmin, xmax = ax_beam.get_xlim()
cxmm, cymm = contour
FWHMx = np.max(cxmm) - np.min(cxmm)
FWHMy = np.max(cymm) - np.min(cymm)
comment = 'beam detected'
else:
ax_beam.set_ylim([ymin, ymax])
ax_beam.set_xlim([xmin, xmax])
LA.showimage(im, axis = ax_beam)
comment = 'No beam detected'
print (comment)
FWHMx = None
FWHMy = None
cxmm = None, cymm = None
cxmm = None
cymm = None
measurement['comment'], measurement['FWHMx'], measurement['FWHMy'], measurement['cxmm'], measurement['cymm'] = (comment, FWHMx, FWHMy, cxmm, cymm)
......@@ -97,7 +95,7 @@ class FocusCamera:
print(cam)
for availca in available_cameras:
if str(availca)[-3] == '4':
if str(availca)[-3] == '8':
self.cam_to_connect = availca
cam = pypylon.factory.create_device(availca)
print ('camera found =) Be happy')
......
......@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {
"collapsed": false,
"deletable": true,
......@@ -22,15 +22,24 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 5,
"metadata": {
"collapsed": true,
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Using matplotlib backend: Qt5Agg\n"
]
}
],
"source": [
"%autoreload"
"%autoreload\n",
"%matplotlib"
]
},
{
......@@ -105,6 +114,84 @@
"print (config['comment'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## FocusCamera"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"available cameras:\n",
"<DeviceInfo Basler avA2300-25gmDSY (21547524)>\n",
"<DeviceInfo Basler acA3800-10gm (22005848)>\n",
"camera found =) Be happy\n"
]
}
],
"source": [
"from Devices.FocusCamera import FocusCamera\n",
"\n",
"try:\n",
" para_config = config['FocusCamera']\n",
"except:\n",
" para_config = {'ExposureTimeAbs': 10000,\n",
" 'min_intensity': 10000,\n",
" 'measure_full' : True}\n",
" \n",
"focus = FocusCamera(para_config)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"No beam detected\n"
]
}
],
"source": [
"meas = focus.measure()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"# of contours: 98\n",
"0.00251096428571 0.00123998236332\n"
]
}
],
"source": [
"focus.plot_measure(meas)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {
......@@ -1003,742 +1090,21 @@
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python [default]",
"language": "python",
"name": "python3"
},
"widgets": {
"state": {
"0610ccdc8c854a05ad7c658019d5db40": {
"views": [
{
"cell_index": 28
}
]
},
"0656dbcbea6c4c4dbaa747f526cfca87": {
"views": [
{
"cell_index": 28
}
]
},
"0738822b7ca54921a30ce4738f1d068a": {
"views": [
{
"cell_index": 28
}
]
},
"080daf40318740f39c227b1e2a0b9bbe": {
"views": [
{
"cell_index": 28
}
]
},
"0cedd56504a74811aca062893d10274d": {
"views": [
{
"cell_index": 28
}
]
},
"0e86edda58674ed0bd0e269448160444": {
"views": [
{
"cell_index": 28
}
]
},
"0f8383f14f3d4c8caf5fc748f99a86f1": {
"views": [
{
"cell_index": 28
}
]
},
"1384adc536ea42868d8a8dc96538bfb5": {
"views": [
{
"cell_index": 28
}
]
},
"17bcfc2397dd458a90ede2c1c584f3f7": {
"views": [
{
"cell_index": 28
}
]
},
"1b44dfda8a584387b0ecaeee18b3439f": {
"views": [
{
"cell_index": 28
}
]
},
"1d695f151f7640e2aa691bda76ab72f2": {
"views": [
{
"cell_index": 28
}
]
},
"1f3bd744549041eea28ffd17324a3385": {
"views": [
{
"cell_index": 28
}
]
},
"1fce7756638d4009bfa55861a125d29d": {
"views": [
{
"cell_index": 28
}
]
},
"2075f6584374432ea041927796052d8c": {
"views": [
{
"cell_index": 28
}
]
},
"232e43c203124e76b0a7aac6aeae8ce6": {
"views": [
{
"cell_index": 28
}
]
},
"2a261d6291c04646bded615fbea5d714": {
"views": [
{
"cell_index": 28
}
]
},
"2a788c84c560459cbf9981d33e30f786": {
"views": [
{
"cell_index": 28
}
]
},
"2b1ff73171c549a486340af049aa1f55": {
"views": [
{
"cell_index": 28
}
]
},
"2cf4e517827e4e62b26d1ef6548e6ff7": {
"views": [
{
"cell_index": 28
}
]
},
"2f0623abdc9b46348d38f464342aff9d": {
"views": [
{
"cell_index": 28
}
]
},
"364cbfc6f09f4f24a67ee6a0b6472d30": {
"views": [
{
"cell_index": 28
}
]
},
"3712d590b03f445798f03032983acc99": {
"views": [
{
"cell_index": 28
}
]
},
"3a620685fcf143eeba67d65c0e86918a": {
"views": [
{
"cell_index": 28
}
]
},
"3d01128335e44b44ad9565c9e6960fa3": {
"views": [
{
"cell_index": 28
}
]
},
"404eae1223304e1a8c83d77e75c8cc96": {
"views": [
{
"cell_index": 28
}
]
},
"4404a4b65fa74ac0a8483e634428c419": {
"views": [
{
"cell_index": 28
}
]
},
"44a65b184e89441790953b7195f24f65": {
"views": [
{
"cell_index": 28
}
]
},
"456be603896e40509772ac1aff103683": {
"views": [
{
"cell_index": 28
}
]
},
"4aee2eb872944fe58335a862f001cc73": {
"views": [
{
"cell_index": 28
}
]
},
"4b257ae964a948708fc0b5888fbb5257": {
"views": [
{
"cell_index": 28
}
]
},
"4dea845d0cf74d10b7fbd47899f4f8d7": {
"views": [
{
"cell_index": 28
}
]
},
"50028c8b1e9f4e01befef927d537b780": {
"views": [
{
"cell_index": 28
}
]
},
"52b2b6bee7834b009460b12e91bfa5ac": {
"views": [
{
"cell_index": 28
}
]
},
"54e1e0cc9b95497493e8ca88aeb4e832": {
"views": [
{
"cell_index": 28
}
]
},
"577a7262e1ce443abec9d81833d1218c": {
"views": [
{
"cell_index": 28
}
]
},
"5957378e821944ca8fd5d61ca5085e86": {
"views": [
{
"cell_index": 28
}
]
},
"598f6ffa94314d92a37d4dab28171799": {
"views": [
{
"cell_index": 28
}
]
},
"5bacb55a97794cd39b3fb38e877c468e": {
"views": [
{
"cell_index": 28
}
]
},
"5e19057bdbc142179b8df043567f12b2": {
"views": [
{
"cell_index": 28
}
]
},
"61023c7b76d34eab8338a0b7b22608a5": {
"views": [
{
"cell_index": 28
}
]
},
"66cc519315cb4e428054aed6896516b8": {
"views": [
{
"cell_index": 28
}
]
},
"6927716909b6444286753128831a0951": {
"views": [
{
"cell_index": 28
}
]
},
"6a1a048c09894dda88ac6c6f9ead4d1c": {
"views": [
{
"cell_index": 28
}
]
},
"6a3abab30add428cb78c0a24dea0afa7": {
"views": [
{
"cell_index": 28
}
]
},
"71dc51fb829d4ff591cff11130057d5f": {
"views": [
{
"cell_index": 28
}
]
},
"74148fd063da4fe4bcf58a088f2dccaa": {
"views": [
{
"cell_index": 28
}
]
},
"74ae6d5e2f564140ada83be79a53936d": {
"views": [
{
"cell_index": 28
}
]
},
"74f13a45000f47099e1374df59597be5": {
"views": [
{
"cell_index": 28
}
]
},
"7899bba27bdd4a8ca64bc70a949f64a2": {
"views": [
{
"cell_index": 28
}
]
},
"78f57336d1bf48cdbf029d193598a3db": {
"views": [
{
"cell_index": 28
}
]
},
"7d84680898034674b9363ad9d9357721": {
"views": [
{
"cell_index": 28
}
]
},
"7e935250f9224469a4e19c93e81ce382": {
"views": [
{
"cell_index": 28
}
]
},
"813e9b2a58c34ef9b092bfae92af42c8": {
"views": [
{
"cell_index": 28
}
]
},
"895deafa73074f8f892d5cb65050ec3f": {
"views": [
{
"cell_index": 28
}
]
},
"8a35fef3b56a4890bc3d7643c89442ec": {
"views": [
{
"cell_index": 28
}
]
},
"8b4cd7b67b2e4a32a21083125c2965d9": {
"views": [
{
"cell_index": 28
}
]
},
"8f0533186d4e442c8106c64a0d03c998": {
"views": [
{
"cell_index": 28
}
]
},
"93381ed822a744be9dcda0139675146b": {
"views": [
{
"cell_index": 28
}
]
},
"9403ce7ce2144bdf8fce5c29c9dd05dd": {
"views": [
{
"cell_index": 28
}
]
},
"95e1672b79174eb0be38f3f9aabed66e": {
"views": [
{
"cell_index": 28
}
]
},
"9703407bb441473f909ce1da9ad8847e": {
"views": [
{
"cell_index": 28
}
]
},
"97946aeb56bd48dba75e7094497dd593": {
"views": [
{
"cell_index": 28
}
]
},
"99f5b36bd99a416183747c4f27fc885b": {
"views": [
{
"cell_index": 28
}
]
},
"9a18a99670a24dbaa6a2b88024df21cd": {
"views": [
{
"cell_index": 28
}
]
},
"9a3ce3924a0f4d65a9354016be9e2224": {
"views": [
{
"cell_index": 28
}
]
},
"9bcbcb8e22e34a9789dab2e38b2df74d": {
"views": [
{
"cell_index": 28
}
]
},
"9e67b92cfcef4223b1f3d7481ce4513e": {
"views": [
{
"cell_index": 28
}
]
},
"9e9632aca5fc48c2b08c9b2fd2dbbe8c": {
"views": [
{
"cell_index": 28
}
]
},
"a38ff0d1038642008dbcbf75cc985825": {
"views": [
{
"cell_index": 28
}
]
},
"a43e5c31a296447b82be78d162ab9fd7": {
"views": [
{