pogucam 0.1.8__py3-none-any.whl → 0.1.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pogucam/buffers.py CHANGED
@@ -26,7 +26,7 @@ class FastAccumBuffer:
26
26
 
27
27
  def add(self, img: np.ndarray, info: dict):
28
28
  """
29
- inconsistent shape resets the buffer
29
+ inconsistent shapes reset the buffer
30
30
  """
31
31
  if img.dtype != np.uint8 or img.shape != self.shape:
32
32
  self.shape = img.shape
@@ -74,6 +74,19 @@ class FastAccumBuffer:
74
74
  self.previous_sum_frames = curr
75
75
  return curr# summed.astype(np.uint8)
76
76
 
77
+ def get_avg_frames(self):
78
+ """
79
+ untested averaged frame
80
+ """
81
+ if self.count == 0:
82
+ return None
83
+ avg = np.mean(self.cube[:self.count].astype(np.float32), axis=0)
84
+ avg = np.clip(avg, 0, 255).astype(np.uint8)
85
+ self.previous_sum_frames = avg
86
+ return avg
87
+
88
+
89
+
77
90
  def get_saturated_pixel_count(self):
78
91
  return self._saturated_pixel_count
79
92
 
@@ -504,6 +504,7 @@ class StreamWidget(QLabel):
504
504
  #self.accum_buffer = None #
505
505
  #self.accum_image = None #
506
506
  self.l_show_accum = False # THIS MUST BE KEPT
507
+ self.l_show_accum_avg = False
507
508
  # ---- np stak-------------------------------------
508
509
  #self.accum_buffer_size = 0 #
509
510
  #self.accum_count = 0 # actual number of img in buff
@@ -535,9 +536,15 @@ class StreamWidget(QLabel):
535
536
  #print(self.internet_not_device, self.internet_not_device)
536
537
  # -------------------------------------------------------------- ACCUM -----------------
537
538
  if self.internet_not_device:
539
+ # every internet call do here
538
540
  if ('accumtxt' in data) and int(data['accumtxt']) == 1: # skip Loop 1
539
541
  print("D... LOOP 1 skipped for remote send command - for some reason I send out 0 only,not 1")
540
542
  pass
543
+ elif ('accumtxt' in data): # NO ACCUM REMOTE !!!!!!!!!!! ??? test
544
+ val = int(data['accumtxt']) # SIZE OF THE BUFFER
545
+ if val == 0: val = 1 # trying to fix
546
+ if len(self.FABuffer) != val and val > 0:
547
+ self.FABuffer.set_max_frames(val)
541
548
  else:
542
549
  post_response = requests.post(url=self.post_addr, data=data )
543
550
  else:
@@ -859,14 +866,18 @@ class StreamWidget(QLabel):
859
866
  # OVERTEXT
860
867
  # --------------------------------------------------------------------------------
861
868
 
862
- def overtext(self, blackbar=False):
869
+ def overtext(self, blackbar=False, image=None):
863
870
  """
864
871
  great font for small numbers
865
872
  """
866
873
  #
867
874
  #
868
875
  #
869
- if self.img is None:
876
+ selfimg = image
877
+ if selfimg is None:
878
+ selfimg = self.img
879
+ # ---------------------------
880
+ if selfimg is None:
870
881
  return
871
882
  RXT = f"XT:{self.r_xtend}" # CC LU ... for remote ok
872
883
  ZOO = f"ZOO:{self.zoomme:3.1f}"
@@ -895,30 +906,30 @@ class StreamWidget(QLabel):
895
906
  #
896
907
  overtext = f"{self.frame_time} # {self.frame_num} # {self.l_frame_num:6d} # {RXT} . {ZOO} . {ROO} . {LGA} . {SAV} {FIT} . {BUF}. {LAPS}"
897
908
  #
898
- position = ( 0, self.img.shape[0]-1 ) # 480 on x-axis
909
+ position = ( 0, selfimg.shape[0]-1 ) # 480 on x-axis
899
910
  #
900
911
 
901
912
  if blackbar:
902
- overlay = self.img.copy()
913
+ overlay = selfimg.copy()
903
914
  if self.resolution == "1920x1080":
904
915
  shade_height = 20
905
916
  else:
906
917
  shade_height = 10
907
- height, width = self.img.shape[:2]
918
+ height, width = selfimg.shape[:2]
908
919
  cv2.rectangle(overlay, (0, height - shade_height), (width, height), (0, 0, 0), -1)
909
920
  alpha = 0.5
910
921
  #alpha = 0.
911
922
  #cv2.addWeighted(overlay, alpha, self.frame, 1 - alpha, 0, self.frame)
912
- cv2.addWeighted(overlay, alpha, self.img, 1 - alpha, 0, self.img)
923
+ cv2.addWeighted(overlay, alpha, selfimg, 1 - alpha, 0, selfimg)
913
924
  #
914
925
  font = "di"
915
926
  if self.resolution == "1920x1080":
916
927
  font = "di2"
