From 0e25ce821ebf22ac728322ec15fa2591c74a4a84 Mon Sep 17 00:00:00 2001
From: am0ebe <am0ebe@gmx.de>
Date: Fri, 14 Apr 2023 14:55:12 +0200
Subject: [PATCH] .

---
 a/bandwith.py         | 39 ++++++++++++++++++++++++
 a/cta.sublime-project | 22 ++++++++++++++
 dox/general_questions |  4 +++
 dox/notes_A           | 69 +++++++++++++++++++++++++++++++++++++++++++
 dox/notes_B           | 39 ++----------------------
 dox/notes_X           | 12 ++++++++
 dox/todo_tron         | 22 ++++++++++++--
 7 files changed, 167 insertions(+), 40 deletions(-)
 create mode 100644 a/bandwith.py
 create mode 100644 a/cta.sublime-project

diff --git a/a/bandwith.py b/a/bandwith.py
new file mode 100644
index 0000000..da765c7
--- /dev/null
+++ b/a/bandwith.py
@@ -0,0 +1,39 @@
+# resolutions:
+# AR (aspect ratio) mostly 16:9. For the Arena a square is needed, the rest will just be cropped.
+precision=2
+resolutions={
+"HDready":720*480,      # 0.3MP
+"fullHD":1080*1920,     # 2MP
+# "fullHDplus":2160*1080, # 2.3MP
+# "QHD":2560*1440,        # 3.7MP
+# "square":1920*1920,     # 3.7MP
+# "UHD":3840*2160,        # 8.3MP
+# "5K":5120*2880,        # 14.7MP -> highest 2023
+}
+
+# HD-Ready    720p  1,5 mbps
+# Full HD  1080p    4 mbps
+
+def calc_bandwith(fps,res,bpp,dur_m):
+   print(f"\n## {res[0]}")
+   dur_s=dur_m*60
+   bandwidth_mbit=fps*res[1]*bpp / (1000**2)
+   bandwidth_gbit=bandwidth_mbit / 1000
+   size_mb=bandwidth_mbit*dur_s/8
+   size_gb=bandwidth_gbit*dur_s/8
+
+   print(f"bandwidth_mbit: {round(bandwidth_mbit,precision)}")
+   print(f"bandwidth_gbit: {round(bandwidth_gbit,precision)}")
+   print(f"size_mb: {round(size_mb,precision)}")
+   print(f"size_gb: {round(size_gb,precision)}")
+   print("###############################")
+
+   print(f"compressed maybe a tenth: {round(size_gb/10,precision)} gb")
+
+
+fps=30
+bpp=24 #bits. not bytes!
+dur_m=1
+
+for res in resolutions.items():
+   calc_bandwith(fps,res,bpp,dur_m)
diff --git a/a/cta.sublime-project b/a/cta.sublime-project
new file mode 100644
index 0000000..563f33c
--- /dev/null
+++ b/a/cta.sublime-project
@@ -0,0 +1,22 @@
+{
+	"folders":
+	[
+		{
+			"path": ".",
+		},
+		{
+			"path": "../b",
+			// "name": "b (vimba)"
+		},
+		{
+			"path": "../c",
+		},
+		{
+			"path": "../d",
+		},
+		{
+			"path": "../dox",
+			"name": "dox"
+		},
+	],
+}
diff --git a/dox/general_questions b/dox/general_questions
index d702936..6caacaf 100644
--- a/dox/general_questions
+++ b/dox/general_questions
@@ -1,5 +1,9 @@
 > !! if beetle runs in circle it is in "escape/panic mode" which doesn't represent "natural" behaviour (explore, forage, quick move from a to b)
 	-> think about different setup. Bigger Arena?
 --> ! beetle needs to be small enough to not be limited by constrained size of the arena
+
+> how much time for beetle to calm down / aclimatize? 10mins?
 > 10 minutes is enough to analyze movement
 > 8 fps could be enough to reduce mean error
