From 4c3080e6b566e7fa9db2ad94d6f0eebcabcad8dd Mon Sep 17 00:00:00 2001
From: Guenter Quast <guenter.quast@online.de>
Date: Sun, 25 Feb 2024 14:54:05 +0100
Subject: [PATCH] improved Docu

---
 README.md   | 14 ++++++++------
 redPosci.py | 18 +++++++++---------
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/README.md b/README.md
index eee851c..c79ea29 100644
--- a/README.md
+++ b/README.md
@@ -87,10 +87,13 @@ to a single detected pulse.
 
 ![Spectrum signals with a fall time of 10 µs at an average rate of 10 kHz](images/spectrum_10mus10kHz.png)
 
+Note that spectra and waveforms are plotted with a very large number channels, well exceeding the
+resolution of a computer display. It is therefore possible to use the looking-glass button of the *matplotlib*
+window to mark regions to zoom in for a detailed inspection of the data. 
 
 ## Oscilloscope and data recorder
 
-The script *redPosci.py* relies on the same server and FPGA image as the pulseheight analyzer.
+The script *redPosci.py* relies on the same server and FPGA image as the pulse-height analyzer.
 The *oscilloscope* and *generator* tabs provide the same functionality as in *mcpha.py*.
 In addition, however,  there is a button "*Start DAQ*" to run the data acquisition for the the 
 oscilloscope independently of the Qt timing loop, i. e. in continuous mode. As soon as data is 
@@ -98,13 +101,12 @@ received by the client, the oscilloscope is restarted immediately. A dummy routi
 *processData()* ist provided as an illustration; right now, it shows a graphical display once 
 per second and calculates and displays the trigger and data rates.
 
-It is possible to transfer data over a 1Gbit network with a rate of 50 MB/s or about
-to 500 waveforms/s.
+It is possible to transfer data over a 1Gbit network with a rate of 50 MB/s or about 500 waveforms/s.
 
 ## Installation
 
 The sub-directory *RP-image* contains files to be transferred to a SD card for the RedPitaya board.
-To get started, proceed as follows:
+Proceed as follows:
 
   - copy the contents of the directory *RP-image* to an empty SD card formatted as VFAT32.
   - connect the RedPitaya to the network via the LAN port 
@@ -133,7 +135,7 @@ where *xxxxxx* is are the last six characters of the ethernet MAC address.
 
 If a usb-to-ethernet adapter is used and a dhcp server on the client computer is enabled for the
 interface, a one-to-one connection of the RedPitaya to a host computer can easily be established;
-use the name *rp-xxxxxx.local* in this case. How to set up a dhcp server for a usb-to-ethernet
+use the name *rp-xxxxxx.local* in this case. How to set up a *dhcp* server for a usb-to-ethernet
 adapter depends on the operating system used on the client; please check the relevant 
 documentation for you system. 
 
@@ -183,7 +185,7 @@ Note that presently mcpha.py exports data in human-readable format using
 
 >  *read_hst.py*  illustrates how to read and plot spectrum data exported by mcpha.py.
 
->  *read_osc.py* demonstrates how to read and plot waveform date exported from the 
+>  *read_osc.py* demonstrates how to read and plot waveform data exported from the 
    oscilloscope tab of mcpha.py.
 
 
diff --git a/redPosci.py b/redPosci.py
index a24f65f..c6d9ddd 100755
--- a/redPosci.py
+++ b/redPosci.py
@@ -382,9 +382,9 @@ class OscDisplay(QWidget, Ui_OscDisplay):
         # initialize variables
         self.rpControl = rpControl
         self.log = log
-        self.tot = self.rpControl.sample_size
-        self.pre = self.rpControl.pretrigger_fraction * self.tot
-        self.buffer = np.zeros(self.tot * 2, np.int16)
+        self.l_tot = self.rpControl.sample_size
+        self.pre = self.rpControl.pretrigger_fraction * self.l_tot
+        self.buffer = np.zeros(self.l_tot * 2, np.int16)
         # create figure
         self.figure = Figure()
         if sys.platform != "win32":
@@ -395,7 +395,7 @@ class OscDisplay(QWidget, Ui_OscDisplay):
         self.plotLayout.addWidget(self.canvas)
         self.ax = self.figure.add_subplot(111)
         self.ax.grid()
-        self.ax.set_xlim(-0.02*self.tot, 1.02*self.tot)
+        self.ax.set_xlim(-0.02*self.l_tot, 1.02*self.l_tot)
         self.ax.set_ylim(-4500, 4500)
         self.xunit = "[{:d} ns / sample]".format(4*8)
         self.ax.set_xlabel("sample number " + self.xunit)
@@ -413,7 +413,7 @@ class OscDisplay(QWidget, Ui_OscDisplay):
         self.osctxt= self.ax.text(0.1, 0.96, ' ', transform=self.ax.transAxes,
                                   color="darkblue", alpha=0.7)
 
-        x = np.arange(self.tot)
+        x = np.arange(self.l_tot)
         (self.curve2,) = self.ax.plot(x, self.buffer[1::2],
                                       color="#00CCCC", label="chan 2")
         (self.curve1,) = self.ax.plot(x, self.buffer[0::2],
@@ -493,7 +493,7 @@ class OscDisplay(QWidget, Ui_OscDisplay):
         self.rpControl.set_trg_slope(self.trg_slope)
         self.rpControl.set_trg_level(self.trg_level)
         self.rpControl.set_osc_pre(self.pre)
-        self.rpControl.set_osc_tot(self.tot)
+        self.rpControl.set_osc_tot(self.l_tot)
 
     def set_gui4start(self):
         self.startButton.setText("Start")
@@ -574,7 +574,7 @@ class OscDisplay(QWidget, Ui_OscDisplay):
             self.Nprev = self.NTrig
             T_active = t - self.T0
             self.dT = 0.
-            status_txt = "active: {:.1f}s  trigger rate: {:.2f} Hz,  data rate: {:.4g} MB/s".format(T_active, r, 4*r*len(chan1)*1e-6)
+            status_txt = "active: {:.1f}s  trigger rate: {:.2f} Hz,  data rate: {:.4g} MB/s".format(T_active, r, r*self.l_tot*4e-6)
             print(status_txt, end='\r')
             self.osctxt.set_text(status_txt)
             # update graph on display
@@ -602,8 +602,8 @@ class OscDisplay(QWidget, Ui_OscDisplay):
         x = int(event.xdata + 0.5)
         if x < 0:
             x = 0
-        if x >= self.tot:
-            x = self.tot - 1
+        if x >= self.l_tot:
+            x = self.l_tot - 1
         y1 = self.curve1.get_ydata(True)[x]
         y2 = self.curve2.get_ydata(True)[x]
         self.timeValue.setText("%d" % x)
-- 
GitLab