917
- self.img = iprint(self.img, str(overtext), font=font, position=position,color_rgb=(0,255,0) )
928
+ selfimg = iprint(selfimg, str(overtext), font=font, position=position,color_rgb=(0,255,0) )
918
929
  if self.SAVED_NOW:
919
- position = ( self.img.shape[1] - 20, self.img.shape[0]-1 ) # 480 on x-axis
920
- self.img = iprint(self.img, f"SAVE", font=font, position=position,color_rgb=(0,0,255) ) # bgr
921
-
930
+ position = ( selfimg.shape[1] - 20, selfimg.shape[0]-1 ) # 480 on x-axis
931
+ selfimg = iprint(selfimg, f"SAVE", font=font, position=position,color_rgb=(0,0,255) ) # bgr
932
+ self.img = selfimg
922
933
  #self.img = iprint(self.img, str(overtext), font="p7", position=position,color_rgb=(0,255,0) )
923
934
 
924
935
 
@@ -1106,6 +1117,8 @@ class StreamWidget(QLabel):
1106
1117
  mycnt += 1
1107
1118
  fff = fname1.replace(".jpg", f"_{mycnt:03d}.jpg")
1108
1119
  print(fff)
1120
+ if self.flag_print_over:
1121
+ self.overtext(blackbar=True) # ---- after ACCUM ------------------ img should be tagged
1109
1122
  if self.saving_jpg:
1110
1123
  cv2.imwrite(fff, i, [int(cv2.IMWRITE_JPEG_QUALITY), 90])
1111
1124
  else:
@@ -1665,11 +1678,14 @@ class StreamWidget(QLabel):
1665
1678
  #if self.define_accum_buffer( self.accum_n ): # does nothing if already exists
1666
1679
  # self.add_to_accum_buffer( self.img) # No idea why fits has wrong colors
1667
1680
 
1668
- # showing or NOT the average image
1681
+ # showing or NOT the average image ************* SHO@WING *********** SHOWING **********
1669
1682
  if self.l_show_accum and (len(self.FABuffer) > 1):# and (len(self.accum_buffer) > 1):
1670
1683
  rimg = None
1671
1684
  if self.FABuffer.new_sum_available():
1672
- rimg = self.FABuffer.get_sum_frames()#_mean_accum_buffer()
1685
+ if self.l_show_accum_avg:
1686
+ rimg = self.FABuffer.get_avg_frames()#_mean_accum_buffer()
1687
+ else:
1688
+ rimg = self.FABuffer.get_sum_frames()#_mean_accum_buffer()
1673
1689
  #print("\n new", type(rimg))
1674
1690
  print(f"SATURATED: {self.FABuffer.get_saturated_pixel_count()}", end="")
1675
1691
  else:
@@ -1679,8 +1695,10 @@ class StreamWidget(QLabel):
1679
1695
  self.img = rimg
1680
1696
  #### self.overtext(blackbar=True) # applies on img
1681
1697
 
1698
+ if self.saving_all: #
1699
+ self.SAVED_NOW = True
1682
1700
  if self.flag_print_over:
1683
- self.overtext(blackbar=True) #
1701
+ self.overtext(blackbar=True) # ---- after ACCUM ------------------ img should be tagged
1684
1702
 
1685
1703
 
1686
1704
  # # -- LAPS 1s 10s 60s but also accumulated local frames
@@ -1770,6 +1788,7 @@ class StreamWidget(QLabel):
1770
1788
  # ---- save ALL ----------------- -------------------------------------------- ************ "shift-s" ***********
1771
1789
  # ---- save ALL ----------------- -------------------------------------------- ************ "shift-s" ***********
1772
1790
  if self.saving_all: # --------------- Shift-S-------
1791
+
1773
1792
  # jpg and NO AVG
1774
1793
  if (len(self.FABuffer) < 2) and (not self.l_show_accum) and (not self.saving_fits_only):
1775
1794
  self.save_img( time_tag=self.frame_time, dumpbuffer=False, use_fits=False) # every frame, BURSTING JPGS!
@@ -1845,6 +1864,9 @@ class StreamWidget(QLabel):
1845
1864
  pass
1846
1865
 
1847
1866
 
1867
+ if self.flag_print_over:
1868
+ ####self.overtext(blackbar=True)
1869
+ self.SAVED_NOW = False # this is for overtext RED save
1848
1870
 
1849
1871
 
1850
1872
  # ------------------------------------- -------------------- TRANNS OR NOT TRANS
@@ -1862,9 +1884,7 @@ class StreamWidget(QLabel):
1862
1884
  self.img = cv2.cvtColor(self.img, cv2.COLOR_GRAY2BGR) #I want to keep 3 channels
1863
1885
  self.use_frame(stripes=True)# img = self.frame
1864
1886
 
1865
- if self.flag_print_over:
1866
- #self.overtext(blackbar=True)
1867
- self.SAVED_NOW = False # this is for overtext RED save
1887
+
1868
1888
 