+
+
diff --git a/dox/notes_A b/dox/notes_A
index 9e7dd19..3fdd003 100644
--- a/dox/notes_A
+++ b/dox/notes_A
@@ -13,6 +13,13 @@ Does
 ###############################
 ## Setup / Preparation
 ###############################
+	> prices chamber (4,5,6 big ones)
+	> research cams
+		infrared
+		rugged (temperature)
+		stream over ethernet, PoE
+
+
 Hardware setup:
 	> Thermostat/Plantgrow chamber
 		> 20 k€ for thermochamber
@@ -57,3 +64,65 @@ Software Setup:
 		https://github.com/opencv/opencv/blob/master/samples/cpp/calibration.cpp
 	* stores values in xml
 	-> mean re-projection error is a useful quality metric for the calibration precision. A smaller mean error means a more precise calibration
+
+
+###############################
+## CAMs
+###############################
+IR?
+strom. (poE, USB, netzteil)
+hdmi?
+
+
+
+###############################
+## calculate bandwidth 		  ##
+###############################
+# as bitstream and as size in bytes on hdd
+#
+# Streamen von HD (1920*1080) need inet speed ~= 5 MBps
+# check inet speed: https://fast.com/
+# 			https://www.speedtest.net/
+# calc vid size:
+#		https://www.videoproc.com/edit-4k-video/video-size-calculator.htm
+# 1000 Mbit/s = 125 MB/s 	(8bit = 1byte, 1 MB = 1024KB)
+#
+# reduce vid size in VLC!
+# h264/h265 + fps + bpp
+# https://www.videoproc.com/video-process/video-size-reducer.htm
+# bpp = 8 or 24...
+What bandwidth do i have? Do i need multiple ports?
+bandwith = fps * pixel format(bpp) * resolution (* ncams)
+StreamBitsPerSecond = 1 * 1456*1936 * 3 * 1 = 8 456 448 ~= 8,4 mbit/s < 125MBps #bits or bytes??
+	14*3*1936*1456 ~= 118,4 MBps ## max res, 3 bpp -> max FPS: 14!
+	44*1*1936*1456 ~= 124,1 MBps ## max res, 1 bpp -> max FPS: 44!
+		a 10 min ->  74 GB?
+		a 60 min -> 446 GB?
+	6*1*1936*1456 ~= 16,9 MBps  ## find optimal FPS to reduce size!
+	8*1*1936*1456 ~= 22,6 MBps  ## find optimal FPS to reduce size!
+	10*1*1936*1456 ~= 28,2 MBps  ## find optimal FPS to reduce size!
+		a 10 min ->  17 GB?
+		a 60 min -> 102 GB?
+
+	1. Determine max_speed with highest fps!
+	2. Take max_speed and reduce fps so it still fits 2*max_speed
+		-> subsample same video ?
+	3. calc mean_err through comparing 1. and 2. -> add to 2. as it will be lower.
+
+	!! exposure and fps: on 10fps exposure can't be more then 10ms!
+	Best practice: set gain to lowest possible val and increase exposure as needed
+
+	!! if you use more than one cam on one interface, the available bandwidth has to be shared between interfaces.
+
+
+	MAX BANDWITH = Gigabit ethernet ~= 125 MB/s
+	MAC1 00:0F:31:03:38:D4
+	YUV 422 = 2 bpp, YUV 444 = 3 bpp
+	TL - Transport Layer -> GIGE as Camera Interface
+	GENICAM - open TL -> GiGE
+
+Prosilica GX:
+	2 ethernet ports...
+	configure LAG (Link aggregate group)
+	-> double available bandwith to 240 MB/s!
+#####################
diff --git a/dox/notes_B b/dox/notes_B
index 6a794f9..794168b 100644
--- a/dox/notes_B
+++ b/dox/notes_B
@@ -46,43 +46,8 @@ VM on ssh thomasboy@172.18.115.7 -> ask Dirk!
 
 
 
