commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r3842 - gnuradio/trunk/gr-radio-astronomy/src/python


From: mleech
Subject: [Commit-gnuradio] r3842 - gnuradio/trunk/gr-radio-astronomy/src/python
Date: Tue, 24 Oct 2006 10:31:24 -0600 (MDT)

Author: mleech
Date: 2006-10-24 10:31:23 -0600 (Tue, 24 Oct 2006)
New Revision: 3842

Modified:
   gnuradio/trunk/gr-radio-astronomy/src/python/usrp_ra_receiver.py
Log:
Added notation tag to continuum log file indicating whether the Sun is in the
  sky at the time or not.

Increased the difficulty of the "gauntlet" that "hits" in the SETI mode
  have to run through in order to be considered a hit.  Hard to test :-)
  Added intensity levels to SETI hit logging.  This will allow post-facto
  gaussian profile determination for any hits that are found.



Modified: gnuradio/trunk/gr-radio-astronomy/src/python/usrp_ra_receiver.py
===================================================================
--- gnuradio/trunk/gr-radio-astronomy/src/python/usrp_ra_receiver.py    
2006-10-23 19:40:31 UTC (rev 3841)
+++ gnuradio/trunk/gr-radio-astronomy/src/python/usrp_ra_receiver.py    
2006-10-24 16:31:23 UTC (rev 3842)
@@ -133,8 +133,8 @@
         # Calculate upper edge
         self.setifreq_upper = options.freq + (self.seti_freq_range/2)
 
-        # We change center frequencies every 20 self.setitimer intervals
-        self.setifreq_timer = self.setitimer * 20
+        # We change center frequencies every 10 self.setitimer intervals
+        self.setifreq_timer = self.setitimer * 10
 
         # Create actual timer
         self.seti_then = time.time()
@@ -142,6 +142,7 @@
         # The hits recording array
         self.nhits = 10
         self.hits_array = Numeric.zeros((self.nhits,3), Numeric.Float64)
+        self.hit_intensities = Numeric.zeros((self.nhits,3), Numeric.Float64)
 
         # Calibration coefficient and offset
         self.calib_coeff = options.calib_coeff
@@ -236,6 +237,8 @@
         self.locality = ephem.Observer()
         self.locality.long = str(options.longitude)
         self.locality.lat = str(options.latitude)
+        # We make notes about Sunset/Sunrise in Continuum log files
+        self.sun = ephem.Sun()
 
         # Set up stripchart display
         self.stripsize = int(options.stripsize)
@@ -439,6 +442,7 @@
             self.seti_then = time.time()
             # Zero-out hits array when changing frequency
             self.hits_array[:,:] = 0.0
+            self.hit_intensities[:,:] = -60.0
 
             return self.set_freq(kv['freq'])
 
@@ -654,6 +658,7 @@
                  # Make sure we zero-out the hits array when changing
                  #   frequency.
                  self.hits_array[:,:] = 0.0
+                 self.hit_intensities[:,:] = 0.0
 
     def fft_outfunc(self,data,l):
         self.fft_outbuf=data
@@ -684,11 +689,16 @@
         # If time to write full header info (saves storage this way)
         #
         if (now - self.continuum_then > 20):
+            self.sun.compute(self.locality)
+            enow = ephem.now()
+            sun_insky = "Down"
+            if ((self.sun.rise_time < enow) and (enow < self.sun.set_time)):
+               sun_insky = "Up"
             self.continuum_then = now
         
             continuum_file.write(str(ephem.hours(sidtime))+" "+flt+" 
Dn="+str(inter)+",")
             
continuum_file.write("Ti="+str(integ)+",Fc="+str(fc)+",Bw="+str(bw))
-            continuum_file.write(",Ga="+str(ga)+"\n")
+            continuum_file.write(",Ga="+str(ga)+",Sun="+str(sun_insky)+"\n")
         else:
             continuum_file.write(str(ephem.hours(sidtime))+" "+flt+"\n")
     
@@ -740,6 +750,7 @@
         l = len(fftbuf)
         x = 0
         hits = []
+        hit_intensities = []
         if self.seticounter < self.setitimer:
             self.seticounter = self.seticounter + 1
             return
@@ -779,6 +790,7 @@
             #
             if ((fftbuf[i] - avg) > (self.setik * sigma)):
                 hits.append(current_f)
+                hit_intensities.append(fftbuf[i])
             current_f = current_f + f_incr
 
         # DC to nyquist
@@ -789,14 +801,33 @@
             #
             if ((fftbuf[i] - avg) > (self.setik * sigma)):
                 hits.append(current_f)
+                hit_intensities.append(fftbuf[i])
             current_f = current_f + f_incr
 
+        # No hits
         if (len(hits) <= 0):
             return
 
+        #
+        # OK, so we have some hits in the FFT buffer
+        #   They'll have a rather substantial gauntlet to run before
+        #   being declared a real "hit"
+        #
+
+        # Weed out buffers with an excessive number of strong signals
         if (len(hits) > self.nhits):
             return
 
+        # Weed out FFT buffers with apparent multiple narrowband signals
+        #   separated significantly in frequency.  This means that a
+        #   single signal spanning multiple bins is OK, but a buffer that
+        #   has multiple, apparently-separate, signals isn't OK.
+        #
+        last = hits[0]
+        for i in range(1,len(hits)):
+            if ((hits[i] - last) > (f_incr*2.0)):
+                return
+            last = hits[i]
 
         #
         # Run through all three hit buffers, computing difference between
@@ -814,16 +845,21 @@
                 self.hitcounter = self.hitcounter + 1
                 break
 
-        if (good_hit):
-            self.write_hits(hits,sidtime)
 
         # Save 'n shuffle hits
         self.hits_array[:,2] = self.hits_array[:,1]
+        self.hit_intensities[:,2] = self.hit_intensities[:,1]
         self.hits_array[:,1] = self.hits_array[:,0]
+        self.hit_intensities[:,1] = self.hit_intensities[:,0]
 
         for i in range(0,len(hits)):
             self.hits_array[i,0] = hits[i]
+            self.hit_intensities[i,0] = hit_intensities[i]
 
+        # Finally, write the hits/intensities buffer
+        if (good_hit):
+            self.write_hits(sidtime)
+
         return
 
     def seti_isahit(self,fdiffs):
@@ -838,7 +874,7 @@
         else:
             return (False)
 
-    def write_hits(self,hits,sidtime):
+    def write_hits(self,sidtime):
         # Create localtime structure for producing filename
         foo = time.localtime()
         pfx = self.prefix
@@ -847,7 +883,21 @@
     
         # Open the data file, appending
         hits_file = open (filenamestr+".seti","a")
-        hits_file.write(str(ephem.hours(sidtime))+" "+str(self.decln)+" 
"+str(hits)+"\n")
+
+        # Write sidtime first
+        hits_file.write(str(ephem.hours(sidtime))+" "+str(self.decln)+"\n")
+
+        #
+        # Then write the hits/hit intensities buffers with enough
+        #   "syntax" to allow parsing by external (not yet written!)
+        #   "stuff".
+        #
+        for i in range(0,self.nhits):
+            hits_file.write(" ")
+            for j in range(0,10):
+                hits_file.write(str(self.hits_array[j,i])+":")
+                hits_file.write(str(self.hit_intensities[j,i])+",")
+        hits_file.write("\n")
         hits_file.close()
         return
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]