1869
1889
  #=============================== --------------------- =================== UPDATE/SHOW
1870
1890
  #=============================== --------------------- =================== UPDATE/SHOW
@@ -1975,9 +1995,11 @@ class StreamWidget(QLabel):
1975
1995
  if (key == Qt.Key.Key_P):
1976
1996
  if ( len(parts_set) == 0):
1977
1997
  self.flag_print = not self.flag_print
1998
+ print(f"i... termtext: {self.flag_print}")
1978
1999
  #print("i... flasg print ", self.flag_print)
1979
2000
  elif (parts_set == {'Shift'}):
1980
2001
  self.flag_print_over = not self.flag_print_over
2002
+ print(f"i... overtext: {self.flag_print_over}")
1981
2003
  elif (parts_set == {'Ctrl'}) :
1982
2004
  pass
1983
2005
  # ----------------------------------------------------------------- e expo
@@ -2140,7 +2162,7 @@ class StreamWidget(QLabel):
2140
2162
  print( "i... reset position red cross")
2141
2163
  self.redcross = [0, 0]
2142
2164
  # ----------------------------------------------------------------- i integrate accumulate
2143
- if (key == Qt.Key.Key_I):
2165
+ if (key == Qt.Key.Key_I): # i shift-i Ctrl-i Ctrl-Shift-i Alt
2144
2166
  # 4.6GB / 1000 640x480
2145
2167
  if ( len(parts_set) == 0):
2146
2168
  if self.r_integrate < 8:
@@ -2172,6 +2194,9 @@ class StreamWidget(QLabel):
2172
2194
  elif (parts_set == {'Ctrl', 'Shift'}) :
2173
2195
  self.l_show_accum = not self.l_show_accum
2174
2196
  print(f"i... ACCUMULATION IS {self.l_show_accum}")
2197
+ elif (parts_set == {'Alt'}) :
2198
+ self.l_show_accum_avg = not self.l_show_accum_avg
2199
+ print(f"i... ACCUMULATION AVG/nonSUM IS {self.l_show_accum_avg}")
2175
2200
 
2176
2201
  # ----------------------------------------------------------------- b
2177
2202
  if (key == Qt.Key.Key_B):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pogucam
3
- Version: 0.1.8
3
+ Version: 0.1.10
4
4
  Summary: Add your description here
5
5
  Author-email: jaromrax <jaromrax@gmail.com>
6
6
  Requires-Python: >=3.12
@@ -0,0 +1,9 @@
1
+ pogucam/__init__.py,sha256=Iij7VvXCrFPMtTia41mQ7LxFLaulf_fD5cb-AyjpUo0,53
2
+ pogucam/buffers.py,sha256=1JLkuenkHoA-K-uZAlNV7chHQDZLrspgT5_XOY-E-34,6692
3
+ pogucam/explore_u24_uni.py,sha256=_vyNd_dIpIAKuvqL7st01QX-2pjeRljZ2MEAZxM9lBk,112075
4
+ pogucam/installation.md,sha256=8qspiLlYjEBx5CedRfBU7Mm0A2pz0lfAnaupZyBm5Eo,128
5
+ pogucam/text_write.py,sha256=hyRyA1M5z-pda963T-k0i8fvvAlv1p3YBTZtYNdOeoE,19304
6
+ pogucam-0.1.10.dist-info/METADATA,sha256=-EXEmOf1UXog_njQALCJ-LbZ5edhDC5YXenGmclimuk,467
7
+ pogucam-0.1.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
+ pogucam-0.1.10.dist-info/entry_points.txt,sha256=-97N0LsXIR8h0rJMzIMuNeNwuY8LvPYPTqnXsuAnVsM,63
9
+ pogucam-0.1.10.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- pogucam/__init__.py,sha256=Iij7VvXCrFPMtTia41mQ7LxFLaulf_fD5cb-AyjpUo0,53
2
- pogucam/buffers.py,sha256=9nW9W8z3wjaLcfFrZqmsnsowxQOWXTweOuHVjwWWIn8,6368
3
- pogucam/explore_u24_uni.py,sha256=1_P7_5IYgxIKcTAh5l8FtXXndN162KS59Qlb9m7TQmM,110637
4
- pogucam/installation.md,sha256=8qspiLlYjEBx5CedRfBU7Mm0A2pz0lfAnaupZyBm5Eo,128
5
- pogucam/text_write.py,sha256=hyRyA1M5z-pda963T-k0i8fvvAlv1p3YBTZtYNdOeoE,19304
6
- pogucam-0.1.8.dist-info/METADATA,sha256=Rdr2jXmn_yWxnwj0YagSp4UFtZanb4JMXu_w0SNVnUM,466
7
- pogucam-0.1.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
- pogucam-0.1.8.dist-info/entry_points.txt,sha256=-97N0LsXIR8h0rJMzIMuNeNwuY8LvPYPTqnXsuAnVsM,63
9
- pogucam-0.1.8.dist-info/RECORD,,