-#####################
-
-What bandwidth do i have? Do i need multiple ports?
-bandwith = fps * pixel format(bpp) * resolution (* ncams)
-StreamBytesPerSecond = 1 * 1456*1936 * 3 * 1 = 8 456 448 ~= 8,4 MBps < 125MBps
-	14×3×1936×1456 ~= 118,4 MBps ## max res, 3 bpp -> max FPS: 14!
-	44×1×1936×1456 ~= 124,1 MBps ## max res, 1 bpp -> max FPS: 44!
-		a 10 min ->  74 GB?
-		a 60 min -> 446 GB?
-	6×1×1936×1456 ~= 16,9 MBps  ## find optimal FPS to reduce size!
-	8×1×1936×1456 ~= 22,6 MBps  ## find optimal FPS to reduce size!
-	10×1×1936×1456 ~= 28,2 MBps  ## find optimal FPS to reduce size!
-		a 10 min ->  17 GB?
-		a 60 min -> 102 GB?
-
-	1. Determine max_speed with highest fps!
-	2. Take max_speed and reduce fps so it still fits 2*max_speed
-		-> subsample same video ?
-	3. calc mean_err through comparing 1. and 2. -> add to 2. as it will be lower.
-
-	!! exposure and fps: on 10fps exposure can't be more then 10ms!
-	Best practice: set gain to lowest possible val and increase exposure as needed
-
-	!! if you use more than one cam on one interface, the available bandwidth has to be shared between interfaces.
-
-
-	MAX BANDWITH = Gigabit ethernet ~= 125 Mbps
-	MAC1 00:0F:31:03:38:D4
-	YUV 422 = 2 bpp, YUV 444 = 3 bpp
-	TL - Transport Layer -> GIGE as Camera Interface
-	GENICAM - open TL -> GiGE
-
-Prosilica GX:
-	2 ethernet ports...
-	configure LAG (Link aggregate group)
-	-> double available bandwith to 240 MB/s!
-#####################
+
+
 
 
 > list currently connected cameras
diff --git a/dox/notes_X b/dox/notes_X
index 9bd0c20..0d5cdd7 100644
--- a/dox/notes_X
+++ b/dox/notes_X
@@ -8,5 +8,17 @@ does
 	C & D will run on HPC
 ###############################
 
+	get login for:
+		https://wiki.ufz.de/eve/
+
 	qsub
 	module load -> opencv4? Qt5.15?
+
+
+libarchive
+
+4mb blockgroesse einstellen
+entries lesen (=jpgs)
+
+might need to update old cmds from
+	https://wiki.ufz.de/eve/index.php/UGE_and_SLURM_Parameter_Comparison
diff --git a/dox/todo_tron b/dox/todo_tron
index 4f2ceac..a3537a4 100644
--- a/dox/todo_tron
+++ b/dox/todo_tron
@@ -7,14 +7,30 @@ CAMTRON PROCESSING PIPELINE
  X) HPC
 ###########################
 
+PRIO:
+* research cam
+* buy fridge
+* calc D) for test data set (get data from joerdis?)
+	-> with all frames
+	-> undersample, shorter length
+	-> compare results. same?
+* HPC cluster account + try script to send over data
+
+
+
+> update libs (opencv, qt, bgs?)
+-> eval how much work to fix?
+
+
 A)
 ###########################
-	> buy chambers
+	> research and buy chambers!
+	> research and buy cams!
 	> hw setup / preparation
 	> cam calibration
 	> configure cam settings
 
-B) recorder
+B) recorder (depends on cam in A)!!!)
 ###########################
 	> read manual (c++ / vimba)
 ============================
@@ -83,7 +99,7 @@ A) setup testsystem
 C) background subtraction
 ###########################
 	> build
-	> get test data (cp to 00 - where is it?)
+	> find test data (cp to 00 - ..)
 	> process
 	-----------
 	> update bgs alg. opencv4 has its own bgs?
-- 
GitLab